.doc-builder {
  max-width: none;
  --doc-border: #222;
  --doc-border-light: #c8c8c8;
  --doc-cell-pad-y: 8px;
  --doc-cell-pad-x: 10px;
  --doc-a4-width: 210mm;
  --doc-page-content-height: 461px;
  --doc-muted: var(--swi-text-secondary, #5c5c5c);
  --doc-accent: var(--portal-accent, #c00);
  --doc-form-bg: #fafcff;
}

.doc-back-btn {
  margin-bottom: 0.75rem;
}

.doc-builder-hint {
  margin: 0 0 1rem;
}

.doc-builder .builder-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

.doc-builder .builder-step {
  cursor: pointer;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface);
  color: var(--swi-text);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.9rem;
}

.doc-builder .builder-step.is-active {
  background: var(--portal-accent);
  color: var(--portal-accent-contrast);
  border-color: var(--portal-accent);
}

.doc-builder .builder-step-sep {
  color: var(--doc-muted);
  font-size: 0.85rem;
}

.doc-page-toolbar-wrap {
  margin-bottom: 1rem;
}

.doc-page-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.doc-page-tab {
  cursor: pointer;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface);
  color: var(--swi-text);
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  font: inherit;
  font-size: 0.85rem;
}

.doc-page-tab.is-active {
  background: var(--portal-accent);
  color: var(--portal-accent-contrast);
  border-color: var(--portal-accent);
}

.doc-page-tab:disabled,
.doc-page-add:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.doc-page-add {
  font-size: 0.85rem;
}

.doc-page-toolbar-hint {
  margin: 0.5rem 0 0;
}

.doc-builder--scroll {
  max-width: 960px;
  margin: 0 auto;
  padding-bottom: 6.5rem;
}

/* Full-width document form / submission (uses entire portal main area) */
.doc-builder--full-width {
  max-width: none;
  width: 100%;
  margin: 0;
}

.doc-builder--full-width.doc-builder--scroll {
  max-width: none;
}

.doc-builder--full-width .doc-page-order,
.doc-builder--full-width .doc-page-filmstrip,
.doc-builder--full-width .doc-page-filmstrip-launcher,
.doc-builder--full-width .doc-status-callout,
.doc-builder--full-width .doc-scroll-shared,
.doc-builder--full-width .doc-scroll-page__head,
.doc-builder--full-width .doc-scroll-page-add,
.doc-builder--full-width .doc-scroll-page .document-wrap--details,
.doc-builder--full-width .doc-scroll-page .document-wrap--content,
.doc-builder--full-width .document-wrap,
.doc-builder--full-width.doc-builder .document-wrap,
.doc-builder--full-width .doc-submission-view .document-wrap--view,
.doc-submission-view--full-width .document-wrap--view {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.doc-builder--full-width .doc-submission-view,
.doc-submission-view--full-width {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.doc-builder--full-width .doc-submission-page-block {
  width: 100%;
}

/* Expand document sheets when the portal sidebar is collapsed. */
.portal-root--sidebar-collapsed .doc-builder,
.portal-root--sidebar-collapsed .doc-builder--scroll,
.portal-root--sidebar-collapsed .doc-builder--full-width,
.portal-root--sidebar-collapsed .doc-submission-view,
.portal-root--sidebar-collapsed .swi-user-page,
.portal-root--sidebar-collapsed .swi-panel {
  max-width: none;
  width: 100%;
}

.portal-root--sidebar-collapsed .doc-builder .document-wrap,
.portal-root--sidebar-collapsed .doc-builder--full-width .document-wrap,
.portal-root--sidebar-collapsed .doc-submission-view .document-wrap--view {
  max-width: none;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.doc-builder--scroll .portal-page-header {
  align-items: center;
  margin-bottom: 0.75rem;
  gap: 0.75rem;
}

.doc-builder--scroll .portal-page-header--solo .portal-page-header__text {
  width: auto;
  flex: 1;
  min-width: 0;
}

.doc-builder--scroll .portal-page-title {
  font-size: 1.125rem;
  line-height: 1.25;
}

.doc-builder--scroll .portal-page-subtitle {
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  line-height: 1.35;
}

.doc-builder--scroll .doc-back-btn {
  margin-bottom: 0.25rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.8125rem;
}

.doc-builder--scroll .portal-page-header__actions {
  flex-shrink: 0;
}

.doc-scroll-workspace {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.doc-page-order {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 1rem 1.1rem;
  border: 1px solid var(--swi-border);
  border-radius: 10px;
  background: var(--swi-surface);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.doc-page-order--dirty {
  border-color: #d4a017;
  box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.25);
}

.doc-page-order--flash {
  animation: doc-page-order-flash 0.6s ease;
}

@keyframes doc-page-order-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(192, 0, 0, 0.35);
  }
  40% {
    box-shadow: 0 0 0 4px rgba(192, 0, 0, 0.18);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(192, 0, 0, 0);
  }
}

.doc-page-order__toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.doc-page-order__toolbar-text {
  min-width: 0;
}

.doc-page-order__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--swi-text);
}

.doc-page-order__hint {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
}

.doc-page-order__reset {
  flex-shrink: 0;
  font-size: 0.8125rem;
}

.doc-page-order__status {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  font-size: 0.8125rem;
  line-height: 1.45;
}

.doc-page-order__status--saved {
  background: rgba(34, 139, 34, 0.08);
  border: 1px solid rgba(34, 139, 34, 0.22);
  color: var(--swi-text);
}

.doc-page-order__status--changed {
  background: rgba(212, 160, 23, 0.12);
  border: 1px solid rgba(212, 160, 23, 0.35);
  color: var(--swi-text);
}

.doc-page-order__status-icon {
  flex-shrink: 0;
  width: 1.25rem;
  height: 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.doc-page-order__status--saved .doc-page-order__status-icon {
  background: rgba(34, 139, 34, 0.15);
  color: #228b22;
}

.doc-page-order__status--changed .doc-page-order__status-icon {
  background: rgba(212, 160, 23, 0.2);
  color: #9a7200;
}

.doc-page-order__track {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.35rem 0.25rem;
}

.doc-page-order__arrow {
  display: flex;
  align-items: center;
  padding: 0 0.15rem;
  color: var(--swi-text-secondary);
  font-size: 1rem;
  font-weight: 600;
}

.doc-page-order__card {
  display: flex;
  flex-direction: column;
  width: min(100%, 168px);
  min-height: 132px;
  border: 1px solid var(--swi-border);
  border-radius: 8px;
  background: var(--swi-bg);
  cursor: grab;
  user-select: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.doc-page-order__card:active {
  cursor: grabbing;
}

.doc-page-order__card.is-dragging {
  opacity: 0.55;
  transform: scale(0.98);
}

.doc-page-order__card.is-drop-target {
  border-color: var(--portal-accent);
  box-shadow: 0 0 0 2px rgba(192, 0, 0, 0.25);
}

.doc-page-order__card.is-moved {
  border-color: #d4a017;
  background: rgba(212, 160, 23, 0.06);
}

.doc-page-order__card-top {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.5rem 0.25rem;
}

.doc-page-order__grip {
  display: flex;
  flex-shrink: 0;
  color: var(--swi-text-secondary);
  opacity: 0.7;
}

.doc-page-order__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.65rem;
  height: 1.65rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--portal-accent);
  color: var(--portal-accent-contrast);
  font-size: 0.8125rem;
  font-weight: 700;
}

.doc-page-order__moved-tag,
.doc-page-order__new-tag {
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.12rem 0.35rem;
  border-radius: 999px;
  line-height: 1.2;
}

.doc-page-order__moved-tag {
  background: rgba(212, 160, 23, 0.18);
  color: #9a7200;
}

.doc-page-order__new-tag {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.doc-page-order__card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  margin: 0;
  padding: 0.15rem 0.55rem 0.35rem;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}

.doc-page-order__card-body:hover:not(:disabled) {
  color: var(--portal-accent);
}

.doc-page-order__card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.doc-page-order__card-meta {
  font-size: 0.6875rem;
  color: var(--swi-text-secondary);
}

.doc-page-order__card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.25rem;
  padding: 0 0.45rem 0.45rem;
}

