.widget-scope {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --border: #e8e6e1;
  --border-light: #f0eee9;
  --text-primary: #1c1b18;
  --text-secondary: #6b6860;
  --text-tertiary: #9e9a90;
  --accept: #3a8a5c;
  --accept-bg: #eef6f0;
  --reject: #b5493a;
  --reject-bg: #faf0ee;
  --modify: #8b6e2f;
  --modify-bg: #f8f3ea;
  --info-bg: #edf3f8;
  --info: #4a7494;
  --content-max: 400px;
  --chrome-max: 400px;
  --screen-gutter: 12px;
  --scrollbar-gutter-width: 30px;
  --widget-height: 500px;
  --review-height: 500px;
  --host-max-height: 540px;
  --host-safe-top: 0px;
  --host-safe-right: 0px;
  --host-safe-bottom: 0px;
  --host-safe-left: 0px;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-primary);
  width: 100%;
  min-width: 0;
}

.widget-scope *,
.widget-scope *::before,
.widget-scope *::after {
  box-sizing: border-box;
}

button,
textarea {
  font: inherit;
}

button:focus-visible,
textarea:focus-visible,
.file-picker:focus-within {
  outline: 2px solid var(--info);
  outline-offset: 2px;
}

.widget {
  width: 100%;
  height: min(var(--widget-height), var(--host-max-height));
  max-height: min(var(--widget-height), var(--host-max-height));
  max-width: none;
  min-width: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.widget-changes,
.widget-edit {
  height: min(var(--review-height), var(--host-max-height));
  max-height: min(var(--review-height), var(--host-max-height));
}

.widget.widget-inline {
  height: min(400px, var(--host-max-height));
  max-height: min(400px, var(--host-max-height));
}

.tab-nav-band,
.widget-footer {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  min-width: 0;
  width: 100%;
}

.tab-nav-band {
  overflow: hidden;
  padding-left: var(--host-safe-left);
  padding-right: var(--host-safe-right);
}

.widget-footer {
  color: var(--text-tertiary);
  font-size: 0.74rem;
}

.tab-nav {
  display: flex;
  gap: 14px;
  margin-left: auto;
  margin-right: auto;
  max-width: var(--chrome-max);
  overflow-x: auto;
  padding: 0;
  scrollbar-width: none;
  width: min(var(--chrome-max), calc(100% - (2 * var(--screen-gutter)) - var(--scrollbar-gutter-width)));
}

.tab-nav::-webkit-scrollbar {
  display: none;
}

.tab-btn {
  border: 0;
  background: none;
  color: var(--text-tertiary);
  cursor: pointer;
  flex: 0 0 auto;
  padding: 12px 0;
  position: relative;
}

.tab-btn.active {
  color: var(--text-primary);
  font-weight: 700;
}

.tab-btn.active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--text-primary);
}

.tab-count {
  background: var(--border-light);
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 0.68rem;
  margin-left: 5px;
  padding: 2px 6px;
}

.screen {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 14px;
  padding-left: calc(18px + var(--host-safe-left));
  padding-right: calc(18px + var(--host-safe-right));
  padding-top: 14px;
  scrollbar-gutter: stable both-edges;
  width: 100%;
}

.screen:not(.changes-screen) > * {
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  min-width: 0;
  width: 100%;
}

.starter-screen,
.intake-screen {
  display: grid;
  gap: 14px;
}

.starter-screen h1,
.intake-heading h1 {
  font-size: 1.1rem;
  margin: 0;
  overflow-wrap: anywhere;
}

.intake-screen {
  align-content: center;
  gap: 8px;
  padding-bottom: 10px;
  padding-top: 10px;
}

.intake-heading {
  display: grid;
  gap: 5px;
}

.intake-heading p {
  color: var(--text-secondary);
  font-size: 0.86rem;
  line-height: 1.35;
  margin: 0;
  max-width: 38ch;
  overflow-wrap: anywhere;
}

.editor-launch-screen {
  align-content: center;
  display: grid;
}

.editor-launch-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  padding: 18px;
}

