/* ──────────────────────────────────────────────────────────────────
   Floati PDF Tools - shared design system
   Reuses variables from style.css (--accent, --bg, --t1 etc.)
   ────────────────────────────────────────────────────────────────── */

/* Layout wrappers - 3 size tiers based on tool content type */
.tools-page { min-height: 60vh; background: var(--bg); padding: 32px 24px 60px; }
.editor-hero + .tools-page { padding-top: 24px; }
.tools-inner { max-width: 960px; margin: 0 auto; }          /* default: thumbnail-grid tools */
.tools-inner.narrow { max-width: 640px; }                    /* simple forms (Protect, Unlock) */
.tools-inner.medium { max-width: 960px; }                    /* thumbnail grids */
.tools-inner.wide   { max-width: 1200px; }                   /* 2-col preview tools */

/* Dropzone: never stretches wider than its content needs */
.dropzone { max-width: 680px; margin: 0 auto; }
.tools-inner.wide .dropzone,
.tools-inner.narrow .dropzone,
.tools-inner.medium .dropzone { display: block; }

/* Centered content blocks (don't stretch to full container) */
.btn-action-row { justify-content: center; margin: 14px 0 10px; }
.btn-action-row .btn-primary.lg { min-width: 240px; }

/* When workspace is active (2-col tools), allow it full width */
.tools-inner.wide .tool-layout { max-width: 100%; }

/* Compact header (tool pages) */
.tool-header { text-align: left; display: flex; align-items: center; gap: 16px; margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--bd); }
.tool-header .tool-icon-lg { width: 48px; height: 48px; border-radius: 12px; margin-bottom: 0; box-shadow: 0 6px 18px var(--accent-glow); }
.tool-header .tool-header-text { flex: 1; min-width: 0; }
.tool-header .tool-title { font-size: clamp(22px, 3vw, 30px); margin-bottom: 2px; line-height: 1.15; }
.tool-header .tool-tagline { font-size: 13px; color: var(--t3); margin-bottom: 0; line-height: 1.45; }
.tool-header .tool-privacy-pill { flex-shrink: 0; font-size: 11px; padding: 5px 10px; }

/* Two-column layout: controls on left, preview/workspace on right */
.tool-layout {
  display: grid; grid-template-columns: 380px 1fr; gap: 20px;
  align-items: start;
}
.tool-layout .tool-layout-controls { position: sticky; top: 80px; }
.tool-layout .tool-layout-main { min-width: 0; }
@media (max-width: 960px) {
  .tool-layout { grid-template-columns: 1fr; }
  .tool-layout .tool-layout-controls { position: static; }
}

/* Tighten common controls spacing */
.dropzone { padding: 38px 28px; }
.dropzone.has-files { padding: 20px; }
.dropzone-icon { width: 56px; height: 56px; margin-bottom: 10px; }
.dropzone-title { font-size: 17px; }
.dropzone-sub { font-size: 13px; }
.dropzone-btn { margin-top: 12px; padding: 9px 20px; }
.btn-action-row { margin: 14px 0 10px; }

/* Back link */
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--t3); font-size: 14px; font-weight: 500;
  padding: 6px 0; margin-bottom: 16px; transition: color 0.2s;
}
.back-link:hover { color: var(--accent); }

/* Back link as eyebrow (replaces the canonical dash with a left-arrow icon) */
.editor-hero-top .qb-eyebrow.back-link-eyebrow::before { display: none; }
.editor-hero-top .qb-eyebrow.back-link-eyebrow {
  text-decoration: none;
  transition: color 0.2s;
}
.editor-hero-top .qb-eyebrow.back-link-eyebrow:hover { color: var(--t1); }

/* Hub header */
.hub-header { text-align: center; margin-bottom: 48px; }
.hub-label {
  display: inline-block; padding: 6px 14px; border-radius: 20px;
  background: var(--accent-light); color: var(--accent);
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 16px;
}
.hub-title {
  font-family: var(--display); font-size: clamp(32px, 5vw, 56px);
  font-weight: 600; line-height: 1.1; margin-bottom: 16px;
}
.hub-title .accent { color: var(--accent);  }
.hub-sub { font-size: 17px; color: var(--t3); max-width: 640px; margin: 0 auto; line-height: 1.5; }

