.pdf-crop-index {
  --crop-paper: #f3f0ea;
  --crop-card: #fffefa;
  --crop-ink: #23211e;
  --crop-muted: #756f67;
  --crop-soft: #f1ede6;
  --crop-line: #d8d1c7;
  --crop-accent: #c4512f;
  --crop-accent-dark: #a83f24;
  --crop-success: #4f8065;
  --crop-warning: #8b4d3c;
  color: var(--crop-ink);
  background: var(--crop-paper);
}

.pdf-crop-index .noise { opacity: .018; }
.pdf-crop-main { padding-top: 58px; }
.pdf-crop-hero { grid-template-columns: minmax(0, 1fr) 270px; }
.pdf-crop-workbench,
.pdf-crop-preview-panel,
.pdf-crop-options,
.pdf-crop-result { box-sizing: border-box; }

.pdf-crop-visual {
  position: relative;
  width: 244px;
  height: 184px;
  display: grid;
  place-items: center;
  justify-self: end;
}

.pdf-crop-visual > div {
  position: relative;
  width: 142px;
  height: 172px;
  border: 1px solid #d1cabf;
  background: #fffefa;
  box-shadow: 0 22px 48px rgba(61, 48, 39, .14);
  transform: rotate(2deg);
}

.pdf-crop-visual > div::before,
.pdf-crop-visual > div::after {
  content: "";
  position: absolute;
  z-index: 2;
  width: 26px;
  height: 26px;
  border-color: var(--crop-accent);
  border-style: solid;
}