.doc-page-order__move-btn {
  padding: 0.28rem 0.35rem;
  border: 1px solid var(--swi-border);
  border-radius: 6px;
  background: var(--swi-surface);
  color: var(--swi-text);
  font: inherit;
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
}

.doc-page-order__move-btn:hover:not(:disabled) {
  border-color: var(--portal-accent);
  color: var(--portal-accent);
}

.doc-page-order__move-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Collapsible page filmstrip launcher + preview panel */
.doc-page-filmstrip-launcher {
  position: sticky;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  padding: 0.35rem 0.5rem 0.5rem;
  pointer-events: none;
}

.doc-page-filmstrip-launcher__btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 1rem 0.55rem 0.75rem;
  border: 1px solid color-mix(in srgb, var(--swi-border) 60%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--swi-surface) 82%, transparent);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.doc-page-filmstrip-launcher__btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--swi-accent) 40%, var(--swi-border));
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.doc-page-filmstrip-launcher__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--swi-accent) 55%, transparent);
  outline-offset: 2px;
}

.doc-page-filmstrip-launcher__btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.doc-page-filmstrip-launcher--dirty .doc-page-filmstrip-launcher__btn {
  border-color: color-mix(in srgb, #d4a017 45%, transparent);
}

/* Floating document action FAB menu (portaled to body — always viewport-fixed) */
.doc-floating-actions {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 0.65rem;
  max-width: min(16rem, calc(100vw - 2rem));
  pointer-events: none;
}

.doc-floating-actions__backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(1px);
  -webkit-backdrop-filter: blur(1px);
  animation: doc-fab-backdrop-in 0.18s ease;
}

@keyframes doc-fab-backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.doc-floating-actions__menu {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.45rem;
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateY(0.75rem) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  transition:
    max-height 0.28s ease,
    opacity 0.2s ease,
    transform 0.24s ease;
}

.doc-floating-actions--open .doc-floating-actions__menu {
  max-height: 28rem;
  opacity: 1;
  overflow: visible;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.doc-floating-actions__fab {
  pointer-events: auto;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.25rem;
  height: 3.25rem;
  padding: 0;
  border: 1px solid color-mix(in srgb, var(--swi-primary, #1a1a1a) 70%, transparent);
  border-radius: 50%;
  background: color-mix(in srgb, var(--swi-primary, #1a1a1a) 94%, transparent);
  color: #fff;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
  cursor: pointer;
  font: inherit;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.doc-floating-actions__fab:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22);
  background: var(--swi-primary, #1a1a1a);
}

.doc-floating-actions__fab:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--swi-accent) 55%, transparent);
  outline-offset: 3px;
}

.doc-floating-actions--open .doc-floating-actions__fab {
  background: color-mix(in srgb, var(--swi-surface) 92%, transparent);
  color: inherit;
  border-color: color-mix(in srgb, var(--swi-border) 75%, transparent);
}

.doc-floating-actions--dirty .doc-floating-actions__fab {
  border-color: color-mix(in srgb, #d4a017 55%, transparent);
}

.doc-floating-actions__fab-icon {
  display: block;
  font-size: 1.65rem;
  font-weight: 300;
  line-height: 1;
  transition: transform 0.22s ease;
}

.doc-floating-actions--open .doc-floating-actions__fab-icon {
  transform: rotate(90deg);
  font-size: 1.85rem;
  font-weight: 400;
}

.doc-floating-actions__fab-dot {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #d4a017;
  border: 2px solid var(--swi-surface, #fff);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.doc-floating-actions--dirty .doc-floating-actions__status {
  border-color: color-mix(in srgb, #d4a017 45%, transparent);
  color: #9a7200;
}

.doc-floating-actions__status {
  pointer-events: auto;
  padding: 0.35rem 0.65rem;
  border-radius: 999px;
  border: 1px solid var(--swi-border);
  background: color-mix(in srgb, var(--swi-surface) 88%, transparent);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  font-size: 0.6875rem;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.doc-floating-actions__btn {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.35rem;
  padding: 0.45rem 0.95rem;
  border: 1px solid color-mix(in srgb, var(--swi-border) 70%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--swi-surface) 86%, transparent);
  backdrop-filter: blur(16px) saturate(1.3);
  -webkit-backdrop-filter: blur(16px) saturate(1.3);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  color: inherit;
  white-space: nowrap;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease,
    background 0.15s ease;
}

.doc-floating-actions__btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--swi-accent) 40%, var(--swi-border));
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.12);
  transform: translateY(-1px);
}

.doc-floating-actions__btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--swi-accent) 55%, transparent);
  outline-offset: 2px;
}

.doc-floating-actions__btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.doc-floating-actions__btn--primary {
  border-color: color-mix(in srgb, var(--swi-primary, #1a1a1a) 75%, transparent);
  background: color-mix(in srgb, var(--swi-primary, #1a1a1a) 92%, transparent);
  color: #fff;
}

.doc-floating-actions__btn--primary:hover:not(:disabled) {
  background: var(--swi-primary, #1a1a1a);
}

.doc-floating-actions__btn--ghost {
  background: color-mix(in srgb, var(--swi-surface-muted) 70%, transparent);
}

.doc-floating-actions__btn--pending-order {
  border-color: color-mix(in srgb, #d4a017 50%, transparent);
}

.doc-scroll-page__actions .swi-btn {
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

@media (max-width: 720px) {
  .doc-floating-actions {
    right: 0.65rem;
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    max-width: calc(100vw - 1.25rem);
  }

  .doc-floating-actions__fab {
    width: 3rem;
    height: 3rem;
  }

  .doc-floating-actions__btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
    min-height: 2.15rem;
  }
}

.doc-page-filmstrip-launcher__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--swi-accent) 12%, var(--swi-surface));
  color: var(--swi-accent);
}

.doc-page-filmstrip-launcher__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.1rem;
  text-align: left;
}

.doc-page-filmstrip-launcher__text strong {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--swi-text);
}

.doc-page-filmstrip-launcher__text span {
  font-size: 0.6875rem;
  color: var(--swi-text-secondary);
}

.doc-page-filmstrip {
  position: sticky;
  bottom: 0;
  z-index: 30;
  width: 100%;
  margin: 0;
  padding: 0.65rem 1rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--swi-border) 55%, transparent);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
  background: color-mix(in srgb, var(--swi-surface) 88%, transparent);
  backdrop-filter: blur(20px) saturate(1.35);
  -webkit-backdrop-filter: blur(20px) saturate(1.35);
  box-shadow:
    0 -8px 32px rgba(0, 0, 0, 0.1),
    inset 0 1px 0 color-mix(in srgb, #fff 45%, transparent);
}

.doc-page-filmstrip--open .doc-page-filmstrip__toolbar {
  align-items: flex-start;
}

.doc-page-filmstrip--dirty {
  border-color: color-mix(in srgb, #d4a017 45%, transparent);
  box-shadow:
    0 -8px 32px rgba(0, 0, 0, 0.1),
    inset 0 2px 0 rgba(212, 160, 23, 0.4);
}

.doc-page-filmstrip__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.doc-page-filmstrip__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--swi-text);
}

.doc-page-filmstrip--open .doc-page-filmstrip__title {
  text-transform: none;
  letter-spacing: normal;
}

.doc-page-filmstrip__hint {
  margin: 0.2rem 0 0;
  font-size: 0.8125rem;
  color: var(--swi-text-secondary);
  line-height: 1.4;
  max-width: 36rem;
}

.doc-page-filmstrip__toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.doc-page-filmstrip__close {
  font-size: 0.8125rem;
}

.doc-page-filmstrip__unsaved {
  font-size: 0.6875rem;
  font-weight: 700;
  color: #9a7200;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  background: color-mix(in srgb, rgba(212, 160, 23, 0.18) 85%, transparent);
  border: 1px solid color-mix(in srgb, #d4a017 35%, transparent);
}

.doc-page-filmstrip__saved {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #228b22;
}

.doc-page-filmstrip__reset {
  font-size: 0.8125rem;
  padding: 0.25rem 0.55rem;
}

.doc-page-filmstrip__scroll {
  position: relative;
  overflow-x: hidden;
  overflow-y: auto;
  max-height: min(52vh, 520px);
  padding-bottom: 0.25rem;
  scrollbar-width: thin;
}

.doc-page-filmstrip--open .doc-page-filmstrip__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 112px));
  gap: 0.65rem 0.75rem;
  align-items: start;
  justify-content: start;
  padding: 0.35rem 0.2rem 0.5rem;
  min-height: 0;
}