/* Hub features row */
.hub-features {
  display: flex; flex-wrap: wrap; gap: 20px; justify-content: center;
  margin: 32px 0 48px; font-size: 14px; color: var(--t3);
}
.hub-feature { display: inline-flex; align-items: center; gap: 8px; }
.hub-feature svg { color: #059669; flex-shrink: 0; }

/* Tool grid */
.tool-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px; margin-bottom: 48px;
}
.tool-card {
  display: flex; flex-direction: column; gap: 12px; padding: 22px 20px;
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 16px;
  color: var(--t1); transition: all 0.25s; position: relative; overflow: hidden;
}
.tool-card:hover {
  transform: translateY(-3px); border-color: var(--accent);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.08);
}
.tool-card-icon {
  width: 42px; height: 42px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  background: var(--tool-color, var(--accent)); color: white;
  flex-shrink: 0;
}
.tool-card-name { font-size: 16px; font-weight: 600; color: var(--t1); }
.tool-card-tagline { font-size: 13px; color: var(--t3); line-height: 1.4; }
.tool-card-badges {
  position: absolute; top: 12px; right: 12px;
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end;
  max-width: 60%;
}
.tool-card-badge {
  padding: 3px 8px; border-radius: 12px; font-size: 10px; font-weight: 600;
  letter-spacing: 0.05em; text-transform: uppercase; white-space: nowrap;
  line-height: 1.4;
}
.tool-card-badge.popular { background: var(--accent-light); color: var(--accent); }
.tool-card-badge.free {
  background: #05966915; color: #059669;
}

/* Tool page header base (overridden by the compact rules above) */
.tool-icon-lg {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--tool-color, var(--accent)); color: white;
}
.tool-title { font-family: var(--display); font-weight: 600; }
.tool-tagline { color: var(--t3); }
.tool-privacy-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: 20px;
  background: #05966915; color: #059669;
  font-size: 13px; font-weight: 500;
}

