/* Print and polish styles (split from legacy monolithic app stylesheet) */

/* === PRINT PREVIEW === */
#print-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30,30,30,0.92);
  z-index: 9500;
  display: none;
  flex-direction: column;
}
#print-preview-overlay.visible { display: flex; }

/* === HTML EXPORT PREVIEW === */
#html-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 30, 0.92);
  z-index: 9510;
  display: none;
  flex-direction: column;
}
#html-preview-overlay.visible { display: flex; }

/* Pin close to top-right: title flexes, meta + close stay grouped on the right. */
#html-preview-overlay .html-preview-toolbar .pp-toolbar-title {
  flex: 1 1 auto;
  min-width: 0;
}
#html-preview-overlay .html-preview-toolbar-end {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  margin-left: auto;
}
#html-preview-overlay .html-preview-toolbar-end .pp-toolbar-meta {
  text-align: right;
  max-width: min(420px, 40vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.html-preview-body {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #1a1a1a;
}
.html-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  z-index: 1;
}
#html-preview-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #fff;
  display: none;
  z-index: 2;
}

/* === PPTX EXPORT PREVIEW === */
#pptx-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(30, 30, 30, 0.92);
  z-index: 9515;
  display: none;
  flex-direction: column;
}
#pptx-preview-overlay.visible { display: flex; }

#pptx-preview-overlay .pptx-preview-toolbar .pp-toolbar-title {
  flex: 1 1 auto;
  min-width: 0;
}
#pptx-preview-overlay .pptx-preview-toolbar-end {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
  margin-left: auto;
}
#pptx-preview-overlay .pptx-preview-toolbar-end .pp-toolbar-meta {
  text-align: right;
  max-width: min(480px, 44vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pptx-preview-scroll-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  background: #1a1a1a;
}
.pptx-preview-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  z-index: 2;
}
.pptx-preview-scroll {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 24px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  z-index: 1;
}