.doc-page-filmstrip--open {
  overflow-x: hidden;
}

.doc-page-filmstrip__drop-indicator {
  position: absolute;
  z-index: 5;
  border-radius: 999px;
  background: var(--swi-accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--swi-accent) 25%, transparent);
  pointer-events: none;
  animation: doc-filmstrip-insert-pulse 0.8s ease-in-out infinite alternate;
}

.doc-page-filmstrip__drop-indicator--row {
  border-radius: 4px;
}

.doc-page-filmstrip--dragging .doc-page-filmstrip__item {
  transition: opacity 0.15s ease;
}

.doc-page-filmstrip--dragging .doc-page-filmstrip__item:not(.is-dragging-source) {
  transition: none;
}

.doc-page-filmstrip__list {
  list-style: none;
  margin: 0;
}

.doc-page-filmstrip__item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem;
  border-radius: 10px;
  transition:
    background 0.15s ease,
    opacity 0.15s ease,
    box-shadow 0.15s ease;
}

.doc-page-filmstrip__item.is-dragging-source {
  opacity: 0.45;
}

.doc-page-filmstrip__grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.35rem;
  border-radius: 6px;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
  color: var(--swi-text-secondary);
  cursor: grab;
  touch-action: none;
  flex-shrink: 0;
}

.doc-page-filmstrip__grip:active {
  cursor: grabbing;
}

.doc-page-filmstrip__grip:hover {
  border-color: color-mix(in srgb, var(--swi-accent) 35%, var(--swi-border));
  color: var(--swi-accent);
}

.doc-page-filmstrip__nudge {
  display: flex;
  gap: 0.2rem;
  width: 100%;
  justify-content: center;
}

.doc-page-filmstrip__nudge-btn {
  flex: 1;
  max-width: 2.5rem;
  padding: 0.15rem 0.35rem;
  border: 1px solid var(--swi-border);
  border-radius: 6px;
  background: var(--swi-surface);
  color: var(--swi-text-secondary);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.doc-page-filmstrip__nudge-btn:hover:not(:disabled) {
  border-color: color-mix(in srgb, var(--swi-accent) 35%, var(--swi-border));
  color: var(--swi-accent);
}

.doc-page-filmstrip__nudge-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.doc-page-filmstrip--open .doc-page-filmstrip__select {
  width: 112px;
  gap: 0.35rem;
  padding: 0.25rem;
}

.doc-page-filmstrip__select {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  width: 72px;
  padding: 0.2rem;
  border: 0;
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  border-radius: 10px;
  transition: background 0.15s ease;
}

.doc-page-filmstrip__select:hover:not([aria-disabled="true"]) {
  background: color-mix(in srgb, var(--swi-surface-muted) 70%, transparent);
}

.doc-page-filmstrip__select:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--swi-accent) 55%, transparent);
  outline-offset: 2px;
}

.doc-page-filmstrip__select[aria-disabled="true"] {
  cursor: default;
  opacity: 0.7;
  pointer-events: none;
}

.doc-page-filmstrip__select[aria-current="true"] .doc-page-filmstrip__thumb {
  box-shadow:
    0 0 0 2px var(--swi-accent),
    0 4px 14px rgba(0, 0, 0, 0.12);
}

.doc-page-filmstrip__thumb {
  position: relative;
  width: 100%;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--swi-border) 85%, #cbd5e1);
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transition:
    box-shadow 0.15s ease,
    transform 0.15s ease,
    opacity 0.15s ease;
}

.doc-page-filmstrip__thumb.is-dragging {
  transform: scale(0.96);
  opacity: 0.75;
}

.doc-page-filmstrip--open .doc-page-filmstrip__page-num {
  top: 6px;
  left: 6px;
  min-width: 1.35rem;
  padding: 0.15rem 0.4rem;
  font-size: 0.6875rem;
  border-radius: 5px;
}

.doc-page-filmstrip__page-num {
  position: absolute;
  top: 3px;
  left: 3px;
  z-index: 2;
  min-width: 1rem;
  padding: 0.05rem 0.28rem;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-size: 0.5625rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.2;
}

.doc-page-filmstrip--open .doc-page-filmstrip__paper {
  height: 128px;
}

.doc-page-filmstrip__paper {
  height: 58px;
  display: flex;
  flex-direction: column;
  background: #fff;
}

.doc-page-filmstrip__paper-head {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 5px 6px 4px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.doc-page-filmstrip__paper-line {
  display: block;
  height: 2px;
  border-radius: 999px;
  background: #cbd5e1;
}

.doc-page-filmstrip--open .doc-page-filmstrip__paper-line {
  height: 3px;
  background: #94a3b8;
}

.doc-page-filmstrip__paper-line--short {
  width: 45%;
}

.doc-page-filmstrip__paper-line--medium {
  width: 72%;
}

.doc-page-filmstrip__paper-body {
  flex: 1;
  min-height: 0;
  padding: 4px;
  overflow: hidden;
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.doc-page-filmstrip__paper-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #f1f5f9;
}

.doc-page-filmstrip__paper-text,
.doc-page-filmstrip__paper-empty {
  margin: 0;
  width: 100%;
  padding: 3px;
  font-size: 0.5625rem;
  line-height: 1.35;
  color: #334155;
  text-align: left;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  word-break: break-word;
}

.doc-page-filmstrip--open .doc-page-filmstrip__paper-text,
.doc-page-filmstrip--open .doc-page-filmstrip__paper-empty {
  font-size: 0.6875rem;
  -webkit-line-clamp: 6;
}

.doc-page-filmstrip__paper-empty {
  color: #94a3b8;
  font-style: italic;
  text-align: center;
  align-self: center;
}

.doc-page-filmstrip__paper-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  justify-content: center;
  padding: 3px 5px 4px;
  font-size: 0.5625rem;
  font-weight: 600;
  color: #64748b;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
}

.doc-page-filmstrip--open .doc-page-filmstrip__paper-meta {
  font-size: 0.625rem;
}

.doc-page-filmstrip--open .doc-page-filmstrip__caption {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--swi-text);
  text-align: center;
  max-width: 100%;
}

.doc-page-filmstrip__caption {
  display: none;
}

.doc-page-filmstrip--open .doc-page-filmstrip__caption-title {
  display: block;
  font-size: 0.6875rem;
  font-weight: 500;
  color: var(--swi-text-secondary);
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-page-filmstrip__caption-title {
  display: none;
}

.doc-page-filmstrip--open .doc-page-filmstrip__moved,
.doc-page-filmstrip--open .doc-page-filmstrip__draft {
  display: block;
  font-size: 0.625rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  max-width: 100%;
}

.doc-page-filmstrip__moved,
.doc-page-filmstrip__draft {
  display: none;
}

.doc-page-filmstrip__moved {
  color: #9a7200;
}

.doc-page-filmstrip__draft {
  color: var(--swi-accent);
}

.doc-order-save-hint {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: rgba(212, 160, 23, 0.15);
  border: 1px solid rgba(212, 160, 23, 0.35);
  color: #9a7200;
  font-size: 0.75rem;
  font-weight: 600;
}

.doc-save-btn--pending-order {
  box-shadow: 0 0 0 2px rgba(212, 160, 23, 0.35);
}

.doc-status-callout {
  max-width: 900px;
  margin: 0 auto 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  font-size: 0.875rem;
  line-height: 1.45;
}

.doc-status-callout--assigned {
  background: color-mix(in srgb, var(--swi-accent) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--swi-accent) 28%, transparent);
}

.doc-status-callout--completed {
  background: rgba(34, 139, 34, 0.08);
  border: 1px solid rgba(34, 139, 34, 0.22);
}

.doc-scroll-pages--locked {
  opacity: 0.72;
  pointer-events: none;
  user-select: none;
}

.doc-scroll-shared {
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
}

.doc-scroll-shared__title {
  margin: 0 0 0.4rem;
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--doc-muted);
}

