.ds-tool {
  --ds-bg: var(--np-bg, #fafaf7);
  --ds-surface: var(--np-surface, #ffffff);
  --ds-ink: var(--np-ink, #171914);
  --ds-muted: var(--np-muted, #4e524a);
  --ds-line: var(--np-line, #e3e3db);
  --ds-accent: var(--np-accent, #e4ff97);
  --ds-accent-press: var(--np-accent-press, #d4f56a);
  --ds-well: var(--np-well, #f0f1eb);
  --ds-danger: var(--np-danger, #8d2f2f);
  --ds-danger-bg: var(--np-danger-bg, #f8eceb);
  --ds-warning: var(--np-warning, #8a4b08);
  --ds-warning-bg: var(--np-warning-bg, #fff4e5);
  --ds-success: var(--np-success, #146c43);
  --ds-success-bg: var(--np-success-bg, #e7f6ee);
  --ds-info: var(--np-info, #1d4e89);
  --ds-info-bg: var(--np-info-bg, #e8f1fb);
  color: var(--ds-ink);
  font-family: var(--np-font, Inter, "Segoe UI", system-ui, sans-serif);
}

.ds-tool:has(.ds-intake:not([hidden])) {
  display: flex;
  align-items: center;
  justify-content: safe center;
  min-height: calc(100dvh - var(--np-header-height, 64px) - 72px);
}

.ds-tool.is-reading:has(.ds-intake:not([hidden])) {
  flex-direction: column;
}

.ds-tool[data-context="home"]:has(.ds-intake:not([hidden])):not(.is-reading) {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  box-sizing: border-box;
  min-height: 0;
  padding: 68px 24px 0;
}

.ds-tool[data-context="home"] .ds-intake {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  width: min(40rem, 100%);
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: 0;
  text-align: center;
}

.ds-intake-badge {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 0 12px;
  background: var(--ds-accent);
  border-radius: 12px;
  color: var(--ds-ink);
}

.ds-intake-badge svg {
  width: 28px;
  height: 28px;
}

.ds-tool[data-context="home"] .ds-intake h1 {
  max-width: 100%;
  margin: 0 0 12px;
  font-size: clamp(1.05rem, 5.2vw, 2.75rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.03em;
  white-space: nowrap;
  text-wrap: nowrap;
}

.ds-tool[data-context="home"] .ds-intake-lead {
  max-width: 28rem;
  margin: 0 0 24px;
  font-size: 1.05rem;
  line-height: 1.5;
}

@media (min-width: 768px) {
  html[lang|="es"] .ds-tool[data-context="home"] .ds-intake-lead {
    max-width: 38rem;
  }

  html[lang|="it"] .ds-tool[data-context="home"] .ds-intake-lead {
    max-width: 36rem;
  }

  html[lang|="ru"] .ds-tool[data-context="home"] .ds-intake-lead {
    max-width: 34rem;
  }
}

.ds-tool[data-context="home"] .ds-intake .ds-add-actions {
  flex-direction: column;
  align-items: stretch;
  align-self: center;
  box-sizing: border-box;
  width: 320px;
  max-width: 100%;
  gap: 12px;
}

.ds-tool[data-context="home"] .ds-intake .ds-add-actions .ds-button {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 12px 22px;
}

.ds-tool[data-context="home"] .ds-format {
  max-width: 100%;
  margin: 20px 0 0;
  color: var(--ds-muted);
  font-size: 0.8125rem;
  letter-spacing: 0;
  line-height: 1.45;
}

.ds-tool[data-context="home"] .ds-privacy {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  max-width: 100%;
  margin: 8px 0 0;
  color: var(--ds-muted);
  font-size: 0.8125rem;
  letter-spacing: 0;
  line-height: 1.45;
}

.ds-privacy svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

.ds-tool.is-reading .ds-intake {
  display: none;
}

.ds-intake {
  width: min(520px, calc(100% - 32px));
  margin: 0;
  padding: 20px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 16px;
  text-align: center;
}

.ds-intake-mark {
  display: block;
  width: 72px;
  height: 72px;
  margin: 0 auto 12px;
}

.ds-intake h1,
.ds-intake h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.ds-intake-lead {
  margin: 0 0 16px;
  color: var(--ds-muted);
}

.ds-intake .ds-add-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ds-intake .ds-add-actions .ds-button {
  width: 100%;
}

.ds-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.ds-format {
  margin: 14px 0 0;
  color: var(--ds-muted);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.ds-points {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.ds-points li {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 10px 8px;
  background: var(--ds-bg);
  border-radius: 12px;
}

.ds-points strong {
  color: var(--ds-ink);
  font-size: 0.92rem;
}

.ds-points span {
  color: var(--ds-muted);
  font-size: 0.75rem;
  line-height: 1.3;
}

.ds-workspace {
  margin-top: 28px;
  background: var(--ds-bg);
}

.ds-session-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: min(720px, calc(100% - 32px));
  margin: 4px auto 16px;
  padding: 8px 10px;
  background: var(--ds-well);
  border: 1px solid var(--ds-line);
  border-radius: 8px;
  color: var(--ds-ink);
}

.ds-session-note svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--ds-muted);
}

.ds-session-note p {
  min-width: 0;
  margin: 0;
}

.ds-session-note strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.35;
}

.ds-session-note span {
  display: block;
  margin-top: 2px;
  color: var(--ds-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

.ds-workspace[hidden],
.ds-intake[hidden] {
  display: none !important;
}

.ds-workspace-head {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 8px 16px;
  scroll-margin-top: 136px;
}

.ds-position {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.ds-notices {
  position: fixed;
  top: 76px;
  left: 50%;
  z-index: 40;
  display: grid;
  gap: 8px;
  width: min(440px, calc(100% - 24px));
  margin: 0;
  padding: 0;
  transform: translateX(-50%);
}

.ds-notices:empty {
  display: none;
}

.ds-message {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--ds-line);
  border-left-width: 3px;
  border-radius: 12px;
  background: var(--ds-surface);
  color: var(--ds-ink);
}

.ds-message p {
  flex: 1 1 auto;
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.ds-message-error {
  border-left-color: var(--ds-danger);
}

.ds-message-success {
  border-left-color: var(--ds-success);
}

.ds-message-warning {
  border-left-color: var(--ds-warning);
}

.ds-message-secure,
.ds-message-info {
  border-left-color: var(--ds-info);
}

.ds-dismiss {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 5px 10px;
  border: 0;
  border-radius: 8px;
  background: var(--ds-well);
  color: var(--ds-ink);
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
}

@media (hover: hover) {
  .ds-dismiss {
    transition: background-color 160ms ease;
  }

  .ds-dismiss:hover {
    background: var(--ds-accent);
  }
}

.ds-reading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: min(520px, calc(100% - 32px));
  margin: 0 auto 16px;
  text-align: center;
}

.ds-tool.is-reading:has(.ds-workspace:not([hidden])) .ds-reading {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 30;
  width: max-content;
  max-width: calc(100% - 32px);
  margin: 0;
  transform: translate(-50%, -50%);
}

.ds-tool.is-reading .ds-add-actions,
.ds-tool.is-reading [data-add-toggle] {
  display: none;
}

.ds-reading[hidden],
.ds-empty[hidden],
.ds-frame[hidden],
.ds-meta[hidden],
.ds-thumbs[hidden],
.ds-preview-error[hidden],
.ds-preview[hidden],
.ds-gallery[hidden],
.ds-crop[hidden],
.ds-format[hidden],
.ds-privacy[hidden],
.ds-points[hidden],
.ds-add-popover[hidden],
.ds-export-popover[hidden],
.ds-download[hidden],
.ds-filter-panel[hidden],
.ds-camera[hidden],
.ds-camera-video[hidden],
.ds-camera-still[hidden],
.ds-camera-icon[hidden],
.ds-shutter[hidden],
.ds-camera-actions .ds-button[hidden],
.ds-thumb-nav[hidden] {
  display: none !important;
}

.ds-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--ds-line);
  border-top-color: var(--ds-accent);
  border-radius: 50%;
  animation: ds-spin 0.8s linear infinite;
}

@keyframes ds-spin {
  to {
    transform: rotate(360deg);
  }
}

.ds-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ds-preview {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: transparent;
}

.ds-workspace,
.ds-gallery,
.ds-stage {
  min-width: 0;
  max-width: 100%;
}

.ds-gallery {
  display: flex;
  flex-direction: column;
}

.ds-stage {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
}

.ds-frame {
  --ds-frame-pad: 16px;
  position: relative;
  display: block;
  flex: 1 1 auto;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  height: clamp(320px, calc(100dvh - var(--np-header-height, 64px) - 300px), 860px);
  margin: 8px 16px 0;
  overflow: hidden;
  touch-action: manipulation;
  background: var(--ds-well);
  border-radius: 16px;
}

.ds-frame.is-zoomed {
  touch-action: none;
}

.ds-preview-image {
  position: absolute;
  inset: var(--ds-frame-pad);
  display: block;
  box-sizing: border-box;
  width: auto;
  height: auto;
  max-width: calc(100% - (var(--ds-frame-pad) * 2));
  max-height: calc(100% - (var(--ds-frame-pad) * 2));
  margin: auto;
  object-fit: contain;
  object-position: center;
  background: transparent;
  transform: translate(var(--ds-pan-x, 0px), var(--ds-pan-y, 0px)) scale(var(--ds-zoom, 1));
  transform-origin: center center;
}

.ds-frame.is-zoomed .ds-preview-image {
  cursor: grab;
}

.ds-frame.is-panning .ds-preview-image {
  cursor: grabbing;
}

.ds-zoom {
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 10px;
  display: flex;
  align-items: center;
  gap: 0;
  padding: 2px;
  border: 1px solid var(--ds-line);
  border-radius: 999px;
  background: var(--ds-surface);
  transform: translateX(-50%);
}

.ds-zoom-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ds-ink);
  cursor: pointer;
}

.ds-zoom-button svg {
  width: 14px;
  height: 14px;
}

.ds-zoom-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ds-zoom-level {
  min-width: 42px;
  color: var(--ds-ink);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}

.ds-page-count {
  color: var(--ds-ink);
  font-weight: 600;
}

.ds-empty,
.ds-preview-error {
  margin: auto;
  max-width: 28rem;
  padding: 32px 16px;
  text-align: center;
}

.ds-empty h2,
.ds-preview-error {
  margin-top: 0;
}

.ds-empty p {
  margin-bottom: 0;
  color: var(--ds-muted);
}

.ds-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 0;
  padding: 8px 16px 12px;
  color: var(--ds-muted);
  font-size: 0.92rem;
}

.ds-file-name {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  color: var(--ds-ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-workspace-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 12px 16px 0;
}

.ds-add-menu {
  position: relative;
  flex: 0 0 auto;
}

.ds-add-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 6;
  display: block;
  width: min(240px, calc(100vw - 32px));
  padding: 8px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 12px;
}

.ds-add-popover .ds-add-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ds-add-popover .ds-button {
  width: 100%;
}

.ds-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 12px 16px 0;
}

.ds-page-actions .ds-button {
  width: auto;
  min-height: 44px;
}

.ds-button-quiet {
  min-height: 40px;
  padding: 8px 12px;
  background: transparent;
  color: var(--ds-ink);
  border-color: transparent;
}

.ds-thumb-row {
  --ds-thumb: 84px;
  --ds-gap: 8px;
  --ds-peek: 18px;
  --ds-visible: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  width: min(100%, max-content);
  max-width: 100%;
  margin: 8px auto 0;
  padding: 4px 16px calc(12px + env(safe-area-inset-bottom));
  overflow: visible;
}

.ds-thumb-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 80px;
  margin-top: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ds-ink);
  cursor: pointer;
}

.ds-thumb-nav svg {
  width: 22px;
  height: 22px;
}

.ds-thumb-nav:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.ds-thumb-window {
  overflow: hidden;
  box-sizing: content-box;
  width: calc(var(--ds-thumb) * var(--ds-visible) + var(--ds-gap) * max(var(--ds-visible) - 1, 0));
  max-width: calc(100vw - 128px);
  min-width: 0;
  padding: 12px 14px 0 0;
  margin: -12px -14px 0 0;
}

.ds-thumb-row.has-later .ds-thumb-window {
  width: calc(var(--ds-thumb) * var(--ds-visible) + var(--ds-gap) * max(var(--ds-visible) - 1, 0) + var(--ds-peek));
}

.ds-thumb-row.has-later .ds-add-menu {
  position: relative;
  z-index: 2;
  margin-left: -12px;
}

.ds-thumbs {
  display: flex;
  flex: 0 0 auto;
  gap: var(--ds-gap);
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow: visible;
  transform: translateX(var(--ds-thumb-x, 0px));
}

.ds-thumbs.is-sliding {
  transition: transform 260ms ease;
}

.ds-thumbs > [role="listitem"] {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex: 0 0 auto;
  width: var(--ds-thumb);
  box-sizing: border-box;
  gap: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--ds-surface);
  transition: transform 180ms ease;
}

.ds-thumbs > [role="listitem"]:has(.ds-thumb[aria-current="true"]) {
  border-color: #c9c9c2;
  background: var(--ds-surface);
}

.ds-thumbs > [role="listitem"].is-dragging {
  z-index: 5;
  transition: none;
}

.ds-thumbs > [role="listitem"].is-dragging .ds-thumb {
  transform: scale(1.12) rotate(-3deg);
  outline: 3px solid var(--ds-ink);
  cursor: grabbing;
}

.ds-thumbs > [role="listitem"].is-drop-before {
  transform: translateX(-56px);
}

.ds-thumbs > [role="listitem"].is-drop-after {
  transform: translateX(56px);
}

.ds-thumb {
  position: relative;
  width: 100%;
  min-width: 0;
  display: grid;
  padding: 4px 4px 0;
  border: 0;
  border-radius: 8px 8px 0 0;
  background: transparent;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.ds-thumb.is-review {
  outline: 2px solid var(--ds-ink);
  outline-offset: -4px;
}

.ds-review-note {
  color: var(--ds-ink);
  font-weight: 600;
}

.ds-thumb img {
  width: 100%;
  height: 72px;
  object-fit: contain;
  background: var(--ds-well);
  border-radius: 6px;
  pointer-events: none;
}

.ds-thumb span {
  position: absolute;
  top: 8px;
  left: 8px;
  min-width: 18px;
  padding: 1px 5px;
  border-radius: 999px;
  background: var(--ds-surface);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.ds-thumb-delete {
  position: absolute;
  top: -8px;
  right: -8px;
  z-index: 3;
  flex: none;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ds-ink);
  color: #ffffff;
}

.ds-thumbs .ds-thumb-delete.ds-thumb-tool {
  width: 22px;
  height: 22px;
  border-radius: 999px;
}

.ds-thumb-delete svg {
  width: 14px;
  height: 14px;
}

.ds-thumb-tools {
  display: flex;
  width: 100%;
  margin-top: 2px;
  border-top: 1px solid var(--ds-line);
}

.ds-thumb-tool {
  display: inline-flex;
  flex: 1 1 50%;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ds-ink);
  cursor: pointer;
}

.ds-thumb-tool + .ds-thumb-tool {
  border-left: 1px solid var(--ds-line);
}

.ds-thumb-tool svg {
  width: 14px;
  height: 14px;
}

.ds-thumb-tool:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.ds-thumb-tool:focus-visible,
.ds-thumb-add:focus-visible {
  outline: 2px solid var(--ds-ink);
  outline-offset: 2px;
}

.ds-thumb[aria-current="true"] {
  background: transparent;
}

.ds-thumb.is-drop-target {
  outline: 2px dashed var(--ds-accent);
  outline-offset: 2px;
}

.ds-thumb-add {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--ds-thumb);
  height: 105px;
  padding: 0;
  border: 1.5px dashed var(--ds-line);
  border-radius: 10px;
  background: var(--ds-bg);
  color: var(--ds-ink);
  cursor: pointer;
}

.ds-thumb-add svg {
  width: 22px;
  height: 22px;
}

.ds-thumb-row .ds-add-menu {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.ds-thumb-row [data-upload-open] {
  display: none;
}

.ds-thumb-row .ds-add-actions {
  display: flex;
}

.ds-thumb-row [data-camera-start] {
  position: relative;
  z-index: 1;
  box-sizing: border-box;
  width: 44px;
  min-width: 44px;
  height: 105px;
  min-height: 105px;
  padding: 0;
  gap: 0;
  border-color: var(--ds-line);
  background: var(--ds-surface);
  font-size: 0;
}

.ds-doc-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 4px 20px;
  width: max-content;
  max-width: 100%;
  margin: 10px auto 0;
  padding: 4px 16px 0;
  overflow-x: auto;
}

.ds-names {
  width: min(420px, calc(100% - 32px));
  margin: 12px auto 0;
}

.ds-name {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: var(--ds-muted);
  font-size: 0.75rem;
  font-weight: 600;
}

.ds-name input {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--ds-line);
  border-radius: 10px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
}

.ds-name input:focus-visible {
  outline: 2px solid var(--ds-ink);
  outline-offset: 2px;
}

.ds-name input:disabled {
  opacity: 0.55;
}

.ds-download {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(23, 25, 20, 0.45);
}

.ds-download-dialog {
  display: grid;
  gap: 16px;
  width: min(860px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  padding: 16px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 16px;
}

.ds-download-title {
  display: flex;
  align-items: center;
  min-width: 0;
  max-width: 100%;
}

.ds-name-view {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ds-ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.ds-name-view span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-name-view svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.ds-name-view[hidden],
.ds-download-name[hidden] {
  display: none;
}

.ds-download-name {
  width: 100%;
  min-height: 36px;
  margin: 0;
  padding: 4px 2px;
  border: 0;
  border-bottom: 1px solid var(--ds-line);
  border-radius: 0;
  background: transparent;
  color: var(--ds-ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
}

.ds-download-name:focus-visible {
  outline: 2px solid var(--ds-ink);
  outline-offset: 2px;
}

.ds-download-pages {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-height: min(72vh, 760px);
  overflow-x: hidden;
  overflow-y: auto;
}

.ds-download-pages img {
  display: block;
  width: 100%;
  height: auto;
  background: var(--ds-well);
  border-radius: 8px;
}

.ds-download-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
}

.ds-download-actions .ds-button {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 40px;
  padding: 8px 8px;
  white-space: nowrap;
}

.ds-doc-bar .ds-position {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 0.95rem;
  white-space: nowrap;
}

.ds-doc-bar .ds-tool-action,
.ds-crop-actions .ds-tool-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px 2px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ds-ink);
  font-weight: 600;
  white-space: nowrap;
}

.ds-doc-bar .ds-button.ds-tool-action,
.ds-crop-actions .ds-button.ds-tool-action {
  min-height: 32px;
  padding: 2px 12px;
}

.ds-filter-panel {
  position: absolute;
  z-index: 2;
  left: 8px;
  right: 8px;
  bottom: 10px;
  width: auto;
  max-width: none;
  margin: 0;
  padding-top: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
}

.ds-filter-panel::-webkit-scrollbar {
  display: none;
}

.ds-filter-options {
  display: flex;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 8px;
  width: max-content;
  min-width: 100%;
  max-width: none;
}

.ds-filter-option {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 76px;
  min-height: 0;
  padding: 6px 6px 8px;
  border: 1px solid var(--ds-line);
  border-radius: 12px;
  background: var(--ds-surface);
  color: var(--ds-ink);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  white-space: normal;
  cursor: pointer;
}

.ds-filter-thumb {
  display: block;
  width: 64px;
  height: 78px;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  background: var(--ds-well);
}

.ds-filter-thumb:not([src]) {
  visibility: hidden;
}

.ds-filter-option[aria-checked="true"] {
  border-color: var(--ds-ink);
  background: var(--ds-accent);
}

.ds-filter-option:focus-visible {
  outline: 2px solid var(--ds-ink);
  outline-offset: 2px;
}

.ds-filter-option:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .ds-doc-bar {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-right: auto;
    margin-left: auto;
    overflow-x: hidden;
    gap: 2px 8px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .ds-doc-bar > [data-action="crop"] {
    order: 1;
  }

  .ds-doc-bar > [data-action="rotate"] {
    order: 2;
  }

  .ds-doc-bar > [data-filters-toggle] {
    order: 3;
  }

  .ds-doc-bar::before {
    content: "";
    order: 4;
    flex-basis: 100%;
    width: 100%;
    height: 0;
  }

  .ds-doc-bar > .ds-position {
    order: 5;
  }

  .ds-doc-bar > [data-download-open] {
    order: 6;
  }

  .ds-doc-bar .ds-button.ds-tool-action {
    padding-right: 6px;
    padding-left: 6px;
  }

  .ds-filter-options {
    gap: 6px;
  }

  .ds-filter-option {
    width: 62px;
    padding: 4px 3px 6px;
    font-size: 0.62rem;
  }

  .ds-filter-thumb {
    width: 52px;
    height: 66px;
  }
}

.ds-tool-action svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

@media (hover: hover) {
  .ds-doc-bar .ds-button.ds-tool-action,
  .ds-crop-actions .ds-button.ds-tool-action,
  .ds-download-actions .ds-button-quiet {
    transition: background-color 160ms ease, transform 180ms ease;
  }

  .ds-doc-bar .ds-button.ds-tool-action svg,
  .ds-crop-actions .ds-button.ds-tool-action svg {
    transition: transform 180ms ease;
  }

  .ds-doc-bar .ds-button.ds-tool-action:hover:not(:disabled),
  .ds-crop-actions .ds-button.ds-tool-action:hover:not(:disabled),
  .ds-download-actions .ds-button-quiet:hover:not(:disabled) {
    background: var(--ds-accent);
  }

  .ds-doc-bar .ds-button.ds-tool-action[data-action="crop"]:hover:not(:disabled) svg,
  .ds-crop-actions .ds-button.ds-tool-action[data-crop-action="detect"]:hover:not(:disabled) svg,
  .ds-crop-actions .ds-button.ds-tool-action[data-crop-action="apply"]:hover:not(:disabled) svg {
    transform: scale(1.12);
  }

  .ds-doc-bar .ds-button.ds-tool-action[data-action="rotate"]:hover:not(:disabled) svg {
    transform: rotate(40deg);
  }

  .ds-crop-actions .ds-button.ds-tool-action[data-crop-action="cancel"]:hover:not(:disabled) svg {
    transform: rotate(-12deg);
  }

  .ds-doc-bar .ds-button.ds-tool-action[data-filters-toggle]:hover:not(:disabled) svg {
    transform: translateY(-2px);
  }

  .ds-doc-bar .ds-button.ds-tool-action[data-download-open]:hover:not(:disabled) svg {
    transform: translateY(2px);
  }

  .ds-download-actions .ds-button-quiet:hover:not(:disabled) {
    transform: translateX(-2px);
  }

  .ds-filter-option {
    transition: transform 180ms ease;
  }

  .ds-filter-option:hover:not(:disabled) {
    transform: translateY(-4px);
  }
}

.ds-doc-bar .ds-button,
.ds-doc-bar .ds-planned {
  width: auto;
}

.ds-doc-bar .ds-export,
.ds-doc-bar .ds-planned {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 20px;
  width: auto;
}

.ds-doc-bar .ds-add-popover {
  top: auto;
  right: auto;
  bottom: calc(100% + 8px);
  left: 0;
}

.ds-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.ds-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
}

.ds-doc-bar .ds-add-actions,
.ds-toolbar .ds-add-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.ds-export {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.ds-export-menu {
  position: relative;
  min-width: 0;
}

.ds-export-popover {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 0;
  z-index: 6;
  display: grid;
  gap: 8px;
  width: min(240px, calc(100vw - 48px));
  padding: 8px;
  background: var(--ds-surface);
  border: 1px solid var(--ds-line);
  border-radius: 12px;
}

.ds-export-popover .ds-button {
  width: 100%;
}

.ds-doc-bar .ds-add-actions .ds-button,
.ds-toolbar .ds-add-actions .ds-button {
  width: 100%;
  min-height: 48px;
}

.ds-crop {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 0 0 12px;
}

.ds-crop-stage {
  position: relative;
  box-sizing: border-box;
  height: clamp(320px, calc(100dvh - var(--np-header-height, 64px) - 180px), 860px);
  margin: 8px 16px 0;
  overflow: hidden;
  background: var(--ds-well);
  border-radius: 16px;
}

.ds-crop-image,
.ds-crop-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.ds-crop-image {
  background: transparent;
}

.ds-crop-overlay {
  touch-action: none;
}

.ds-crop-overlay polygon {
  fill: rgba(23, 25, 20, 0.08);
  stroke: var(--ds-ink);
  stroke-width: 2;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

.ds-crop-overlay circle {
  fill: var(--ds-surface);
  stroke: var(--ds-ink);
  cursor: grab;
}

.ds-crop-status {
  margin: 12px auto 0;
  max-width: min(640px, calc(100% - 32px));
  color: var(--ds-muted);
  text-align: center;
  overflow-wrap: anywhere;
}

.ds-crop-status:empty {
  display: none;
}

.ds-crop-status.is-error {
  color: var(--ds-danger);
}

.ds-crop-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 4px 20px;
  width: max-content;
  max-width: 100%;
  margin: 8px auto 0;
  padding: 4px 16px 0;
  overflow-x: auto;
}

.ds-crop-actions .ds-button.ds-tool-action[data-crop-action="apply"] {
  background: var(--ds-accent);
}

@media (max-width: 640px) {
  .ds-crop-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-right: 0;
    margin-left: 0;
    overflow: visible;
    gap: 4px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .ds-crop-actions .ds-button.ds-tool-action {
    max-width: 100%;
  }
}

.ds-camera {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  overflow: hidden;
  background: #101816;
  color: #ffffff;
}

.ds-camera-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.ds-camera-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: calc(100% - 64px);
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-weight: 600;
  cursor: pointer;
}

.ds-camera-stage {
  position: relative;
  flex: 1;
  width: 100%;
  height: auto;
  min-height: 0;
  max-width: 100%;
  margin: 8px auto;
  overflow: hidden;
  background: #101816;
  border-radius: 16px;
}

.ds-viewfinder {
  position: absolute;
  inset: 10%;
  pointer-events: none;
}

.ds-viewfinder span {
  position: absolute;
  width: 28px;
  height: 28px;
  border: 3px solid #ffffff;
}

.ds-viewfinder span:nth-child(1) {
  top: 0;
  left: 0;
  border-right: 0;
  border-bottom: 0;
}

.ds-viewfinder span:nth-child(2) {
  top: 0;
  right: 0;
  border-bottom: 0;
  border-left: 0;
}

.ds-viewfinder span:nth-child(3) {
  right: 0;
  bottom: 0;
  border-top: 0;
  border-left: 0;
}

.ds-viewfinder span:nth-child(4) {
  bottom: 0;
  left: 0;
  border-top: 0;
  border-right: 0;
}

.ds-camera-video,
.ds-camera-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: #101816;
}

.ds-camera-still {
  z-index: 1;
}

.ds-camera-status {
  width: min(100%, 640px);
  margin: 0 auto 8px;
  color: #d5e0dc;
  text-align: center;
  overflow-wrap: anywhere;
}

.ds-camera-status:empty {
  display: none;
}

.ds-camera-status.is-error {
  color: var(--ds-danger);
}

.ds-camera-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: min(100%, 640px);
  max-width: 100%;
  margin: 0 auto;
}

.ds-camera-actions .ds-button {
  min-width: 120px;
  min-height: 48px;
}

.ds-shutter {
  display: grid;
  place-items: center;
  width: 74px;
  height: 74px;
  padding: 0;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}

.ds-shutter-core {
  display: block;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ffffff;
}

.ds-shutter:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ds-planned {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-width: 0;
}

.ds-button-primary {
  background: var(--ds-accent);
  color: var(--ds-ink);
}

.ds-button-secondary,
.ds-button-planned {
  background: #ffffff;
  color: var(--ds-ink);
  border-color: var(--ds-line);
}

.ds-button-planned {
  flex-direction: column;
  gap: 0;
  color: var(--ds-muted);
}

.ds-button-note {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
}

.ds-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ds-tool.is-reading .ds-button-primary {
  opacity: 0.45;
  pointer-events: none;
}

.ds-file-input:focus-visible + .ds-button {
  outline: 2px solid var(--ds-ink);
  outline-offset: 2px;
}

@media (hover: hover) {
  .ds-button-primary:hover {
    background: var(--ds-accent-press);
  }

  .ds-button-secondary:hover,
  .ds-button-planned:hover {
    background: var(--ds-well);
  }
}

@media (max-width: 640px) {
  .ds-thumb-window,
  .ds-thumb-row.has-later .ds-thumb-window {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .ds-frame,
  .ds-crop-stage {
    --ds-frame-pad: 10px;
    height: clamp(280px, calc(100dvh - var(--np-header-height, 64px) - 340px), 560px);
    margin-right: 12px;
    margin-left: 12px;
  }

  .ds-thumb-row,
  .ds-doc-bar {
    padding-right: 12px;
    padding-left: 12px;
  }
}

[dir="rtl"] .ds-tool {
  font-family: Tahoma, "Segoe UI", "Noto Naskh Arabic", sans-serif;
}

[dir="rtl"] .ds-message {
  border-left-width: 1px;
  border-right-width: 3px;
  padding: 12px 14px 12px 12px;
}

[dir="rtl"] .ds-message-error,
[dir="rtl"] .ds-message-success,
[dir="rtl"] .ds-message-warning,
[dir="rtl"] .ds-message-secure,
[dir="rtl"] .ds-message-info {
  border-left-color: var(--ds-line);
}

[dir="rtl"] .ds-message-error {
  border-right-color: var(--ds-danger);
}

[dir="rtl"] .ds-message-success {
  border-right-color: var(--ds-success);
}

[dir="rtl"] .ds-message-warning {
  border-right-color: var(--ds-warning);
}

[dir="rtl"] .ds-message-secure,
[dir="rtl"] .ds-message-info {
  border-right-color: var(--ds-info);
}

[dir="rtl"] .ds-thumb-row,
[dir="rtl"] .ds-thumbs,
[dir="rtl"] .ds-crop-stage,
[dir="rtl"] .ds-crop-image,
[dir="rtl"] .ds-crop-overlay,
[dir="rtl"] .ds-frame,
[dir="rtl"] .ds-preview-image,
[dir="rtl"] .ds-camera-stage,
[dir="rtl"] .ds-camera-video,
[dir="rtl"] .ds-camera-still,
[dir="rtl"] .ds-filter-thumb,
[dir="rtl"] .ds-download-name {
  direction: ltr;
  unicode-bidi: isolate;
}

[dir="rtl"] .ds-download-name {
  text-align: left;
}

@media (prefers-reduced-motion: reduce) {
  .ds-spinner,
  .ds-thumbs,
  .ds-thumbs > [role="listitem"],
  .ds-doc-bar .ds-button.ds-tool-action,
  .ds-doc-bar .ds-button.ds-tool-action svg,
  .ds-crop-actions .ds-button.ds-tool-action,
  .ds-crop-actions .ds-button.ds-tool-action svg,
  .ds-download-actions .ds-button-quiet,
  .ds-filter-option,
  .ds-dismiss {
    animation: none;
    transition: none;
  }
}