.editor-launch-card h1 {
  font-size: 1.1rem;
  margin: 0;
}

.editor-launch-card p {
  color: var(--text-secondary);
  line-height: 1.4;
  margin: 0;
}

.editor-launch-error {
  color: var(--reject) !important;
  font-size: 0.8rem;
}

.starter-methods {
  display: grid;
  gap: 14px;
}

.starter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.starter-label {
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
}

.dropzone {
  align-items: center;
  background: var(--surface);
  border: 1px dashed #cfcac0;
  border-radius: 12px;
  cursor: pointer;
  display: grid;
  gap: 6px;
  justify-items: center;
  min-height: 98px;
  max-width: 100%;
  padding: 10px;
  text-align: center;
  transition:
    background 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.dropzone.active,
.dropzone:focus-within {
  background: #fbfaf7;
  border-color: var(--accept);
  box-shadow: inset 0 0 0 1px var(--accept);
}

.dropzone.selected {
  border-style: solid;
}

.dropzone strong {
  color: var(--text-primary);
  font-size: 0.98rem;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.dropzone span,
.dropzone small {
  color: var(--text-tertiary);
  max-width: 100%;
  overflow-wrap: anywhere;
}

.dropzone small {
  display: none;
  line-height: 1.4;
  max-width: 46ch;
}

.dropzone input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.dropzone-icon {
  background: var(--border-light);
  border-radius: 10px;
  display: grid;
  height: 34px;
  place-items: center;
  position: relative;
  width: 30px;
}

.dropzone-icon::before {
  background:
    linear-gradient(90deg, transparent 0 12px, var(--text-tertiary) 12px 14px, transparent 14px),
    linear-gradient(var(--text-tertiary), var(--text-tertiary));
  background-position:
    0 0,
    center;
  background-repeat: no-repeat;
  background-size:
    20px 20px,
    20px 2px;
  border: 2px solid var(--text-tertiary);
  border-radius: 50%;
  bottom: -7px;
  content: "";
  height: 20px;
  position: absolute;
  right: -8px;
  width: 20px;
}

.dropzone-icon span {
  border-bottom: 7px solid transparent;
  border-left: 7px solid #d9d6ce;
  position: absolute;
  right: 0;
  top: 0;
}

.intake-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
  margin-right: auto;
  max-width: 340px;
  width: 100%;
}

.intake-actions.single {
  max-width: 230px;
}

.intake-actions .btn {
  padding-bottom: 9px;
  padding-top: 9px;
  white-space: nowrap;
}

.paste-fallback {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.paste-fallback summary {
  color: var(--text-secondary);
  cursor: pointer;
  font-weight: 700;
}

.paste-fallback-body {
  display: grid;
  gap: 10px;
  padding-top: 12px;
}

.draft-input,
.modify-panel textarea {
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  line-height: 1.45;
  max-width: 100%;
  min-height: 180px;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.file-picker {
  align-items: center;
  border: 1px dashed var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  min-width: 0;
  padding: 12px;
}

.file-picker span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-picker input {
  width: 1px;
  height: 1px;
  opacity: 0;
  position: absolute;
}

.modify-panel {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.modify-panel textarea {
  min-height: 92px;
}

.status-message {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-secondary);
  display: grid;
  gap: 4px;
  line-height: 1.45;
  padding: 12px;
}

.status-message.error {
  background: var(--reject-bg);
  border-color: #e8ccc7;
  color: var(--reject);
}

.intake-complete-screen {
  align-content: start;
}

.intake-complete-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 8px;
  padding: 14px;
}

.intake-complete-card h1 {
  font-size: 1.05rem;
  margin: 0;
}

.intake-complete-card p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  line-height: 1.35;
  margin: 0;
}

.intake-complete-details {
  border-top: 1px solid var(--border-light);
  display: grid;
  gap: 8px;
  margin: 4px 0 0;
  padding-top: 12px;
}

.intake-complete-details div {
  display: grid;
  gap: 2px;
}

.intake-complete-details dt {
  color: var(--text-tertiary);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.intake-complete-details dd {
  color: var(--text-primary);
  margin: 0;
  overflow-wrap: anywhere;
}

.intake-complete-note {
  border-top: 1px solid var(--border-light);
  margin-top: 4px;
  padding-top: 10px;
}

.intake-continue {
  margin-top: 4px;
  width: 100%;
}

.diagnostic-screen {
  display: grid;
  gap: 10px;
  min-height: 230px;
}

.diagnostic-screen h1 {
  font-size: 1rem;
  margin: 0;
}

.diagnostic-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 10px;
}

.diagnostic-details div {
  display: grid;
  gap: 4px;
}

.diagnostic-details dt {
  color: var(--text-tertiary);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.diagnostic-details dd {
  color: var(--text-secondary);
  margin: 0;
  overflow-wrap: anywhere;
}

.diagnostic-retry {
  width: 100%;
}

.loading-screen {
  align-content: center;
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  min-height: 230px;
}

.loading-screen h1 {
  font-size: 1.05rem;
  margin: 0;
}

.loading-screen p {
  color: var(--text-secondary);
  font-size: 0.88rem;
  margin: 0;
}

.loading-screen > .loading-spinner {
  animation: loading-pulse 1.1s ease-in-out infinite;
  border: 2px solid var(--border);
  border-top-color: var(--accept);
  border-radius: 50%;
  display: block;
  height: 24px;
  margin: 0;
  max-width: 24px;
  width: 24px;
}

@keyframes loading-pulse {
  0%,
  100% {
    opacity: 0.45;
  }

  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .loading-screen > .loading-spinner {
    animation: none;
  }

  .edit-detail,
  .edit-btn,
  .edit-row,
  .edit-row-summary,
  .progress-fill,
  .row-chevron svg {
    animation: none;
    transition: none;
  }
}

.doc-header {
  display: flex;
  gap: 14px;
  align-items: center;
}

.doc-icon {
  flex: 0 0 auto;
  width: 38px;
  height: 46px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  position: relative;
}

.doc-icon-corner {
  position: absolute;
  top: -1px;
  right: -1px;
  width: 15px;
  height: 15px;
  background: var(--bg);
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.doc-info h1 {
  font-size: 1rem;
  margin: 0 0 6px;
  overflow-wrap: anywhere;
}

.doc-info {
  min-width: 0;
}

.doc-kind {
  align-items: center;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.78rem;
}

.doc-header h1 {
  font-size: 1rem;
  line-height: 1.15;
  margin: 0 0 8px;
  overflow-wrap: anywhere;
}

.layout-confidence {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  gap: 5px;
  font-weight: 700;
  padding: 4px 8px;
}

.layout-confidence svg {
  fill: none;
  flex: 0 0 13px;
  height: 13px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 13px;
}

.layout-confidence.stable {
  background: var(--accept-bg);
  color: var(--accept);
}

.layout-confidence.risk {
  background: var(--modify-bg);
  color: var(--modify);
}

.structure-summary,
.warning-box,
.edit-row,
.block,
.export-warning,
.export-success,
.success-file {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.structure-summary,
.warning-box {
  margin-top: 12px;
  padding: 12px;
}

.structure-label,
.export-format-label {
  color: var(--text-secondary);
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
}

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

.structure-stat {
  background: var(--bg);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
  min-width: 0;
}

.structure-stat strong {
  display: block;
  font-size: 1.12rem;
}

.structure-stat span {
  color: var(--text-tertiary);
  font-size: 0.72rem;
}

.warning-box,
.export-warning {
  color: var(--modify);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.review-handoff {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 10px 12px;
}

.review-handoff strong {
  color: var(--text-primary);
}

.review-handoff span {
  color: var(--text-tertiary);
  font-size: 0.78rem;
}

.overview-actions,
.edit-actions,
.format-options {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

.overview-actions-primary {
  margin-top: 12px;
}

.btn,
.edit-btn,
.format-option {
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}

.btn:disabled,
.edit-btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn {
  flex: 1;
  font-weight: 700;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 11px 14px;
}

.btn-filled,
.save-btn {
  background: var(--text-primary);
  border-color: var(--text-primary);
  color: #fff;
}

.btn-outline,
.edit-btn {
  background: var(--surface);
  color: var(--text-primary);
}

.review-toolbar {
  align-items: center;
  display: flex;
  gap: 10px;
  padding: 10px 12px;
}

.changes-screen {
  align-content: start;
  display: grid;
  gap: 12px;
  grid-auto-rows: max-content;
  padding-bottom: var(--screen-gutter);
  padding-left: calc(var(--screen-gutter) + var(--host-safe-left));
  padding-right: calc(var(--screen-gutter) + var(--host-safe-right));
  padding-top: var(--screen-gutter);
}

.changes-screen > .review-controls-card,
.changes-screen > .edit-list,
.changes-screen > .document-preview {
  margin-left: auto;
  margin-right: auto;
  max-width: var(--chrome-max);
  width: 100%;
}

.review-controls-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.review-progress-text {
  color: var(--text-tertiary);
  font-size: 0.78rem;
  white-space: nowrap;
}

.review-controls-card .edit-btn {
  flex: 0 0 auto;
  margin: 0;
  min-width: 86px;
  white-space: nowrap;
}

.progress-track {
  background: var(--border-light);
  border-radius: 999px;
  flex: 1 1 auto;
  height: 4px;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  display: block;
  height: 100%;
  position: absolute;
  top: 0;
  transition: left 180ms ease, width 180ms ease;
}

.progress-fill-accept {
  background: var(--accept);
  left: 0;
}

.progress-fill-reject {
  background: #d59c92;
}

.edit-list {
  background: var(--surface);
  display: block;
}

.edit-section-group {
  display: block;
}

.edit-section-title {
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0;
  padding: 10px 2px 7px;
  text-transform: uppercase;
}

.edit-row {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  overflow: hidden;
  transition: background-color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.edit-row-summary {
  align-items: center;
  background: var(--surface);
  border: 0;
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  min-height: 60px;
  min-width: 0;
  padding: 12px 14px;
  text-align: left;
  width: 100%;
  transition: background-color 180ms ease;
}

.edit-row-summary > * {
  min-width: 0;
}

.edit-category,
.edit-status {
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: capitalize;
}

.edit-category {
  grid-column: 2;
  grid-row: 1;
  align-items: center;
  color: var(--text-secondary);
  display: inline-flex;
  gap: 7px;
  min-width: 0;
  padding: 0;
  text-transform: uppercase;
}

.edit-category-dot {
  background: var(--text-tertiary);
  border-radius: 50%;
  flex: 0 0 auto;
  height: 6px;
  width: 6px;
}

.cat-impact .edit-category-dot,
.cat-audience_fit .edit-category-dot,
.cat-role_fit .edit-category-dot {
  background: var(--accept);
}

.cat-clarity .edit-category-dot,
.cat-structure .edit-category-dot,
.cat-formatting .edit-category-dot {
  background: var(--info);
}

.cat-grammar .edit-category-dot {
  background: var(--reject);
}

.cat-length .edit-category-dot,
.cat-consistency .edit-category-dot {
  background: var(--modify);
}

.cat-tone .edit-category-dot {
  background: #8467a9;
}

.edit-status {
  grid-column: 3;
  grid-row: 1;
  background: var(--border-light);
  color: var(--text-secondary);
  padding: 4px 8px;
}

.edit-status-accepted,
.edit-status-applied,
.edit-status-modified {
  background: var(--accept-bg);
  color: var(--accept);
}

.edit-status-rejected {
  background: var(--reject-bg);
  color: var(--reject);
}

.row-chevron {
  align-items: center;
  color: var(--text-tertiary);
  display: inline-flex;
  height: 14px;
  justify-content: center;
  width: 14px;
}

.row-chevron svg {
  fill: none;
  height: 13px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
  transition: transform 160ms ease;
  width: 13px;
}

.edit-row.is-expanded .row-chevron svg {
  transform: rotate(90deg);
}

.row-summary-text {
  color: var(--text-primary);
  grid-column: 2 / 4;
  grid-row: 2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-detail {
  border-top: 1px solid var(--border-light);
  padding: 14px;
  animation: edit-detail-enter 170ms ease-out;
}

.edit-row.is-expanded {
  box-shadow: inset 3px 0 0 var(--border);
}

.edit-row.status-accepted,
.edit-row.status-applied,
.edit-row.status-modified {
  background: var(--accept-bg);
}

.edit-row.status-rejected {
  color: var(--text-tertiary);
}

@keyframes edit-detail-enter {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.edit-diff {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.diff-col {
  background: var(--bg);
  border-radius: 8px;
  color: var(--text-secondary);
  line-height: 1.35;
  min-width: 0;
  overflow-wrap: anywhere;
  padding: 10px;
}

.diff-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.edit-rationale,
.edit-mode-hint,
.mode-desc,
.format-desc,
.success-ttl {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.edit-rationale {
  margin: 14px 0 0;
}

.edit-btn {
  background: var(--surface);
  min-width: 86px;
  padding: 8px 10px;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, opacity 160ms ease;
}

.accept-btn {
  color: var(--accept);
}

.reject-btn {
  color: var(--reject);
}

.modify-btn {
  color: var(--modify);
}

.edit-mode-header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.edit-mode-label {
  font-weight: 700;
}

.edit-mode-count {
  color: var(--text-tertiary);
  font-size: 0.78rem;
  white-space: nowrap;
}

.manual-edit-toolbar {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.manual-save-message {
  margin-top: 12px;
}

.block-editor {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.block {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.block-label {
  color: var(--text-tertiary);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
}

.block textarea {
  border: 1px solid transparent;
  border-radius: 6px;
  max-width: 100%;
  min-height: 44px;
  resize: vertical;
  padding: 6px;
}

.block textarea:not([readonly]) {
  background: var(--surface);
  border-color: var(--border-light);
}

.section-heading textarea {
  font-weight: 700;
}

.page-break-block {
  border-style: dashed;
  color: var(--text-tertiary);
}

.document-preview {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  padding: 18px 20px 22px;
}

.preview-title-row {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.preview-label {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.preview-meta {
  color: var(--text-tertiary);
  font-size: 0.75rem;
}

.preview-page {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 2px 12px rgba(28, 27, 24, 0.05);
  color: var(--text-primary);
  display: grid;
  gap: 7px;
  line-height: 1.35;
  min-height: 220px;
  padding: 20px;
}

.preview-block {
  overflow-wrap: anywhere;
}

.preview-title {
  font-size: 1.15rem;
  font-weight: 800;
  text-align: center;
}

.preview-contact {
  color: var(--text-secondary);
  font-size: 0.78rem;
  text-align: center;
}

.preview-heading,
.preview-section_label {
  border-bottom: 1px solid var(--border-light);
  font-size: 0.82rem;
  font-weight: 800;
  margin-top: 8px;
  padding-bottom: 3px;
  text-transform: uppercase;
}

.preview-bullet {
  padding-left: 12px;
}

.preview-table_cell {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 6px;
}

.preview-page-break {
  border-top: 1px dashed var(--border);
  color: var(--text-tertiary);
  font-size: 0.72rem;
  margin: 8px 0;
  padding-top: 6px;
  text-align: center;
}

.export-body {
  display: grid;
  gap: 12px;
}

.format-option {
  background: var(--surface);
  display: grid;
  gap: 3px;
  padding: 12px;
  text-align: left;
}

.format-option {
  flex: 1;
}

.format-option.selected {
  border-color: var(--text-primary);
  box-shadow: inset 0 0 0 1px var(--text-primary);
}

.format-ext,
.export-preservation-note strong {
  font-weight: 800;
}

.export-warning,
.export-preservation-note,
.export-pending-note {
  padding: 12px;
}

.export-preservation-note,
.export-pending-note {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 4px;
}

.export-pending-note {
  background: var(--modify-bg);
}

.export-pending-note strong {
  color: var(--modify);
  font-size: 0.82rem;
}

.export-pending-note p {
  color: var(--text-secondary);
  font-size: 0.78rem;
  line-height: 1.4;
  margin: 0;
}

.export-preservation-note .export-format-label {
  margin-bottom: 2px;
}

.export-preservation-note p {
  color: var(--text-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
  margin: 0;
}

.btn-export {
  width: 100%;
}

.export-success {
  display: grid;
  gap: 10px;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  padding: 18px;
  place-items: center;
  text-align: center;
  width: 100%;
}

.export-download-screen {
  align-content: start;
  display: grid;
}

.export-success h1 {
  font-size: 1.15rem;
  line-height: 1.15;
  margin: 0;
  overflow-wrap: anywhere;
}

.export-success p {
  color: var(--text-secondary);
  line-height: 1.35;
  margin: 0;
  overflow-wrap: anywhere;
}

.success-icon {
  background: var(--accept-bg);
  border-radius: 50%;
  color: var(--accept);
  display: inline-grid;
  font-weight: 900;
  height: 42px;
  place-items: center;
  width: 42px;
}

.success-file {
  margin-top: 14px;
  overflow-wrap: anywhere;
  padding: 10px;
}

.download-btn,
.export-another-btn {
  display: block;
  max-width: 100%;
  min-width: 0;
  width: 100%;
}

.download-link {
  color: var(--info);
  font-size: 0.8rem;
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
  text-decoration: none;
}

.download-link:hover {
  text-decoration: underline;
}

.success-ttl {
  color: var(--text-tertiary);
  font-size: 0.74rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.widget-footer {
  border-bottom: 0;
  border-top: 1px solid var(--border);
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
  padding-bottom: calc(9px + var(--host-safe-bottom));
  padding-left: calc(14px + var(--host-safe-left));
  padding-right: calc(14px + var(--host-safe-right));
  padding-top: 9px;
  text-align: center;
  white-space: normal;
  width: 100%;
}

@media (max-width: 680px) {
  .tab-nav {
    gap: 12px;
  }

  .review-toolbar,
  .edit-section-title,
  .edit-row-summary,
  .edit-detail,
  .document-preview {
    padding-left: 16px;
    padding-right: 16px;
  }

  .edit-row-summary {
    gap: 8px;
    grid-template-columns: 14px minmax(0, 1fr) auto;
  }

  .edit-diff {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    padding: 0;
  }

  .widget {
    border-radius: 0;
    height: min(var(--widget-height), var(--host-max-height));
    max-height: min(var(--widget-height), var(--host-max-height));
    min-height: 0;
    width: 100%;
  }

  .widget-changes,
  .widget-edit {
    height: min(var(--review-height), var(--host-max-height));
  }

  .tab-nav {
    gap: 12px;
  }

  .screen {
    padding-bottom: 14px;
    padding-left: calc(14px + var(--host-safe-left));
    padding-right: calc(14px + var(--host-safe-right));
    padding-top: 14px;
  }

  .review-toolbar,
  .edit-section-title,
  .edit-row-summary,
  .edit-detail,
  .document-preview {
    padding-left: 14px;
    padding-right: 14px;
  }

  .edit-diff {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 470px) {
  :root {
    --screen-gutter: 10px;
  }

  .intake-screen {
    gap: 10px;
    padding-top: 12px;
  }

  .intake-heading {
    gap: 5px;
  }

  .starter-screen h1,
  .intake-heading h1 {
    font-size: 1.08rem;
  }

  .intake-heading p {
    line-height: 1.35;
  }

  .intake-complete-card {
    gap: 6px;
    padding: 10px;
  }

  .intake-complete-details {
    gap: 6px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding-top: 8px;
  }

  .screen {
    padding-bottom: 12px;
    padding-left: calc(12px + var(--host-safe-left));
    padding-right: calc(12px + var(--host-safe-right));
    padding-top: 12px;
  }

  .changes-screen {
    gap: 10px;
    padding-bottom: var(--screen-gutter);
    padding-left: calc(var(--screen-gutter) + var(--host-safe-left));
    padding-right: calc(var(--screen-gutter) + var(--host-safe-right));
    padding-top: var(--screen-gutter);
  }

  .tab-nav {
    gap: 4px;
  }

  .tab-btn {
    flex: 1 1 0;
    font-size: 0.86rem;
    padding: 10px 4px;
  }

  .tab-btn.active::after {
    left: 6px;
    right: 6px;
  }

  .tab-count {
    margin-left: 3px;
    padding: 1px 5px;
  }

  .review-toolbar {
    gap: 8px;
    padding: 9px 10px;
  }

  .review-controls-card .edit-btn {
    font-size: 0.78rem;
    min-width: 76px;
    padding: 7px 8px;
  }

  .review-progress-text {
    font-size: 0.7rem;
  }

  .edit-row-summary {
    align-items: center;
    gap: 8px;
    grid-template-columns: 14px minmax(0, 1fr) auto;
    min-height: 0;
    padding-bottom: 12px;
    padding-top: 12px;
  }

  .row-chevron {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .edit-category {
    grid-column: 2;
    grid-row: 1;
    justify-self: start;
    width: auto;
  }

  .edit-status {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    width: auto;
  }

  .row-summary-text {
    grid-column: 2 / 4;
    grid-row: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .edit-diff {
    grid-template-columns: 1fr;
  }

  .edit-detail {
    padding-bottom: 10px;
    padding-top: 10px;
  }

  .diff-col {
    padding: 8px 10px;
  }

  .diff-label {
    margin-bottom: 4px;
  }

  .edit-rationale {
    margin-top: 8px;
  }

  .edit-actions {
    gap: 6px;
    margin-top: 8px;
  }

  .edit-actions,
  .intake-actions,
  .overview-actions,
  .format-options,
  .manual-edit-toolbar {
    flex-wrap: wrap;
  }

  .edit-btn,
  .btn,
  .format-option {
    flex: 1 1 110px;
  }

  .dropzone {
    gap: 6px;
    min-height: 122px;
    padding: 12px;
  }

  .dropzone-icon {
    border-radius: 10px;
    height: 40px;
    width: 34px;
  }

  .dropzone-icon::before {
    background-size:
      22px 22px,
      22px 2px;
    bottom: -7px;
    height: 22px;
    right: -8px;
    width: 22px;
  }

  .dropzone strong {
    font-size: 0.96rem;
  }

  .dropzone small {
    display: none;
  }

  .structure-summary,
  .warning-box,
  .review-handoff,
  .overview-actions,
  .edit-actions,
  .format-options {
    margin-top: 12px;
  }

  .widget-footer {
    font-size: 0.68rem;
    line-height: 1.25;
    padding-bottom: calc(9px + var(--host-safe-bottom));
    padding-left: calc(12px + var(--host-safe-left));
    padding-right: calc(12px + var(--host-safe-right));
    padding-top: 9px;
  }

  .doc-header {
    gap: 10px;
  }

  .doc-icon {
    width: 34px;
    height: 42px;
  }

  .structure-summary,
  .warning-box {
    padding: 12px;
  }

  .structure-grid {
    gap: 6px;
  }

  .structure-stat {
    padding: 8px 4px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .screen {
    scrollbar-gutter: auto;
  }

  .tab-nav {
    width: min(var(--chrome-max), calc(100% - (2 * var(--screen-gutter))));
  }
}

@media (max-width: 340px) {
  .doc-header {
    align-items: flex-start;
  }

  .doc-icon {
    display: none;
  }

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

/* ── Landing-page overrides ──
   Hide all scrollbars inside the widget and remove the reserved
   scrollbar gutter that pinches content on the narrow hero column. */
.widget-scope * {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.widget-scope *::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.widget-scope .screen {
  scrollbar-gutter: auto;
}

/* The narrow Overview embed keeps its workflow tabs aligned to the card edges. */
.integration-mockup .tab-nav {
  gap: 0;
  justify-content: space-between;
  padding: 0 16px;
  width: 100%;
}