.pptx-preview-slide {
  width: min(960px, calc(100vw - 32px));
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
.pptx-preview-slide::after {
  content: attr(data-slide-index);
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  color: #aaa;
  font-family: var(--font-mono, monospace);
  pointer-events: none;
  z-index: 2;
}
.pptx-preview-slide-inner {
  position: absolute;
  inset: 0;
  padding: 5% 5.5%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(10px, 1.15vw, 14px);
  color: #3a3a3a;
  box-sizing: border-box;
}

.pptx-preview-cover { position: relative; height: 100%; display: flex; flex-direction: column; }
.pptx-preview-cover-logo {
  position: absolute;
  top: 0;
  right: 0;
  max-width: 25%;
  max-height: 14%;
  object-fit: contain;
}
.pptx-preview-eyebrow {
  font-size: 0.75em;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.4em;
  padding-right: 28%;
}
.pptx-preview-cover-title {
  font-size: 1.75em;
  font-weight: 700;
  color: #1a1a1a;
  margin: 0 0 0.35em;
  line-height: 1.2;
  max-width: 72%;
}
.pptx-preview-cover-desc {
  font-size: 0.9em;
  font-style: italic;
  color: #5a5a5a;
  margin: 0 0 0.6em;
  max-width: 90%;
}
.pptx-preview-date { font-size: 0.85em; color: #888; margin: 0.25em 0 0; }
.pptx-preview-accent {
  height: 3px;
  width: 100%;
  margin: 0.5em 0 0.75em;
  flex-shrink: 0;
}
.pptx-preview-footer {
  margin-top: auto;
  padding-top: 0.35em;
  border-top: 2px solid var(--pptx-accent, #C4956A);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1em;
  flex-shrink: 0;
  font-size: 0.65em;
  color: #888;
  line-height: 1.3;
}
.pptx-preview-footer-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pptx-preview-footer-meta {
  flex-shrink: 0;
  text-align: right;
}
.pptx-preview-slide--divider .pptx-preview-slide-inner {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.pptx-preview-divider {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5em;
  max-width: 85%;
}
.pptx-preview-divider-title {
  margin: 0;
  font-size: 1.65em;
  font-weight: 700;
  color: #2c2420;
  line-height: 1.2;
}
.pptx-preview-divider-narr {
  margin: 0;
  font-size: 0.95em;
  color: #666;
  line-height: 1.45;
}
.pptx-preview-head {
  font-size: 1.35em;
  font-weight: 700;
  color: #2c2420;
  margin: 0 0 0.25em;
  line-height: 1.2;
}
.pptx-preview-body {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  line-height: 1.45;
}
.pptx-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  margin-top: 0.25em;
}
.pptx-preview-table th,
.pptx-preview-table td {
  border: 1px solid #ddd;
  padding: 0.35em 0.5em;
  text-align: left;
  vertical-align: top;
}
.pptx-preview-table th {
  background: #f4f4f4;
  font-weight: 700;
}
.pptx-preview-table:not(.pptx-preview-table--wide):not(.pptx-preview-table--raci) th { width: 28%; }
.pptx-preview-table--raci { font-size: 0.78em; }
.pptx-preview-raci-dot { text-align: center !important; width: 2.2em; }
.pptx-preview-raci-legend { font-size: 0.75em; color: #888; margin: 0.35em 0 0; }

.pptx-preview-step-head { margin-bottom: 0.35em; line-height: 1.35; flex-shrink: 0; }
.pptx-preview-step-num { font-weight: 700; font-size: 0.85em; }
.pptx-preview-slide--visual .pptx-preview-step-head--visual {
  margin-bottom: 0.25em;
}
.pptx-preview-step-fig--hero {
  flex: 1;
  min-height: 0;
  margin: 0.15em 0 0;
}
.pptx-preview-slide--visual .pptx-preview-cap {
  margin-top: 0.15em;
}
.pptx-preview-slide--combined .pptx-preview-step-head--visual {
  margin-bottom: 0.2em;
}
.pptx-preview-combined-body {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 0.35em;
  align-items: stretch;
}
.pptx-preview-combined-media {
  flex: 0 0 58%;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pptx-preview-slide--combined .pptx-preview-combined-media .pptx-preview-step-fig {
  flex: 1;
  min-height: 0;
  margin: 0;
}
.pptx-preview-slide--combined .pptx-preview-combined-media .pptx-mock-shot {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.pptx-preview-slide--combined .pptx-preview-cap {
  margin-top: 0.12em;
  text-align: left;
}
.pptx-preview-combined-detail {
  flex: 1;
  min-width: 0;
  min-height: 0;
  font-size: 0.82em;
  line-height: 1.4;
  overflow: hidden;
}
.pptx-preview-combined-detail .pptx-preview-step-notes,
.pptx-preview-combined-detail .pptx-preview-step-narr {
  margin: 0 0 0.35em;
  max-height: none;
}
.pptx-preview-combined-detail .pp-form-tip {
  margin: 0 0 0.35em;
  font-size: 0.95em;
}
.pptx-preview-step-narr { font-size: 0.85em; margin-bottom: 0.25em; flex-shrink: 0; }
.pptx-preview-step-fig {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0.25em 0;
}
.pptx-preview-step-fig img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.pptx-preview-step-notes {
  font-size: 0.85em;
  margin-top: 0.25em;
  max-height: 22%;
  overflow: hidden;
  flex-shrink: 0;
}
.pptx-preview-cap {
  font-size: 0.75em;
  font-style: italic;
  color: #888;
  text-align: center;
  margin: 0.1em 0 0;
  flex-shrink: 0;
}
.pptx-preview-err { font-size: 0.85em; font-style: italic; color: #c00; margin: 0.35em 0; }
.pptx-preview-slide-inner .pp-form-tip { margin: 0.35em 0; font-size: 0.85em; flex-shrink: 0; }

.pp-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--gray-900);
  color: #fff;
  flex-shrink: 0;
  gap: 16px;
}
.pp-toolbar-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
  color: #fff;
  flex: 1;
}
.pp-toolbar-meta {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  font-family: var(--font-mono);
}
.pp-toolbar-actions { display: flex; gap: 8px; }
.pp-btn {
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all 0.15s;
}
.pp-btn-close { background: rgba(255,255,255,0.12); color: #fff; }
.pp-btn-close:hover { background: rgba(255,255,255,0.24); }
.pp-btn-save { background: var(--accent, #C4956A); color: #fff; }
.pp-btn-save:hover { filter: brightness(1.08); }
.pp-btn-save-as { background: rgba(255,255,255,0.12); color: #fff; }
.pp-btn-save-as:hover { background: rgba(255,255,255,0.24); }

.pp-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 40px 0 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
}

/*
 * Print preview only: pages sit in a scrollable flex region over a dim rgba() backdrop.
 * Chrome/WebKit can promote layers so JPEG/screenshot tiles composite as if they had holes,
 * which makes the dark overlay or footer chrome show "through" shots. Exports (PDF/Word/HTML)
 * are not inside this shell, so they look fine. Isolate each sheet + force opaque surfaces.
 */
#print-preview-overlay .pp-scroll {
  background-color: rgba(30, 30, 30, 0.92);
}
#print-preview-overlay .pp-page {
  isolation: isolate;
  background-color: #fff;
}
#print-preview-overlay .pp-page-body-flow,
#print-preview-overlay .pp-page-footer {
  background-color: #fff;
}
#print-preview-overlay .pp-step-img,
#print-preview-overlay .pp-step-canvas {
  mix-blend-mode: normal;
}

/* Welcome samples always use default document accent (Expresso), not a custom Theme color. */
#print-preview-overlay.pp-example-sample {
  --stepbinder-doc-accent: #C4956A;
  --stepbinder-doc-accent-dark: #A07548;
  --stepbinder-doc-note-bg: #FDF5EC;
  --stepbinder-doc-note-strong: #A07548;
}

.pp-page {
  width: 816px;       /* 8.5in at 96dpi */
  min-height: 1056px; /* 11in */
  background: #fff;
  box-shadow: 0 12px 24px -10px rgba(0, 0, 0, 0.28);
  padding: 0;
  box-sizing: border-box;
  position: relative;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  color: #1a1a1a;
  display: flex;
  flex-direction: column;
}

/* Full-page white sheet behind flow content (Chrome can skip painting bg on very tall pages). */
.pp-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: #fff;
  z-index: 0;
  pointer-events: none;
}

/* Page header / footer */
.pp-page-header {
  position: absolute;
  top: 24px; left: 80px; right: 80px;
  z-index: 5;
  font-size: 11px;
  color: #888;
  display: flex;
  justify-content: flex-end;
  border-bottom: 1.5px solid #2C2420;
  padding-bottom: 6px;
}

/* All narrative + steps live here; footer sits below in normal flow so it cannot paint over screenshots. */
.pp-page-body-flow {
  /* Content-sized column; flex-shrink 0 avoids the flow box collapsing under the page flex layout. */
  flex: 0 0 auto;
  min-width: 0;
  width: 100%;
  padding: 72px 80px 8px 80px;
  box-sizing: border-box;
  position: relative;
  /* Paint above footer so any sub-pixel overlap from print layout does not show lines through shots */
  z-index: 3;
}

.pp-page-footer {
  flex-shrink: 0;
  position: relative;
  margin: 8px 80px 28px 80px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1.5px solid #2C2420;
  font-size: 11px;
  color: #888;
  display: flex;
  justify-content: space-between;
  z-index: 1;
}

/* Cover page elements */
.pp-cover-root { padding-top: 80px; position: relative; }
.pp-cover-toprow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 12px;
}
.pp-cover-root > .pp-cover-eyebrow {
  margin-bottom: 10px;
}
.pp-cover-toprow-main { flex: 1; min-width: 0; padding-right: 8px; }
.pp-cover-logo-wrap {
  flex: 0 0 auto;
  max-width: 38%;
  min-width: 0;
  text-align: right;
  line-height: 1.25;
}
.pp-cover-company-name {
  font-weight: 700;
  font-size: 13px;
  color: #2c2420;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  word-wrap: break-word;
}
.pp-cover-company-dept {
  font-size: 8px;
  color: #a07548;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-top: 3px;
  word-wrap: break-word;
}
.pp-cover-logo-img {
  display: block;
  max-width: 148px;
  max-height: 68px;
  width: auto;
  height: auto;
  object-fit: contain;
  object-position: center right;
  margin-left: auto;
}
.pp-cover-eyebrow { color: var(--stepbinder-doc-accent, #C4956A); font-weight: 700; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 10px; }
.pp-cover-title { font-size: 34px; font-weight: 700; color: #1A1A1A; line-height: 1.12; margin: 0; }
.pp-cover-desc { font-size: 15px; color: #5A5A5A; font-style: italic; margin: 0 0 28px; }
.pp-cover-rule { border: none; border-top: 4px solid var(--stepbinder-doc-accent, #C4956A); margin-bottom: 28px; }

/* Metadata table */
.pp-meta-table { width: 100%; border-collapse: collapse; margin-bottom: 0; font-size: 12px; }
.pp-meta-table td { padding: 7px 10px; border: 1px solid #ddd; vertical-align: top; }
.pp-meta-table td:first-child { background: #f4f4f4; font-weight: 700; width: 28%; white-space: nowrap; }
.pp-meta-table td.raci-cell {
  text-align: center;
  width: 30px;
  font-size: 11px;
  color: #444;
  background: #fff;
}

/* SOP section heading */
.pp-page-body-flow > .pp-sop-head:first-child,
.pp-page-body-flow > .pp-section-head:first-child {
  margin-top: 0;
}
.pp-sop-head {
  font-size: 16px; font-weight: 700; color: #2C2420; margin: 28px 0 6px; border-bottom: 1.5px solid #2C2420; padding-bottom: 4px;
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Narrative lists (global reset zeros padding — markers otherwise hang left of section headers). */
.pp-page-body-flow ul,
.pp-page-body-flow ol {
  margin: 6px 0 12px;
  padding-left: 22px;
}
.pp-page-body-flow li {
  margin: 0 0 6px;
  font-size: 13px;
  color: #3a3a3a;
  line-height: 1.45;
}
.pp-page-body-flow li:last-child { margin-bottom: 0; }

/* Keep section titles with the table or list that follows (print + sample repagination). */
.pp-keep-together {
  break-inside: avoid;
  page-break-inside: avoid;
}
.pp-sop-head + table.pp-meta-table,
.pp-section-head + table.pp-meta-table {
  break-before: avoid;
  page-break-before: avoid;
}

/* Section divider (user-added section headers) */
.pp-section-head {
  font-size: 20px; font-weight: 700; color: #2C2420; margin: 32px 0 6px; border-bottom: 1.5px solid #2C2420; padding-bottom: 4px;
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Step heading */
.pp-step-label { font-size: 11px; font-weight: 700; color: var(--stepbinder-doc-accent, #C4956A); letter-spacing: 0.06em; text-transform: uppercase; margin: 24px 0 2px; }
.pp-step-desc { font-size: 15px; font-weight: 700; color: #1a1a1a; margin-bottom: 10px; }
.pp-step-notes {
  font-size: 13px;
  color: #3a3a3a;
  line-height: 1.45;
  margin-bottom: 12px;
}
.pp-step-notes p { margin: 0 0 8px; }
.pp-step-notes p:last-child { margin-bottom: 0; }
.pp-step-notes ul,
.pp-step-notes ol { margin: 6px 0 6px 18px; padding: 0; }
.pp-step-notes a { color: var(--stepbinder-doc-accent, #C4956A); }

.pp-step-section-narrative {
  font-size: 13px;
  color: #3a3a3a;
  line-height: 1.45;
  margin-bottom: 12px;
}
.pp-step-section-narrative p { margin: 0 0 8px; }
.pp-step-section-narrative p:last-child { margin-bottom: 0; }
.pp-step-section-narrative ul,
.pp-step-section-narrative ol { margin: 6px 0 6px 18px; padding: 0; }

.pp-step-procedure,
.pp-step-marker-steps {
  font-size: 13px;
  color: #3a3a3a;
  line-height: 1.45;
  margin: 10px 0 12px;
}
.pp-step-marker-steps ol {
  margin: 0;
  padding-left: 22px;
}
.pp-step-procedure p,
.pp-step-marker-steps p { margin: 0 0 8px; }
.pp-step-procedure p:last-child,
.pp-step-marker-steps p:last-child { margin-bottom: 0; }
.pp-step-procedure ul,
.pp-step-procedure ol,
.pp-step-marker-steps ol { margin: 0; padding-left: 22px; }
.pp-step-procedure li,
.pp-step-marker-steps li { margin: 0 0 6px; }

/* One capture/manual step: keep label + narrative + screenshot from splitting across print sheets */
.pp-step-block {
  display: block;
  break-inside: avoid;
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;
  background-color: #fff;
}

/* Step image (preview uses <img class="pp-step-canvas">, not a live canvas, for stable compositing) */
.pp-step-img {
  max-width: 100%;
  display: block;
  margin-bottom: 10px;
  border: 1px solid #e8e8e8;
  background-color: #fff;
  position: relative;
  break-inside: avoid;
  page-break-inside: avoid;
  -webkit-column-break-inside: avoid;
}
.pp-step-canvas {
  display: block;
  vertical-align: top;
  background-color: #fff;
  object-fit: contain;
  max-width: 100%;
  width: auto;
  height: auto;
  break-inside: avoid;
  page-break-inside: avoid;
}

/* Workflow UI mocks (welcome samples + exports) */
.pp-step-canvas:has(.wf-chrome) {
  border: 1px solid #d8d4cf;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0 10px;
  background: #fff;
}
.pp-step-canvas .wf-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #f3f1ee;
  border-bottom: 1px solid #d8d4cf;
}
.pp-step-canvas .wf-traffic { display: flex; gap: 4px; flex-shrink: 0; }
.pp-step-canvas .wf-traffic span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ccc;
}
.pp-step-canvas .wf-traffic span:nth-child(1) { background: #ff5f57; }
.pp-step-canvas .wf-traffic span:nth-child(2) { background: #febc2e; }
.pp-step-canvas .wf-traffic span:nth-child(3) { background: #28c840; }
.pp-step-canvas .wf-url {
  flex: 1;
  min-width: 0;
  font-size: 10px;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pp-step-canvas .wf-app-row {
  display: flex;
  min-height: 100px;
  max-height: 340px;
  overflow: hidden;
  background: #fff;
}
.pp-step-canvas .wf-side {
  width: 118px;
  flex-shrink: 0;
  background: #2c2420;
  color: rgba(255, 255, 255, 0.88);
  padding: 8px 6px;
  font-size: 10px;
  line-height: 1.35;
}
.pp-step-canvas .wf-brand {
  font-weight: 700;
  font-size: 11px;
  margin-bottom: 8px;
  color: #fff;
}
.pp-step-canvas .wf-nav {
  padding: 3px 6px;
  border-radius: 3px;
  opacity: 0.72;
}
.pp-step-canvas .wf-nav.active {
  opacity: 1;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
}
.pp-step-canvas .wf-body {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  font-size: 11px;
  line-height: 1.4;
  position: relative;
}
.pp-step-canvas .wf-crumb {
  color: #888;
  font-size: 10px;
  margin-bottom: 4px;
}
.pp-step-canvas .wf-title {
  font-weight: 700;
  font-size: 12px;
  color: #1a1a1a;
  margin-bottom: 8px;
}
.pp-step-canvas .wf-row {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.pp-step-canvas .wf-field {
  flex: 1 1 120px;
  min-width: 0;
}
.pp-step-canvas .wf-lbl {
  display: block;
  font-size: 9.5px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 3px;
}
.pp-step-canvas .wf-inp {
  font-size: 11px;
  padding: 5px 7px;
  border: 1px solid #d4d4d4;
  border-radius: 3px;
  background: #fafafa;
  color: #1a1a1a;
}
.pp-step-canvas .wf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}
.pp-step-canvas .wf-table th,
.pp-step-canvas .wf-table td {
  border: 1px solid #e4e4e4;
  padding: 4px 6px;
  text-align: left;
  vertical-align: top;
}
.pp-step-canvas .wf-table th {
  background: #f4f4f4;
  font-weight: 700;
}
.pp-step-canvas .wf-table tr.hl td { background: #fff8e6; }
.pp-step-canvas .wf-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.pp-step-canvas .wf-table .pos { color: #2e7d32; }
.pp-step-canvas .wf-table .neg { color: #c62828; }
.pp-step-canvas .wf-btn {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  background: #ece9e4;
  color: #2c2420;
}
.pp-step-canvas .wf-btn.cta { background: #2c2420; color: #fff; }
.pp-step-canvas .wf-btn.ghost {
  background: transparent;
  border: 1px solid #ccc;
}
.pp-step-canvas .wf-shot-anno {
  position: absolute;
  border: 2px solid #d32f2f;
  border-radius: 2px;
  pointer-events: none;
  box-sizing: border-box;
}
.pp-shot-caption {
  display: block;
  font-size: 10px;
  color: #888;
  font-style: italic;
  margin: 4px 0 10px;
}
.export-marker-pin {
  position: absolute;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: var(--stepbinder-editor-markup, var(--orange));
  color: #fff;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  outline: 2px solid #fff;
  pointer-events: none;
  line-height: 1;
  z-index: 2;
}

/* Notes / section callouts — match FORM_CALLOUT_EXPORT_STYLE in app.js */
.pp-note,
.pp-form-tip {
  margin: 0 0 12px;
  padding: 8px 12px;
  background: var(--stepbinder-doc-note-bg, #FDF5EC);
  border-left: 4px solid var(--stepbinder-doc-accent, #C4956A);
  font-size: 12px;
  line-height: 1.45;
  color: #5A5A5A;
  white-space: pre-wrap;
}
.pp-note strong,
.pp-form-tip strong {
  color: var(--stepbinder-doc-note-strong, #A07548);
}
.pp-note p { margin: 0 0 8px; }
.pp-note p:last-child { margin-bottom: 0; }
.pp-note ul, .pp-note ol { margin: 6px 0 6px 18px; padding: 0; }

/* Loading state */
.pp-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: rgba(255,255,255,0.7);
  font-size: 16px;
  flex: 1;
}

@media print {
  body > *:not(#print-preview-overlay):not(#html-preview-overlay):not(#pptx-preview-overlay) { display: none !important; }
  #print-preview-overlay {
    position: static !important;
    background: transparent !important;
    display: block !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    forced-color-adjust: none;
  }
  .pp-toolbar { display: none !important; }
  .pp-scroll {
    overflow: visible !important;
    padding: 0 !important;
    gap: 0 !important;
    display: block !important;
  }
  .pp-page {
    box-shadow: none !important;
    page-break-after: always;
    margin: 0 !important;
    width: 100% !important;
    background: #fff !important;
    color: #1a1a1a !important;
    display: flex !important;
    flex-direction: column !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    forced-color-adjust: none;
  }
  .pp-page::before {
    background: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .pp-step-block {
    break-inside: avoid-page !important;
    page-break-inside: avoid !important;
  }
  .pp-sop-head,
  .pp-section-head {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  .pp-keep-together {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  .pp-sop-head + table.pp-meta-table,
  .pp-section-head + table.pp-meta-table {
    break-before: avoid !important;
    page-break-before: avoid !important;
  }
  .pp-step-img,
  .pp-step-canvas {
    background-color: #fff !important;
    mix-blend-mode: normal !important;
    filter: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
    forced-color-adjust: none;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  .pp-step-notes,
  .pp-step-section-narrative,
  .pp-step-procedure,
  .pp-step-marker-steps,
  .pp-note {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .pp-loading { display: none !important; }
}

/* Hidden preview area for PDF rendering */
#pdf-render-area {
  position: absolute;
  left: -99999px;
  top: 0;
  width: 816px;
  background: #fff;
  font-family: Arial, sans-serif;
  color: #000;
}

/* Help content styles */
.help-article {
  margin-bottom: 28px;
  display: none;
}
.help-article.visible { display: block; }
.help-article h3 {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--teal);
  margin-bottom: 10px;
}
.help-article p {
  color: var(--gray-700);
  line-height: 1.6;
  margin-bottom: 12px;
  font-size: 14px;
}
.help-article ol, .help-article ul {
  margin-left: 20px;
  margin-bottom: 12px;
  color: var(--gray-700);
  font-size: 14px;
}
.help-article li { margin-bottom: 6px; line-height: 1.5; }
.help-article code {
  background: var(--gray-100);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
}
.help-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 12px;
}
.help-article th, .help-article td {
  border: 1px solid var(--gray-300);
  padding: 8px;
  text-align: left;
  color: var(--gray-700);
}
.help-article th { background: var(--gray-100); font-weight: 600; }
.help-no-results {
  text-align: center;
  color: var(--gray-500);
  padding: 40px 20px;
  font-size: 14px;
}

/* === WORKFLOW PROGRESS INDICATOR (G1) — F-01 fix: numbered stepper === */
.top-bar-progress {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-400);
  flex-shrink: 0;
}
.progress-step {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  color: var(--gray-400);
  transition: color 0.2s;
  white-space: nowrap;
  cursor: default;
  pointer-events: none;
  border: none;
  background: transparent;
  font: inherit;
  border-radius: var(--radius-sm);
}
.progress-step.clickable {
  pointer-events: auto;
  cursor: pointer;
}
.progress-step.clickable:hover {
  color: var(--teal);
  background: rgba(44, 36, 32, 0.06);
}
.progress-step.clickable:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.progress-step-node {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--gray-300);
  background: #fff;
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-400);
  flex-shrink: 0;
  transition: all 0.2s;
}
.progress-step.done .progress-step-node {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
  font-size: 11px;
}
.progress-step.done { color: var(--green); }
.progress-step.active .progress-step-node {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}
.progress-step.active {
  color: var(--teal);
  font-weight: 700;
}
.progress-step-label {
  font-size: 12px;
}
.progress-sep {
  color: var(--gray-300);
  font-size: 11px;
  user-select: none;
  padding: 0 2px;
}

/* === ACTIVE TOOL MODE INDICATOR (E5) === */
#active-tool-bar {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 5px 18px;
  background: var(--teal-light);
  border-bottom: 1px solid var(--teal);
  font-size: 12px;
  color: var(--teal-dark);
  font-weight: 500;
}
#active-tool-bar.visible { display: flex; }
#active-tool-bar .esc-hint {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.75;
}

/* === TOUR TEXT LINK (W1) === */
.tour-text-link {
  font-size: 12px;
  color: var(--gray-500);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
}
.tour-text-link:hover { color: var(--teal); }

/* === WELCOME STEP INDICATORS (W3) === */
.welcome-step-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.welcome-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--teal);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}
/* F-06: load session is now a proper button, not a label wrapper */
.load-session-link {
  display: block;
  text-align: right;
  font-size: 12px;
  color: var(--gray-500);
  margin-bottom: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.load-session-link:hover { color: var(--teal); }

/* === STEP THUMBNAILS (F-09: widened to 96px) === */
.step-list-thumb {
  width: 96px; height: 62px;
  border-radius: 4px;
  background: var(--gray-200);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  border: 1px solid var(--gray-300);
  position: relative;
  overflow: hidden;
}
/* Expand hint on hover */
.step-list-thumb::after {
  content: "⤢";
  position: absolute;
  bottom: 3px;
  right: 4px;
  font-size: 10px;
  color: #fff;
  background: rgba(0,0,0,0.45);
  border-radius: 2px;
  padding: 0 3px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  line-height: 1.4;
}
.step-list-item:hover .step-list-thumb::after { opacity: 1; }

/* Hover preview tooltip (E6) */
.step-thumb-preview {
  position: fixed;
  width: 220px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-300);
  background: var(--gray-200);
  background-size: cover;
  background-position: center;
  z-index: 5000;
  pointer-events: none;
  display: none;
  aspect-ratio: 16/10;
}

/* === SAVE / PREVIEW LABELED BUTTONS (E3) === */
.btn-labeled-icon {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 10px;
  font-size: 13px;
  min-width: 52px;
}
.btn-labeled-icon .btn-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--gray-500);
  line-height: 1;
}

/* === EXPORT LOADING STATE (X1) === */
.download-btn.generating,
.download-btn.export-blocked {
  opacity: 0.7;
  cursor: not-allowed;
  pointer-events: none;
}
.dl-preview-link.export-blocked {
  opacity: 0.5;
  cursor: not-allowed;
  text-decoration: line-through;
}
.download-btn.generating .dl-icon {
  background: var(--gray-400) !important;
}
@keyframes spin { to { transform: rotate(360deg); } }
.dl-spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* === RIGHT PANEL STEP ACTIONS (E1) === */
.step-action-row {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--gray-200);
}

/* === EXPORT CHECKMARK ANIMATION (F-15) === */
@keyframes checkIn {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* Field hints — canonical styles in 02-app-ui.css (.sop-field-hint) */