/* Dropzone */
.dropzone {
  position: relative;
  border: 2px dashed var(--bd); border-radius: 20px;
  padding: 60px 40px; text-align: center;
  background: var(--bg2); cursor: pointer;
  transition: all 0.25s;
}
.dropzone:hover, .dropzone.drag-over {
  border-color: var(--accent); background: var(--accent-light);
  transform: scale(1.005);
}
.dropzone.has-files { padding: 24px; cursor: default; }
.dropzone-icon {
  width: 72px; height: 72px; margin: 0 auto 16px;
  border-radius: 20px; background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.dropzone-title { font-size: 20px; font-weight: 600; margin-bottom: 6px; }
.dropzone-sub { font-size: 14px; color: var(--t3); }
.dropzone-btn {
  display: inline-block; margin-top: 16px;
  padding: 10px 22px; border-radius: 10px;
  background: var(--accent); color: white; font-weight: 500; font-size: 14px;
  border: none; cursor: pointer; transition: transform 0.15s;
}
.dropzone-btn:hover { transform: translateY(-1px); }
.dropzone input[type="file"] { display: none; }

/* Page thumbnails */
.thumb-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px; margin: 24px 0;
}
.thumb {
  position: relative; background: var(--bg2);
  border: 1px solid var(--bd); border-radius: 10px; overflow: hidden;
  transition: all 0.2s; cursor: grab;
}
.thumb:hover { border-color: var(--accent); transform: translateY(-2px); }
.thumb.dragging { opacity: 0.5; cursor: grabbing; }
.thumb.drag-over { border-color: var(--accent); border-width: 2px; }
.thumb canvas { display: block; width: 100%; height: auto; }
.thumb-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 6px 8px; background: rgba(0,0,0,0.7); color: white;
  font-size: 11px; font-weight: 500; text-align: center;
}
.thumb-actions {
  position: absolute; top: 6px; right: 6px;
  display: flex; gap: 4px; opacity: 0; transition: opacity 0.2s;
}
.thumb:hover .thumb-actions { opacity: 1; }
.thumb-action {
  width: 28px; height: 28px; border-radius: 6px;
  background: rgba(0,0,0,0.7); color: white; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.thumb-action:hover { background: var(--accent); }
.thumb-action.danger:hover { background: #e11d48; }
.thumb-rotation-0 canvas { transform: rotate(0deg); }
.thumb-rotation-90 canvas { transform: rotate(90deg) scale(0.7); }
.thumb-rotation-180 canvas { transform: rotate(180deg); }
.thumb-rotation-270 canvas { transform: rotate(270deg) scale(0.7); }

/* File header row (for multi-file tools like merge) */
.file-group {
  margin-bottom: 24px; background: var(--bg2);
  border: 1px solid var(--bd); border-radius: 14px; overflow: hidden;
}
.file-group-header {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; background: var(--bg3); border-bottom: 1px solid var(--bd);
  font-weight: 500; font-size: 14px;
}
.file-group-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-group-meta { font-size: 12px; color: var(--t3); font-weight: 400; }
.file-group-remove {
  padding: 4px 8px; border-radius: 6px; background: transparent;
  color: var(--t3); border: none; cursor: pointer; font-size: 12px;
}
.file-group-remove:hover { background: #e11d4815; color: #e11d48; }
.file-group-body { padding: 14px; }

/* Tool controls panel */
.controls-panel {
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 14px;
  padding: 18px 20px; margin: 14px 0;
}
.controls-panel + .controls-panel { margin-top: -4px; }
.controls-panel > * + * { margin-top: 14px; }
.controls-panel > .controls-row + .controls-row { margin-top: 10px; }
.controls-panel > p { margin-top: 10px; }
.controls-row {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: end;
}
.control-group { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 150px; }
.control-label { font-size: 12px; font-weight: 600; color: var(--t3); letter-spacing: 0.04em; text-transform: uppercase; }
.control-input {
  padding: 10px 12px; border-radius: 8px; font-size: 14px;
  background: var(--bg); color: var(--t1); border: 1px solid var(--bd);
  font-family: var(--font);
  width: 100%;
}
.control-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
/* Remove native number input spinners (always show big steppers instead) */
.control-input[type="number"] { -moz-appearance: textfield; }
.control-input[type="number"]::-webkit-outer-spin-button,
.control-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}

/* Custom color picker (replaces native <input type="color">) */
.color-picker { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.color-swatch {
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer;
  border: 2px solid transparent; transition: all 0.15s;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
.color-swatch:hover { transform: scale(1.1); }
.color-swatch.selected { border-color: var(--t1); box-shadow: 0 0 0 2px var(--bg2), 0 0 0 4px var(--accent); }
.color-swatch-custom {
  position: relative; overflow: hidden;
  background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red);
}
.color-swatch-custom input[type="color"] {
  position: absolute; inset: -4px; opacity: 0; cursor: pointer;
}

/* Stepper (minus/plus buttons around number input) */
.stepper { display: flex; align-items: stretch; border: 1px solid var(--bd); border-radius: 8px; overflow: hidden; background: var(--bg); }
.stepper:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.stepper-btn {
  width: 36px; background: transparent; color: var(--t2); border: none;
  cursor: pointer; font-family: var(--font); font-size: 16px; font-weight: 600;
  transition: background 0.15s;
}
.stepper-btn:hover { background: var(--bg3); color: var(--t1); }
.stepper-input {
  flex: 1; min-width: 40px; padding: 10px 4px; text-align: center;
  border: none; background: transparent; color: var(--t1);
  font-family: var(--font); font-size: 14px;
  border-left: 1px solid var(--bd); border-right: 1px solid var(--bd);
}
.stepper-input:focus { outline: none; }

/* 2-column toggle grid (becomes single-col on narrow screens) */
.toggle-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px 24px;
}
@media (max-width: 640px) { .toggle-grid { grid-template-columns: 1fr; } }
.toggle-grid .toggle-row { padding: 4px 0; }

/* Radio group */
.radio-group { display: flex; gap: 8px; flex-wrap: wrap; }
.radio-option {
  position: relative; padding: 10px 14px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--bd); cursor: pointer;
  font-size: 14px; transition: all 0.15s; font-weight: 500;
}
.radio-option:hover { border-color: var(--accent); }
.radio-option.selected {
  background: var(--accent-light); color: var(--accent);
  border-color: var(--accent);
}
.radio-option input { position: absolute; opacity: 0; pointer-events: none; }
.radio-option-desc { display: block; font-size: 11px; color: var(--t3); font-weight: 400; margin-top: 2px; }
.radio-option.selected .radio-option-desc { color: var(--accent); opacity: 0.9; }

/* Toggle */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.toggle-label { font-size: 14px; font-weight: 500; }
.toggle-sub { font-size: 12px; color: var(--t3); margin-top: 2px; }
.toggle {
  position: relative; width: 40px; height: 22px; border-radius: 11px;
  background: var(--bd); cursor: pointer; transition: background 0.2s;
  flex-shrink: 0;
}
.toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 18px; height: 18px; border-radius: 50%; background: white;
  transition: transform 0.2s;
}
.toggle.on { background: var(--accent); }
.toggle.on::after { transform: translateX(18px); }