.pdf-crop-visual > div::before { left: 18px; top: 18px; border-width: 2px 0 0 2px; }
.pdf-crop-visual > div::after { right: 18px; bottom: 18px; border-width: 0 2px 2px 0; }
.pdf-crop-visual span { position: absolute; inset: 31px; border: 1px dashed rgba(196, 81, 47, .75); }
.pdf-crop-visual i { position: absolute; left: 43px; right: 43px; top: 62px; height: 4px; background: #ded8cf; box-shadow: 0 18px #ded8cf, 0 36px #ded8cf; }
.pdf-crop-visual b { position: absolute; inset: 0; border: 18px solid rgba(43, 39, 35, .08); }
.pdf-crop-visual > small { position: absolute; right: 1px; bottom: 15px; border: 1px solid #d7cfc4; padding: 7px 9px; color: var(--crop-accent); background: #fffefa; font: 850 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .15em; }

.pdf-crop-workbench {
  position: relative;
  border: 1px solid rgba(105, 98, 88, .2);
  border-radius: 28px;
  padding: 27px;
  background: rgba(255, 254, 250, .86);
  box-shadow: 0 28px 75px rgba(54, 47, 37, .1), inset 0 1px #fff;
  backdrop-filter: blur(14px);
}

.pdf-crop-empty[hidden],
.pdf-crop-workspace[hidden],
#cropPdfProgress[hidden],
#cropPdfError[hidden],
#cropPdfResult[hidden] { display: none !important; }

.pdf-crop-index .workbench-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 22px;
}

.pdf-crop-index .workbench-heading > div:first-child { display: grid; gap: 5px; }
.pdf-crop-index .workbench-heading > div:first-child > span,
.pdf-crop-kicker {
  color: var(--crop-accent);
  font: 850 10px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .13em;
  text-transform: uppercase;
}

.pdf-crop-index .workbench-heading h2 { margin: 0; font-size: clamp(28px, 3vw, 40px); line-height: 1.05; }
.pdf-crop-index .local-note { display: inline-flex; align-items: center; gap: 8px; color: #716b63; font-size: 13px; }
.pdf-crop-index .local-note i { width: 8px; height: 8px; border-radius: 50%; background: var(--crop-success); box-shadow: 0 0 0 6px rgba(79, 128, 101, .1); }

.pdf-crop-index .pdf-drop-zone {
  min-height: 330px;
  border-color: #d3cbc0;
  background: rgba(255, 255, 255, .36);
}

.pdf-crop-index .pdf-drop-zone:hover,
.pdf-crop-index .pdf-drop-zone.dragging { border-color: var(--crop-accent); background: rgba(255, 255, 255, .64); }
.pdf-crop-index .pdf-drop-zone .upload-mark { border-radius: 10px; background: var(--crop-accent); transform: rotate(-2deg); }
.pdf-crop-index .pdf-drop-zone strong { color: var(--crop-ink); font-size: clamp(24px, 2.4vw, 34px); }
.pdf-crop-index .pdf-drop-zone p { font-size: 14px; }
.pdf-crop-index .pdf-drop-zone em { color: #fff; background: var(--crop-ink); }
.pdf-crop-index .pdf-drop-zone small { font-size: 11px; line-height: 1.5; }
.pdf-crop-index .pdf-drop-zone small.is-error { color: #a33928; font-weight: 800; }
.pdf-crop-capabilities { grid-template-columns: repeat(3, 1fr); }
.pdf-crop-capabilities > span { min-width: 0; }
.pdf-crop-capabilities b { color: var(--crop-warning); }

.pdf-crop-filebar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--crop-line);
  border-radius: 14px;
  padding: 10px 12px;
  background: #f7f4ee;
}

.pdf-crop-file-copy { min-width: 0; display: flex; align-items: center; gap: 11px; }
.pdf-crop-file-copy > b { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; color: #fff; background: var(--crop-accent); font: 850 9px ui-monospace, SFMono-Regular, Menlo, monospace; }
.pdf-crop-file-copy > span { min-width: 0; display: grid; gap: 3px; }
.pdf-crop-file-copy strong { overflow: hidden; color: var(--crop-ink); font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.pdf-crop-file-copy small { color: #837c73; font-size: 11px; }
.pdf-crop-file-actions { display: flex; flex: 0 0 auto; gap: 7px; }
.pdf-crop-file-actions button {
  min-height: 38px;
  border: 1px solid #d4cdc3;
  border-radius: 8px;
  padding: 0 13px;
  color: #5e5851;
  background: #fffefa;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}
.pdf-crop-file-actions button:first-child { color: #fff; border-color: var(--crop-ink); background: var(--crop-ink); }
.pdf-crop-file-actions button:hover { border-color: var(--crop-accent); }

.pdf-crop-warning {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 10px 15px;
  margin-top: 10px;
  border: 1px solid #ddb7aa;
  border-radius: 12px;
  padding: 12px 14px;
  color: #704438;
  background: #fff1eb;
}

.pdf-crop-warning b { font-size: 12px; white-space: nowrap; }
.pdf-crop-warning span { font-size: 11px; line-height: 1.62; }

.pdf-crop-layout { display: grid; grid-template-columns: minmax(0, 1fr) 370px; align-items: start; gap: 13px; margin-top: 13px; }
.pdf-crop-preview-panel,
.pdf-crop-options { min-width: 0; border: 1px solid #dfd9d0; border-radius: 18px; background: var(--crop-card); }
.pdf-crop-preview-panel { padding: 18px; }
.pdf-crop-preview-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.pdf-crop-preview-heading > div:first-child { min-width: 0; display: grid; gap: 4px; }
.pdf-crop-preview-heading > div:first-child > span { color: var(--crop-accent); font: 850 9px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; }
.pdf-crop-preview-heading h3 { margin: 0; font-size: 17px; line-height: 1.25; }
.pdf-crop-page-nav { flex: 0 0 auto; display: flex; align-items: center; gap: 5px; }
.pdf-crop-page-nav button,
.pdf-crop-page-nav strong { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid #d5cec4; border-radius: 8px; background: #f5f1eb; }
.pdf-crop-page-nav button { width: 38px; color: var(--crop-ink); font-size: 16px; cursor: pointer; }
.pdf-crop-page-nav strong { min-width: 104px; padding: 0 10px; color: #655f57; font-size: 11px; }
.pdf-crop-page-nav button:disabled { opacity: .35; cursor: default; }

.pdf-crop-canvas-shell {
  position: relative;
  min-height: 610px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid #ded8cf;
  border-radius: 14px;
  padding: 28px;
  background-color: #e9e5df;
  background-image: linear-gradient(45deg, rgba(255,255,255,.42) 25%, transparent 25%), linear-gradient(-45deg, rgba(255,255,255,.42) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(255,255,255,.42) 75%), linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.42) 75%);
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  background-size: 24px 24px;
  touch-action: pan-y;
}

#pdfCropCanvas {
  max-width: 100%;
  max-height: 660px;
  display: block;
  background: #fff;
  box-shadow: 0 18px 40px rgba(45, 38, 32, .19);
}

.pdf-crop-overlay {
  --crop-handle-size: 26px;
  position: absolute;
  inset: 28px;
  z-index: 3;
  border: 2px solid var(--crop-accent);
  box-shadow: 0 0 0 200vmax rgba(30, 27, 24, .48), inset 0 0 0 1px rgba(255, 255, 255, .8);
  pointer-events: none;
  touch-action: pan-y;
}

.pdf-crop-overlay::before,
.pdf-crop-overlay::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: .48;
}
.pdf-crop-overlay::before { left: 33.333%; right: 33.333%; top: 0; bottom: 0; border-left: 1px dashed #fff; border-right: 1px dashed #fff; }
.pdf-crop-overlay::after { left: 0; right: 0; top: 33.333%; bottom: 33.333%; border-top: 1px dashed #fff; border-bottom: 1px dashed #fff; }

.pdf-crop-overlay [data-crop-handle] { position: absolute; display: block; z-index: 4; pointer-events: auto; touch-action: none; }
.pdf-crop-overlay [data-crop-handle="top"] { left: var(--crop-handle-size); right: var(--crop-handle-size); top: calc(var(--crop-handle-size) / -2); height: var(--crop-handle-size); cursor: ns-resize; }
.pdf-crop-overlay [data-crop-handle="right"] { top: var(--crop-handle-size); right: calc(var(--crop-handle-size) / -2); bottom: var(--crop-handle-size); width: var(--crop-handle-size); cursor: ew-resize; }
.pdf-crop-overlay [data-crop-handle="bottom"] { left: var(--crop-handle-size); right: var(--crop-handle-size); bottom: calc(var(--crop-handle-size) / -2); height: var(--crop-handle-size); cursor: ns-resize; }
.pdf-crop-overlay [data-crop-handle="left"] { top: var(--crop-handle-size); left: calc(var(--crop-handle-size) / -2); bottom: var(--crop-handle-size); width: var(--crop-handle-size); cursor: ew-resize; }
.pdf-crop-overlay [data-crop-handle*="top-"] { top: calc(var(--crop-handle-size) / -2); }
.pdf-crop-overlay [data-crop-handle*="bottom-"] { bottom: calc(var(--crop-handle-size) / -2); }
.pdf-crop-overlay [data-crop-handle$="-left"] { left: calc(var(--crop-handle-size) / -2); }
.pdf-crop-overlay [data-crop-handle$="-right"] { right: calc(var(--crop-handle-size) / -2); }
.pdf-crop-overlay [data-crop-handle="top-left"],
.pdf-crop-overlay [data-crop-handle="top-right"],
.pdf-crop-overlay [data-crop-handle="bottom-left"],
.pdf-crop-overlay [data-crop-handle="bottom-right"] { width: var(--crop-handle-size); height: var(--crop-handle-size); }
.pdf-crop-overlay [data-crop-handle="top-left"],
.pdf-crop-overlay [data-crop-handle="bottom-right"] { cursor: nwse-resize; }
.pdf-crop-overlay [data-crop-handle="top-right"],
.pdf-crop-overlay [data-crop-handle="bottom-left"] { cursor: nesw-resize; }
.pdf-crop-overlay [data-crop-handle="top-left"]::after,
.pdf-crop-overlay [data-crop-handle="top-right"]::after,
.pdf-crop-overlay [data-crop-handle="bottom-left"]::after,
.pdf-crop-overlay [data-crop-handle="bottom-right"]::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: 12px;
  height: 12px;
  box-sizing: border-box;
  border: 2px solid #fff;
  border-radius: 3px;
  background: var(--crop-accent);
  box-shadow: 0 1px 5px rgba(36, 29, 24, .35);
}

.pdf-crop-preview-note { margin: 10px 2px 0; color: #898278; font-size: 11px; line-height: 1.55; }
.pdf-crop-options { position: sticky; top: 14px; padding: 19px; }
.pdf-crop-options > h3 { margin: 7px 0 6px; font-size: 22px; line-height: 1.12; }
.pdf-crop-options > h3 + p { margin: 0; color: #817a71; font-size: 12px; line-height: 1.55; }

.pdf-crop-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; margin-top: 16px; }
.pdf-crop-presets button { min-height: 39px; border: 1px solid #d8d1c7; border-radius: 8px; padding: 5px 7px; color: #625b54; background: #f5f1eb; font-size: 10px; font-weight: 800; line-height: 1.2; cursor: pointer; }
.pdf-crop-presets button:hover,
.pdf-crop-presets button.active,
.pdf-crop-presets button[aria-pressed="true"] { color: #fff; border-color: var(--crop-ink); background: var(--crop-ink); }

.pdf-crop-edge-fields,
.pdf-crop-scope { border: 0; margin: 18px 0 0; padding: 0; }
.pdf-crop-edge-fields legend,
.pdf-crop-scope legend,
.pdf-crop-field > span { margin-bottom: 7px; color: #6d665f; font-size: 11px; font-weight: 850; }
.pdf-crop-edge-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pdf-crop-edge-fields legend { grid-column: 1 / -1; }
.pdf-crop-edge-fields label { min-width: 0; display: grid; gap: 5px; }
.pdf-crop-edge-fields label > span { display: flex; justify-content: space-between; color: #797169; font-size: 10px; font-weight: 750; }
.pdf-crop-edge-fields label small { color: #aaa198; font-size: 9px; }
.pdf-crop-edge-fields input,
.pdf-crop-field input {
  width: 100%;
  height: 42px;
  box-sizing: border-box;
  border: 1px solid #d6cfc5;
  border-radius: 8px;
  outline: 0;
  padding: 0 11px;
  color: var(--crop-ink);
  background: #fff;
  font-size: 13px;
}

.pdf-crop-edge-fields input:focus,
.pdf-crop-field input:focus { border-color: var(--crop-accent); box-shadow: 0 0 0 3px rgba(196, 81, 47, .1); }
.pdf-crop-field input:disabled { color: #9e978e; background: #efebe4; cursor: not-allowed; }
.pdf-crop-field { display: grid; margin-top: 15px; }
.pdf-crop-field > small { margin-top: 5px; color: #999188; font-size: 9px; line-height: 1.45; }

.pdf-crop-scope > div { display: grid; gap: 5px; }
.pdf-crop-scope label { position: relative; display: block; cursor: pointer; }
.pdf-crop-scope input { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin: -8px 0 0; accent-color: var(--crop-accent); }
.pdf-crop-scope label > span { min-height: 49px; display: grid; align-content: center; gap: 2px; border: 1px solid #ddd6cd; border-radius: 9px; padding: 6px 10px 6px 39px; background: #f7f4ef; }
.pdf-crop-scope input:checked + span { border-color: #c56d54; background: #fff3ee; box-shadow: inset 3px 0 var(--crop-accent); }
.pdf-crop-scope b { font-size: 11px; }
.pdf-crop-scope small { color: #8e877e; font-size: 9px; }

.pdf-crop-progress { margin-top: 15px; }
.pdf-crop-progress > div { display: flex; justify-content: space-between; gap: 10px; color: #686158; font-size: 10px; font-weight: 800; }
.pdf-crop-progress > p { height: 6px; overflow: hidden; margin: 7px 0 0; border-radius: 99px; background: #e4ded6; }
.pdf-crop-progress > p i { width: var(--crop-progress, 0%); height: 100%; display: block; border-radius: inherit; background: var(--crop-accent); transition: width .2s ease; }
.pdf-crop-error { margin: 13px 0 0; border: 1px solid #e2aa9c; border-radius: 8px; padding: 9px 10px; color: #913d2c; background: #fff0eb; font-size: 10px; line-height: 1.5; }
.pdf-crop-action { width: 100%; margin-top: 15px; }
.pdf-crop-action:disabled { opacity: .45; cursor: not-allowed; }
.pdf-crop-options .export-note { display: block; margin-top: 8px; color: #918980; font-size: 9px; line-height: 1.55; }

.pdf-crop-result { display: grid; gap: 6px; margin-top: 15px; border: 1px solid #afd0be; border-radius: 12px; padding: 14px; background: #eff8f3; }
.pdf-crop-result > span { color: var(--crop-success); font: 850 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .14em; }
.pdf-crop-result > strong { font-size: 15px; }
.pdf-crop-result > p { margin: 0; color: #5e7165; font-size: 10px; line-height: 1.5; }
.pdf-crop-result > button { min-height: 43px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 0; border-radius: 8px; padding: 0 13px; color: #fff; background: var(--crop-success); font-size: 11px; font-weight: 850; cursor: pointer; }

.pdf-crop-index button,
.pdf-crop-index input { font-family: inherit; }
.pdf-crop-index button:focus-visible,
.pdf-crop-index input:focus-visible,
.pdf-crop-index a:focus-visible,
.pdf-crop-index summary:focus-visible { outline: 3px solid rgba(196, 81, 47, .3); outline-offset: 3px; }

@media (max-width: 1080px) {
  .pdf-crop-layout { grid-template-columns: minmax(0, 1fr) 330px; }
  .pdf-crop-canvas-shell { min-height: 540px; }
}

@media (max-width: 900px) {
  .pdf-crop-layout { grid-template-columns: 1fr; }
  .pdf-crop-options { position: static; }
  .pdf-crop-canvas-shell { min-height: 520px; }
  .pdf-crop-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; }
  .pdf-crop-options > .pdf-crop-kicker,
  .pdf-crop-options > h3,
  .pdf-crop-options > h3 + p,
  .pdf-crop-options > .pdf-crop-presets,
  .pdf-crop-options > .pdf-crop-progress,
  .pdf-crop-options > .pdf-crop-error,
  .pdf-crop-options > .pdf-crop-action,
  .pdf-crop-options > .export-note,
  .pdf-crop-options > .pdf-crop-result { grid-column: 1 / -1; }
}

@media (max-width: 800px) {
  .pdf-crop-hero { grid-template-columns: 1fr; }
  .pdf-crop-visual { display: none; }
  .pdf-crop-capabilities { grid-template-columns: 1fr; }
  .pdf-crop-warning { grid-template-columns: 1fr; }
  .pdf-crop-warning b { white-space: normal; }
}

@media (max-width: 620px) {
  .pdf-crop-main { padding-top: 36px; }
  .pdf-crop-workbench { border-radius: 20px; padding: 13px; }
  .pdf-crop-index .workbench-heading { align-items: start; flex-direction: column; margin-bottom: 16px; }
  .pdf-crop-index .workbench-heading h2 { font-size: 28px; }
  .pdf-crop-index .pdf-drop-zone { min-height: 310px; padding: 26px 17px; }
  .pdf-crop-filebar { align-items: flex-start; flex-direction: column; }
  .pdf-crop-file-copy { width: 100%; }
  .pdf-crop-file-copy > span { max-width: calc(100% - 52px); }
  .pdf-crop-file-actions { width: 100%; }
  .pdf-crop-file-actions button { flex: 1; }
  .pdf-crop-preview-panel,
  .pdf-crop-options { border-radius: 14px; }
  .pdf-crop-preview-panel { padding: 11px; }
  .pdf-crop-preview-heading { align-items: flex-start; flex-direction: column; }
  .pdf-crop-page-nav { width: 100%; }
  .pdf-crop-page-nav strong { flex: 1; }
  .pdf-crop-canvas-shell { min-height: 390px; border-radius: 10px; padding: 16px; }
  #pdfCropCanvas { max-height: 520px; }
  .pdf-crop-overlay { inset: 16px; --crop-handle-size: 30px; }
  .pdf-crop-options { display: block; padding: 15px; }
  .pdf-crop-presets { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 380px) {
  .pdf-crop-edge-fields { grid-template-columns: 1fr; }
  .pdf-crop-edge-fields legend { grid-column: auto; }
  .pdf-crop-canvas-shell { min-height: 340px; }
}

@media (prefers-reduced-motion: reduce) {
  .pdf-crop-progress > p i { transition: none; }
}

@media (forced-colors: active) {
  .pdf-crop-overlay { box-shadow: none; outline: 2px solid CanvasText; }
  .pdf-crop-warning,
  .pdf-crop-result { border: 2px solid CanvasText; }
}
