.pdf-tools-body {
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(56, 5, 93, 0.08), transparent 34%),
    linear-gradient(180deg, #f8fafc 0%, #eef2ff 100%);
}

.pdf-tools-main {
  width: min(100%, 1520px);
  margin: 0 auto;
}

.pdf-tools-hero {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 24px;
  padding: 28px;
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(56, 5, 93, 0.98), rgba(104, 34, 164, 0.94)),
    #38055d;
  color: #fff;
  box-shadow: 0 20px 45px rgba(56, 5, 93, 0.22);
}

.pdf-hero-copy {
  display: flex;
  align-items: center;
  gap: 22px;
  max-width: 820px;
}

.pdf-hero-logo {
  width: 94px;
  height: 94px;
  object-fit: contain;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  padding: 12px;
  box-shadow: inset 0 0 0 1px rgba(56, 5, 93, 0.08);
}

.pdf-kicker {
  display: inline-flex;
  align-items: center;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.pdf-tools-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1;
  font-weight: 800;
}

.pdf-tools-hero p {
  max-width: 640px;
  margin: 10px 0 0;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.05rem;
}

.pdf-hero-status {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

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

.pdf-step {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "num title"
    "num text";
  gap: 2px 12px;
  padding: 16px;
  border: 1px solid rgba(56, 5, 93, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.06);
}

.pdf-step span,
.pdf-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: #38055d;
  color: #fff;
  font-weight: 800;
}

.pdf-step span {
  grid-area: num;
}

.pdf-step strong {
  grid-area: title;
}

.pdf-step small {
  grid-area: text;
  color: #64748b;
}

.pdf-tool-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(250px, 0.65fr) minmax(520px, 1.5fr);
  gap: 24px;
  align-items: start;
}

.pdf-tool-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: 18px;
}

.pdf-card-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pdf-card-title small {
  color: var(--muted-color);
}

.pdf-dropzone {
  display: flex;
  min-height: 210px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 26px;
  border: 2px dashed rgba(56, 5, 93, 0.34);
  border-radius: 18px;
  background: linear-gradient(180deg, #fbfdff, #f1f5ff);
  color: #334155;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}

.pdf-dropzone i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: rgba(56, 5, 93, 0.1);
  color: #38055d;
  font-size: 2rem;
}

.pdf-dropzone strong {
  font-size: 1.15rem;
}

.pdf-dropzone span {
  max-width: 260px;
  color: #64748b;
}

.pdf-dropzone.is-dragging,
.pdf-dropzone:hover {
  border-color: #38055d;
  box-shadow: 0 16px 35px rgba(56, 5, 93, 0.12);
  transform: translateY(-1px);
}

.pdf-summary-box {
  border: 1px solid rgba(56, 5, 93, 0.16);
  border-radius: 14px;
  padding: 14px;
  background: #faf5ff;
}

.pdf-summary-box strong,
.pdf-summary-box div {
  display: block;
}

.pdf-summary-box span {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #ede9fe;
  color: #5b21b6;
  font-size: 0.8rem;
  font-weight: 700;
}

.pdf-format-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pdf-format-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon title"
    "icon text";
  align-items: center;
  gap: 0 10px;
  min-height: 72px;
  padding: 12px;
  border: 1px solid #dbe3f0;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.pdf-format-card i {
  grid-area: icon;
  color: #38055d;
  font-size: 1.5rem;
}

.pdf-format-card strong {
  grid-area: title;
}

.pdf-format-card span {
  grid-area: text;
  color: #64748b;
  font-size: 0.85rem;
}

.btn-check:checked + .pdf-format-card {
  border-color: #38055d;
  box-shadow: 0 0 0 3px rgba(56, 5, 93, 0.12);
  background: #faf5ff;
}

.pdf-format-card:hover {
  transform: translateY(-1px);
}

.pdf-crop-preview {
  min-height: 150px;
  padding: 18px;
  border-radius: 18px;
  background:
    linear-gradient(45deg, rgba(56, 5, 93, 0.07) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(56, 5, 93, 0.07) 25%, transparent 25%),
    #f8fafc;
  background-size: 18px 18px;
}

.pdf-crop-paper {
  display: flex;
  width: 120px;
  height: 112px;
  margin: 0 auto;
  align-items: center;
  justify-content: center;
  border: 2px solid #38055d;
  border-radius: 8px;
  background: #fff;
  color: #38055d;
  font-size: 0.78rem;
  font-weight: 800;
  text-align: center;
  box-shadow: 0 12px 28px rgba(56, 5, 93, 0.14);
}

.pdf-preview-stage {
  position: relative;
  display: block;
  min-height: 560px;
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(56, 5, 93, 0.14);
  border-radius: 18px;
  background:
    linear-gradient(45deg, rgba(15, 23, 42, 0.05) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(15, 23, 42, 0.05) 25%, transparent 25%),
    #eef2f7;
  background-size: 20px 20px;
}

.pdf-preview-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
  align-items: start;
}

.pdf-preview-list.hidden {
  display: none;
}

.pdf-preview-page {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pdf-preview-page header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #334155;
  font-weight: 800;
}

.pdf-preview-page img {
  max-width: 100%;
  max-height: 720px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.24);
}

.pdf-preview-empty {
  display: flex;
  min-height: 520px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #64748b;
  text-align: center;
}

.pdf-preview-empty i {
  display: inline-flex;
  width: 58px;
  height: 58px;
  align-items: center;
  justify-content: center;
  border-radius: 16px;
  background: rgba(56, 5, 93, 0.1);
  color: #38055d;
  font-size: 1.8rem;
}

.pdf-preview-loading {
  position: absolute;
  inset: auto 18px 18px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.88);
  color: #fff;
  font-weight: 700;
}