/* Buttons */
.btn-primary, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 24px; border-radius: 10px; font-weight: 600;
  font-size: 14px; border: none; cursor: pointer;
  font-family: var(--font); transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px var(--accent-glow); }
.btn-primary:disabled { background: var(--bd); color: var(--t3); cursor: not-allowed; transform: none; box-shadow: none; }
.btn-secondary { background: var(--bg2); color: var(--t1); border: 1px solid var(--bd); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary.lg, .btn-secondary.lg { padding: 14px 32px; font-size: 15px; }
.btn-action-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin: 24px 0; }

/* Progress bar */
.progress-wrap { margin: 24px 0; display: none; }
.progress-wrap.active { display: block; }
.progress-label { font-size: 13px; color: var(--t3); margin-bottom: 8px; display: flex; justify-content: space-between; }
.progress-track { height: 8px; background: var(--bd); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width 0.2s; border-radius: 4px; }

/* Toast */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 10000; display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.toast {
  padding: 12px 20px; border-radius: 12px;
  background: var(--t1); color: var(--bg);
  font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15);
  display: flex; align-items: center; gap: 10px;
  animation: toastIn 0.25s ease-out;
  max-width: 90vw;
}
.toast.success { background: #059669; color: white; }
.toast.error { background: #e11d48; color: white; }
@keyframes toastIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* Privacy verification panel */
.privacy-panel {
  display: flex; flex-wrap: wrap; gap: 20px; padding: 20px 24px;
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 14px;
  max-width: 820px; margin: 24px auto;
}
.privacy-stat {
  display: flex; align-items: center; gap: 10px;
  flex: 1; min-width: 200px;
}
.privacy-stat-icon {
  width: 36px; height: 36px; border-radius: 10px;
  background: #05966915; color: #059669;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.privacy-stat-label { font-size: 12px; color: var(--t3); margin-bottom: 2px; }
.privacy-stat-value { font-size: 14px; font-weight: 600; color: var(--t1); }
.privacy-stat-value.ok { color: #059669; }

/* FAQ */
.faq-section { max-width: 720px; margin: 56px auto 32px; }
.faq-title { font-family: var(--display); font-size: 32px; font-weight: 600; text-align: center; margin-bottom: 28px; }
.faq-list { max-width: 720px; margin: 0 auto; }
.faq-item {
  border-bottom: 1px solid var(--bd); padding: 18px 0; cursor: pointer;
}
.faq-q {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 16px; font-weight: 600; color: var(--t1); gap: 20px;
}
.faq-q-icon { flex-shrink: 0; color: var(--t3); transition: transform 0.2s; }
.faq-item.open .faq-q-icon { transform: rotate(180deg); }
.faq-a {
  margin-top: 10px; font-size: 14px; color: var(--t3); line-height: 1.6;
  max-height: 0; overflow: hidden; transition: max-height 0.3s;
}
.faq-item.open .faq-a { max-height: 400px; }

/* Tool footer / related tools */
.related-tools { max-width: 960px; margin: 48px auto 0; }
.related-title { font-size: 14px; font-weight: 600; color: var(--t3); letter-spacing: 0.08em; text-transform: uppercase; text-align: center; margin-bottom: 20px; }
.related-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px; max-width: 960px; margin: 0 auto;
}
.related-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 12px;
  color: var(--t1); transition: all 0.2s; font-size: 14px;
}
.related-card:hover { border-color: var(--accent); transform: translateX(2px); }
.related-card-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--tool-color, var(--accent)); color: white;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.related-card-name { font-weight: 500; }

/* Signature canvas */
.sig-tabs { display: flex; gap: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--bd); padding-bottom: 0; }
.sig-tab {
  padding: 10px 16px; cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--t3); border-bottom: 2px solid transparent; transition: all 0.15s;
  background: none; border-left: none; border-right: none; border-top: none;
  font-family: var(--font);
}
.sig-tab:hover { color: var(--t1); }
.sig-tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.sig-canvas-wrap { position: relative; }
.sig-canvas {
  width: 100%; height: 180px; background: var(--bg);
  border: 1px solid var(--bd); border-radius: 10px; cursor: crosshair;
  touch-action: none;
}
.sig-clear {
  position: absolute; top: 8px; right: 8px; padding: 6px 10px;
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 6px;
  font-size: 12px; color: var(--t3); cursor: pointer;
}
.sig-clear:hover { color: #e11d48; border-color: #e11d48; }
.sig-preview {
  border: 1px solid var(--bd); border-radius: 10px; padding: 20px;
  min-height: 100px; display: flex; align-items: center; justify-content: center;
  background: var(--bg);
}
.sig-typed-input {
  width: 100%; padding: 14px; font-size: 36px; text-align: center;
  font-family: 'Dancing Script', 'Pacifico', cursive;
  border: 1px solid var(--bd); border-radius: 10px; background: var(--bg);
}

/* Custom file picker button (replaces native <input type="file">) */
.file-picker {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border: 1px dashed var(--bd); border-radius: 12px;
  background: var(--bg); transition: border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.file-picker:hover { border-color: var(--accent); background: var(--accent-light); }
.file-picker input[type="file"] { display: none; }
.file-picker-btn {
  padding: 8px 14px; background: var(--accent); color: white;
  border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
  white-space: nowrap; border: none; font-family: var(--font);
  flex-shrink: 0;
}
.file-picker-btn:hover { opacity: 0.9; }
.file-picker-name { font-size: 13px; color: var(--t3); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-picker-name.chosen { color: var(--t1); font-weight: 500; }

/* Custom select (replaces native <select>) */
.custom-select {
  position: relative; width: 100%;
}
.custom-select-trigger {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px; background: var(--bg); color: var(--t1);
  border: 1px solid var(--bd); border-radius: 8px;
  font-size: 14px; font-family: var(--font); cursor: pointer;
  transition: border-color 0.15s;
  width: 100%; text-align: left;
}
.custom-select-trigger:hover { border-color: var(--accent); }
.custom-select.open .custom-select-trigger { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.custom-select-chev { color: var(--t3); transition: transform 0.2s; flex-shrink: 0; }
.custom-select.open .custom-select-chev { transform: rotate(180deg); }
.custom-select-menu {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.08);
  z-index: 50; max-height: 280px; overflow-y: auto;
  padding: 4px; display: none;
  animation: csOpen 0.14s ease;
}
.custom-select.open .custom-select-menu { display: block; }
@keyframes csOpen { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.custom-select-option {
  padding: 9px 12px; border-radius: 6px; cursor: pointer;
  font-size: 14px; color: var(--t2); transition: background 0.1s;
}
.custom-select-option:hover { background: var(--bg3); color: var(--t1); }
.custom-select-option.selected { background: var(--accent-light); color: var(--accent); font-weight: 600; }

/* Carousel navigation (for multi-page tools) */
.carousel-nav {
  display: flex; align-items: center; justify-content: center;
  gap: 16px; margin: 20px auto 0;
  padding: 12px 16px; background: var(--bg2);
  border: 1px solid var(--bd); border-radius: 14px;
  max-width: 420px;
}
.carousel-btn {
  display: flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--bg); color: var(--t1);
  border: 1px solid var(--bd); cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
  flex-shrink: 0;
}
.carousel-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }
.carousel-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.carousel-label {
  flex: 1; text-align: center; font-size: 14px; font-weight: 600;
  color: var(--t1); min-width: 120px;
}
.carousel-label-sub { display: block; font-size: 11px; color: var(--t3); font-weight: 400; margin-top: 1px; }

/* Split colour-coded page groups */
.thumb.group-0 { box-shadow: 0 0 0 3px #6366f1; }
.thumb.group-1 { box-shadow: 0 0 0 3px #0891b2; }
.thumb.group-2 { box-shadow: 0 0 0 3px #059669; }
.thumb.group-3 { box-shadow: 0 0 0 3px #d97706; }
.thumb.group-4 { box-shadow: 0 0 0 3px #e11d48; }
.thumb.group-5 { box-shadow: 0 0 0 3px #7c3aed; }
.thumb.group-6 { box-shadow: 0 0 0 3px #6366f1; }
.thumb.group-7 { box-shadow: 0 0 0 3px #0891b2; }

/* Watermark live preview */
.preview-area {
  display: flex; flex-direction: column; align-items: center;
  padding: 20px; background: var(--bg3); border-radius: 14px;
  margin: 14px 0; position: relative;
}
.preview-area-scroll {
  max-width: 100%; max-height: 70vh; overflow: auto;
  padding: 4px; border-radius: 8px; text-align: center;
}
.preview-area-scroll > * { display: inline-block; }
/* When zoomed beyond container width, the zoomable canvas should not shrink */
.preview-area-scroll .watermark-preview.zoomable { max-width: none; flex-shrink: 0; }
.zoom-nav {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg2); border: 1px solid var(--bd); border-radius: 10px;
  padding: 4px; margin-top: 10px;
}
.zoom-btn {
  width: 34px; height: 34px; border-radius: 7px;
  background: transparent; color: var(--t2); border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all 0.15s; font-family: var(--font);
}
.zoom-btn:hover:not(:disabled) { background: var(--bg3); color: var(--accent); }
.zoom-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.zoom-level {
  min-width: 60px; text-align: center; font-size: 12px; font-weight: 600;
  color: var(--t1); font-family: 'JetBrains Mono', monospace;
  padding: 0 4px;
}
.zoom-nav + .carousel-nav { margin-top: 10px; }
.preview-area-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--t3); margin-bottom: 12px; }
.watermark-preview {
  position: relative; display: inline-block;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1); border-radius: 4px; overflow: hidden;
  background: white;
}
.watermark-preview canvas { display: block; }
/* Keep auto-fit behaviour on unzoomed previews (jpg-to-pdf, ocr, etc.) */
.watermark-preview:not(.zoomable) canvas { max-width: 100%; height: auto; }
.watermark-overlay {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.watermark-overlay.anchor-top { align-items: flex-start; padding-top: 5%; }
.watermark-overlay.anchor-bottom { align-items: flex-end; padding-bottom: 5%; }
.watermark-overlay.anchor-left { justify-content: flex-start; padding-left: 5%; }
.watermark-overlay.anchor-right { justify-content: flex-end; padding-right: 5%; }
.watermark-text {
  font-family: 'Helvetica Neue', Arial, sans-serif; font-weight: 700;
  white-space: nowrap; user-select: none;
  transition: opacity 0.1s linear, color 0.1s linear;
}
.watermark-overlay.behind { z-index: 0; }
.watermark-overlay.behind + canvas { position: relative; z-index: 1; mix-blend-mode: multiply; }

/* Position picker (3x3 grid) */
.position-picker {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px;
  padding: 4px; background: var(--bg); border: 1px solid var(--bd); border-radius: 10px;
  width: max-content;
}
.position-cell {
  width: 28px; height: 28px; border-radius: 6px;
  background: transparent; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  padding: 0;
}
.position-cell:hover { background: var(--bg3); }
.position-cell.selected { background: var(--accent); }
.position-cell-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--t4); }
.position-cell.selected .position-cell-dot { background: white; }

/* Size estimate card (for compress) */
.size-estimate {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin: 14px 0 0;
}
.size-estimate-card {
  padding: 14px; background: var(--bg); border: 1px solid var(--bd);
  border-radius: 10px; text-align: center; cursor: pointer;
  transition: all 0.15s;
}
.size-estimate-card:hover { border-color: var(--accent); }
.size-estimate-card.selected {
  background: var(--accent-light); border-color: var(--accent);
}
.size-estimate-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--t3); margin-bottom: 4px; }
.size-estimate-value { font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 700; color: var(--t1); }
.size-estimate-savings { font-size: 12px; color: #059669; font-weight: 600; margin-top: 2px; }

/* Placement overlay for sign */
.pdf-page-preview {
  position: relative; display: inline-block; margin: 0 auto;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1); border-radius: 4px; overflow: hidden;
}
.page-preview-canvas { display: block; max-width: 100%; }
.sig-placement {
  position: absolute; top: 0; left: 0; cursor: move;
  border: 2px dashed var(--accent); border-radius: 4px;
  padding: 2px; display: flex; align-items: center; justify-content: center;
}
.sig-placement img { max-width: 100%; max-height: 100%; pointer-events: none; user-select: none; -webkit-user-drag: none; }
.sig-placement-handle {
  position: absolute; bottom: -6px; right: -6px; width: 14px; height: 14px;
  background: var(--accent); border-radius: 50%; cursor: nwse-resize;
  border: 2px solid white; box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}
.sig-placement-delete {
  position: absolute; top: -8px; left: -8px; width: 22px; height: 22px;
  background: #e11d48; color: white; border: 2px solid white; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2); transition: transform 0.15s;
  padding: 0; font-family: var(--font);
}
.sig-placement-delete:hover { transform: scale(1.1); }

/* Paste button */
.paste-btn {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 10px 14px; border-radius: 8px;
  background: var(--bg2); color: var(--t2); border: 1px dashed var(--bd);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: var(--font); transition: all 0.15s;
}
.paste-btn:hover { border-color: var(--accent); color: var(--accent); border-style: solid; }

/* Empty state */
.empty-msg { text-align: center; padding: 40px 20px; color: var(--t3); }

/* Content sections (SEO) */
.content-section { margin: 64px 0; }
.content-section h2 { font-family: var(--display); font-size: 28px; margin-bottom: 16px; }
.content-section p { font-size: 15px; color: var(--t2); line-height: 1.6; margin-bottom: 12px; max-width: 720px; }
.content-section .tip-row {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px; margin: 24px 0;
}
.tip-card {
  padding: 20px; background: var(--bg2); border: 1px solid var(--bd); border-radius: 12px;
}
.tip-card-num {
  font-family: var(--display); font-size: 28px; color: var(--accent); font-weight: 600;
  margin-bottom: 8px;
}
.tip-card-title { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.tip-card-desc { font-size: 13px; color: var(--t3); line-height: 1.5; }

/* Responsive */
@media (max-width: 640px) {
  .tools-page { padding: 80px 16px 40px; }
  .dropzone { padding: 40px 20px; }
  .controls-row { flex-direction: column; align-items: stretch; }
  .control-group { width: 100%; }
  .btn-action-row .btn-primary, .btn-action-row .btn-secondary { width: 100%; }
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
}

/* Focus indicators (a11y) */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