.doc-scroll-shared .document-wrap--summary {
  margin-bottom: 0;
  box-shadow: none;
}

.doc-scroll-shared .doc-margin--form {
  padding: 4px 8px 6px;
}

.doc-scroll-shared .doc-row--form input,
.doc-scroll-shared .doc-row-2--form input,
.doc-scroll-shared .form-margin-field input {
  padding: 2px 4px;
  font-size: 11px;
}

.doc-scroll-pages {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.doc-scroll-page {
  width: 100%;
  scroll-margin-top: 1rem;
}

.doc-scroll-page--moved {
  border-left: 3px solid #d4a017;
  padding-left: 0.65rem;
  margin-left: -0.65rem;
}

.doc-scroll-page + .doc-scroll-page {
  padding-top: 0.25rem;
  border-top: 1px solid var(--swi-border);
}

.doc-scroll-page__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  max-width: 900px;
  margin: 0 auto 0.5rem;
  padding: 0 2px;
}

.doc-scroll-page__head-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
}

.doc-scroll-page__moved-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  background: rgba(212, 160, 23, 0.15);
  border: 1px solid rgba(212, 160, 23, 0.35);
  color: #9a7200;
  font-size: 0.6875rem;
  font-weight: 600;
}

.doc-scroll-page__title {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--swi-text-secondary);
}

.doc-scroll-page .document-wrap--details,
.doc-scroll-page .document-wrap--content {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
}

.doc-scroll-page .document-wrap--details {
  margin-bottom: 0;
  border-bottom: none;
  box-shadow: none;
}

.doc-scroll-page .document-wrap--content {
  margin-bottom: 0;
  margin-top: 0;
  border-top: none;
  box-shadow: var(--swi-shadow-sm);
}

.doc-scroll-page .doc-main--form {
  min-height: 360px;
}

.doc-scroll-page-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  text-align: center;
  max-width: 900px;
  margin: 0 auto;
  padding: 1rem;
  border: 1px dashed var(--swi-border);
  border-radius: 8px;
  background: var(--swi-surface-muted);
}

.doc-scroll-page__head {
  flex-wrap: wrap;
  align-items: center;
}

.doc-scroll-page__actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-left: auto;
  flex-wrap: wrap;
}

.doc-page-duplicate-btn {
  margin-left: 0;
}

.doc-page-remove-btn {
  flex-shrink: 0;
}

.doc-scroll-add-btn {
  font-size: 0.875rem;
  padding: 0.45rem 0.85rem;
}

.doc-scroll-add-hint {
  margin: 0.5rem 0 0;
}

.doc-scroll-save-bar {
  display: none;
}

.doc-builder .form-component-heading {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.doc-builder .doc-block-icon-row {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.doc-builder .doc-block-icon-select {
  flex: 1;
  min-width: 0;
  margin: 0;
}

.doc-builder .doc-icon-select {
  font-size: 11px;
  padding: 4px 6px;
}

.doc-builder .doc-icon-preview {
  width: 28px;
  height: 28px;
  object-fit: contain;
  border: 1px solid var(--swi-border);
  border-radius: 3px;
  background: var(--swi-surface);
  flex-shrink: 0;
}

.doc-builder .doc-logo-icon-select {
  width: 100%;
  margin: 0;
}

.doc-builder .document-wrap--summary {
  margin-bottom: 1rem;
}

.doc-builder .form-field-tag {
  display: block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--doc-muted);
  margin-bottom: 2px;
}

.doc-builder .document-wrap {
  background: var(--swi-surface);
  border: 1px solid var(--doc-border);
  width: 100%;
  max-width: var(--doc-a4-width);
  margin: 0 auto;
  font-size: 11px;
}

.doc-builder .doc-a4-sheet {
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.doc-builder .document-wrap--form {
  margin-bottom: 1.25rem;
  font-size: 11px;
  border: 2px solid #000;
}

.doc-builder .document-wrap--form .doc-header-grid {
  border-top: 2px solid #000;
  border-bottom: 2px solid #000;
}

.doc-builder .document-wrap--form .doc-row {
  border-bottom: 2px solid #000;
}

.doc-builder .document-wrap--form .doc-row-2 .doc-cell:first-child {
  border-right: 2px solid #000;
}

.doc-builder .document-wrap--form .doc-cell {
  border-right: 2px solid #000;
}

.doc-builder .document-wrap--form .doc-materials-side--form {
  border-right: 2px solid #000;
}

.doc-builder .document-wrap--form .doc-content-row {
  border-bottom: 2px solid #000;
}

.doc-builder .document-wrap--form .doc-content-row__logo {
  border-right: 2px solid #000;
}

.doc-builder .doc-margin {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px 8px;
  font-size: 11px;
}

.doc-builder .doc-margin--form {
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  border-bottom: none;
}

.doc-builder .form-margin-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 0 0 auto;
  margin: 0;
}

.doc-builder .form-margin-field--center {
  flex: 1 1 auto;
  text-align: center;
  max-width: 55%;
}

.doc-builder .form-margin-spacer {
  flex: 0 0 24px;
}

.doc-builder .doc-header-grid {
  border-top: 1px solid var(--doc-border-light);
  border-bottom: 1px solid var(--doc-border);
}

.doc-builder .doc-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-bottom: 1px solid var(--doc-border-light);
}

.doc-builder .doc-row:last-child {
  border-bottom: none;
}

.doc-builder .doc-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.doc-builder .doc-row-2 .doc-cell:first-child {
  border-right: 1px solid var(--doc-border-light);
}

.doc-builder .doc-cell {
  border-right: 1px solid var(--doc-border-light);
  padding: var(--doc-cell-pad-y) var(--doc-cell-pad-x);
  min-height: 32px;
  margin: 0;
}

.doc-builder .doc-cell:last-child {
  border-right: none;
}

.doc-builder .doc-cell-label {
  font-weight: 700;
  display: block;
  margin-bottom: 2px;
}

.doc-builder .form-margin-field input,
.doc-builder .form-doc-cell input,
.doc-builder .form-footer-field input,
.doc-builder .form-input-materials {
  width: 100%;
  padding: 4px 6px;
  border: 1px solid #999;
  border-radius: 3px;
  font: inherit;
  font-size: 11px;
  background: var(--doc-form-bg);
  color: var(--swi-text);
}

.doc-builder .form-doc-cell input[readonly],
.doc-builder .form-margin-field input[readonly] {
  background: var(--swi-surface-muted);
  color: var(--swi-text-secondary);
}

.doc-builder .doc-row--form .form-doc-cell {
  min-height: 52px;
}

.doc-builder .doc-row-2--form .form-doc-cell {
  min-height: 48px;
}

.doc-builder .doc-main {
  display: grid;
  grid-template-columns: 44px 52px minmax(120px, 1fr) 42%;
  min-height: var(--doc-page-content-height);
  border-bottom: 1px solid var(--doc-border);
}

.doc-builder .doc-main--form {
  grid-template-columns: 40px minmax(0, 1fr);
  min-height: var(--doc-page-content-height);
  align-items: stretch;
  --doc-row-picture-edit-min-height: 180px;
}

.doc-builder .doc-main-rows {
  grid-column: 2;
  grid-row: 1 / -1;
  display: grid;
  grid-template-columns: minmax(88px, 14%) minmax(120px, 1fr) minmax(0, 34%);
  grid-auto-rows: minmax(var(--doc-row-band-min-height, 180px), auto);
  align-items: stretch;
  align-self: stretch;
  min-width: 0;
}

.doc-builder .doc-main-rows__logo,
.doc-builder .doc-main-rows__text {
  min-width: 0;
  border-bottom: 1px solid var(--doc-border-light);
}

.doc-builder .doc-main-rows__logo--last,
.doc-builder .doc-main-rows__text--last {
  border-bottom: none;
}

.doc-builder .doc-main-rows__logo .doc-content-row__logo {
  height: 100%;
  border-right: 1px solid var(--doc-border-light);
}

.doc-builder .doc-main-rows__text .doc-content-row__text {
  height: 100%;
}

.doc-builder .doc-main-rows__pics {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
  border-left: 2px solid #000;
  border-bottom: 2px solid #000;
  align-self: stretch;
}