.pdf-preview-help {
  color: #64748b;
  font-size: 0.9rem;
}

.pdf-pages-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
  max-height: 610px;
  overflow: auto;
  padding: 4px 4px 8px;
}

.pdf-page-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 260px;
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: 14px;
  background: var(--surface-secondary);
  cursor: grab;
  user-select: none;
  touch-action: none;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.pdf-page-row.is-dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.pdf-page-row.is-drop-target {
  border-color: #38055d;
  box-shadow: 0 0 0 3px rgba(56, 5, 93, 0.14);
}

.pdf-drag-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 700;
}

.pdf-page-row:hover {
  border-color: rgba(56, 5, 93, 0.45);
  transform: translateY(-1px);
}

.pdf-page-row.is-selected {
  border-color: #38055d;
  background: #faf5ff;
  box-shadow: 0 0 0 3px rgba(56, 5, 93, 0.1);
}

.pdf-page-thumb {
  display: flex;
  width: 100%;
  height: 178px;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(56, 5, 93, 0.14);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.1);
}

.pdf-page-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  pointer-events: none;
  user-select: none;
}

.pdf-page-thumb span {
  color: #94a3b8;
  font-size: 0.75rem;
  text-align: center;
}

.pdf-page-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pdf-page-row strong {
  min-width: 0;
}

.pdf-page-row small {
  color: var(--muted-color);
}

.pdf-page-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: auto;
}

.pdf-icon-btn {
  width: 100%;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pdf-workspace-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 6px;
  border-radius: 14px;
  background: #eef2ff;
}

.pdf-workspace-tabs button {
  border: 0;
  border-radius: 10px;
  padding: 10px 12px;
  background: transparent;
  color: #475569;
  font-weight: 700;
}

.pdf-workspace-tabs button.active {
  background: #fff;
  color: #38055d;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.pdf-tab-panel.hidden {
  display: none;
}

.pdf-export-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--border-color);
}

.pdf-export-bar small {
  display: block;
  color: #64748b;
}

.pdf-export-bar .btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

@media (max-width: 1200px) {
  .pdf-tool-grid,
  .pdf-steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .pdf-tools-hero,
  .pdf-hero-copy,
  .pdf-hero-status,
  .pdf-export-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .pdf-hero-logo {
    width: 76px;
    height: 76px;
  }

  .pdf-format-grid,
  .pdf-page-row {
    grid-template-columns: 1fr;
  }

  .pdf-page-thumb {
    width: 100%;
    height: 190px;
  }

  .pdf-page-actions {
    justify-content: flex-end;
  }
}

/* Refined tabbed workspace */
.pdf-tool-shell {
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(56, 5, 93, 0.1);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.96);
}

.pdf-main-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  padding: 10px;
  background: #f2f4fb;
  border-bottom: 1px solid #e2e8f0;
}

.pdf-main-tabs button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #475569;
  font-weight: 800;
}

.pdf-main-tabs button.active {
  background: #38055d;
  color: #fff;
  box-shadow: 0 12px 22px rgba(56, 5, 93, 0.22);
}

.pdf-tool-panel {
  display: none;
  padding: 28px;
}

.pdf-tool-panel.active {
  display: block;
}

.pdf-panel-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.pdf-panel-heading h2 {
  margin: 0;
  color: #111827;
  font-size: 1.45rem;
  font-weight: 850;
}

.pdf-panel-heading p {
  margin: 4px 0 0;
  color: #64748b;
}

.pdf-file-layout,
.pdf-crop-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(280px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.pdf-side-summary {
  min-height: 260px;
  padding: 22px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #f8fafc;
}

.pdf-side-summary h3 {
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 800;
}

.pdf-empty-note,
.pdf-empty-state {
  display: flex;
  min-height: 180px;
  align-items: center;
  justify-content: center;
  border: 1px dashed #cbd5e1;
  border-radius: 16px;
  color: #64748b;
  background: #f8fafc;
  text-align: center;
}

.pdf-summary-box:not(.hidden) + .pdf-empty-note {
  display: none;
}

.pdf-dropzone {
  min-height: 280px;
  background: #fbfdff;
}

.pdf-crop-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
  padding: 22px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #f8fafc;
}

.pdf-crop-fields label {
  margin-bottom: -2px;
  color: #334155;
  font-weight: 700;
}

.pdf-pages-list {
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  max-height: none;
  overflow: visible;
  padding: 0;
}

.pdf-page-row {
  min-height: 320px;
  padding: 14px;
  background: #f8fafc;
}

.pdf-page-thumb {
  height: 226px;
}

.pdf-page-info strong {
  color: #111827;
  font-size: 0.98rem;
}

.pdf-page-info small {
  color: #64748b;
}

.pdf-page-actions {
  grid-template-columns: repeat(3, 1fr);
}

.pdf-preview-stage {
  min-height: 680px;
  background:
    linear-gradient(45deg, rgba(15, 23, 42, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(15, 23, 42, 0.04) 25%, transparent 25%),
    #eef2f7;
}

.pdf-format-grid {
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.pdf-format-card {
  min-height: 100px;
  padding: 18px;
}

.pdf-export-bar {
  margin: 0 28px 28px;
  padding: 18px;
  background: #f8fafc;
}

#pdf-error {
  margin: 0 28px 18px;
}

@media (max-width: 980px) {
  .pdf-main-tabs {
    grid-template-columns: 1fr;
  }

  .pdf-file-layout,
  .pdf-crop-layout,
  .pdf-crop-fields {
    grid-template-columns: 1fr;
  }

  .pdf-tool-panel {
    padding: 20px;
  }

  .pdf-export-bar {
    margin: 0 20px 20px;
  }
}