.doc-builder .doc-main-rows__pics--merged {
  border-bottom: none;
}

.doc-builder .doc-main-rows__pics--last {
  border-bottom: 2px solid #000;
}

.doc-builder .doc-main-rows__pics--edit {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: var(--swi-bg-subtle, #f6f7f9);
}

.doc-builder .doc-main-rows__pics--edit .doc-picture-canvas--row {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: auto;
  align-self: stretch;
  background: var(--swi-surface, #fff);
}

/* Stage uses preview/print height so saved % coords match submission view. */
.doc-builder .doc-main-rows__pics--edit .doc-picture-canvas--row .doc-picture-canvas__stage {
  flex: 0 0 auto;
  height: var(--doc-pics-stage-height, auto);
  min-height: var(--doc-pics-stage-height, auto);
  max-height: var(--doc-pics-stage-height, auto);
  align-self: stretch;
  background: var(--swi-surface, #fff);
}

.doc-builder .doc-main-rows__pics .doc-picture-canvas--row {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  border-left: none;
}

.doc-builder .doc-main-rows__pics:not(.doc-main-rows__pics--edit) .doc-picture-canvas--row .doc-picture-canvas__stage {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
}

.doc-builder .doc-main--fixed-height {
  min-height: var(--doc-page-content-height, 461px);
  height: auto;
  max-height: none;
  overflow-x: hidden;
  overflow-y: visible;
}

.doc-builder .doc-content-rows-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--doc-border-light);
  background: var(--swi-bg-subtle, #f6f7f9);
}

.doc-builder .doc-content-rows-toolbar__label {
  font-size: 11px;
  font-weight: 600;
  color: var(--swi-text);
}

.doc-builder .doc-content-rows-toolbar__meta {
  font-weight: 400;
  color: var(--doc-muted);
}

.doc-builder .doc-content-row {
  display: grid;
  grid-template-columns: minmax(88px, 14%) minmax(120px, 1fr) minmax(0, 34%);
  align-items: stretch;
  min-height: auto;
  border-bottom: 1px solid var(--doc-border-light);
  background: var(--swi-surface);
  height: auto;
}

.doc-builder .doc-content-row__logo {
  border-right: 1px solid var(--doc-border-light);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  padding: var(--doc-cell-pad-y) 6px;
  min-height: auto;
}

.doc-builder .doc-content-row__text {
  display: flex;
  flex-direction: column;
  min-height: auto;
  padding: var(--doc-cell-pad-y) var(--doc-cell-pad-x);
}

.doc-builder .doc-content-row__text .doc-text-block--form {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: auto;
  margin: 0;
}

.doc-builder .doc-content-row__text .form-textarea-block--sized {
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
  box-sizing: border-box;
}

.doc-builder .doc-content-row__pics {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-width: 0;
  border-left: 2px solid #000;
  align-self: stretch;
}

.doc-builder .doc-picture-canvas--row {
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  border-left: none;
}

.doc-builder .doc-picture-canvas--row .doc-picture-canvas__stage {
  flex: 1 1 auto;
  min-height: 0 !important;
  height: auto;
}

.doc-builder .doc-picture-canvas__merge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 500;
  color: var(--doc-muted, #666);
  white-space: nowrap;
}

.doc-builder .doc-picture-canvas__merge input {
  margin: 0;
}

.doc-builder .doc-page-marker-panel {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding-right: 8px;
  margin-right: 8px;
  border-right: 1px dashed var(--doc-border-light, #d0d0d0);
  flex-wrap: wrap;
}

.doc-builder .doc-page-marker-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--doc-muted, #666);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.doc-builder .doc-row-marker-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  line-height: 1;
}

.doc-builder .doc-row-marker-option input {
  margin: 0;
}

.doc-builder .doc-row-marker-symbol {
  display: inline-flex;
  width: 14px;
  justify-content: center;
  font-weight: 700;
}

.doc-builder .doc-row-marker-symbol--tips {
  color: #de2222;
}

.doc-builder .doc-row-marker-symbol--quality {
  color: #2f6cff;
}

.doc-builder .doc-row-marker-symbol--safety {
  color: #17aa3c;
}

.doc-builder .doc-row-marker-symbol--visual {
  color: #111;
}

.doc-builder .doc-row-marker-text {
  color: var(--doc-muted, #666);
}

.doc-builder .doc-content-row--last {
  border-bottom: none;
}

.doc-builder .doc-content-rows-toolbar__hint {
  max-width: 220px;
  text-align: right;
  line-height: 1.3;
}

.doc-builder .doc-main-materials {
  grid-column: 1;
  grid-row: 1 / -1;
  align-self: stretch;
}

/* Independent picture canvas column (spans the full page body height). */
.doc-builder .doc-picture-canvas {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100%;
  background: var(--swi-surface, #fff);
}

.doc-builder .doc-picture-canvas {
  grid-column: 3;
  grid-row: 1 / -1;
  align-self: stretch;
  border-left: 2px solid #000;
}

.doc-builder .doc-picture-canvas__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--doc-border-light);
  background: var(--swi-bg-subtle, #f6f7f9);
}

.doc-builder .doc-picture-canvas__title {
  font-size: 11px;
  font-weight: 600;
  color: var(--swi-text);
}

.doc-builder .doc-picture-canvas__toolbar-actions {
  display: flex;
  gap: 6px;
}

.doc-builder .doc-picture-canvas__file {
  display: none;
}

.doc-picture-canvas__stage {
  position: relative;
  flex: 1;
  min-height: var(--doc-page-content-height, 461px);
  overflow: hidden;
}

.doc-picture-canvas__empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  text-align: center;
  font-size: 11px;
  color: var(--doc-muted, #888);
}

.doc-picture-canvas__item {
  position: absolute;
  border: none;
  background: transparent;
  box-sizing: border-box;
  overflow: visible;
}

.doc-builder .doc-picture-canvas__item {
  touch-action: none;
}

.doc-picture-canvas__img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
  user-select: none;
  pointer-events: none;
  touch-action: none;
}

.doc-builder .doc-picture-canvas__item:hover .doc-picture-canvas__img,
.doc-builder .doc-picture-canvas__item--active .doc-picture-canvas__img {
  box-shadow: 0 0 0 2px var(--swi-primary, #2563eb);
}

.doc-picture-canvas__label {
  position: absolute;
  top: 2px;
  left: 2px;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 2px;
  pointer-events: none;
}

.doc-picture-canvas__item-actions {
  position: absolute;
  top: 2px;
  right: 2px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.doc-picture-canvas__item:hover .doc-picture-canvas__item-actions {
  opacity: 1;
}

.doc-builder .doc-materials-side {
  border-right: 1px solid var(--doc-border);
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 8px 0;
}

.doc-builder .doc-materials-side--form {
  padding: 8px 4px;
  justify-content: flex-start;
  font-size: 10px;
  letter-spacing: 0.08em;
}

.doc-builder .form-doc-vertical-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 120px;
  text-align: center;
  margin: 0;
}

.doc-builder .form-input-materials {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  max-height: 200px;
  width: auto;
  min-width: 1.5rem;
  text-align: center;
}

.doc-builder .doc-logo-column {
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--doc-border);
  background: var(--swi-surface);
}

.doc-builder .doc-content-row .doc-logo-cell {
  border-bottom: none;
}

.doc-builder .doc-logo-cell {
  border-bottom: 2px solid var(--doc-border);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8px 4px;
  min-height: 0;
}

.doc-builder .doc-logo-cell:last-child {
  border-bottom: none;
}

.doc-builder .doc-logo-column--form .doc-logo-cell--form {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 6px 5px;
  min-height: 0;
}

.doc-builder .form-input-file-tight {
  width: 100%;
  font-size: 10px;
}

.doc-builder .checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.doc-builder .checkbox--tight {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 10px;
}

.doc-builder .logo-form-row--compact {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.doc-builder .logo-form-preview--cell {
  max-height: 36px;
  max-width: 100%;
  padding: 2px;
  object-fit: contain;
  border: 1px solid var(--swi-border);
  border-radius: 3px;
  background: var(--swi-surface);
}

.doc-builder .doc-block-logo-slots {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.doc-builder .doc-block-logo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 3px;
}

.doc-builder .doc-block-logo-slots__label {
  margin-bottom: 0;
  font-size: 8px;
}

.doc-builder .doc-block-logo-actions {
  display: flex;
  gap: 4px;
}

.logo-image-picker {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
}

.logo-image-picker__trigger {
  flex: 1;
  min-width: 0;
  height: 26px;
  padding: 1px;
  border: 1px solid var(--doc-border-light);
  border-radius: 3px;
  background: var(--swi-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-image-picker__trigger:hover {
  border-color: var(--portal-accent, #c00);
}

.logo-image-picker__trigger-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.logo-image-picker__empty {
  color: var(--doc-muted);
  font-size: 1.1rem;
  line-height: 1;
}

.logo-image-picker__clear {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  padding: 0;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--doc-muted);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.logo-image-picker__clear:hover {
  color: var(--portal-accent, #c00);
  background: var(--swi-surface-muted);
}

.logo-image-picker__menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  max-width: min(240px, 70vw);
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--swi-border);
  border-radius: 6px;
  background: var(--swi-surface);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.logo-image-picker--open {
  z-index: 30;
}

.logo-image-picker__option {
  aspect-ratio: 1;
  padding: 3px;
  border: 1px solid var(--swi-border);
  border-radius: 4px;
  background: var(--swi-surface-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo-image-picker__option img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.logo-image-picker__option:hover,
.logo-image-picker__option--selected {
  border-color: var(--portal-accent, #c00);
  background: var(--swi-surface);
}

.logo-image-picker__option--none {
  color: var(--doc-muted);
}

.logo-image-picker__none-mark {
  font-size: 0.85rem;
}

.doc-submission-view .doc-logo-stack {
  display: flex;
  flex-direction: column;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  padding: 2px;
}

.doc-submission-view .doc-logo-stack .doc-logo-img {
  max-width: 100%;
  max-height: 32px;
}

.doc-builder .form-cell-quiet {
  background: repeating-linear-gradient(
    -45deg,
    var(--swi-surface-muted),
    var(--swi-surface-muted) 6px,
    var(--swi-bg-subtle) 6px,
    var(--swi-bg-subtle) 12px
  );
}

.doc-builder .doc-content-rows-toolbar__actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.doc-builder .doc-row-remove-btn {
  align-self: flex-end;
  margin-top: 4px;
}

.doc-builder .doc-text-blocks {
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--doc-border);
}

.doc-builder .doc-text-blocks__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-bottom: 2px solid var(--doc-border);
}

.doc-builder .doc-text-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.doc-builder .doc-text-block__remove {
  flex-shrink: 0;
}

.doc-builder .doc-text-block--form {
  display: flex;
  flex-direction: column;
  padding: 0;
  min-height: 0;
  border-bottom: none;
  margin: 0;
  gap: 0;
  justify-content: stretch;
}

.doc-builder .doc-content-row__text.doc-text-block--form {
  gap: 0;
}

.doc-builder .doc-text-block__head {
  flex-shrink: 0;
}

.doc-builder .form-textarea-block {
  flex: 1;
  min-height: 0;
  width: 100%;
  margin: 0;
  padding: 6px 8px;
  border: 1px solid var(--doc-border-light);
  border-radius: 2px;
  font: inherit;
  font-size: 11px;
  line-height: 1.4;
  resize: none;
  overflow: hidden;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--doc-form-bg);
  color: var(--swi-text);
  box-sizing: border-box;
}

.doc-builder .form-textarea-block--sized {
  flex: 1 1 auto;
  max-height: none;
}

.doc-builder .form-doc-img-frame {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 4px;
  gap: 4px;
  background: var(--swi-surface);
}

.doc-builder .form-img-cell .slot-preview.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--doc-muted);
  font-size: 0.75rem;
  border: 1px dashed var(--doc-border-light);
  border-radius: 2px;
  min-height: 0;
}

.doc-builder .doc-content-row .form-img-cell {
  border-bottom: none;
}

.doc-builder .form-img-cell {
  border-bottom: none;
  border-right: none;
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  min-width: 0;
  height: auto;
}

.doc-builder .form-img-cell .slot-preview {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  object-fit: contain;
  background: var(--swi-surface);
  border: none;
  border-radius: 0;
  display: block;
}

.doc-builder .slot-preview.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--doc-muted);
  font-size: 0.85rem;
  border: 1px dashed var(--swi-border);
  border-radius: 4px;
}

.doc-builder .form-img-cell .slot-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

.doc-builder .form-img-cell .slot-actions--inline {
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

.doc-builder .slot-actions input[type="file"] {
  flex: 1 1 72px;
  min-width: 0;
  font-size: 10px;
  max-width: 100%;
}

.doc-builder .slot-actions--inline .swi-btn {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 0.2rem 0.45rem;
  font-size: 10px;
}

.doc-builder .doc-img-num {
  border-top: 2px solid var(--doc-border);
  text-align: center;
  font-weight: 700;
  padding: 4px;
  font-size: 12px;
}

.doc-builder .doc-footer--form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
  border-top: 2px solid var(--doc-border);
  padding: 6px 10px;
}

.doc-builder .form-footer-field {
  display: flex;
  flex-direction: column;
  flex: 1 1 45%;
  gap: 2px;
  min-width: 200px;
  margin: 0;
}

.doc-builder .form-footer-field--right {
  flex: 0 0 auto;
  min-width: 100px;
  max-width: 120px;
  margin-left: auto;
  text-align: right;
}

.doc-builder .form-footer-field--right input {
  text-align: right;
}

.doc-builder .form-step-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0.75rem 0 0.25rem;
}

.doc-builder .form-step-actions--split {
  margin-bottom: 0;
}

.doc-builder .form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.doc-builder .btn-small {
  padding: 0.35rem 0.55rem;
  font-size: 11px;
}

.doc-builder .hidden {
  display: none !important;
}

.swi-assign-doc-item--static {
  cursor: default;
  padding: 1rem;
  border: 1px solid var(--swi-border);
  border-radius: 8px;
  background: var(--swi-surface);
}

.swi-assign-task-meta {
  margin: 0.35rem 0 0.75rem;
  font-size: 0.875rem;
}

.swi-form-actions--inline {
  margin-top: 0.5rem;
}

@media (max-width: 800px) {
  .doc-builder .doc-main--form,
  .doc-builder .doc-main--fixed-height {
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
    grid-template-columns: 1fr;
  }

  .doc-builder .doc-main-materials {
    grid-column: 1;
    grid-row: auto;
  }

  .doc-builder .doc-main-rows {
    grid-column: 1;
    grid-row: auto;
    grid-template-columns: 1fr;
  }

  .doc-builder .doc-main-rows__logo,
  .doc-builder .doc-main-rows__text,
  .doc-builder .doc-main-rows__pics {
    grid-column: 1 !important;
    grid-row: auto !important;
    border-right: none;
    border-bottom: 2px solid var(--doc-border);
  }

  .doc-builder .doc-content-row {
    grid-column: 1;
    grid-template-columns: 1fr;
  }

  .doc-builder .doc-main--form .doc-materials-side--form {
    border-right: none;
    border-bottom: 2px solid var(--doc-border);
  }

  .doc-builder .doc-content-row__logo,
  .doc-builder .doc-content-row__text,
  .doc-builder .doc-content-row__pics {
    border-right: none;
    border-bottom: 2px solid var(--doc-border);
  }

  .doc-builder .doc-content-row--last .doc-content-row__logo,
  .doc-builder .doc-content-row--last .doc-content-row__text,
  .doc-builder .doc-content-row--last .doc-content-row__pics {
    border-bottom: 2px solid var(--doc-border);
  }

  .doc-builder .form-doc-vertical-label {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    min-height: auto;
    justify-content: flex-start;
  }

  .doc-builder .form-input-materials {
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    max-height: none;
    width: 100%;
    min-width: 0;
    flex: 1;
  }
}

@media (max-width: 560px) {
  .doc-builder .form-margin-field--center {
    max-width: none;
    flex: 1 1 100%;
  }

  .doc-builder .doc-row--form {
    grid-template-columns: 1fr 1fr !important;
  }
}

/* ——— Submitted document read-only view ——— */
.doc-submission-view {
  max-width: none;
  margin: 0 auto 1rem;
  --doc-border: #222;
  --doc-border-light: #c8c8c8;
  --doc-a4-width: 210mm;
  --doc-page-content-height: 461px;
}

.doc-submission-view .doc-outer {
  background: var(--swi-surface);
}

.doc-submission-view .swi-shot-sheet {
  border: 2px solid #000;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.doc-submission-view .swi-shot-meta-row {
  display: grid;
  width: 100%;
}

.doc-submission-view .swi-shot-meta-row--top {
  grid-template-columns: 1.4fr 2fr 0.9fr 0.8fr 0.9fr 0.9fr 1fr 0.7fr 0.6fr 0.8fr 0.6fr 0.6fr;
}

.doc-submission-view .swi-shot-meta-row--second {
  grid-template-columns: 1.2fr 1fr 1.2fr 2.4fr 1fr 1.2fr;
}

.doc-submission-view .swi-shot-meta-cell {
  border-right: 2px solid #000;
  border-bottom: 2px solid #000;
  padding: 4px 6px;
  font-size: 10px;
  min-height: 24px;
  display: flex;
  align-items: center;
}

.doc-submission-view .swi-shot-meta-row .swi-shot-meta-cell:last-child {
  border-right: none;
}

.doc-submission-view .swi-shot-meta-label {
  font-weight: 700;
  background: #f5f5f5;
  white-space: nowrap;
}

.doc-submission-view .swi-shot-meta-value {
  font-weight: 700;
}

.doc-submission-view .swi-shot-body-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.doc-submission-view .swi-shot-body-table tbody {
  height: var(--doc-page-content-height, 461px);
}

.doc-submission-view .swi-shot-col-category {
  width: 44px;
}

.doc-submission-view .swi-shot-col-no {
  width: 52px;
}

.doc-submission-view .swi-shot-col-safety {
  width: 90px;
}

.doc-submission-view .swi-shot-col-pics {
  width: 34%;
}

.doc-submission-view .swi-shot-legend-row th {
  border-right: 2px solid #000;
  border-bottom: 2px solid #000;
  padding: 5px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: left;
  vertical-align: middle;
}

.doc-submission-view .swi-shot-legend-row th:last-child {
  border-right: none;
}

.doc-submission-view .swi-shot-op-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.doc-submission-view .swi-shot-op-header-title {
  flex: 0 0 auto;
}

.doc-submission-view .swi-shot-op-header-legend {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.doc-submission-view .swi-shot-op-header-marker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  line-height: 1;
}

.doc-submission-view .swi-shot-body-table td {
  border-right: 2px solid #000;
  border-bottom: 2px solid #000;
  vertical-align: top;
}

.doc-submission-view .swi-shot-category-cell {
  width: 44px;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  text-align: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 8px 2px;
  background: #fbfbfb;
}

.doc-submission-view .swi-shot-no-cell {
  width: 52px;
  text-align: center;
  font-weight: 700;
  font-size: 12px;
  padding-top: 12px;
  overflow: hidden;
  vertical-align: top;
}

.doc-submission-view .swi-shot-icon-col {
  width: 90px;
  padding: 8px;
  overflow: hidden;
  vertical-align: top;
}

.doc-submission-view .swi-shot-op-col {
  padding: 8px 10px;
  overflow: hidden;
  vertical-align: top;
  border-right: 2px solid #000;
}

.doc-submission-view .swi-shot-pics-col {
  width: 34%;
  padding: 0;
  vertical-align: top;
  position: relative;
  overflow: hidden;
  border-right: none;
}

.doc-submission-view .swi-shot-icon-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 70px;
}

.doc-submission-view .swi-shot-icon-img {
  max-width: 52px;
  max-height: 52px;
  object-fit: contain;
}

.doc-submission-view .swi-shot-op-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.doc-submission-view .swi-shot-op-cell-layout {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.doc-submission-view .swi-shot-op-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.doc-submission-view .swi-shot-op-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.doc-submission-view .swi-shot-op-empty {
  color: var(--doc-muted);
}

.doc-submission-view .swi-shot-op-markers {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  align-self: flex-start;
}

.doc-submission-view .swi-shot-op-marker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  line-height: 1;
}

.doc-submission-view .swi-shot-op-marker-symbol {
  display: inline-flex;
  width: 14px;
  justify-content: center;
  font-weight: 700;
}

.doc-submission-view .swi-shot-op-marker-symbol--tips {
  color: #de2222;
}

.doc-submission-view .swi-shot-op-marker-symbol--quality {
  color: #2f6cff;
}

.doc-submission-view .swi-shot-op-marker-symbol--safety {
  color: #17aa3c;
}

.doc-submission-view .swi-shot-op-marker-symbol--visual {
  color: #111;
}

.doc-submission-view .swi-shot-op-marker-label {
  font-weight: 600;
  color: #333;
  letter-spacing: 0.02em;
}

.doc-submission-view .doc-picture-canvas {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  background: var(--swi-surface, #fff);
  border-left: none;
}

.doc-submission-view .swi-shot-pics-col .doc-picture-canvas--row .doc-picture-canvas__stage {
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
}

.doc-submission-view .doc-picture-canvas__stage {
  flex: 0 0 auto;
  height: auto;
  min-height: 0;
}

.doc-submission-view .swi-shot-footer {
  border-top: none;
  border-left: none;
  border-right: none;
}

.doc-submission-view .document-wrap--view {
  border: 2px solid #000;
  background: var(--swi-surface);
  font-size: 11px;
  width: 100%;
  max-width: var(--doc-a4-width);
  margin: 0 auto;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.doc-submission-view .doc-view-margin {
  padding: 6px 12px 8px;
  font-size: 11px;
}

.doc-submission-view .doc-main--view {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  min-height: var(--doc-page-content-height);
  height: var(--doc-page-content-height);
  max-height: var(--doc-page-content-height);
  overflow: hidden;
  border-bottom: 1px solid var(--doc-border);
  align-items: stretch;
}

.doc-submission-view .doc-main-materials {
  grid-column: 1;
  grid-row: 1 / -1;
  align-self: stretch;
}

.doc-submission-view .doc-content-row {
  grid-column: 2;
  display: grid;
  grid-template-columns: minmax(88px, 11%) minmax(120px, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  min-height: 0;
  border-bottom: 1px solid var(--doc-border-light);
}

.doc-submission-view .doc-content-row--last {
  border-bottom: none;
}

.doc-submission-view .doc-content-row__logo {
  border-right: 1px solid var(--doc-border-light);
  padding: 8px 6px;
}

.doc-submission-view .doc-content-row__text {
  border-right: 1px solid var(--doc-border-light);
  border-bottom: none;
  padding: 8px 10px;
}

.doc-submission-view .doc-content-row__img {
  border-right: 1px solid var(--doc-border-light);
  border-bottom: none;
  padding: 8px 6px;
}

.doc-submission-view .doc-content-row__img--last {
  border-right: none;
}

.doc-submission-view .doc-view-materials {
  border-right: 2px solid var(--doc-border);
  display: flex;
  align-items: center;
  justify-content: center;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 12px;
  padding: 8px 0;
}

.doc-submission-view .doc-logo-column {
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--doc-border);
}

.doc-submission-view .doc-content-row .doc-view-logo-cell {
  border-bottom: none;
}

.doc-submission-view .doc-view-logo-cell {
  border-bottom: 2px solid var(--doc-border);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  min-height: 0;
}

.doc-submission-view .doc-view-logo-cell:last-child {
  border-bottom: none;
}

.doc-submission-view .doc-logo-img {
  max-width: 100%;
  max-height: 72px;
  object-fit: contain;
}

.doc-submission-view .doc-logo-plus {
  display: block;
  width: 20px;
  height: 20px;
  background: var(--doc-accent);
  border-radius: 2px;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.doc-submission-view .doc-logo-plus::before,
.doc-submission-view .doc-logo-plus::after {
  content: "";
  position: absolute;
  background: #fff;
  border-radius: 0.5px;
}

.doc-submission-view .doc-logo-plus::before {
  left: 50%;
  top: 4px;
  bottom: 4px;
  width: 2px;
  transform: translateX(-50%);
}

.doc-submission-view .doc-logo-plus::after {
  top: 50%;
  left: 4px;
  right: 4px;
  height: 2px;
  transform: translateY(-50%);
}

.doc-submission-view .doc-text-blocks {
  display: flex;
  flex-direction: column;
  border-right: 2px solid var(--doc-border);
}

.doc-submission-view .doc-view-text-block {
  padding: 8px 10px;
  min-height: 0;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.35;
}

.doc-submission-view .doc-content-row__text.doc-view-text-block {
  border-bottom: none;
}

.doc-submission-view .doc-view-text-block--empty {
  color: var(--doc-muted);
}

.doc-submission-view .doc-content-row .doc-img-cell {
  border-bottom: none;
}

.doc-submission-view .doc-img-cell {
  border-right: none;
  border-bottom: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.doc-submission-view .doc-img-frame {
  flex: 1;
  min-height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  background: var(--swi-surface);
}

.doc-submission-view .doc-img-frame img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: none;
  object-fit: contain;
}

.doc-submission-view .doc-view-muted {
  color: var(--doc-muted);
  font-size: 0.85rem;
}

.doc-submission-view .doc-view-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  font-size: 10px;
  border-top: 2px solid var(--doc-border);
}

.doc-submission-view .doc-view-footer a {
  color: inherit;
  word-break: break-all;
}

.doc-submission-page-block {
  margin-bottom: 1.5rem;
}

.doc-submission-page-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  font-weight: 600;
}

.swi-form-actions--inline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ——— Image editor modal (crop + mark) ——— */
.image-editor-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.image-editor-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
}

.image-editor-modal__card {
  position: relative;
  background: var(--swi-surface);
  border: 1px solid var(--swi-border);
  border-radius: 8px;
  padding: 1rem;
  max-width: min(920px, 100%);
  width: 100%;
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.image-editor-modal__card h2 {
  margin: 0 0 0.35rem;
  font-size: 1.1rem;
}

.image-editor-modal__slot {
  margin: 0 0 0.35rem;
}

.image-editor-modal__actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.doc-builder .editor-hint,
.image-editor-modal .editor-hint {
  margin: 0 0 0.5rem;
}

.doc-builder .editor-mode-tabs,
.image-editor-modal .editor-mode-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.doc-builder .tab-btn,
.image-editor-modal .tab-btn {
  cursor: pointer;
  border: 1px solid var(--swi-border);
  background: var(--swi-surface-muted);
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font: inherit;
  font-size: 0.9rem;
}

.doc-builder .tab-btn:hover,
.image-editor-modal .tab-btn:hover {
  background: var(--swi-surface);
}

.doc-builder .tab-btn.active,
.image-editor-modal .tab-btn.active {
  background: var(--swi-primary, #1a1a1a);
  color: #fff;
  border-color: var(--swi-primary, #1a1a1a);
}

.doc-builder .editor-toolbar-mark .toolbar-inline,
.image-editor-modal .editor-toolbar-mark .toolbar-inline {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
}

.doc-builder .editor-toolbar-mark input[type="color"],
.image-editor-modal .editor-toolbar-mark input[type="color"] {
  width: 2rem;
  height: 1.75rem;
  padding: 0;
  border: 1px solid var(--swi-border);
  cursor: pointer;
}

.doc-builder .editor-toolbar-mark input[type="range"],
.image-editor-modal .editor-toolbar-mark input[type="range"] {
  width: 100px;
  vertical-align: middle;
}

.doc-builder .mark-tool-btn.active,
.image-editor-modal .mark-tool-btn.active {
  background: var(--swi-primary, #333);
  color: #fff;
  border-color: var(--swi-primary, #333);
}

.doc-builder .mark-canvas-scroll,
.image-editor-modal .mark-canvas-scroll {
  width: 100%;
  height: min(55vh, 480px);
  min-height: 200px;
  overflow: auto;
  background: #2a2a2a;
  line-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-editor-modal .mark-canvas-scroll .canvas-container {
  display: block;
  margin: 0 auto;
  flex-shrink: 0;
}

.doc-builder .mark-canvas-scroll canvas,
.image-editor-modal .mark-canvas-scroll canvas {
  display: block;
}

.image-editor-modal .editor-stage--grayscale-preview .cropper-container,
.image-editor-modal .editor-stage--grayscale-preview .cropper-canvas,
.image-editor-modal .editor-stage--grayscale-preview .cropper-wrap-box,
.image-editor-modal .editor-stage--grayscale-preview > img,
.image-editor-modal .editor-stage--grayscale-preview .mark-canvas-scroll,
.image-editor-modal .editor-stage--grayscale-preview .canvas-container {
  filter: grayscale(100%);
}

.doc-builder .editor-stage,
.image-editor-modal .editor-stage {
  max-height: 55vh;
  min-height: 200px;
  background: #222;
  margin: 0.75rem 0;
  overflow: auto;
}

.image-editor-modal .editor-stage--hidden {
  display: none !important;
}

.image-editor-modal .editor-stage__error {
  margin: 0;
  padding: 1rem;
  color: #f5c6c6;
  font-size: 0.875rem;
  text-align: center;
}

.doc-builder .editor-stage img,
.image-editor-modal .editor-stage img {
  display: block;
  max-width: 100%;
  max-height: 55vh;
}

.doc-builder .editor-toolbar,
.image-editor-modal .editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
  align-items: center;
}

.doc-builder .toolbar-sep,
.image-editor-modal .toolbar-sep {
  width: 1px;
  height: 1.25rem;
  background: var(--swi-border);
  margin: 0 0.25rem;
}

.doc-builder .editor-output-options,
.image-editor-modal .editor-output-options {
  margin: 0.5rem 0 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--swi-border);
}

.doc-builder .checkbox--editor,
.image-editor-modal .checkbox--editor {
  flex-direction: row !important;
  align-items: center !important;
  gap: 0.5rem !important;
  margin: 0 !important;
  font-size: 0.9rem;
  display: flex;
}

.image-editor-modal .cropper-container,
.image-editor-modal .cropper-wrap-box,
.image-editor-modal .cropper-canvas {
  max-height: 55vh;
}

.image-editor-modal .cropper-container {
  width: 100% !important;
}

@media print {
  @page {
    size: A4;
    margin: 10mm;
  }

  .portal-topbar,
  .portal-sidebar,
  .portal-page-header,
  .swi-form-actions,
  .doc-back-btn,
  .doc-content-rows-toolbar,
  .doc-floating-actions,
  .doc-scroll-page__actions,
  .doc-scroll-page__head,
  .page-order-bar {
    display: none !important;
  }

  .portal-main {
    padding: 0 !important;
  }

  .doc-builder,
  .doc-submission-view {
    max-width: none;
  }

  .doc-builder .document-wrap,
  .doc-submission-view .document-wrap--view {
    max-width: none;
    width: 100%;
    box-shadow: none;
    border: 1px solid #000;
    page-break-after: always;
  }

  .doc-builder .doc-main--fixed-height,
  .doc-submission-view .doc-main--view {
    height: var(--doc-page-content-height, 461px);
    max-height: var(--doc-page-content-height, 461px);
    overflow: hidden;
  }

  .doc-submission-view .swi-shot-body-table tbody {
    height: var(--doc-page-content-height, 461px);
  }

  .doc-scroll-page {
    page-break-after: always;
    break-after: page;
  }
}

@media (max-width: 800px) {
  .doc-submission-view .doc-main--view {
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    min-height: 0;
    overflow: visible;
  }

  .doc-submission-view .doc-main-materials {
    grid-column: 1;
    grid-row: auto;
  }

  .doc-submission-view .doc-content-row {
    grid-column: 1;
    grid-template-columns: 1fr;
  }

  .doc-submission-view .doc-view-materials {
    border-right: none;
    border-bottom: 2px solid var(--doc-border);
    writing-mode: horizontal-tb;
    text-orientation: mixed;
    min-height: auto;
    padding: 8px;
  }

  .doc-submission-view .doc-content-row__logo,
  .doc-submission-view .doc-content-row__text,
  .doc-submission-view .doc-content-row__img {
    border-right: none;
    border-bottom: 2px solid var(--doc-border);
  }

  .doc-submission-view .doc-content-row__img--last {
    border-bottom: none;
  }
}
