:root {
  --muted: var(--text-muted);
  --success: var(--green);
  --danger: #ff7a8a;
}

.workspace-page { min-height: 100vh; background: radial-gradient(circle at 85% 5%, rgba(114,230,255,.08), transparent 30%), var(--bg); }
.workspace-header { position: sticky; top: 0; }
.workspace-actions { display: flex; align-items: center; gap: 9px; }
.back-link { gap: 8px; white-space: nowrap; }
.back-link-short { display: none; }
.workspace-shell { padding-top: calc(var(--header-height) + 44px); padding-bottom: 80px; }
.workspace-intro { display: flex; align-items: end; justify-content: space-between; gap: 28px; margin-bottom: 28px; }
.workspace-intro h1 { margin: 7px 0 8px; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.05; }
.workspace-intro > div > p:last-child { max-width: 720px; margin: 0; color: var(--text-soft); }
.privacy-pill { display: inline-flex; align-items: center; gap: 9px; flex: 0 0 auto; padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-soft); font-size: .82rem; background: rgba(13,29,46,.78); }
.privacy-pill span { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 12px var(--green); }
.workspace-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 22px; align-items: start; }
.workspace-controls { display: grid; gap: 22px; min-width: 0; }
.workspace-preview { min-width: 0; position: sticky; top: calc(var(--header-height) + 22px); }
.workspace-card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(145deg, rgba(16,35,56,.94), rgba(9,23,38,.94)); box-shadow: 0 24px 70px rgba(0,0,0,.2); padding: clamp(18px, 3vw, 28px); overflow: hidden; }
.card-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.card-heading h2 { margin: 0; font-size: 1.1rem; }
.card-heading p { margin: 2px 0 0; color: var(--text-muted); font-size: .82rem; }
.step-number { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px; color: var(--primary); background: rgba(114,230,255,.09); border: 1px solid rgba(114,230,255,.2); font-size: .72rem; font-weight: 800; }
.drop-zone { position: relative; display: grid; justify-items: center; gap: 7px; min-height: 230px; padding: 34px 20px; text-align: center; border-radius: 20px; border: 1px dashed rgba(114,230,255,.45); background: rgba(5,16,29,.55); transition: transform .2s ease, border-color .2s ease, background .2s ease; }
.drop-zone:hover, .drop-zone.is-dragging { transform: translateY(-2px); border-color: var(--primary); background: rgba(114,230,255,.08); }
.native-file-input { display: none; }
.upload-glyph { display: grid; place-items: center; width: 54px; height: 54px; margin-bottom: 4px; border-radius: 17px; color: #06101d; background: linear-gradient(135deg, var(--primary), #a4f2ff); font-size: 1.65rem; font-weight: 900; box-shadow: 0 12px 30px rgba(114,230,255,.18); }
.drop-zone strong { font-size: 1.04rem; }.drop-zone span { color: var(--text-soft); font-size: .88rem; }.drop-zone small { margin-top: 10px; color: var(--text-muted); font-size: .74rem; }
.status-text { min-height: 23px; padding-top: 10px; text-align: center; font-size: .84rem; font-weight: 700; }
.field { display: grid; gap: 9px; margin-bottom: 18px; }.field label, .field-header label { color: var(--text-soft); font-size: .84rem; font-weight: 700; }.field-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }.field-header span { color: var(--primary); font-weight: 800; }
.field input[type="number"], .field select { width: 100%; min-height: 48px; padding: 11px 13px; color: var(--text); border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg-soft); outline: none; }.field input:focus, .field select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(114,230,255,.1); }
.field input[type="range"] { width: 100%; accent-color: var(--primary); }.split-fields { grid-template-columns: 1fr 1fr; }.split-fields label { display: grid; gap: 8px; }
.quality-note { display: block; margin-top: 7px; color: var(--text-muted); font-size: .7rem; line-height: 1.45; }
.signature-modes { margin: 0 0 18px; padding: 0; border: 0; }
.signature-modes legend { margin-bottom: 9px; color: var(--text-soft); font-size: .84rem; font-weight: 800; }
.signature-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.signature-mode-grid label { position: relative; min-width: 0; cursor: pointer; }
.signature-mode-grid input { position: absolute; opacity: 0; pointer-events: none; }
.signature-mode-grid span { display: grid; gap: 2px; min-height: 58px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 11px; color: var(--text-soft); background: rgba(255,255,255,.025); font-size: .76rem; font-weight: 800; }
.signature-mode-grid small { color: var(--text-muted); font-size: .64rem; font-weight: 500; }
.signature-mode-grid input:checked + span { color: var(--primary); border-color: rgba(114,230,255,.55); background: rgba(114,230,255,.08); box-shadow: 0 0 0 2px rgba(114,230,255,.06); }
.signature-mode-grid input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.signature-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; transition: opacity .18s ease; }
.signature-controls.is-disabled { opacity: .42; }
.compact-range { margin-bottom: 14px; }
.signature-quality-note { margin: 0 0 16px; padding: 10px 11px; border: 1px solid rgba(114,224,161,.16); border-radius: 10px; background: rgba(114,224,161,.05); }
.checkbox-row { display: flex; align-items: center; gap: 9px; margin: -3px 0 18px; color: var(--text-soft); font-size: .84rem; }.checkbox-row input { accent-color: var(--primary); }
.process-btn { width: 100%; justify-content: center; min-height: 50px; border: 0; }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }.preset-row button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: rgba(255,255,255,.03); color: var(--text-soft); font-size: .76rem; }.preset-row button:hover { color: var(--primary); border-color: rgba(114,230,255,.4); }
.tool-note { display: grid; gap: 3px; margin-bottom: 18px; padding: 13px; border: 1px solid rgba(114,224,161,.2); border-radius: 12px; background: rgba(114,224,161,.06); }.tool-note strong { color: var(--green); font-size: .83rem; }.tool-note span { color: var(--text-soft); font-size: .76rem; }
.preview-card { min-height: 590px; }.empty-preview { min-height: 470px; display: grid; align-content: center; justify-items: center; gap: 8px; text-align: center; color: var(--text-muted); border: 1px dashed var(--line-strong); border-radius: 20px; background: rgba(5,16,29,.38); }.empty-preview div { font-size: 2.4rem; color: var(--primary); }.empty-preview strong { color: var(--text-soft); }.empty-preview span { font-size: .82rem; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }.preview-toolbar > span { padding: 5px 9px; border-radius: 7px; color: var(--primary); background: rgba(114,230,255,.09); font-size: .72rem; font-weight: 800; text-transform: uppercase; }.preview-toolbar div { display: flex; gap: 6px; }.preview-toolbar button { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-soft); background: transparent; font-size: .73rem; }
.image-preview-wrap { display: grid; place-items: center; min-height: 330px; max-height: 430px; border-radius: 17px; overflow: hidden; background: #030a12; border: 1px solid var(--line); }.image-preview { width: 100%; height: 100%; max-height: 430px; object-fit: contain; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 12px 0 0; }.info-grid div { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }.info-grid dt { color: var(--text-muted); font-size: .68rem; text-transform: uppercase; }.info-grid dd { margin: 2px 0 0; color: var(--text-soft); font-size: .78rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compare-hint { display: grid; gap: 2px; margin-top: 12px; padding: 11px 12px; border-radius: 11px; background: rgba(140,124,255,.07); border: 1px solid rgba(140,124,255,.15); }.compare-hint strong { font-size: .78rem; }.compare-hint span { color: var(--text-muted); font-size: .72rem; }
.results-box { margin-top: 18px; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(4,13,24,.72); }.results-box p { margin-top: 0; }.results-box .btn { text-decoration: none; }.hidden { display: none !important; }
.bulk-picker { display: grid; place-items: center; min-height: 110px; padding: 20px; border: 1px dashed rgba(114,230,255,.4); border-radius: 15px; color: var(--primary); background: rgba(5,16,29,.5); cursor: pointer; font-weight: 800; }.bulk-status { min-height: 24px; padding: 8px 0; color: var(--text-soft); font-size: .82rem; }.bulk-preview-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 8px; margin-bottom: 18px; }.bulk-preview-grid figure { min-width: 0; margin: 0; }.bulk-preview-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 9px; border: 1px solid var(--line); }.bulk-preview-grid figcaption { margin-top: 4px; color: var(--text-muted); font-size: .63rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.pixora-compare { margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--line); }.pixora-compare-header h3 { margin: 0; font-size: 1rem; }.pixora-compare-header p { margin: 3px 0 12px; color: var(--text-muted); font-size: .78rem; }.pixora-compare-viewport { position: relative; width: 100%; aspect-ratio: 4/3; min-height: 240px; overflow: hidden; border: 1px solid var(--line-strong); border-radius: 14px; background: #030a12; touch-action: pan-y; cursor: ew-resize; }.pixora-compare-viewport{user-select:none;-webkit-user-select:none;-webkit-touch-callout:none}.pixora-compare-viewport.is-dragging{cursor:ew-resize}.pixora-compare-layer { position: absolute; inset: 0; overflow: hidden; }.pixora-compare-before { z-index: 2; width: 50%; }.pixora-compare-after { z-index: 1; }.pixora-compare-image { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: contain; user-select: none; pointer-events: none; }.pixora-compare-before .pixora-compare-image { width: var(--comparison-width, 100%); }.pixora-compare-label { position: absolute; top: 10px; z-index: 4; padding: 5px 8px; border-radius: 7px; background: rgba(3,10,18,.75); color: #fff; font-size: .68rem; font-weight: 800; }.pixora-compare-label-before { left: 10px; }.pixora-compare-label-after { right: 10px; }.pixora-compare-handle { position: absolute; top: 0; bottom: 0; left: 50%; z-index: 6; width: 42px; border: 0; background: transparent; transform: translateX(-50%); touch-action: none; }.pixora-compare-handle-line { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; background: var(--primary); box-shadow: 0 0 10px rgba(114,230,255,.8); }.pixora-compare-handle-circle { position: absolute; top: 50%; left: 50%; display: flex; align-items: center; justify-content: space-around; width: 42px; height: 42px; padding: 0 8px; border-radius: 50%; color: #06101d; background: var(--primary); transform: translate(-50%,-50%); pointer-events: none; }.pixora-compare-arrow { font-size: .7rem; }.pixora-compare-controls { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 9px; margin-top: 10px; }.pixora-compare-range { width: 100%; accent-color: var(--primary); }.pixora-compare-percentage { min-width: 42px; color: var(--text-soft); font-size: .73rem; }.pixora-compare-reset { padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--text-soft); font-size: .7rem; }

.pixora-compare-before { width: 100%; }
.pixora-compare-before .pixora-compare-image { width: 100%; }
.pixora-compare-layer { width: 100%; height: 100%; transform: none; }
.pixora-compare-image { inset: 50% auto auto 50%; object-position: 50% 50%; transform: translate(-50%, -50%); }
.pixora-compare-label { transition: opacity .16s ease, visibility .16s ease; }
.pixora-compare-label.is-hidden { opacity: 0; visibility: hidden; }

html[data-theme="light"] .workspace-page { background: radial-gradient(circle at 85% 5%, rgba(8,127,159,.08), transparent 30%), var(--bg); }
html[data-theme="light"] .workspace-card { background: linear-gradient(145deg, rgba(255,255,255,.98), rgba(237,245,251,.96)); box-shadow: 0 20px 55px rgba(32,67,92,.12); }
html[data-theme="light"] .drop-zone, html[data-theme="light"] .empty-preview, html[data-theme="light"] .image-preview-wrap, html[data-theme="light"] .results-box { background: rgba(227,239,248,.68); }
html[data-theme="light"] .field input[type="number"], html[data-theme="light"] .field select { background: #fff; }

@media (max-width: 900px) { .workspace-grid { grid-template-columns: 1fr; }.workspace-preview { position: static; order: -1; }.workspace-intro { align-items: flex-start; flex-direction: column; }.preview-card { min-height: 0; }.empty-preview { min-height: 300px; } }
@media (max-width: 600px) { .workspace-shell { padding-top: calc(var(--header-height) + 24px); }.workspace-card { border-radius: 18px; padding: 16px; }.back-link { padding: 9px 11px; font-size: .72rem; }.back-link span { display: none; }.split-fields { grid-template-columns: 1fr; }.info-grid { grid-template-columns: 1fr; }.image-preview-wrap { min-height: 250px; }.bulk-preview-grid { grid-template-columns: 1fr 1fr; }.pixora-compare-controls { grid-template-columns: 1fr auto; }.pixora-compare-reset { grid-column: 1 / -1; }.pixora-compare-image {
    object-position: center center !important;
  }.privacy-pill { white-space: normal; } }

/* =========================================================
   MODERN TOOL WORKSPACE
========================================================= */

.workspace-page {
  background:
    radial-gradient(circle at 8% 16%, rgba(114, 230, 255, .08), transparent 26%),
    radial-gradient(circle at 90% 11%, rgba(140, 124, 255, .09), transparent 30%),
    var(--bg);
}

.workspace-shell { padding-top: calc(var(--header-height) + 32px); }
.workspace-breadcrumb { display: flex; align-items: center; gap: 8px; margin-bottom: 17px; color: var(--text-muted); font-size: .72rem; }
.workspace-breadcrumb a { color: var(--text-soft); }
.workspace-breadcrumb a:hover { color: var(--primary); }

.workspace-intro {
  align-items: stretch;
  margin-bottom: 22px;
  padding: clamp(20px, 3.5vw, 34px);
  border: 1px solid var(--line);
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(16, 35, 56, .88), rgba(8, 23, 38, .72));
  box-shadow: 0 24px 70px rgba(0, 0, 0, .16);
  overflow: hidden;
}

.workspace-intro-copy { display: grid; align-content: center; min-width: 0; }
.workspace-title-row { display: flex; align-items: center; gap: 16px; }
.workspace-tool-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(114, 230, 255, .26);
  border-radius: 18px;
  color: #06101d;
  background: linear-gradient(135deg, var(--primary), #9ef1ff);
  box-shadow: 0 15px 36px rgba(114, 230, 255, .16);
  font-size: 1.35rem;
  font-weight: 900;
}

.workspace-intro h1 { margin: 4px 0 0; }
.workspace-intro-copy > p { max-width: 700px; margin: 14px 0 0; color: var(--text-soft); line-height: 1.65; }
.workspace-trust { display: flex; flex-wrap: wrap; gap: 9px 16px; margin-top: 17px; color: var(--text-muted); font-size: .72rem; }
.workspace-trust span::first-letter { color: var(--green); }

.workspace-flow-card {
  display: grid;
  align-content: center;
  gap: 12px;
  flex: 0 0 min(390px, 38%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(3, 13, 24, .34);
}
.workspace-flow-card > strong { font-size: .82rem; }
.workspace-flow-card > div { display: grid; grid-template-columns: auto auto 1fr auto auto 1fr auto auto; align-items: center; gap: 7px; }
.workspace-flow-card span { display: grid; place-items: center; width: 27px; height: 27px; border-radius: 9px; color: var(--primary); background: rgba(114, 230, 255, .09); font-size: .62rem; font-weight: 900; }
.workspace-flow-card b { color: var(--text-soft); font-size: .67rem; }
.workspace-flow-card i { height: 1px; background: linear-gradient(90deg, var(--line-strong), rgba(114, 230, 255, .38)); }
.workspace-flow-card small { color: var(--text-muted); font-size: .67rem; }

.workspace-grid { grid-template-columns: minmax(340px, .82fr) minmax(0, 1.18fr); gap: 18px; }
.workspace-grid.is-bulk { grid-template-columns: minmax(0, 880px); justify-content: center; }
.workspace-card { position: relative; border-radius: 22px; }
.upload-card::before, .preview-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 28px;
  right: 28px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(114, 230, 255, .45), transparent);
}

.drop-zone { min-height: 280px; border-width: 1.5px; cursor: pointer; }
.upload-orbit { position: relative; display: grid; place-items: center; width: 90px; height: 90px; margin-bottom: 2px; border: 1px solid rgba(114, 230, 255, .15); border-radius: 50%; }
.upload-orbit::before, .upload-orbit::after { content: ""; position: absolute; border: 1px solid rgba(140, 124, 255, .13); border-radius: 50%; }
.upload-orbit::before { inset: 8px -14px; transform: rotate(25deg); }
.upload-orbit::after { inset: 8px -14px; transform: rotate(-25deg); }
.upload-glyph { position: relative; z-index: 1; margin: 0; }
.drop-zone-action { margin-top: 7px; padding: 9px 15px; border-radius: 10px; color: #06101d !important; background: var(--primary); font-size: .76rem !important; font-weight: 900; box-shadow: 0 9px 22px rgba(114, 230, 255, .16); }

.preview-card { min-height: 630px; }
.bulk-preview-pane { min-height: 500px; }
.bulk-preview-pane .bulk-status { margin-bottom: 10px; padding: 9px 11px; border: 1px solid rgba(114, 224, 161, .16); border-radius: 10px; color: var(--green); background: rgba(114, 224, 161, .055); }
.bulk-preview-pane .bulk-preview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.bulk-preview-pane .bulk-preview-grid img { aspect-ratio: 4 / 3; border-radius: 13px; background: #030a12; }
.bulk-preview-pane .bulk-preview-grid figcaption { padding-inline: 2px; font-size: .68rem; }
.empty-preview { min-height: 500px; padding: clamp(24px, 5vw, 48px); gap: 22px; background: radial-gradient(circle at 50% 38%, rgba(114, 230, 255, .07), transparent 36%), rgba(5, 16, 29, .38); }
.empty-visual { position: relative; width: 180px; height: 150px; }
.empty-image-card { position: absolute; display: block; width: 116px; height: 92px; border: 1px solid rgba(114, 230, 255, .28); border-radius: 17px; box-shadow: 0 18px 38px rgba(0, 0, 0, .24); }
.empty-image-back { top: 12px; left: 8px; background: linear-gradient(145deg, #132b42, #091829); transform: rotate(-8deg); opacity: .72; }
.empty-image-front { right: 7px; bottom: 9px; overflow: hidden; background: linear-gradient(150deg, #12314a, #0b1c2e); transform: rotate(5deg); }
.empty-image-front::before { content: ""; position: absolute; left: 15px; bottom: 14px; width: 88px; height: 44px; background: linear-gradient(145deg, rgba(114, 230, 255, .52), rgba(140, 124, 255, .28)); clip-path: polygon(0 100%, 30% 32%, 51% 65%, 72% 18%, 100% 100%); }
.empty-image-front i { position: absolute; top: 15px; right: 17px; width: 14px; height: 14px; border-radius: 50%; background: #72e0a1; box-shadow: 0 0 16px rgba(114, 224, 161, .65); }
.empty-image-front b { position: absolute; inset: 0; border: 1px solid rgba(255, 255, 255, .06); border-radius: inherit; }
.empty-spark { position: absolute; color: var(--primary); font-size: 1rem; }
.empty-spark-one { top: 6px; right: 1px; }
.empty-spark-two { bottom: 5px; left: 11px; color: var(--primary-2); font-size: .7rem; }
.empty-preview-copy { max-width: 480px; display: grid; justify-items: center; gap: 8px; }
.preview-ready-pill { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border: 1px solid rgba(114, 224, 161, .18); border-radius: 999px; color: var(--green); background: rgba(114, 224, 161, .06); font-size: .68rem !important; font-weight: 800; }
.preview-ready-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px var(--green); }
.empty-preview-copy strong { font-size: clamp(1.25rem, 2.5vw, 1.65rem); color: var(--text); }
.empty-preview-copy p { margin: 0; color: var(--text-muted); font-size: .82rem; line-height: 1.65; }
.preview-capabilities { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; }
.preview-capabilities span { padding: 6px 9px; border: 1px solid var(--line); border-radius: 8px; color: var(--text-soft); background: rgba(255, 255, 255, .025); font-size: .64rem; }

.workspace-assurance { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0 0; }
.workspace-assurance article { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: rgba(11, 27, 43, .52); }
.workspace-assurance article > span { display: grid; place-items: center; flex: 0 0 auto; width: 37px; height: 37px; border-radius: 11px; color: var(--primary); background: rgba(114, 230, 255, .08); font-weight: 900; }
.workspace-assurance strong { display: block; font-size: .78rem; }
.workspace-assurance p { margin: 3px 0 0; color: var(--text-muted); font-size: .68rem; line-height: 1.45; }

.workspace-guide { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 18px; margin-top: 54px; }
.workspace-guide-copy, .workspace-tip-card { padding: clamp(22px, 4vw, 34px); border: 1px solid var(--line); border-radius: 22px; background: rgba(11, 27, 43, .52); }
.workspace-guide h2, .related-tools h2 { margin: 8px 0 12px; font-size: clamp(1.6rem, 3vw, 2.35rem); letter-spacing: -.035em; }
.workspace-guide-copy > p:not(.section-kicker) { max-width: 730px; color: var(--text-soft); line-height: 1.7; }
.workspace-guide ul { display: flex; flex-wrap: wrap; gap: 8px; margin: 20px 0 0; padding: 0; list-style: none; }
.workspace-guide li { padding: 7px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--text-soft); background: rgba(255, 255, 255, .025); font-size: .7rem; }
.workspace-tip-card { position: relative; overflow: hidden; }
.workspace-tip-card::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 140px; height: 140px; border-radius: 50%; background: rgba(140, 124, 255, .1); filter: blur(2px); }
.tip-icon { position: absolute; top: 22px; right: 22px; display: grid; place-items: center; width: 31px; height: 31px; border-radius: 50%; color: var(--primary); border: 1px solid rgba(114, 230, 255, .25); font-family: serif; font-style: italic; }
.workspace-tip-card h3 { margin: 10px 0 9px; font-size: 1.15rem; }
.workspace-tip-card > p:not(.section-kicker) { color: var(--text-muted); font-size: .76rem; line-height: 1.65; }
.tip-meta { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.tip-meta span { color: var(--primary); font-size: .65rem; font-weight: 800; }

.related-tools { margin-top: 54px; }
.related-tools > div:first-child { margin-bottom: 18px; }
.related-tool-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 11px; }
.related-tool-grid a { display: flex; align-items: center; gap: 11px; min-width: 0; padding: 15px; border: 1px solid var(--line); border-radius: 15px; background: rgba(11, 27, 43, .52); transition: transform .2s var(--ease), border-color .2s ease; }
.related-tool-grid a:hover { transform: translateY(-3px); border-color: rgba(114, 230, 255, .35); }
.related-tool-grid a > span { display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px; border-radius: 12px; color: var(--primary); background: rgba(114, 230, 255, .08); font-weight: 900; }
.related-tool-grid strong, .related-tool-grid small { display: block; }
.related-tool-grid strong { color: var(--text); font-size: .74rem; }
.related-tool-grid small { margin-top: 3px; color: var(--text-muted); font-size: .62rem; }

.workspace-footer { border-top: 1px solid var(--line); background: rgba(4, 13, 23, .72); }
.workspace-footer .container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 74px; color: var(--text-muted); font-size: .7rem; }
.workspace-footer nav { display: flex; align-items: center; gap: 13px; }
.workspace-footer a { color: var(--text-muted); }
.workspace-footer a:hover { color: var(--primary); }
.workspace-footer button { padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; color: var(--text-soft); background: transparent; cursor: pointer; }
.workspace-footer button:hover { color: var(--primary); border-color: rgba(114, 230, 255, .32); }

html[data-theme="light"] .workspace-intro,
html[data-theme="light"] .workspace-card,
html[data-theme="light"] .workspace-assurance article,
html[data-theme="light"] .workspace-guide-copy,
html[data-theme="light"] .workspace-tip-card,
html[data-theme="light"] .related-tool-grid a {
  border-color: rgba(12, 43, 66, .14);
  background: linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(235, 244, 250, .94));
  box-shadow: 0 20px 55px rgba(25, 56, 78, .09);
}
html[data-theme="light"] .workspace-flow-card { background: rgba(218, 232, 242, .62); }
html[data-theme="light"] .drop-zone, html[data-theme="light"] .empty-preview { background: radial-gradient(circle at 50% 35%, rgba(6, 124, 156, .08), transparent 38%), rgba(222, 235, 244, .74); }
html[data-theme="light"] .empty-image-back, html[data-theme="light"] .empty-image-front { box-shadow: 0 18px 38px rgba(25, 56, 78, .2); }
html[data-theme="light"] .preview-capabilities span, html[data-theme="light"] .workspace-guide li { background: rgba(255, 255, 255, .68); }
html[data-theme="light"] .workspace-footer { background: #d2e0eb; }
html[data-theme="light"] .workspace-footer button { color: #294b63; border-color: rgba(12, 43, 66, .2); }

@media (max-width: 1050px) {
  .workspace-intro { flex-direction: column; }
  .workspace-flow-card { flex-basis: auto; }
  .workspace-grid { grid-template-columns: 1fr; }
  .workspace-preview { position: static; order: -1; }
  .workspace-assurance { grid-template-columns: 1fr 1fr 1fr; }
  .related-tool-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 720px) {
  .workspace-title-row { align-items: flex-start; }
  .workspace-tool-icon { width: 48px; height: 48px; border-radius: 15px; }
  .workspace-intro h1 { font-size: clamp(1.8rem, 9vw, 2.55rem); }
  .workspace-flow-card > div { grid-template-columns: auto auto 1fr auto auto; }
  .workspace-flow-card > div i:nth-of-type(2), .workspace-flow-card > div span:nth-of-type(3), .workspace-flow-card > div b:nth-of-type(3) { display: none; }
  .workspace-assurance, .workspace-guide { grid-template-columns: 1fr; }
  .empty-preview { min-height: 390px; }
  .related-tool-grid { grid-template-columns: 1fr; }
  .workspace-footer .container { align-items: flex-start; flex-direction: column; justify-content: center; padding-block: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .related-tool-grid a, .drop-zone { transition: none; }
}

/* =========================================================
   FINAL DEVICE RESPONSIVE PASS
========================================================= */

.workspace-page,
.workspace-shell,
.workspace-intro,
.workspace-grid,
.workspace-controls,
.workspace-preview,
.workspace-card,
.workspace-guide,
.related-tool-grid,
.workspace-footer .container {
  min-width: 0;
  max-width: 100%;
}

.workspace-title-row > div,
.card-heading > div,
.preview-toolbar > div,
.related-tool-grid a > div {
  min-width: 0;
}

.workspace-card {
  padding: clamp(17px, 2.2vw, 24px);
}

.drop-zone {
  min-height: 240px;
  padding: 26px 18px;
}

.preview-card {
  min-height: 540px;
}

.empty-preview {
  min-height: 410px;
  padding: clamp(22px, 4vw, 36px);
}

.results-box,
.results-box .btn,
.results-box a,
.preview-toolbar,
.compare-hint,
.workspace-flow-card {
  min-width: 0;
  max-width: 100%;
}

.results-box .btn,
.results-box a {
  white-space: normal;
  overflow-wrap: anywhere;
}

.metadata-report { padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--bg-soft); margin-bottom: 16px; }
.metadata-report > p { margin: 9px 0 0; color: var(--text-muted); font-size: .85rem; }
.metadata-grid { display: grid; gap: 7px; margin: 14px 0 0; }
.metadata-grid div { display: flex; justify-content: space-between; gap: 16px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
.metadata-grid dt, .metadata-grid dd { margin: 0; font-size: .85rem; }
.metadata-grid dd { color: var(--text-muted); }
.metadata-grid dd.is-found { color: var(--success); font-weight: 800; }

.crop-action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.crop-action-row button { border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); color: var(--text); min-height: 40px; padding: 8px 12px; font: inherit; font-weight: 750; cursor: pointer; }
.crop-stage {
  position: relative;
  width: 100%;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: #06101c;
  touch-action: none;
  user-select: none;
  margin: 10px auto;
  box-sizing: border-box;
}

/*
  When an image is loaded, crop-ui.js gives the stage an exact
  pixel width/height that matches the source image aspect ratio.
  Do not force a minimum height here or the preview becomes stretched.
*/
.crop-stage.is-ready {
  min-height: 0;
  max-height: none;
}

.crop-stage:not(.is-ready)::after {
  content: "Crop preview appears here";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #9eb0c3;
  font-weight: 750;
}

.crop-stage img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  pointer-events: none;
}

.crop-stage img:not([src]),
.crop-stage:not(.is-ready) img {
  display: none;
}
.crop-box { position: absolute; display: none; border: 2px solid #63e5ff; box-shadow: 0 0 0 9999px rgb(0 6 14 / .58), 0 0 18px rgb(99 229 255 / .45); cursor: move; }
.crop-stage.is-ready .crop-box { display: block; }
.crop-box::before, .crop-box::after { content: ""; position: absolute; pointer-events: none; }
.crop-box::before { left: 33.333%; right: 33.333%; top: 0; bottom: 0; border-left: 1px solid rgb(255 255 255 / .5); border-right: 1px solid rgb(255 255 255 / .5); }
.crop-box::after { top: 33.333%; bottom: 33.333%; left: 0; right: 0; border-top: 1px solid rgb(255 255 255 / .5); border-bottom: 1px solid rgb(255 255 255 / .5); }
.crop-box i { position: absolute; width: 22px; height: 22px; border: 3px solid #e9fcff; border-radius: 50%; background: #18bedf; z-index: 2; }
.crop-box [data-handle="nw"] { left: -11px; top: -11px; cursor: nwse-resize; }
.crop-box [data-handle="ne"] { right: -11px; top: -11px; cursor: nesw-resize; }
.crop-box [data-handle="sw"] { left: -11px; bottom: -11px; cursor: nesw-resize; }
.crop-box [data-handle="se"] { right: -11px; bottom: -11px; cursor: nwse-resize; }
.crop-stage-compact { max-height: 330px; }
.editor-crop { padding-bottom: 8px; margin-bottom: 16px; border-bottom: 1px solid var(--line); }

@media (max-width: 800px) {
  /*
    Keep an empty crop area comfortably tappable, but once an image
    is loaded its stage size is controlled by crop-ui.js so the image
    can never be visually stretched.
  */
  .crop-stage:not(.is-ready) {
    min-height: 240px;
  }

  .crop-stage.is-ready,
  .crop-stage-compact.is-ready {
    min-height: 0;
    max-height: none;
  }

  .crop-stage-compact:not(.is-ready) {
    min-height: 220px;
  }

  .crop-action-row button {
    flex: 1 1 42%;
  }
}

@media (min-width: 801px) and (max-width: 1050px) {
  .workspace-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, .55fr);
  }

  .workspace-grid {
    grid-template-columns: minmax(300px, .82fr) minmax(0, 1.18fr);
  }

  .workspace-preview {
    position: sticky;
    top: calc(var(--header-height) + 18px);
    order: 0;
  }

  .preview-card {
    min-height: 500px;
  }

  .empty-preview {
    min-height: 370px;
  }

  .workspace-assurance article {
    padding: 14px;
  }
}

@media (max-width: 800px) {
  .workspace-shell {
    padding-bottom: 56px;
  }

  .workspace-intro {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
  }

  .workspace-flow-card {
    width: 100%;
    flex-basis: auto;
  }

  .workspace-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .workspace-controls,
  .workspace-preview {
    order: 0;
  }

  .workspace-preview {
    position: static;
  }

  .preview-card {
    min-height: 0;
  }

  .empty-preview {
    min-height: 320px;
  }

  .workspace-guide {
    margin-top: 38px;
  }

  .related-tools {
    margin-top: 38px;
  }
}

@media (max-width: 600px) {
  .workspace-header .nav-inner {
    gap: 8px;
  }

  .workspace-actions {
    flex: 0 0 auto;
    min-width: 0;
    gap: 6px;
  }

  .back-link {
    width: auto;
    max-width: none;
    min-height: 42px;
    padding: 8px 12px;
    overflow: visible;
    font-size: .74rem;
    text-overflow: clip;
  }

  .back-link .back-link-long { display: none; }
  .back-link .back-link-short { display: inline; }
  .back-link .back-link-arrow { display: inline; }

  .workspace-shell {
    padding-top: calc(var(--header-height) + 18px);
  }

  .workspace-breadcrumb {
    flex-wrap: wrap;
  }

  .workspace-intro {
    padding: 17px;
    border-radius: 19px;
  }

  .workspace-title-row {
    gap: 11px;
  }

  .workspace-tool-icon {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .workspace-intro h1 {
    font-size: clamp(1.65rem, 8.5vw, 2.2rem);
    overflow-wrap: anywhere;
  }

  .workspace-trust {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
  }

  .workspace-flow-card {
    padding: 14px;
  }

  .workspace-flow-card > div {
    grid-template-columns: auto auto auto auto auto auto;
    justify-content: start;
    gap: 6px;
  }

  .workspace-flow-card > div i {
    display: none !important;
  }

  .workspace-flow-card > div span:nth-of-type(3),
  .workspace-flow-card > div b:nth-of-type(3) {
    display: grid;
  }

  .workspace-card {
    padding: 14px;
    border-radius: 17px;
  }

  .card-heading {
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
  }

  .card-heading h2 {
    font-size: 1rem;
  }

  .card-heading p {
    font-size: .74rem;
  }

  .step-number {
    width: 31px;
    height: 31px;
  }

  .drop-zone {
    min-height: 205px;
    padding: 20px 12px;
    border-radius: 15px;
  }

  .upload-orbit {
    width: 72px;
    height: 72px;
  }

  .upload-glyph {
    width: 46px;
    height: 46px;
  }

  .preview-toolbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .preview-toolbar div,
  .workspace-footer nav,
  .tip-meta {
    flex-wrap: wrap;
  }

  .empty-preview {
    min-height: 255px;
    padding: 20px 12px;
    gap: 13px;
    border-radius: 15px;
  }

  .empty-visual {
    width: 132px;
    height: 106px;
    transform: scale(.82);
    transform-origin: center;
  }

  .empty-preview-copy strong {
    font-size: 1.15rem;
  }

  .preview-capabilities {
    gap: 5px;
  }

  .image-preview-wrap,
  .pixora-compare-viewport {
    min-height: 0;
  }

  .image-preview-wrap {
    aspect-ratio: 4 / 3;
  }

  .pixora-compare-controls {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .pixora-compare-viewport {
    min-height: 360px;
    aspect-ratio: 3 / 4;
  }

  .signature-controls { grid-template-columns: 1fr; }
  .signature-mode-grid { gap: 7px; }

  .workspace-assurance article {
    padding: 13px;
  }

  .workspace-guide-copy,
  .workspace-tip-card {
    padding: 18px;
    border-radius: 17px;
  }

  .workspace-guide h2,
  .related-tools h2 {
    font-size: 1.55rem;
  }

  .related-tool-grid a {
    padding: 12px;
  }

  .workspace-footer .container {
    width: calc(100% - 28px);
  }
}

@media (max-width: 380px) {
  .workspace-header .brand-name {
    display: none;
  }

  .back-link {
    min-height: 40px;
    padding-inline: 10px;
    font-size: .7rem;
  }

  .workspace-flow-card > div {
    gap: 4px;
  }

  .workspace-flow-card b {
    font-size: .61rem;
  }

  .bulk-preview-pane .bulk-preview-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.browser-result { text-align: center; }
.browser-result-title { margin: 0 0 6px; color: var(--success); font-weight: 800; }
.browser-result-meta { margin: 0 0 12px; color: var(--muted); font-size: .82rem; }
.browser-result.is-error .browser-result-title { color: var(--danger); }
.browser-download { display: inline-flex; width: auto; padding: 10px 24px; }

/* Larger, touch-friendly before/after comparison on phone screens. */
@media (max-width: 600px) {
  .results-box {
    margin-inline: -8px;
    padding: 12px 8px;
  }

  .pixora-compare {
    margin-top: 16px;
    padding-top: 14px;
  }

  .pixora-compare-header {
    padding-inline: 4px;
  }

  .pixora-compare-header h3 {
    font-size: 1.05rem;
  }

  .pixora-compare-header p {
    margin-bottom: 10px;
    font-size: .76rem;
  }

  .pixora-compare-viewport {
    width: 100%;
    height: clamp(340px, 105vw, 480px);
    min-height: 340px;
    aspect-ratio: auto;
    border-radius: 12px;
  }

  .pixora-compare-label {
    top: 8px;
    padding: 6px 9px;
    font-size: .72rem;
  }

  .pixora-compare-label-before {
    left: 8px;
  }

  .pixora-compare-label-after {
    right: 8px;
  }

  .pixora-compare-handle {
    width: 56px;
  }

  .pixora-compare-handle-circle {
    width: 48px;
    height: 48px;
  }

  .pixora-compare-controls {
    gap: 8px;
    margin-top: 12px;
  }

  .pixora-compare-range {
    min-height: 44px;
  }

  .pixora-compare-percentage {
    min-width: 38px;
    font-size: .76rem;
  }

  .pixora-compare-reset {
    min-height: 42px;
    padding: 8px 12px;
    font-size: .74rem;
  }
}

@media (max-width: 380px) {
  .pixora-compare-viewport {
    height: clamp(320px, 108vw, 410px);
    min-height: 320px;
  }
}

/* =========================================================
   PDF CONVERTER + PDF EDITOR
   Browser-only document tools. Keeps the existing workspace system.
========================================================= */
.workspace-grid.is-document-tool {
  grid-template-columns: minmax(0, 1180px);
  justify-content: center;
}
.workspace-grid.is-document-tool .workspace-controls { width: 100%; }
.workspace-grid.is-document-tool .tool-control-card { padding: clamp(18px, 3vw, 30px); }
.pdf-tool-panel { display: grid; gap: 18px; }
/* Intro cards need clear visual separation even when browser rounding is tight. */
#panel-pdf-editor > .pdf-privacy-note + .pdf-text-edit-note { margin-top: 2px; }
.pdf-privacy-note,
.pdf-overlay-warning,
.pdf-text-edit-note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid rgba(114, 224, 161, .2);
  border-radius: 14px;
  background: rgba(114, 224, 161, .055);
}
.pdf-privacy-note > span { flex: 0 0 auto; font-size: 1rem; }
.pdf-privacy-note strong,
.pdf-overlay-warning strong,
.pdf-text-edit-note strong { display: block; color: var(--text); font-size: .8rem; }
.pdf-privacy-note p,
.pdf-overlay-warning p,
.pdf-text-edit-note p { margin: 4px 0 0; color: var(--text-muted); font-size: .72rem; line-height: 1.55; }
.pdf-overlay-warning, .pdf-text-edit-note { border-color: rgba(114, 230, 255, .18); background: rgba(114, 230, 255, .045); }
.pdf-text-edit-note > span { display:grid; place-items:center; flex:0 0 auto; width:34px; height:34px; border-radius:10px; color:#06101d; background:var(--primary); font-weight:900; }
.pdf-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(3, 13, 24, .3);
}
.pdf-mode-tabs button,
.pdf-editor-toolbar button,
.pdf-editor-page-actions button,
.pdf-inline-actions button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-soft);
  background: var(--bg-soft);
  font: inherit;
  font-size: .72rem;
  font-weight: 800;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, color .18s ease, transform .18s ease;
}
.pdf-mode-tabs button:hover,
.pdf-editor-toolbar button:hover,
.pdf-editor-page-actions button:hover,
.pdf-inline-actions button:hover { border-color: rgba(114, 230, 255, .32); color: var(--primary); }
.pdf-mode-tabs button.is-active,
.pdf-editor-toolbar button.is-active { color: #06101d; border-color: transparent; background: var(--primary); }
.pdf-editor-page-actions button.is-danger { color: #ff9da8; border-color: rgba(255, 107, 125, .2); }
.pdf-drop-zone {
  display: grid;
  place-items: center;
  min-height: 220px;
  margin-top: 16px;
  padding: 24px 18px;
  text-align: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: 18px;
  background: radial-gradient(circle at 50% 30%, rgba(114, 230, 255, .08), transparent 37%), rgba(5, 16, 29, .32);
  cursor: pointer;
  outline: none;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.pdf-drop-zone:hover,
.pdf-drop-zone:focus-visible,
.pdf-drop-zone.is-dragging { border-color: var(--primary); background-color: rgba(114, 230, 255, .055); }
.pdf-drop-zone.is-dragging { transform: translateY(-2px); }
.pdf-drop-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin-bottom: 9px;
  border: 1px solid rgba(114, 230, 255, .2);
  border-radius: 18px;
  color: var(--primary);
  background: rgba(114, 230, 255, .065);
  font-size: .85rem;
  font-weight: 900;
}
.pdf-drop-zone strong { font-size: .9rem; }
.pdf-drop-zone p { margin: 6px 0 4px; color: var(--text-muted); font-size: .74rem; }
.pdf-drop-zone small { margin-top: 8px; color: var(--text-muted); font-size: .66rem; }
.pdf-status {
  min-height: 22px;
  margin-top: 10px;
  color: var(--text-muted);
  font-size: .72rem;
  line-height: 1.55;
}
.pdf-status[data-state="success"] { color: var(--green); }
.pdf-status[data-state="error"] { color: var(--danger); }
.pdf-status[data-state="info"] { color: var(--text-muted); }
.pdf-file-list { display: grid; gap: 9px; margin-top: 12px; }
.pdf-file-card {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 255, 255, .022);
}
.pdf-file-card.is-dragging-card { opacity: .55; }
.pdf-file-card > img { width: 76px; height: 64px; object-fit: cover; border-radius: 9px; background: #fff; }
.pdf-file-copy { min-width: 0; }
.pdf-file-copy strong,
.pdf-file-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-file-copy strong { font-size: .74rem; }
.pdf-file-copy small { margin-top: 3px; color: var(--text-muted); font-size: .65rem; }
.pdf-inline-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pdf-inline-actions button { min-height: 32px; padding: 5px 9px; font-size: .64rem; }
.pdf-inline-actions button:disabled { opacity: .4; cursor: default; }
.pdf-settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.pdf-settings-grid .field { margin: 0; }
.pdf-settings-grid .field > select,
.pdf-settings-grid .field > input[type="text"],
.pdf-settings-grid .field > input[type="color"] { margin-top: 7px; }
.pdf-settings-grid input[type="color"] { width: 100%; min-height: 44px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); }
.pdf-action-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.pdf-action-row .btn { min-height: 44px; }
.pdf-secondary-actions { padding-top: 2px; border-top: 1px solid var(--line); }
.pdf-document-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin-top: 12px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, .025);
}
.pdf-document-info strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .75rem; }
.pdf-document-info span { color: var(--text-muted); font-size: .67rem; }
.pdf-page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
  max-height: 430px;
  margin-top: 12px;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(3, 13, 24, .22);
}
.pdf-page-card { display: grid; gap: 7px; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.025); }
.pdf-page-card canvas { width: 100%; aspect-ratio: 3 / 4; object-fit: contain; border-radius: 6px; background: #fff; }
.pdf-page-card canvas.is-preview-error::after { content: "Preview unavailable"; }
.pdf-page-card span { color: var(--text-soft); font-size: .64rem; font-weight: 800; }
.pdf-progress { display: grid; gap: 6px; margin-top: 15px; }
.pdf-progress > div { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.07); }
.pdf-progress > div > span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--primary-2)); transition: width .15s ease; }
.pdf-progress small { color: var(--text-muted); font-size: .66rem; }
.pdf-results { display: grid; gap: 10px; margin-top: 14px; }
.pdf-result-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.pdf-result-heading strong { font-size: .8rem; }
.pdf-result-heading small { color: var(--text-muted); font-size: .67rem; }
.pdf-output-list { display: grid; gap: 7px; }
.pdf-output-list > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.pdf-output-list strong,
.pdf-output-list small { display: block; }
.pdf-output-list strong { font-size: .72rem; }
.pdf-output-list small { margin-top: 2px; color: var(--text-muted); font-size: .63rem; }

.pdf-editor-workspace { display: grid; gap: 12px; margin-top: 14px; }
.pdf-editor-page-actions,
.pdf-editor-toolbar { display: flex; flex-wrap: wrap; gap: 7px; }
.pdf-editor-page-actions button,
.pdf-editor-toolbar button { min-height: 38px; padding: 7px 10px; }
.pdf-editor-layout {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(3, 13, 24, .25);
}
.pdf-editor-sidebar { min-width: 0; padding: 12px 9px; overflow: auto; border-right: 1px solid var(--line); background: rgba(3, 13, 24, .28); }
.pdf-editor-sidebar > strong { display: block; margin: 0 5px 10px; font-size: .7rem; }
#pdfe-thumbnails { display: grid; gap: 8px; }
.pdf-editor-thumb {
  display: grid;
  width: 100%;
  min-height: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-soft);
  background: rgba(255,255,255,.025);
  text-align: left;
  cursor: pointer;
}
.pdf-editor-thumb.is-active { border-color: var(--primary); box-shadow: 0 0 0 1px rgba(114,230,255,.12); }
.pdf-editor-thumb canvas { display: block; width: 100%; max-height: 128px; object-fit: contain; border-radius: 5px; background: #fff; }
.pdf-editor-thumb span { margin-top: 5px; font-size: .63rem; font-weight: 800; }
.pdf-editor-thumb small { margin-top: 2px; color: var(--text-muted); font-size: .57rem; }
.pdf-editor-main { min-width: 0; display: grid; place-items: center; align-content: center; gap: 9px; padding: 16px; overflow: auto; }
.pdf-editor-stage-wrap { display: grid; place-items: center; width: 100%; min-width: 0; overflow: auto; }
.pdf-editor-stage { position: relative; flex: 0 0 auto; max-width: 100%; box-shadow: 0 16px 45px rgba(0,0,0,.28); background: #fff; touch-action: none; }
.pdf-editor-stage canvas { display: block; width: 100%; height: 100%; background: #fff; }
.pdf-editor-stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; touch-action: none; user-select: none; }
.pdf-editor-stage svg[data-tool="pen"],
.pdf-editor-stage svg[data-tool="rect"],
.pdf-editor-stage svg[data-tool="ellipse"],
.pdf-editor-stage svg[data-tool="line"],
.pdf-editor-stage svg[data-tool="highlight"] { cursor: crosshair; }
.pdf-editor-stage svg[data-tool="eraser"] { cursor: not-allowed; }
.pdf-annotation { pointer-events: all; cursor: move; vector-effect: non-scaling-stroke; }
.pdf-annotation.is-selected { filter: drop-shadow(0 0 2px rgba(0, 162, 255, .95)); }
.pdf-page-label { color: var(--text-muted); font-size: .66rem; }
.pdf-editor-stage canvas { position: relative; z-index: 1; }
.pdf-editor-text-layer { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.pdf-editor-stage svg { z-index: 3; }
.pdf-editor-stage[data-text-edit="true"] .pdf-editor-text-layer { pointer-events: auto; }
.pdf-editor-stage[data-text-edit="true"] svg { pointer-events: none; }
.pdf-existing-text-hit { position: absolute; display: block; min-width: 2px; min-height: 8px; padding: 0; border: 1px solid transparent; border-radius: 3px; color: transparent; background: transparent; white-space: pre; line-height: 1; outline: none; cursor: text; transform-origin: left top; }
.pdf-editor-stage[data-text-edit="true"] .pdf-existing-text-hit:hover { border-color: rgba(114,230,255,.72); background: rgba(114,230,255,.08); }
.pdf-existing-text-hit.is-editing, .pdf-existing-text-hit.is-edited { z-index: 4; color: #101820; background: #fff; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(114,230,255,.16); caret-color: #111; }
.pdf-existing-text-hit.is-edited:not(.is-editing) { border-color: rgba(114,224,161,.55); }
.pdf-existing-text-controls { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:11px 12px; border:1px solid rgba(114,230,255,.16); border-radius:12px; background:rgba(114,230,255,.035); }
.pdf-existing-text-controls > div { min-width:0; display:grid; gap:3px; }
.pdf-existing-text-controls strong { font-size:.75rem; }
.pdf-existing-text-controls span { color:var(--text-muted); font-size:.66rem; line-height:1.45; }
.pdf-existing-text-controls .btn { flex:0 0 auto; min-height:38px; }

.pdf-annotation-controls { display: grid; gap: 10px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.02); }
.pdf-text-control { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end; }
.pdf-text-control .field { margin: 0; }
.pdf-annotation-settings { grid-template-columns: 1.4fr .7fr .75fr 1.4fr; align-items: end; margin-top: 0; }
.pdf-annotation-settings .checkbox-row { min-height: 44px; margin: 0; align-self: end; }
.pdf-file-button { display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.pdf-editor-export-actions { align-items: center; }
.pdf-editor-export-actions #pdfe-export { margin-left: auto; }

html[data-theme="light"] .pdf-mode-tabs,
html[data-theme="light"] .pdf-editor-layout,
html[data-theme="light"] .pdf-editor-sidebar,
html[data-theme="light"] .pdf-drop-zone,
html[data-theme="light"] .pdf-page-grid { background-color: rgba(224, 237, 246, .55); }
html[data-theme="light"] .pdf-file-card,
html[data-theme="light"] .pdf-page-card,
html[data-theme="light"] .pdf-editor-thumb,
html[data-theme="light"] .pdf-annotation-controls,
html[data-theme="light"] .pdf-document-info { background: rgba(255,255,255,.68); }

@media (max-width: 820px) {
  .pdf-editor-layout { grid-template-columns: 112px minmax(0, 1fr); min-height: 440px; }
  .pdf-editor-main { padding: 10px; }
  .pdf-annotation-settings { grid-template-columns: 1fr 1fr; }
  .pdf-page-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); max-height: 350px; }
}

@media (max-width: 620px) {
  .workspace-grid.is-document-tool .tool-control-card { padding: 15px; }
  .pdf-mode-tabs { grid-template-columns: 1fr; }
  .pdf-drop-zone { min-height: 190px; padding: 20px 12px; }
  .pdf-settings-grid,
  .pdf-annotation-settings { grid-template-columns: 1fr; }
  .pdf-action-row { align-items: stretch; flex-direction: column-reverse; }
  .pdf-action-row .btn,
  .pdf-file-button { width: 100%; }
  .pdf-file-card { grid-template-columns: 60px minmax(0, 1fr); }
  .pdf-file-card > img { width: 60px; height: 56px; }
  .pdf-editor-layout { grid-template-columns: 88px minmax(0, 1fr); min-height: 390px; }
  .pdf-editor-sidebar { padding: 9px 6px; }
  .pdf-editor-main { padding: 8px; }
  .pdf-editor-page-actions,
  .pdf-editor-toolbar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pdf-editor-page-actions button,
  .pdf-editor-toolbar button { min-height: 44px; }
  .pdf-text-control { grid-template-columns: 1fr; }
  .pdf-existing-text-controls { align-items:stretch; flex-direction:column; }
  .pdf-existing-text-controls .btn { width:100%; }
  .pdf-editor-export-actions #pdfe-export { margin-left: 0; }
  .pdf-output-list > div { align-items: stretch; flex-direction: column; }
  .pdf-output-list .btn { width: 100%; }
}

/* =========================================================
   PDF UX POLISH v42
   One consistent PixelOrigen document workspace; no duplicate CTAs.
========================================================= */
.pdf-tool-panel .field > input[type="text"],
.pdf-tool-panel .field > input[type="number"],
.pdf-tool-panel .field > select {
  width: 100%;
  min-height: 48px;
  padding: 11px 13px;
  color: var(--text, #eef7ff);
  border: 1px solid var(--line-strong, rgba(153,184,207,.24));
  border-radius: 12px;
  background: var(--bg-soft, #0a1726);
  outline: none;
  font: inherit;
}
.pdf-tool-panel .field > input[type="text"]::placeholder { color: var(--text-muted); opacity: .82; }
.pdf-tool-panel .field > input[type="text"]:focus,
.pdf-tool-panel .field > input[type="number"]:focus,
.pdf-tool-panel .field > select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(114,230,255,.1);
}
html[data-theme="light"] .pdf-tool-panel .field > input[type="text"],
html[data-theme="light"] .pdf-tool-panel .field > input[type="number"],
html[data-theme="light"] .pdf-tool-panel .field > select { background: #fff; }

.pdf-page-grid {
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  max-height: 560px;
  gap: 12px;
  padding: 12px;
}
.pdf-page-card {
  gap: 9px;
  padding: 10px;
  border-radius: 13px;
  transition: border-color .18s ease, transform .18s ease, background .18s ease;
}
.pdf-page-card:hover { transform: translateY(-2px); border-color: rgba(114,230,255,.34); }
.pdf-page-card canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: auto !important;
  object-fit: contain;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(0,0,0,.18);
}
.pdf-page-card span { font-size: .69rem; }

.pdf-editor-commandbar {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(3,13,24,.22);
}
.pdf-command-group { display: grid; grid-template-columns: 54px minmax(0,1fr); align-items: center; gap: 10px; min-width: 0; }
.pdf-command-label { color: var(--text-muted); font-size: .64rem; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.pdf-editor-page-actions,
.pdf-editor-toolbar { min-width: 0; }
.pdf-editor-page-actions button,
.pdf-editor-toolbar button {
  min-height: 40px;
  padding: 8px 11px;
  border-radius: 10px;
  white-space: nowrap;
}

.pdf-editor-layout {
  grid-template-columns: 142px minmax(0, 1fr);
  min-height: 600px;
  max-height: min(78vh, 820px);
}
.pdf-editor-sidebar { scrollbar-width: thin; }
.pdf-editor-thumb { overflow: hidden; }
.pdf-editor-thumb canvas {
  width: 100%;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 20px rgba(0,0,0,.18);
}
.pdf-editor-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  place-items: stretch;
  align-content: stretch;
  gap: 10px;
  min-height: 0;
  padding: 12px;
  overflow: hidden;
}
.pdf-editor-viewbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: .7rem;
}
.pdf-editor-viewbar > span { font-weight: 850; color: var(--text-soft); }
.pdf-editor-viewbar > div { display: flex; align-items: center; gap: 6px; }
.pdf-editor-viewbar button {
  min-width: 38px;
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-soft);
  background: rgba(255,255,255,.025);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}
.pdf-editor-viewbar button:hover { color: var(--primary); border-color: rgba(114,230,255,.34); }
.pdf-editor-viewbar .pdf-zoom-value { min-width: 58px; }
.pdf-editor-stage-wrap {
  position: relative;
  display: grid;
  place-items: start center;
  min-height: 0;
  width: 100%;
  padding: 18px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(45deg, rgba(255,255,255,.018) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.018) 75%),
    linear-gradient(45deg, rgba(255,255,255,.018) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.018) 75%),
    #06111e;
  background-size: 24px 24px;
  background-position: 0 0, 12px 12px;
  scrollbar-width: thin;
}
.pdf-editor-stage {
  max-width: none;
  border: 1px solid rgba(0,0,0,.22);
  border-radius: 2px;
  box-shadow: 0 20px 54px rgba(0,0,0,.42);
}
.pdf-page-label { display: none; }

.pdf-selection-box {
  pointer-events: none;
  fill: none;
  stroke: #72e6ff;
  stroke-width: 1.5;
  stroke-dasharray: 6 4;
  vector-effect: non-scaling-stroke;
}
.pdf-resize-handle {
  pointer-events: none;
  cursor: nwse-resize;
  fill: #72e6ff;
  stroke: #06101d;
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  touch-action: none;
}
.pdf-resize-handle[data-handle="ne"],
.pdf-resize-handle[data-handle="sw"] { cursor: nesw-resize; }
.pdf-resize-hit-target {
  pointer-events: all;
  cursor: nwse-resize;
  fill: rgba(0,0,0,.001);
  stroke: none;
  touch-action: none;
}
.pdf-resize-hit-target[data-handle="ne"],
.pdf-resize-hit-target[data-handle="sw"] { cursor: nesw-resize; }
.pdf-object-hint {
  margin-top: -2px;
  padding: 9px 11px;
  border-radius: 10px;
  color: var(--text-muted);
  background: rgba(114,230,255,.035);
  font-size: .67rem;
  line-height: 1.5;
}
.pdf-text-control { align-items: end; }
.pdf-annotation-controls { gap: 12px; }
.pdf-existing-text-controls { border-color: rgba(114,230,255,.13); }
.pdf-editor-export-actions {
  margin-top: 0;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}
.pdf-editor-export-actions #pdfe-export { min-width: 220px; }
.pdf-results.pdf-export-summary { padding: 12px 14px; }

@media (max-width: 820px) {
  .pdf-page-grid { grid-template-columns: repeat(auto-fill, minmax(136px, 1fr)); }
  .pdf-editor-layout { grid-template-columns: 104px minmax(0,1fr); min-height: 520px; max-height: 74vh; }
  .pdf-command-group { grid-template-columns: 1fr; gap: 6px; }
  .pdf-command-label { display: none; }
  .pdf-editor-page-actions,
  .pdf-editor-toolbar { display: flex; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 3px; scrollbar-width: thin; }
  .pdf-editor-page-actions button,
  .pdf-editor-toolbar button { flex: 0 0 auto; }
}

@media (max-width: 620px) {
  .pdf-page-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 480px; padding: 8px; }
  .pdf-editor-layout { grid-template-columns: 78px minmax(0,1fr); min-height: 470px; max-height: 70vh; }
  .pdf-editor-main { padding: 7px; }
  .pdf-editor-stage-wrap { padding: 10px; }
  .pdf-editor-viewbar { padding: 0; }
  .pdf-editor-viewbar button { min-width: 36px; min-height: 36px; padding: 5px 8px; }
  .pdf-editor-viewbar .pdf-zoom-value { min-width: 52px; }
  .pdf-editor-sidebar { padding: 7px 5px; }
  .pdf-editor-sidebar > strong { margin-inline: 3px; }
  .pdf-text-control { grid-template-columns: 1fr; }
  .pdf-editor-export-actions #pdfe-export { min-width: 0; width: 100%; }
}

/* v43 mobile document editing: keep the actual page large and make thumbnails a horizontal rail. */
@media (max-width: 620px) {
  .pdf-editor-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 540px;
    max-height: 78vh;
  }
  .pdf-editor-sidebar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 7px 8px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .pdf-editor-sidebar > strong { margin: 0; }
  #pdfe-thumbnails {
    display: flex;
    gap: 7px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 1px 5px;
    scrollbar-width: thin;
  }
  .pdf-editor-thumb {
    flex: 0 0 68px;
    padding: 5px;
  }
  .pdf-editor-thumb canvas { max-height: 78px; }
  .pdf-editor-thumb small { display: none; }
  .pdf-editor-main { min-height: 420px; }
}

/* =========================================================
   v44 — PROGRESSIVE DISCLOSURE + MOBILE UX
   Keep common actions visible and tuck expert controls behind
   native, keyboard-accessible disclosure panels.
========================================================= */

.advanced-options {
  width: 100%;
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(5, 18, 31, .26);
  overflow: clip;
}

.advanced-options > summary {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 12px 44px 12px 14px;
  color: var(--text-soft);
  cursor: pointer;
  list-style: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.advanced-options > summary::-webkit-details-marker { display: none; }

.advanced-options > summary::after {
  content: "+";
  position: absolute;
  right: 14px;
  top: 50%;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  transform: translateY(-50%);
  color: var(--primary);
  background: rgba(114, 230, 255, .04);
  font-size: 1rem;
  font-weight: 800;
}

.advanced-options[open] > summary::after { content: "−"; }
.advanced-options > summary:hover { background: rgba(114, 230, 255, .035); }
.advanced-options > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.advanced-options > summary span { min-width: 0; font-size: .76rem; font-weight: 850; }
.advanced-options > summary small { color: var(--text-muted); font-size: .64rem; font-weight: 650; text-align: right; }

.advanced-options-content {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
  border-top: 1px solid rgba(255,255,255,.045);
}

.advanced-options-content > :first-child { margin-top: 14px; }
.advanced-options-compact { margin: 10px 0; }
.advanced-options-compact > summary { min-height: 44px; padding-block: 10px; }

/* The color control should read as a picker, not a giant black field. */
.pdf-color-field { align-content: start; }
.pdf-color-control {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin-top: 7px;
}
.pdf-color-control input[type="color"],
.pdf-settings-grid .pdf-color-control input[type="color"] {
  flex: 0 0 48px;
  width: 48px !important;
  height: 38px;
  min-height: 38px !important;
  margin: 0 !important;
  padding: 3px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg-soft);
  cursor: pointer;
}
.pdf-color-control small {
  color: var(--text-muted);
  font-size: .65rem;
  line-height: 1.35;
}

/* PDF editor: the simple actions stay visible, the rest is opt-in. */
.pdf-command-group-primary { margin: 0; }
.pdf-editor-more-tools { margin: 0; }
.pdf-editor-more-tools .advanced-options-content { gap: 10px; }
.pdf-basic-object-actions { margin-top: 2px; }
.pdf-basic-settings { grid-template-columns: minmax(0, 280px); }

/* Avoid controls stretching wider than the editor on narrow displays. */
.pdf-tool-panel,
.pdf-editor-workspace,
.pdf-editor-commandbar,
.pdf-annotation-controls,
.advanced-options,
.advanced-options-content,
.pdf-settings-grid,
.pdf-action-row {
  min-width: 0;
  max-width: 100%;
}

html[data-theme="light"] .advanced-options {
  background: rgba(255,255,255,.58);
}

html[data-theme="light"] .advanced-options-content {
  border-top-color: rgba(9, 43, 66, .08);
}

@media (max-width: 760px) {
  .advanced-options > summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 3px;
    min-height: 52px;
    padding: 10px 42px 10px 12px;
  }

  .advanced-options > summary small {
    text-align: left;
    overflow-wrap: anywhere;
  }

  .advanced-options-content {
    padding: 0 12px 12px;
  }

  .pdf-basic-settings,
  .pdf-settings-grid,
  .pdf-annotation-settings {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .pdf-editor-commandbar {
    padding: 9px;
  }

  .pdf-editor-toolbar,
  .pdf-editor-page-actions {
    width: 100%;
    max-width: 100%;
  }

  .pdf-editor-toolbar button,
  .pdf-editor-page-actions button {
    min-height: 44px;
  }

  .pdf-text-control,
  .pdf-action-row,
  .pdf-basic-object-actions,
  .pdf-editor-export-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .pdf-action-row .btn,
  .pdf-basic-object-actions .btn,
  .pdf-editor-export-actions .btn,
  .pdf-file-button {
    width: 100%;
    min-height: 46px;
    justify-content: center;
  }

  .pdf-color-control {
    justify-content: flex-start;
  }

  .pdf-editor-stage-wrap {
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 420px) {
  .advanced-options { border-radius: 12px; }
  .advanced-options > summary { padding-inline-start: 11px; }
  .pdf-editor-toolbar button,
  .pdf-editor-page-actions button { padding-inline: 10px; }
  .pdf-color-control input[type="color"],
  .pdf-settings-grid .pdf-color-control input[type="color"] {
    width: 44px !important;
    flex-basis: 44px;
  }
}

/* =========================================================
   V45 — GENTLE INPUT GUIDANCE + PERSISTENT MOBILE HEADER
========================================================= */
.workspace-header {
  position: fixed !important;
  inset: 0 0 auto 0;
  z-index: 1300;
  background: rgba(6, 16, 29, .90);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, .14);
}

html[data-theme="light"] .workspace-header {
  background: rgba(232, 240, 247, .94);
  border-bottom-color: rgba(12, 43, 66, .11);
  box-shadow: 0 8px 28px rgba(25, 56, 78, .08);
}

.workspace-menu-btn { display: none; }
.workspace-mobile-menu { display: none; }

.status-text.is-guidance,
.bulk-status.is-guidance {
  color: var(--primary) !important;
}

.drop-zone.needs-file,
.bulk-picker.needs-file {
  border-color: var(--primary);
  background: rgba(114, 230, 255, .10);
  box-shadow: 0 0 0 4px rgba(114, 230, 255, .08), 0 14px 34px rgba(30, 187, 220, .10);
  animation: pixelorigen-input-nudge .62s ease 2;
}

@keyframes pixelorigen-input-nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .drop-zone.needs-file,
  .bulk-picker.needs-file { animation: none; }
}

@media (max-width: 600px) {
  .workspace-header {
    display: block !important;
    min-height: 68px;
  }

  .workspace-header .container.nav-inner {
    width: min(calc(100% - 28px), 1280px);
    min-height: 68px;
    padding: 0;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .workspace-header .brand {
    display: inline-flex !important;
    flex: 1 1 auto;
    min-width: 0;
  }

  .workspace-header .brand-name {
    display: inline-block !important;
    white-space: nowrap;
  }

  .workspace-actions {
    display: flex !important;
    align-items: center;
    gap: 8px;
  }

  .workspace-actions .theme-toggle,
  .workspace-menu-btn {
    display: inline-grid !important;
    place-items: center;
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }

  .workspace-actions .back-link { display: none !important; }

  .workspace-menu-btn {
    border: 1px solid var(--line-strong);
    border-radius: 13px;
    background: var(--bg-soft);
  }

  .workspace-menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 2px 0;
    border-radius: 999px;
    background: var(--text);
  }

  .workspace-mobile-menu {
    position: absolute;
    top: 68px;
    left: 14px;
    right: 14px;
    z-index: 1301;
    display: none;
    gap: 5px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: rgba(7, 17, 31, .98);
    box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
  }

  .workspace-mobile-menu.open { display: grid; }

  .workspace-mobile-menu a {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--text);
    font-weight: 750;
  }

  .workspace-mobile-menu a:hover,
  .workspace-mobile-menu a:focus-visible {
    background: rgba(114, 230, 255, .08);
    color: var(--primary);
  }

  html[data-theme="light"] .workspace-mobile-menu {
    background: rgba(244, 248, 252, .98);
    box-shadow: 0 18px 48px rgba(25, 56, 78, .16);
  }

  .workspace-shell {
    padding-top: calc(68px + 18px) !important;
  }
}

@media (max-width: 380px) {
  .workspace-header .brand-name { font-size: .95rem; }
  .workspace-header .brand-mark { transform: scale(.92); transform-origin: left center; }
}


/* v49 — consistent Basic / Advanced settings organization. */
.settings-basic { display: grid; gap: 12px; margin-bottom: 10px; }
.settings-group-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.settings-group-heading strong { color: var(--text); font-size: .78rem; font-weight: 850; }
.settings-group-heading small { color: var(--text-muted); font-size: .64rem; text-align: right; }
.settings-basic > .field:last-child,
.settings-basic > fieldset:last-child { margin-bottom: 0; }
html[data-theme="light"] .settings-group-heading { border-bottom-color: rgba(25,56,78,.08); }
@media (max-width: 560px) {
  .settings-group-heading { align-items: flex-start; }
  .settings-group-heading small { max-width: 55%; }
}

/* =========================================================
   v60 — PDF CONVERTER MODE CHOOSER
   Replaces the crowded five-shortcut row with two clear,
   mobile-safe workflow cards. Existing converter logic is used.
========================================================= */
.pdf-mode-chooser {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.pdf-mode-heading {
  display: grid;
  gap: 4px;
}

.pdf-mode-heading strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
}

.pdf-mode-heading span {
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.45;
}

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

.pdf-mode-choice {
  min-width: 0;
  min-height: 168px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(145deg, color-mix(in srgb, var(--surface-2) 94%, transparent), color-mix(in srgb, var(--surface) 90%, transparent));
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  box-sizing: border-box;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.pdf-mode-choice:hover,
.pdf-mode-choice:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--primary) 55%, var(--border));
  background: color-mix(in srgb, var(--primary) 6%, var(--surface-2));
  box-shadow: 0 12px 30px rgba(0, 0, 0, .12);
}

.pdf-mode-choice.is-active {
  border-color: color-mix(in srgb, var(--primary) 72%, var(--border));
  background: color-mix(in srgb, var(--primary) 10%, var(--surface-2));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--primary) 18%, transparent), 0 12px 28px rgba(0, 0, 0, .10);
}

.pdf-mode-choice-visual {
  min-width: 0;
  min-height: 78px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.pdf-format-stack {
  display: grid;
  gap: 5px;
  flex: 0 0 auto;
}

.pdf-format-stack span {
  min-width: 46px;
  padding: 5px 8px;
  border: 1px solid color-mix(in srgb, var(--primary) 32%, var(--border));
  border-radius: 8px;
  background: color-mix(in srgb, var(--primary) 8%, var(--surface));
  color: color-mix(in srgb, var(--primary) 80%, var(--text));
  font-size: 10px;
  line-height: 1;
  font-weight: 900;
  text-align: center;
  box-sizing: border-box;
}

.pdf-format-stack-output span {
  border-color: color-mix(in srgb, var(--primary-2) 36%, var(--border));
  background: color-mix(in srgb, var(--primary-2) 8%, var(--surface));
  color: color-mix(in srgb, var(--primary-2) 78%, var(--text));
}

.pdf-mode-arrow {
  flex: 0 0 auto;
  color: var(--primary);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.pdf-file-symbol {
  width: 58px;
  height: 68px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--primary-2) 38%, var(--border));
  border-radius: 13px;
  background: linear-gradient(145deg, var(--primary), var(--primary-2));
  color: #06131f;
  font-size: 13px;
  font-weight: 950;
  letter-spacing: .04em;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--primary) 14%, transparent);
}

.pdf-mode-choice-copy {
  min-width: 0;
  display: grid;
  gap: 5px;
  align-self: end;
}

.pdf-mode-choice-copy strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
}

.pdf-mode-choice-copy small {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}

html[data-theme="light"] .pdf-mode-choice {
  box-shadow: 0 8px 22px rgba(24, 52, 78, .06);
}

@media (max-width: 700px) {
  .pdf-mode-chooser {
    gap: 12px;
    padding: 14px;
  }

  .pdf-mode-choice-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .pdf-mode-choice {
    min-height: 0;
    grid-template-columns: minmax(132px, .78fr) minmax(0, 1fr);
    grid-template-rows: none;
    align-items: center;
    gap: 14px;
    padding: 15px;
  }

  .pdf-mode-choice-visual {
    min-height: 72px;
    justify-content: flex-start;
    gap: 9px;
  }

  .pdf-file-symbol {
    width: 50px;
    height: 60px;
    border-radius: 11px;
    font-size: 11px;
  }

  .pdf-format-stack span {
    min-width: 40px;
    padding: 4px 6px;
    font-size: 9px;
  }

  .pdf-mode-arrow {
    font-size: 20px;
  }
}

@media (max-width: 430px) {
  .pdf-mode-chooser {
    padding: 12px;
    border-radius: 16px;
  }

  .pdf-mode-heading strong {
    font-size: 13px;
  }

  .pdf-mode-heading span {
    font-size: 11px;
  }

  .pdf-mode-choice {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  .pdf-mode-choice-visual {
    width: 100%;
    min-height: 66px;
    justify-content: center;
  }

  .pdf-mode-choice-copy {
    text-align: center;
  }

  .pdf-mode-choice-copy strong {
    font-size: 13px;
  }

  .pdf-mode-choice-copy small {
    font-size: 10.5px;
  }
}

/* =========================================================
   v57 — mobile result-column alignment hardening
   Keep the process action, result card, download action and
   before/after comparison on one consistent vertical column.
========================================================= */
@media (max-width: 600px) {
  .tool-panel {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .tool-panel > .process-btn,
  .tool-panel > .results-box {
    width: 100% !important;
    max-width: none !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box;
    transform: none !important;
  }

  .tool-panel > .results-box {
    margin-top: 18px !important;
    padding: 14px !important;
  }

  .results-box > .browser-result {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    margin: 0;
    box-sizing: border-box;
  }

  .results-box .browser-result-title,
  .results-box .browser-result-meta {
    width: 100%;
    box-sizing: border-box;
  }

  .results-box .browser-download {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    box-sizing: border-box;
  }

  .results-box .pixora-compare {
    width: 100%;
    min-width: 0;
    margin-left: 0;
    margin-right: 0;
    box-sizing: border-box;
  }

  .results-box .pixora-compare-viewport,
  .results-box .pixora-compare-controls {
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }
}


/* =========================================================
   v61 — SMART CROP PREVIEW GEOMETRY FIX
   1) Never stretch the displayed source image.
   2) Make the crop overlay use the same geometry as the image,
      so a 16:9 crop also LOOKS 16:9 on screen.
========================================================= */

.crop-stage.is-ready {
  min-width: 0;
  min-height: 0 !important;
  max-width: 100%;
  max-height: none !important;
  flex: 0 0 auto;
}

.crop-stage.is-ready > img[data-crop-image] {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: contain !important;
  object-position: center !important;
}

@media (max-width: 800px) {
  .crop-stage.is-ready {
    min-height: 0 !important;
    max-height: none !important;
  }
}


/* =========================================================
   v63 — IMAGE TO TEXT (BROWSER OCR)
========================================================= */
.image-to-text-panel{display:grid;gap:16px}
.image-to-text-panel.hidden{display:none!important}
.image-to-text-drop.is-dragging{border-color:var(--primary)!important;background:rgba(114,230,255,.07)!important;box-shadow:0 0 0 3px rgba(114,230,255,.08)}
.image-to-text-settings{display:grid;grid-template-columns:minmax(180px,260px) minmax(240px,1fr);align-items:end;gap:12px}
.image-to-text-preprocess{min-height:44px;margin:0;padding:10px 12px;border:1px solid var(--line);border-radius:11px;background:rgba(255,255,255,.025)}
.image-to-text-run-actions{justify-content:flex-end}
.image-to-text-output{display:grid;gap:10px;padding:14px;border:1px solid var(--line);border-radius:14px;background:rgba(3,12,22,.28)}
.image-to-text-output-head{display:flex;align-items:end;justify-content:space-between;gap:12px}
.image-to-text-output-head>div{display:grid;gap:3px}
.image-to-text-output-head strong{font-size:.9rem}
.image-to-text-output-head span,.image-to-text-output-head small{color:var(--text-muted);font-size:.7rem}
#itt-output{width:100%;min-height:260px;max-height:60vh;resize:vertical;box-sizing:border-box;border:1px solid var(--line);border-radius:12px;background:#07111f;color:var(--text);padding:14px;font:500 .9rem/1.6 ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;outline:none;tab-size:4}
#itt-output:focus{border-color:rgba(114,230,255,.65);box-shadow:0 0 0 3px rgba(114,230,255,.08)}
#itt-status[data-type="error"]{color:#ff8a8a}
#itt-status[data-type="success"]{color:#8ee3b0}
#itt-info{grid-template-columns:minmax(0,1fr) auto auto}
html[data-theme="light"] .image-to-text-output{background:rgba(255,255,255,.6)}
html[data-theme="light"] #itt-output{background:#fff;color:#102033}
@media(max-width:720px){
  .image-to-text-settings{grid-template-columns:1fr}
  /* Mobile OCR actions must remain normal touch targets.
     The old 145px flex-basis became button HEIGHT after .pdf-action-row
     switched to a column layout on phones. */
  .image-to-text-run-actions .btn,
  .image-to-text-output .pdf-action-row .btn{
    flex:0 0 auto;
    width:100%;
    min-height:46px;
    height:auto;
    padding:10px 16px;
  }
  .image-to-text-output-head{align-items:start;flex-direction:column}
  #itt-output{min-height:220px;font-size:16px}
  #itt-info{grid-template-columns:1fr 1fr}
  #itt-info strong{grid-column:1/-1;overflow-wrap:anywhere}
}

/* =========================================================
   v64 — OCR SEARCHABLE PDF OUTPUT
========================================================= */
.image-to-text-settings{grid-template-columns:repeat(2,minmax(180px,1fr));align-items:end}
.image-to-text-preprocess{grid-column:1/-1}
.image-to-text-pdf-result{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:14px 16px;border:1px solid rgba(114,230,255,.28);border-radius:14px;background:rgba(114,230,255,.055)}
.image-to-text-pdf-result.hidden{display:none!important}
.image-to-text-pdf-result>div{display:flex;align-items:center;gap:12px;min-width:0}
.image-to-text-pdf-result strong{display:block;font-size:.9rem}
.image-to-text-pdf-result p{margin:3px 0 0;color:var(--text-muted);font-size:.72rem;line-height:1.45}
.image-to-text-pdf-badge{display:grid;place-items:center;width:44px;height:44px;flex:0 0 44px;border-radius:11px;border:1px solid rgba(114,230,255,.28);background:rgba(114,230,255,.08);font-size:.7rem;font-weight:900;letter-spacing:.08em;color:var(--primary)}
@media(max-width:720px){
  .image-to-text-settings{grid-template-columns:1fr}
  .image-to-text-preprocess{grid-column:auto}
  .image-to-text-pdf-result{align-items:stretch;flex-direction:column}
  .image-to-text-pdf-result .btn{width:100%}
}

/* v57: OCR progress uses an indeterminate animation while the worker/model is
   loading because Tesseract does not provide a reliable numeric percentage for
   those phases. Once recognition starts the bar switches to real percentages. */
.pdf-progress.is-indeterminate > div > span {
  width: 34% !important;
  transition: none !important;
  animation: pixelOrigen-progress-indeterminate 1.05s ease-in-out infinite;
}
@keyframes pixelOrigen-progress-indeterminate {
  0% { transform: translateX(-125%); }
  50% { transform: translateX(95%); }
  100% { transform: translateX(310%); }
}
@media (prefers-reduced-motion: reduce) {
  .pdf-progress.is-indeterminate > div > span {
    animation-duration: 2.2s;
  }
}


/* OCR first-initialization status v60 */
.ocr-first-init{display:grid;gap:14px;margin-top:2px;padding:16px;border:1px solid rgba(129,110,255,.34);border-radius:15px;background:linear-gradient(145deg,rgba(15,34,52,.92),rgba(7,21,36,.78));box-shadow:inset 0 1px 0 rgba(255,255,255,.025),0 12px 28px rgba(0,0,0,.08)}
.ocr-first-init.hidden{display:none!important}
.ocr-first-init-head{display:flex;align-items:flex-start;gap:12px}
.ocr-first-init-icon{display:grid;place-items:center;width:42px;height:42px;flex:0 0 42px;border:1px solid rgba(129,110,255,.35);border-radius:12px;background:rgba(129,110,255,.1);color:#9c8cff;font-size:1.3rem;animation:ocrInitPulse 1.35s ease-in-out infinite}
.ocr-first-init-head strong{display:block;font-size:.92rem;color:var(--text)}
.ocr-first-init-head p{margin:4px 0 0;color:var(--text-muted);font-size:.72rem;line-height:1.55;max-width:760px}
.ocr-init-lines{display:grid;gap:2px;padding-left:4px}
.ocr-init-line{position:relative;display:grid;grid-template-columns:22px minmax(0,1fr);gap:10px;align-items:start;padding:9px 0;opacity:.48;transition:opacity .18s ease,transform .18s ease}
.ocr-init-line:not(:last-child)::after{content:"";position:absolute;left:7px;top:28px;bottom:-8px;width:1px;background:rgba(129,110,255,.22)}
.ocr-init-line>i{position:relative;z-index:1;display:block;width:15px;height:15px;margin-top:2px;border:2px solid rgba(151,165,184,.45);border-radius:50%;background:#0b1b2b}
.ocr-init-line strong{display:block;font-size:.77rem;line-height:1.25;color:var(--text)}
.ocr-init-line small{display:block;margin-top:2px;color:var(--text-muted);font-size:.67rem;line-height:1.4}
.ocr-init-line.is-current{opacity:1;transform:translateX(2px)}
.ocr-init-line.is-current>i{border-color:#8b7cff;border-top-color:transparent;animation:ocrInitSpin .8s linear infinite;box-shadow:0 0 12px rgba(129,110,255,.24)}
.ocr-init-line.is-done{opacity:.92}
.ocr-init-line.is-done>i{border-color:#6fe5ff;background:linear-gradient(135deg,#6fe5ff,#8b7cff)}
.ocr-init-line.is-done>i::after{content:"";position:absolute;left:3px;top:1px;width:4px;height:7px;border:solid #07111f;border-width:0 2px 2px 0;transform:rotate(45deg)}
.ocr-init-line.is-error{opacity:1}
.ocr-init-line.is-error>i{border-color:#ff7f91;background:rgba(255,90,110,.15)}
.ocr-first-init-foot{margin:0;padding-top:10px;border-top:1px solid rgba(255,255,255,.065);color:#86b8df;font-size:.68rem;line-height:1.45}
html[data-theme="light"] .ocr-first-init{background:linear-gradient(145deg,rgba(244,248,255,.98),rgba(236,243,252,.94));box-shadow:0 10px 25px rgba(22,42,66,.06)}
html[data-theme="light"] .ocr-init-line>i{background:#f4f8fd}
html[data-theme="light"] .ocr-init-line.is-done>i::after{border-color:#fff}
@keyframes ocrInitSpin{to{transform:rotate(360deg)}}
@keyframes ocrInitPulse{0%,100%{opacity:.72;transform:scale(.98)}50%{opacity:1;transform:scale(1.03)}}
@media (max-width:640px){.ocr-first-init{padding:13px}.ocr-first-init-head p{font-size:.69rem}.ocr-init-line{grid-template-columns:20px minmax(0,1fr);gap:9px}.ocr-first-init-icon{width:38px;height:38px;flex-basis:38px}}
@media (prefers-reduced-motion:reduce){.ocr-first-init-icon,.ocr-init-line.is-current>i{animation:none}.ocr-init-line{transition:none}}

/* =========================================================
   v67 — OCR EXTRACTED TEXT AREA POLISH
========================================================= */
#itt-output{
  min-height:280px;
  max-height:58vh;
  resize:none;
  overflow:auto;
  padding:16px 18px;
  border:1px solid rgba(122,151,184,.22);
  border-radius:14px;
  background:linear-gradient(180deg,rgba(5,15,27,.96),rgba(4,13,24,.98));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.025),inset 0 0 0 1px rgba(0,0,0,.08);
  caret-color:var(--primary);
  scrollbar-width:thin;
  scrollbar-color:rgba(139,125,255,.62) rgba(255,255,255,.035);
}
#itt-output:hover{
  border-color:rgba(122,151,184,.32);
}
#itt-output:focus{
  border-color:rgba(114,230,255,.62);
  box-shadow:0 0 0 3px rgba(114,230,255,.075),inset 0 1px 0 rgba(255,255,255,.025);
}
#itt-output::placeholder{
  color:rgba(158,178,201,.52);
}
#itt-output::-webkit-scrollbar{
  width:9px;
  height:9px;
}
#itt-output::-webkit-scrollbar-track{
  margin:7px 0;
  background:rgba(255,255,255,.025);
  border-radius:999px;
}
#itt-output::-webkit-scrollbar-thumb{
  min-height:44px;
  border:2px solid transparent;
  border-radius:999px;
  background:linear-gradient(180deg,rgba(114,230,255,.76),rgba(139,125,255,.8)) padding-box;
}
#itt-output::-webkit-scrollbar-thumb:hover{
  background:linear-gradient(180deg,rgba(114,230,255,.94),rgba(139,125,255,.96)) padding-box;
}
#itt-output::-webkit-scrollbar-corner{
  background:transparent;
}
html[data-theme="light"] #itt-output{
  background:linear-gradient(180deg,#fff,#f8fbff);
  border-color:rgba(32,66,103,.16);
  color:#102033;
  scrollbar-color:rgba(91,86,210,.6) rgba(23,48,75,.06);
}
html[data-theme="light"] #itt-output::-webkit-scrollbar-track{
  background:rgba(23,48,75,.045);
}
@media(max-width:720px){
  #itt-output{
    min-height:240px;
    max-height:52vh;
    padding:14px 15px;
    border-radius:12px;
    font-size:16px;
  }
  #itt-output::-webkit-scrollbar{width:7px}
}

/* OCR interaction lock v63 */
.tool-dropzone.is-disabled {
  pointer-events: none;
  opacity: 0.72;
  filter: saturate(0.85);
}

.tool-dropzone[aria-disabled="true"] {
  cursor: wait;
}

button:disabled {
  cursor: not-allowed;
}

/* OCR v63: prevent mid-job interaction while initialization/recognition is active. */
#panel-image-to-text.is-ocr-interaction-locked #itt-drop[aria-disabled="true"] { pointer-events:none; opacity:.72; }
#panel-image-to-text.is-ocr-interaction-locked button:disabled,
#panel-image-to-text.is-ocr-interaction-locked select:disabled,
#panel-image-to-text.is-ocr-interaction-locked input:disabled,
#pdfe-workspace.is-ocr-interaction-locked button:disabled,
#pdfe-workspace.is-ocr-interaction-locked select:disabled,
#pdfe-workspace.is-ocr-interaction-locked input:disabled { cursor:wait !important; }
.pdfe-ocr-button:disabled, #itt-start:disabled { opacity:.58; filter:saturate(.65); }

/* OCR clipboard confirmation toast */
.itt-copy-toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  z-index: 10050;
  max-width: calc(100vw - 32px);
  padding: 8px 14px;
  border: 1px solid rgba(126, 231, 255, .22);
  border-radius: 999px;
  background: rgba(10, 24, 39, .96);
  color: #f6fbff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: .01em;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility 0s linear .18s;
}

.itt-copy-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  visibility: visible;
  transition-delay: 0s;
}

html[data-theme="light"] .itt-copy-toast {
  border-color: rgba(15, 76, 104, .16);
  background: rgba(247, 252, 255, .98);
  color: #102638;
  box-shadow: 0 10px 28px rgba(24, 56, 78, .18);
}

@media (prefers-reduced-motion: reduce) {
  .itt-copy-toast { transition: none; }
}



/* =========================================================
   V70 — OCR SELECTED-LANGUAGE CLEANUP
========================================================= */
.image-to-text-language-clean {
  grid-column: 1 / -1;
  min-height: 50px;
  margin: 0;
  padding: 10px 12px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255,255,255,.025);
}

.image-to-text-language-clean > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.image-to-text-language-clean strong {
  color: var(--text);
  font-size: .76rem;
  line-height: 1.35;
}

.image-to-text-language-clean small {
  color: var(--text-muted);
  font-size: .66rem;
  line-height: 1.45;
}

html[data-theme="light"] .image-to-text-language-clean {
  background: rgba(255,255,255,.58);
}

@media (max-width: 600px) {
  .image-to-text-language-clean {
    grid-column: auto;
    min-height: 48px;
    padding: 9px 10px;
  }
}



/* Production tap reliability: keep normal controls on the browser's fast tap
   path without changing drag/pan surfaces. */
button:not(.pixora-compare-handle),
a.btn,
label.drop-zone-action,
label.bulk-picker,
label.pdf-file-button {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.pixora-compare-handle { touch-action: none; }

/* =========================================================
   FORM PHOTO & SIGNATURE — verified presets + manual override
========================================================= */
.form-assets-panel { display: grid; gap: 18px; }
.form-tool-notice { display: grid; gap: 4px; padding: 13px 14px; border: 1px solid rgba(114,224,161,.22); border-radius: 13px; background: rgba(114,224,161,.06); }
.form-tool-notice strong { color: var(--green); font-size: .84rem; }
.form-tool-notice p { margin: 0; color: var(--text-soft); font-size: .76rem; line-height: 1.55; }
.form-upload-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.form-upload-card { display: grid; align-content: start; gap: 12px; min-width: 0; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(255,255,255,.025); }
.form-upload-card-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.form-upload-card-head > span { display: grid; place-items: center; flex: 0 0 auto; width: 42px; height: 42px; border: 1px solid rgba(114,230,255,.2); border-radius: 12px; color: var(--primary); background: rgba(114,230,255,.07); font-size: .62rem; font-weight: 900; letter-spacing: .04em; }
.form-upload-card-head > div { display: grid; min-width: 0; }
.form-upload-card-head strong { color: var(--text); font-size: .84rem; }
.form-upload-card-head small { color: var(--text-muted); font-size: .68rem; }
.form-file-button { width: 100%; justify-content: center; min-height: 42px; cursor: pointer; touch-action: manipulation; }
.form-file-preview { display: grid; grid-template-columns: 52px minmax(0,1fr) auto; align-items: center; gap: 9px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; background: rgba(3,13,24,.3); }
.form-file-preview img { width: 52px; height: 52px; object-fit: contain; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.form-file-preview > div { display: grid; min-width: 0; }
.form-file-preview strong, .form-file-preview small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.form-file-preview strong { color: var(--text-soft); font-size: .72rem; }
.form-file-preview small { color: var(--text-muted); font-size: .65rem; }
.form-file-preview .btn { min-height: 34px; padding: 7px 9px; font-size: .68rem; }
.form-preset-section { display: grid; gap: 11px; }
.form-preset-combobox { position: relative; display: grid; gap: 7px; }
.form-preset-combobox > label { color: var(--text-soft); font-size: .78rem; font-weight: 750; }
#form-preset-search, #form-custom-source-url { width: 100%; min-height: 48px; padding: 11px 13px; color: var(--text); border: 1px solid var(--line-strong); border-radius: 12px; background: var(--bg-soft); outline: none; }
#form-preset-search:focus, #form-custom-source-url:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(114,230,255,.1); }
.form-preset-listbox { position: absolute; top: calc(100% + 7px); left: 0; right: 0; z-index: 40; max-height: min(380px,58vh); overflow: auto; padding: 7px; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--bg-soft); box-shadow: 0 18px 48px rgba(0,0,0,.28); }
.form-preset-option { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 11px 10px; border: 0; border-radius: 9px; color: var(--text); background: transparent; text-align: left; cursor: pointer; touch-action: manipulation; }
.form-preset-option:hover, .form-preset-option:focus-visible { background: rgba(114,230,255,.08); outline: none; }
.form-preset-option > span { display: grid; min-width: 0; }
.form-preset-option strong { font-size: .77rem; }
.form-preset-option small { color: var(--text-muted); font-size: .65rem; }
.form-preset-option em { flex: 0 0 auto; color: var(--primary); font-size: .63rem; font-style: normal; font-weight: 850; }
.form-preset-empty { margin: 0; padding: 12px; color: var(--text-muted); font-size: .72rem; line-height: 1.55; }
.form-preset-info { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: rgba(3,13,24,.28); }
.form-preset-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.form-preset-title-row > div { display: grid; gap: 2px; min-width: 0; }
.form-preset-title-row strong { font-size: .9rem; }
.form-preset-title-row span:not(.form-verify-badge) { color: var(--text-muted); font-size: .68rem; }
.form-verify-badge { flex: 0 0 auto; padding: 5px 8px; border: 1px solid rgba(114,224,161,.25); border-radius: 999px; color: var(--green); background: rgba(114,224,161,.07); font-size: .62rem; font-weight: 900; }
.form-verify-badge[data-status="manual-check"], .form-verify-badge[data-status="stale"] { color: #f3c768; border-color: rgba(243,199,104,.26); background: rgba(243,199,104,.07); }
.form-verify-badge[data-status="custom"] { color: var(--primary); border-color: rgba(114,230,255,.25); background: rgba(114,230,255,.07); }
.form-source-citation, .form-source-scope, .form-latest-warning { margin: 0; line-height: 1.55; }
.form-source-citation { color: var(--text-soft); font-size: .72rem; font-weight: 720; }
.form-source-scope { color: var(--text-muted); font-size: .69rem; }
.form-requirement-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.form-requirement-grid > article { min-width: 0; padding: 11px; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.02); }
.form-requirement-grid > article > strong { display: block; margin-bottom: 7px; color: var(--text-soft); font-size: .72rem; }
.form-requirement-summary ul { display: grid; gap: 5px; margin: 0; padding-left: 16px; }
.form-requirement-summary li { color: var(--text-muted); font-size: .66rem; line-height: 1.45; }
.form-source-row { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 10px; }
.form-source-link { display: inline-flex; align-items: center; min-height: 34px; padding: 7px 9px; border: 1px solid rgba(114,230,255,.24); border-radius: 9px; color: var(--primary); background: rgba(114,230,255,.055); font-size: .66rem; font-weight: 800; text-decoration: none; }
.form-source-link:hover { border-color: rgba(114,230,255,.5); background: rgba(114,230,255,.1); }
.form-source-row small { margin-left: auto; color: var(--text-muted); font-size: .64rem; }
.form-latest-warning { padding: 10px 11px; border: 1px solid rgba(243,199,104,.19); border-radius: 10px; color: var(--text-soft); background: rgba(243,199,104,.055); font-size: .68rem; }
.form-review-check { align-items: flex-start; margin: 0; padding: 10px 11px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.02); }
.form-review-check > span { display: grid; gap: 2px; }
.form-review-check strong { color: var(--text-soft); font-size: .7rem; }
.form-review-check small { color: var(--text-muted); font-size: .64rem; line-height: 1.45; }
.form-edit-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.form-edit-grid fieldset { min-width: 0; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; }
.form-edit-grid legend { padding: 0 5px; color: var(--text-soft); font-size: .73rem; font-weight: 850; }
.form-edit-grid .field { margin-bottom: 12px; }
.form-custom-source-field { margin: 12px 0 16px; }
.form-custom-source-field > small { color: var(--text-muted); font-size: .64rem; line-height: 1.45; }
.form-processing-note { min-height: 21px; color: var(--text-soft); font-size: .72rem; line-height: 1.5; }
.form-results { display: grid; gap: 12px; }
.form-result-card { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 7px 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.form-result-card > strong, .form-result-card > p, .form-result-card > .form-result-preview, .form-result-card > .form-result-warning { grid-column: 1 / -1; }
.form-result-card > strong { color: var(--green); font-size: .8rem; }
.form-result-card > p { margin: 0; color: var(--text-muted); font-size: .68rem; }
.form-result-card > .btn { grid-column: 1 / -1; justify-content: center; }
.form-result-preview { display: grid; place-items: center; min-height: 120px; max-height: 260px; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.form-result-preview img { display: block; width: 100%; max-height: 260px; object-fit: contain; }
.form-result-warning { margin: 0 !important; padding: 8px 9px; border: 1px solid rgba(243,199,104,.2); border-radius: 9px; color: var(--text-soft) !important; background: rgba(243,199,104,.05); }
.form-result-card.is-note > strong { color: #f3c768; }

html[data-theme="light"] .form-upload-card,
html[data-theme="light"] .form-preset-info,
html[data-theme="light"] .form-requirement-grid > article,
html[data-theme="light"] .form-review-check,
html[data-theme="light"] .form-result-card { background: rgba(255,255,255,.72); }
html[data-theme="light"] .form-file-preview { background: rgba(235,243,249,.8); }
html[data-theme="light"] #form-preset-search,
html[data-theme="light"] #form-custom-source-url,
html[data-theme="light"] .form-preset-listbox,
html[data-theme="light"] .form-edit-grid input,
html[data-theme="light"] .form-edit-grid select { color: var(--text); background: #fff; }
html[data-theme="light"] .form-preset-listbox { box-shadow: 0 18px 42px rgba(25,56,78,.16); }

@media (max-width: 760px) {
  .form-upload-grid, .form-requirement-grid, .form-edit-grid { grid-template-columns: 1fr; }
  .form-preset-title-row { align-items: stretch; flex-direction: column; }
  .form-verify-badge { width: fit-content; }
  .form-source-row small { width: 100%; margin-left: 0; }
  .form-file-preview { grid-template-columns: 48px minmax(0,1fr); }
  .form-file-preview .btn { grid-column: 1 / -1; }
}

/* Form Photo & Signature production UX pass */

.workspace-tool-icon.has-icon-asset { padding: 11px; }
.workspace-tool-icon.has-icon-asset img { display: block; width: 100%; height: 100%; object-fit: contain; }
.related-tool-grid a > span.has-icon-asset { padding: 7px; }
.related-tool-grid a > span.has-icon-asset img { display: block; width: 100%; height: 100%; object-fit: contain; }

.workspace-grid.is-form-tool {
  grid-template-columns: minmax(0, 980px);
  justify-content: center;
}
.workspace-grid.is-form-tool .workspace-controls { width: 100%; }
.workspace-grid.is-form-tool .tool-control-card { padding: clamp(18px, 3vw, 30px); }
.form-primary-upload { display: grid; gap: 16px; }
.form-primary-upload[hidden] { display: none !important; }
.form-upload-grid-primary { gap: 16px; }
.form-upload-grid-primary .form-upload-card {
  min-height: 210px;
  padding: 18px;
  align-content: start;
  border-color: rgba(114,230,255,.2);
  background: linear-gradient(145deg, rgba(114,230,255,.045), rgba(255,255,255,.018));
}
.form-upload-grid-primary .form-upload-card-head > span { width: 54px; height: 54px; border-radius: 15px; font-size: .66rem; }
.form-upload-grid-primary .form-upload-card-head strong { font-size: .94rem; }
.form-upload-grid-primary .form-upload-card-head small { margin-top: 2px; font-size: .7rem; }
.form-upload-grid-primary .form-file-button { min-height: 52px; margin-top: 4px; font-size: .78rem; font-weight: 900; }
.form-upload-grid-primary .form-file-preview { margin-top: auto; }
.form-trust-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.form-trust-grid article { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 12px; border: 1px solid rgba(114,224,161,.18); border-radius: 12px; background: rgba(114,224,161,.045); }
.form-trust-grid article > span { flex: 0 0 auto; min-width: 48px; padding: 5px 6px; border-radius: 8px; color: var(--green); background: rgba(114,224,161,.08); font-size: .54rem; font-weight: 950; text-align: center; letter-spacing: .025em; }
.form-trust-grid article > div { display: grid; gap: 3px; min-width: 0; }
.form-trust-grid strong { color: var(--text-soft); font-size: .72rem; }
.form-trust-grid small { color: var(--text-muted); font-size: .63rem; line-height: 1.48; }
.form-edit-grid fieldset { position: relative; }
.form-reset-kind { position: absolute; top: 7px; right: 8px; min-height: 34px; padding: 6px 9px; font-size: .64rem; }
.form-session-note { margin: 12px 0 0; padding: 10px 11px; border: 1px solid rgba(114,230,255,.16); border-radius: 10px; color: var(--text-muted); background: rgba(114,230,255,.04); font-size: .66rem; line-height: 1.5; }
.form-session-note strong { color: var(--text-soft); }
.form-source-link { position: relative; z-index: 2; min-height: 42px; padding: 9px 11px; cursor: pointer; touch-action: manipulation; pointer-events: auto; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.form-source-link:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
html[data-theme="light"] .form-upload-grid-primary .form-upload-card { background: linear-gradient(145deg, #fff, rgba(235,244,250,.88)); }
html[data-theme="light"] .form-trust-grid article { background: rgba(226,247,237,.74); border-color: rgba(34,128,81,.16); }

@media (max-width: 760px) {
  .workspace-grid.is-form-tool .tool-control-card { padding: 15px; }
  .form-upload-grid-primary .form-upload-card { min-height: 185px; padding: 15px; }
  .form-upload-grid-primary .form-file-button { min-height: 54px; font-size: .8rem; }
  .form-trust-grid { grid-template-columns: 1fr; }
  .form-source-row { align-items: stretch; }
  .form-source-link { width: 100%; justify-content: center; min-height: 46px; text-align: center; }
  .form-reset-kind { position: static; width: 100%; margin: 0 0 10px; justify-content: center; }
}

@media (max-width: 420px) {
  .form-upload-grid-primary .form-upload-card-head > span { width: 48px; height: 48px; }
  .form-upload-grid-primary .form-file-preview { grid-template-columns: 46px minmax(0,1fr); }
  .form-upload-grid-primary .form-file-preview img { width: 46px; height: 46px; }
}

/* Avoid showing the generic uploader/compare card before deferred JS initializes the form tool. */
html[data-route-tool="passport"] #generic-upload-content { display: none !important; }
html[data-route-tool="passport"] #form-primary-upload,
html[data-route-tool="passport"] #form-primary-upload.hidden { display: grid !important; }
html[data-route-tool="passport"] #image-info-section { display: none !important; }

html[data-route-tool="passport"] .generic-upload-heading { display: none !important; }
html[data-route-tool="passport"] .form-upload-heading,
html[data-route-tool="passport"] .form-upload-heading.hidden { display: flex !important; }


/* Contextual install and PDF OCR override polish. */
.pdf-command-note { display:block; max-width:560px; margin-top:6px; color:var(--text-muted); font-size:.65rem; line-height:1.45; }
@media (max-width:600px) {
  .workspace-actions > .workspace-install-btn { display:none !important; }
  .workspace-mobile-menu .mobile-install-action {
    border:0;
    border-top:1px solid var(--line);
    border-radius:0;
    text-align:left;
    color:var(--primary);
  }
}


/* Route-correct first paint for document tools. The server already marks the
   active panel; hide the generic image upload/preview before deferred JS runs. */
html[data-route-tool="image-to-text"] #upload-section,
html[data-route-tool="pdf-converter"] #upload-section,
html[data-route-tool="pdf-editor"] #upload-section,
html[data-route-tool="image-to-text"] #image-info-section,
html[data-route-tool="pdf-converter"] #image-info-section,
html[data-route-tool="pdf-editor"] #image-info-section {
  display: none !important;
}
html[data-route-tool="image-to-text"] .workspace-grid,
html[data-route-tool="pdf-converter"] .workspace-grid,
html[data-route-tool="pdf-editor"] .workspace-grid {
  grid-template-columns: minmax(0, 1fr);
}


/* =========================================================
   V79 — DEDICATED FULL-SCREEN PDF EDITOR WORKSPACE
   After a PDF is chosen, editing moves into a same-tab,
   browser-only workspace with a large page canvas and all
   PDF editing controls kept inside the editor surface.
========================================================= */
.pdf-editor-entry-actions {
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid rgba(114, 230, 255, .16);
  border-radius: 12px;
  background: rgba(114, 230, 255, .035);
}
.pdf-editor-entry-actions:not(.hidden) { display: flex; }
.pdf-editor-entry-actions span { color: var(--text-muted); font-size: .68rem; line-height: 1.45; }

.pdf-editor-fullscreen-header {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
.pdf-editor-fullscreen-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--text-soft);
  background: var(--bg-soft);
  font: inherit;
  font-weight: 850;
  cursor: pointer;
}
.pdf-editor-fullscreen-back:hover { color: var(--primary); border-color: rgba(114,230,255,.35); }
.pdf-editor-fullscreen-document { min-width: 0; display: grid; gap: 2px; }
.pdf-editor-fullscreen-document strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: .83rem;
}
.pdf-editor-fullscreen-document span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: .64rem;
}
.pdf-editor-fullscreen-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
.pdf-editor-local-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid rgba(114,224,161,.2);
  border-radius: 999px;
  color: #72e0a1;
  background: rgba(114,224,161,.06);
  font-size: .62rem;
  font-weight: 850;
  white-space: nowrap;
}
.pdf-editor-fullscreen-actions .btn { min-height: 40px; padding: 8px 14px; }

.pdf-editor-content { min-width: 0; min-height: 0; }
.pdf-editor-inspector { min-width: 0; }

body.pdfe-fullscreen-mode {
  overflow: hidden !important;
  overscroll-behavior: none;
}
body.pdfe-fullscreen-mode #pdfe-workspace {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid !important;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  isolation: isolate;
}
body.pdfe-fullscreen-mode #feedback-widget .feedback-launch { display: none !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-commandbar {
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 12px;
  background: rgba(3,13,24,.4);
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-command-group-primary {
  grid-template-columns: auto minmax(0, 1fr);
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools {
  margin-top: 0;
  border-radius: 11px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(290px, 25vw, 370px);
  min-height: 0;
  overflow: hidden;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-layout {
  grid-template-columns: clamp(108px, 10vw, 148px) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  height: 100%;
  max-height: none;
  border: 0;
  border-right: 1px solid var(--line);
  border-radius: 0;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-main {
  min-width: 0;
  min-height: 0;
  padding: 10px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
  min-height: 0;
  height: 100%;
  padding: 20px;
  border-radius: 12px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 0;
  padding: 11px;
  overflow: auto;
  overscroll-behavior: contain;
  background: rgba(3,13,24,.22);
  scrollbar-width: thin;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-annotation-controls {
  padding: 11px;
  border-radius: 12px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-annotation-settings {
  grid-template-columns: minmax(0, 1fr);
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-controls {
  align-items: flex-start;
  flex-direction: column;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-controls .btn { width: 100%; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-export-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0;
  padding-top: 10px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-export-actions #pdfe-export {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
  margin: 0;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-results { margin-top: 0; }
body.pdfe-fullscreen-mode #pdfe-workspace.is-loading .pdf-editor-content::after {
  content: "Opening PDF locally…";
  position: absolute;
  inset: 50% auto auto 50%;
  z-index: 8;
  transform: translate(-50%, -50%);
  padding: 11px 15px;
  border: 1px solid rgba(114,230,255,.24);
  border-radius: 12px;
  color: var(--text-soft);
  background: rgba(6,17,30,.92);
  box-shadow: 0 18px 50px rgba(0,0,0,.35);
  font-size: .72rem;
  font-weight: 800;
  pointer-events: none;
}
body.pdfe-fullscreen-mode #pdfe-workspace.is-loading .pdf-editor-content { position: relative; }
body.pdfe-fullscreen-mode #pdfe-workspace.is-loading .pdf-editor-layout,
body.pdfe-fullscreen-mode #pdfe-workspace.is-loading .pdf-editor-inspector { opacity: .35; pointer-events: none; }

html[data-theme="light"] body.pdfe-fullscreen-mode #pdfe-workspace { background: #eef6fb; }
html[data-theme="light"] body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-commandbar,
html[data-theme="light"] body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector { background: rgba(239,247,252,.94); }
html[data-theme="light"] .pdf-editor-fullscreen-header { background: rgba(244,250,253,.96); }

@media (max-width: 900px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-content {
    grid-template-columns: minmax(0, 1fr) minmax(260px, 32vw);
  }
  .pdf-editor-local-badge span { display: none; }
}

@media (max-width: 700px) {
  .pdf-editor-entry-actions:not(.hidden) { display: grid; }
  .pdf-editor-entry-actions .btn { width: 100%; }
  .pdf-editor-fullscreen-header {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
    padding: max(7px, env(safe-area-inset-top)) 8px 7px;
  }
  .pdf-editor-fullscreen-back { min-width: 42px; min-height: 42px; padding: 6px 9px; }
  .pdf-editor-fullscreen-back > span[aria-hidden="true"] { display: inline !important; color: currentColor; font-size: 1.15rem; line-height: 1; }
  .pdf-editor-fullscreen-document strong { font-size: .74rem; }
  .pdf-editor-fullscreen-document span { font-size: .56rem; }
  .pdf-editor-local-badge { display: none; }
  .pdf-editor-fullscreen-actions .btn { min-width: 92px; min-height: 42px; padding: 7px 10px; }

  body.pdfe-fullscreen-mode #pdfe-workspace {
    grid-template-rows: auto auto minmax(0, 1fr);
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-commandbar {
    padding: 6px 8px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-commandbar::-webkit-scrollbar { display: none; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-commandbar,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-command-group-primary,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-toolbar {
    display: flex;
    flex-wrap: nowrap;
    width: max-content;
    max-width: none;
    gap: 6px;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-command-label { display: none; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools { flex: 0 0 auto; width: auto; min-width: 160px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools > summary { min-height: 42px; white-space: nowrap; }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-content {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) auto;
    overflow: hidden;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar {
    display: grid;
    grid-template-columns: auto minmax(0,1fr);
    align-items: center;
    gap: 7px;
    padding: 5px 7px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-thumbnails {
    display: flex;
    gap: 6px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 0 4px;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-thumb { flex: 0 0 58px; padding: 4px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-thumb canvas { max-height: 62px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-thumb small { display: none; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-main { min-height: 0; padding: 5px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar { min-height: 34px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap { padding: 8px; border-radius: 9px; }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector {
    max-height: min(34dvh, 310px);
    padding: 8px;
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 96%, transparent);
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-annotation-controls { padding: 8px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-controls { gap: 7px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-text-control { grid-template-columns: minmax(0,1fr); }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-export-actions {
    grid-template-columns: 1fr 1fr;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-export-actions #pdfe-export { display: none; }
}

@media (max-width: 420px) {
  .pdf-editor-fullscreen-document span { max-width: 42vw; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-toolbar button { min-height: 40px; padding: 6px 9px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector { max-height: min(36dvh, 300px); }
}


/* ===== PDF Editor v2: responsive pro layout ===== */
.pdfe-mobile-tool-dock,
.pdfe-mobile-sheet-head,
.pdfe-mobile-page-actions { display: none; }

@media (max-width: 700px) {
  body.pdfe-fullscreen-mode #pdfe-workspace {
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  /* Mobile follows the common editor pattern: canvas first, tools at the bottom. */
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-commandbar {
    display: none !important;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-content {
    display: block;
    min-height: 0;
    overflow: hidden;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-layout {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-main {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 0;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document span {
    display: none;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar {
    position: absolute;
    top: 7px;
    left: 8px;
    right: 8px;
    z-index: 12;
    min-height: 38px;
    padding: 4px 6px 4px 10px;
    border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
    border-radius: 12px;
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    pointer-events: none;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar > * {
    pointer-events: auto;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar > span {
    font-size: .66rem;
    font-weight: 850;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar button {
    min-width: 38px;
    min-height: 34px;
    padding: 4px 8px;
    border-radius: 9px;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
    width: 100%;
    height: 100%;
    min-height: 0;
    padding: 52px 6px 8px !important;
    border: 0;
    border-radius: 0;
    overflow: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    background:
      linear-gradient(45deg, rgba(255,255,255,.022) 25%, transparent 25% 75%, rgba(255,255,255,.022) 75%),
      linear-gradient(45deg, rgba(255,255,255,.022) 25%, transparent 25% 75%, rgba(255,255,255,.022) 75%);
    background-position: 0 0, 12px 12px;
    background-size: 24px 24px;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage {
    margin-inline: auto;
  }

  /* Hide desktop panels until the matching mobile sheet is requested. */
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(68px + env(safe-area-inset-bottom));
    z-index: 5055;
    display: none;
    width: auto;
    max-width: none;
    max-height: min(46dvh, 420px);
    margin: 0;
    padding: 8px;
    overflow: auto;
    border: 1px solid color-mix(in srgb, var(--line) 92%, transparent);
    border-radius: 17px 17px 12px 12px;
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    box-shadow: 0 -18px 54px rgba(0,0,0,.34);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar.is-mobile-open,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector.is-mobile-open {
    display: block;
    animation: pdfeMobileSheetIn 180ms ease-out both;
  }

  @keyframes pdfeMobileSheetIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-sheet-head {
    position: sticky;
    top: -8px;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-height: 42px;
    margin: -8px -8px 8px;
    padding: 7px 9px 7px 12px;
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 97%, transparent);
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-sheet-head strong {
    font-size: .78rem;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-sheet-head button {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255,255,255,.035);
    color: var(--text);
    font-size: 1.2rem;
    line-height: 1;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-desktop-sidebar-title {
    display: none;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar {
    max-height: min(38dvh, 330px);
  }

  body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-thumbnails {
    display: flex;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 2px 2px 7px;
    scroll-snap-type: x proximity;
    scrollbar-width: thin;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-thumb {
    flex: 0 0 68px;
    scroll-snap-align: start;
    padding: 4px;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-thumb canvas {
    max-height: 78px;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-thumb small {
    display: none;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-page-actions {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding: 6px 1px 1px;
    scrollbar-width: none;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-page-actions::-webkit-scrollbar {
    display: none;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-page-actions button {
    flex: 0 0 54px;
    min-height: 52px;
    display: grid;
    place-items: center;
    gap: 2px;
    padding: 5px 4px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(255,255,255,.025);
    color: var(--text);
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-page-actions button > span {
    font-size: 1.05rem;
    line-height: 1;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-page-actions button > small {
    font-size: .49rem;
    font-weight: 800;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-page-actions .is-danger {
    color: #ff8e8e;
    border-color: rgba(255,107,107,.34);
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector {
    max-height: min(48dvh, 430px);
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector .pdf-annotation-controls {
    padding: 4px;
    border: 0;
    background: transparent;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-export-actions {
    grid-template-columns: 1fr 1fr;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-export-actions #pdfe-export {
    display: none;
  }

  /* Compact, horizontally scrollable mobile tool dock. */
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock {
    position: relative;
    z-index: 5060;
    display: flex;
    gap: 4px;
    min-width: 0;
    min-height: 62px;
    padding: 5px 6px calc(5px + env(safe-area-inset-bottom));
    overflow-x: auto;
    overflow-y: hidden;
    border-top: 1px solid var(--line);
    background: color-mix(in srgb, var(--bg) 96%, transparent);
    box-shadow: 0 -8px 28px rgba(0,0,0,.16);
    scrollbar-width: none;
    scroll-snap-type: x proximity;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock::-webkit-scrollbar {
    display: none;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock button {
    flex: 0 0 54px;
    min-width: 54px;
    min-height: 52px;
    display: grid;
    grid-template-rows: 25px auto;
    place-items: center;
    align-content: center;
    gap: 2px;
    padding: 3px 2px;
    scroll-snap-align: center;
    border: 1px solid transparent;
    border-radius: 12px;
    background: transparent;
    color: var(--text-muted);
    touch-action: manipulation;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock button.is-active {
    color: var(--text);
    border-color: rgba(114,230,255,.34);
    background: rgba(114,230,255,.11);
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock button:active {
    transform: translateY(1px) scale(.98);
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-dock-icon {
    display: grid;
    place-items: center;
    min-width: 25px;
    min-height: 25px;
    font-size: 1.08rem;
    line-height: 1;
    font-weight: 850;
    letter-spacing: -.05em;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-dock-text-icon {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.15rem;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-dock-shape {
    font-size: 1.32rem;
    font-weight: 500;
  }

  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock small {
    max-width: 50px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: .48rem;
    font-weight: 850;
    line-height: 1.1;
  }

  /* More-tools remains available on desktop; mobile has the dock + sheets instead. */
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools {
    display: none !important;
  }
}

@media (max-width: 420px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-header {
    padding-inline: 6px;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-actions .btn {
    min-width: 88px;
    padding-inline: 9px;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock button {
    flex-basis: 52px;
    min-width: 52px;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar.is-mobile-open,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector.is-mobile-open {
    animation: none;
  }
}

/* =========================================================
   PDF Editor document-first workspace v3
   Compact controls + overlay drawers + independently scrollable canvas.
   Scoped to PDF editor fullscreen only; other tools are unaffected.
========================================================= */
.pdfe-visually-hidden { position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0 0 0 0)!important;white-space:nowrap!important;border:0!important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-icon-button{width:38px;min-width:38px;height:38px;min-height:38px;padding:0;border-radius:10px;display:inline-grid;place-items:center;font-size:1.15rem;line-height:1}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon{width:42px;min-width:42px;font-size:1.35rem}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-header{min-height:48px;padding:5px 9px;gap:8px}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document{gap:0}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document strong{font-size:.76rem}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document span{font-size:.57rem}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-local-badge{min-height:30px;padding:4px 7px;font-size:.56rem}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-commandbar{position:relative;z-index:40;min-height:46px;display:flex;align-items:center;justify-content:space-between;gap:6px;padding:4px 8px;overflow:visible}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-command-group-primary{display:block;min-width:0}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-command-label{display:none}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-compact-toolbar{display:flex;align-items:center;gap:3px;min-width:0;overflow-x:auto;overflow-y:hidden;scrollbar-width:none}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-compact-toolbar::-webkit-scrollbar{display:none}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-toolbar-icon,body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-summary{width:38px;min-width:38px;height:38px;min-height:38px;padding:0!important;display:inline-grid;place-items:center;border:1px solid var(--line);border-radius:9px;background:rgba(255,255,255,.025);color:var(--text-muted);font:inherit;font-size:.88rem;font-weight:850;line-height:1;cursor:pointer;list-style:none;touch-action:manipulation}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-summary::-webkit-details-marker{display:none}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-toolbar-icon:hover,body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-summary:hover,body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-toolbar-icon.is-active{color:var(--text);border-color:rgba(114,230,255,.38);background:rgba(114,230,255,.11)}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools{position:relative;flex:0 0 auto;width:38px;min-width:38px;margin:0;border:0;background:transparent}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools>summary{min-height:38px;border:1px solid var(--line);border-radius:9px}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools>.advanced-options-content{position:absolute;top:calc(100% + 6px);right:0;z-index:5070;width:min(570px,calc(100vw - 20px));max-height:min(66dvh,620px);padding:10px;overflow:auto;overscroll-behavior:contain;border:1px solid var(--line);border-radius:14px;background:color-mix(in srgb,var(--bg) 97%,transparent);box-shadow:0 20px 60px rgba(0,0,0,.34);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px)}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools:not([open])>.advanced-options-content{display:none}
@media(min-width:701px){
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-content{position:relative;display:block;min-width:0;min-height:0;overflow:hidden}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-layout{position:relative;display:block;width:100%;height:100%;min-width:0;min-height:0;border:0}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-main{width:100%;height:100%;min-width:0;min-height:0;padding:0}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar{position:absolute;top:7px;left:9px;right:9px;z-index:14;min-height:36px;padding:3px 5px 3px 10px;border:1px solid color-mix(in srgb,var(--line) 86%,transparent);border-radius:10px;background:color-mix(in srgb,var(--bg) 84%,transparent);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);pointer-events:none}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar>*{pointer-events:auto}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar button{min-width:34px;min-height:32px;padding:3px 8px;border-radius:8px}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap{width:100%;height:100%;min-width:0;min-height:0;padding:52px 16px 28px!important;overflow:auto!important;overscroll-behavior:contain;scrollbar-gutter:stable both-edges;touch-action:pan-x pan-y;align-items:start!important;justify-items:center!important;place-items:start center!important;scroll-padding:54px 20px 28px;border:0;border-radius:0}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage{margin:0 auto;flex:0 0 auto}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar,body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector{position:absolute;top:9px;bottom:9px;z-index:5060;display:grid;align-content:start;gap:8px;min-height:0;margin:0;overflow:auto;overscroll-behavior:contain;border:1px solid var(--line);border-radius:14px;background:color-mix(in srgb,var(--bg) 97%,transparent);box-shadow:0 18px 54px rgba(0,0,0,.32);backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);opacity:0;pointer-events:none;transition:transform 160ms ease,opacity 160ms ease}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar{left:9px;width:116px;padding:8px;transform:translateX(calc(-100% - 18px))}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector{right:9px;width:min(330px,calc(100vw - 28px));padding:9px;transform:translateX(calc(100% + 18px))}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar.is-desktop-open,body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector.is-desktop-open{opacity:1;pointer-events:auto;transform:translateX(0)}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-sheet-head{position:sticky;top:-9px;z-index:4;display:flex;align-items:center;justify-content:space-between;min-height:38px;margin:-9px -9px 7px;padding:5px 7px 5px 10px;border-bottom:1px solid var(--line);background:color-mix(in srgb,var(--bg) 98%,transparent)}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar .pdfe-mobile-sheet-head{margin:-8px -8px 7px}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-sheet-head button{width:30px;height:30px;border:1px solid var(--line);border-radius:8px;background:rgba(255,255,255,.035);color:var(--text);font-size:1rem}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-desktop-sidebar-title{display:none}
}
@media(max-width:700px){
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-header{min-height:48px;padding:5px 7px}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-local-badge{display:none}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap{align-items:start!important;justify-items:center!important;place-items:start center!important;overflow:auto!important;touch-action:pan-x pan-y;scrollbar-gutter:stable}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage{margin:0 auto!important}
 body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document strong{font-size:.70rem}
}

@media(prefers-reduced-motion:reduce) and (min-width:701px){body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar,body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector{transition:none}}

/* =========================================================
   PDF Editor v4 — document-first compact workspace
   Inspired by established PDF-editor interaction patterns:
   compact top tools, popover menus, overlay drawers, and a
   contextual text toolbar. Scoped to the PDF editor only.
========================================================= */
body.pdfe-fullscreen-mode #pdfe-workspace {
  --pdfe-header-h: 44px;
  --pdfe-toolbar-h: 44px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-header {
  min-height: var(--pdfe-header-h) !important;
  height: var(--pdfe-header-h);
  padding: 4px 8px !important;
  gap: 7px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-back,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon {
  width: 34px !important;
  min-width: 34px !important;
  height: 34px !important;
  min-height: 34px !important;
  border-radius: 8px !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document {
  min-width: 0;
  gap: 0 !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document strong {
  max-width: min(58vw, 680px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .72rem !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document #pdfe-fullscreen-status {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-local-badge {
  width: 30px;
  min-width: 30px;
  height: 30px;
  min-height: 30px !important;
  padding: 0 !important;
  justify-content: center;
  border-radius: 8px;
  font-size: .72rem !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-local-badge span { display: none !important; }

/* Compact Sejda-style command surface. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-commandbar.pdfe-document-toolbar {
  position: relative;
  z-index: 90;
  min-height: var(--pdfe-toolbar-h) !important;
  height: var(--pdfe-toolbar-h);
  padding: 3px 7px !important;
  overflow: visible !important;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 94%, transparent) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-sejda-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  width: 100%;
  min-width: 0;
  height: 100%;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-menu {
  position: relative;
  flex: 0 0 auto;
  width: auto !important;
  min-width: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  background: transparent !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-trigger {
  box-sizing: border-box;
  min-width: 42px;
  height: 34px;
  min-height: 34px !important;
  margin: 0;
  padding: 3px 8px !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid transparent !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--text-soft) !important;
  font: inherit;
  font-size: .64rem !important;
  font-weight: 780 !important;
  line-height: 1;
  white-space: nowrap;
  list-style: none;
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}
body.pdfe-fullscreen-mode #pdfe-workspace summary.pdfe-tool-trigger::-webkit-details-marker { display: none; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-trigger:hover,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-trigger.is-active,
body.pdfe-fullscreen-mode #pdfe-workspace details[open] > .pdfe-tool-trigger {
  border-color: rgba(114,230,255,.24) !important;
  background: rgba(114,230,255,.10) !important;
  color: var(--text) !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-glyph {
  display: inline-grid;
  place-items: center;
  min-width: 17px;
  font-size: .84rem;
  line-height: 1;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-label { font-size: .62rem; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-menu-caret {
  margin-left: -1px;
  color: var(--text-muted);
  font-size: .56rem;
}

body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-popover,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools > .advanced-options-content.pdfe-tool-popover {
  position: absolute !important;
  top: calc(100% + 6px) !important;
  left: 0;
  right: auto !important;
  z-index: 5200;
  width: min(315px, calc(100vw - 18px)) !important;
  max-height: min(64dvh, 520px) !important;
  padding: 6px !important;
  display: grid;
  gap: 3px;
  overflow: auto;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  background: color-mix(in srgb, var(--bg) 98%, transparent) !important;
  box-shadow: 0 16px 42px rgba(0,0,0,.34) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-menu:not([open]) > .pdfe-tool-popover,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools:not([open]) > .advanced-options-content { display: none !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-menu:nth-last-child(-n+2) > .pdfe-tool-popover { left: auto; right: 0 !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-popover > button,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-actions > button {
  min-height: 42px !important;
  padding: 7px 9px !important;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  color: var(--text) !important;
  text-align: left;
  cursor: pointer;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-popover > button:hover,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-actions > button:hover { background: rgba(114,230,255,.09) !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-popover > button > span:first-child,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-actions > button > span:first-child {
  width: 24px;
  min-width: 24px;
  display: grid;
  place-items: center;
  color: var(--primary);
  font-size: .86rem;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-popover button strong,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-popover button small { display: block; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-popover button strong { font-size: .68rem; line-height: 1.2; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-popover button small { margin-top: 2px; color: var(--text-muted); font-size: .55rem; line-height: 1.35; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-grid-menu {
  grid-template-columns: repeat(3, minmax(0,1fr));
  width: 258px !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-grid-menu > button {
  min-height: 54px !important;
  padding: 6px !important;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  text-align: center;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-grid-menu > button > span:first-child { width: auto; min-width: 0; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-popover { width: min(370px, calc(100vw - 18px)) !important; gap: 8px; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-section { display: grid; gap: 5px; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-section > strong {
  padding: 2px 5px;
  color: var(--text-muted);
  font-size: .56rem;
  letter-spacing: .04em;
  text-transform: uppercase;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-page-actions {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(38px,1fr));
  gap: 3px !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-page-actions button {
  min-width: 0 !important;
  min-height: 48px !important;
  padding: 5px 2px !important;
  display: grid !important;
  place-items: center;
  gap: 2px;
  border-radius: 7px !important;
  font-size: .74rem !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-page-actions button small { font-size: .48rem !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-note { padding: 4px 5px 1px; color: var(--text-muted); font-size: .53rem; line-height: 1.35; }

/* The PDF owns the workspace. Sidebars are drawers, never layout columns. */
@media (min-width: 701px) {
  body.pdfe-fullscreen-mode #pdfe-workspace { grid-template-rows: var(--pdfe-header-h) var(--pdfe-toolbar-h) minmax(0,1fr) !important; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-content {
    position: relative !important;
    display: block !important;
    min-width: 0;
    min-height: 0;
    overflow: hidden !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-layout {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 0;
    min-height: 0;
    max-height: none !important;
    border: 0 !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-main {
    position: relative;
    width: 100% !important;
    height: 100% !important;
    min-width: 0;
    min-height: 0;
    padding: 0 !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
    box-sizing: border-box;
    width: 100% !important;
    height: 100% !important;
    min-width: 0;
    min-height: 0;
    padding: 48px 14px 28px !important;
    display: grid !important;
    place-items: start center !important;
    align-content: start !important;
    overflow: auto !important;
    overscroll-behavior: contain;
    scrollbar-gutter: stable both-edges;
    scroll-padding: 52px 18px 28px;
    touch-action: pan-x pan-y;
    border: 0 !important;
    border-radius: 0 !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage {
    flex: 0 0 auto;
    margin: 0 auto !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar {
    position: absolute !important;
    top: 7px;
    right: 9px;
    left: auto !important;
    z-index: 20;
    width: auto;
    min-width: 170px;
    min-height: 34px !important;
    padding: 3px 4px 3px 8px !important;
    border: 1px solid color-mix(in srgb,var(--line) 88%,transparent);
    border-radius: 9px;
    background: color-mix(in srgb,var(--bg) 88%,transparent);
    box-shadow: 0 5px 18px rgba(0,0,0,.12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar button { min-width: 30px; min-height: 28px; padding: 2px 7px; border-radius: 7px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector {
    position: absolute !important;
    top: 8px !important;
    bottom: 8px !important;
    z-index: 5100 !important;
    display: grid !important;
    align-content: start;
    gap: 7px;
    min-height: 0;
    overflow: auto !important;
    overscroll-behavior: contain;
    border: 1px solid var(--line) !important;
    border-radius: 11px !important;
    background: color-mix(in srgb,var(--bg) 98%,transparent) !important;
    box-shadow: 0 18px 48px rgba(0,0,0,.32) !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    opacity: 0 !important;
    pointer-events: none !important;
    transition: transform 150ms ease, opacity 150ms ease;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar {
    left: 8px !important;
    width: 118px !important;
    padding: 7px !important;
    transform: translateX(calc(-100% - 16px));
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector {
    right: 8px !important;
    width: min(320px, calc(100vw - 24px)) !important;
    padding: 8px !important;
    transform: translateX(calc(100% + 16px));
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar.is-desktop-open,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector.is-desktop-open {
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: translateX(0) !important;
  }
}

/* Contextual text formatter: only appears for a selected added text object. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar {
  position: fixed !important;
  z-index: 5400 !important;
  width: max-content;
  max-width: calc(100vw - 20px);
  min-height: 40px;
  margin: 0 !important;
  padding: 4px !important;
  display: flex;
  flex-wrap: nowrap !important;
  align-items: center !important;
  gap: 3px !important;
  overflow-x: auto;
  overflow-y: hidden;
  border: 1px solid var(--line) !important;
  border-radius: 9px !important;
  background: color-mix(in srgb,var(--bg) 98%,transparent) !important;
  box-shadow: 0 12px 34px rgba(0,0,0,.32) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  scrollbar-width: none;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar[hidden] { display: none !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar::-webkit-scrollbar { display: none; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-format-field,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-format-color { display: flex !important; align-items: center; gap: 3px; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-format-field > span,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-format-color > span,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-format-hint { display: none !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar select,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar input[type="number"] {
  min-height: 30px !important;
  height: 30px;
  padding: 3px 6px !important;
  border-radius: 6px !important;
  font-size: .62rem;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-font-field select { min-width: 118px !important; max-width: 145px; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-size-field input { width: 58px !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-format-buttons { gap: 2px !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-format-buttons button {
  width: 30px !important;
  height: 30px !important;
  min-height: 30px !important;
  border-radius: 6px !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-format-color input {
  width: 30px !important;
  height: 30px !important;
  border-radius: 6px !important;
}
.pdf-added-text-box.has-overflow { outline-color: #ffb454 !important; }

/* Existing editable text is clipped to its detected line box while typing;
   preview font auto-fit handles longer replacements instead of spilling over. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-hit.is-editing,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-hit.is-edited {
  overflow: hidden;
  max-width: 100%;
}

@media (max-width: 900px) and (min-width: 701px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-trigger { padding-inline: 6px !important; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-label { display: none; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-menu-caret { display: none; }
}

@media (max-width: 700px) {
  body.pdfe-fullscreen-mode #pdfe-workspace { --pdfe-header-h: 44px; grid-template-rows: var(--pdfe-header-h) minmax(0,1fr) auto !important; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-commandbar { display: none !important; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-content { display: block !important; height: 100%; min-height: 0; overflow: hidden !important; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-layout,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-main { width: 100% !important; height: 100% !important; min-height: 0; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
    width: 100% !important;
    height: 100% !important;
    padding: 42px 7px 18px !important;
    overflow: auto !important;
    place-items: start center !important;
    align-content: start !important;
    scroll-padding: 44px 8px 18px;
    touch-action: pan-x pan-y;
    overscroll-behavior: contain;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar {
    position: absolute !important;
    top: 5px;
    left: 6px;
    right: 6px;
    z-index: 18;
    min-height: 32px !important;
    padding: 2px 4px 2px 8px !important;
    border-radius: 8px !important;
    background: color-mix(in srgb,var(--bg) 88%,transparent) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document strong { max-width: 56vw; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-actions { gap: 4px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar {
    left: 7px !important;
    right: 7px !important;
    top: auto !important;
    bottom: calc(67px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    max-width: none;
    border-radius: 10px !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar .pdfe-font-field select { min-width: 106px !important; }
}

@media (prefers-reduced-motion: reduce) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-trigger { transition: none !important; }
}

.pdfe-mobile-more-actions { display: none; }
@media (max-width: 700px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock {
    grid-template-columns: repeat(7, minmax(48px, 1fr)) !important;
    gap: 2px !important;
    padding: 4px max(5px, env(safe-area-inset-right)) calc(4px + env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left)) !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock button {
    min-width: 0 !important;
    min-height: 48px !important;
    padding: 3px 2px !important;
    border-radius: 8px !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock .pdfe-dock-icon { font-size: .92rem !important; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock small { font-size: .48rem !important; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-more-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 5px;
    padding: 2px 0 4px;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-more-actions button {
    min-height: 52px;
    padding: 5px 3px;
    display: grid;
    place-items: center;
    gap: 3px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255,255,255,.025);
    color: var(--text);
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-more-actions button > span { color: var(--primary); font-size: .92rem; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-more-actions button small { font-size: .52rem; }
}


/* =========================================================
   PDF Editor More-menu reliability hotfix v1
   Explicit JS-controlled popover. Overrides legacy 38px/details rules.
========================================================= */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools.pdfe-more-menu {
  position: relative !important;
  flex: 0 0 auto !important;
  width: 42px !important;
  min-width: 42px !important;
  margin: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  background: transparent !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-more-trigger {
  width: 42px !important;
  min-width: 42px !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 0 !important;
  display: inline-grid !important;
  place-items: center !important;
  overflow: hidden !important;
  border-radius: 7px !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-more-trigger .pdfe-tool-glyph {
  min-width: 0 !important;
  font-size: 1rem !important;
  letter-spacing: 1px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-menu > .pdfe-more-popover {
  left: auto !important;
  right: 0 !important;
  width: min(370px, calc(100vw - 18px)) !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-menu > .pdfe-more-popover[hidden] {
  display: none !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-menu.is-open > .pdfe-more-popover:not([hidden]) {
  display: grid !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-menu.is-open > #pdfe-more-trigger {
  border-color: rgba(114,230,255,.30) !important;
  background: rgba(114,230,255,.12) !important;
  color: var(--text) !important;
}


/* =========================================================
   PDF Editor v6 — responsive popovers, safe header actions,
   neutral document canvas, and touch-friendly page panning.
   Strictly scoped to #pdfe-workspace so other tools are unchanged.
========================================================= */
body.pdfe-fullscreen-mode #pdfe-workspace,
body.pdfe-fullscreen-mode #pdfe-workspace * { box-sizing: border-box; }

/* Header must never push the download action outside the viewport. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-header {
  display: grid !important;
  grid-template-columns: 36px minmax(0, 1fr) auto !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 100vw !important;
  min-width: 0 !important;
  overflow: hidden !important;
  padding-left: max(6px, env(safe-area-inset-left)) !important;
  padding-right: max(6px, env(safe-area-inset-right)) !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document {
  min-width: 0 !important;
  overflow: hidden !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document strong {
  display: block;
  max-width: 100% !important;
  min-width: 0;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-actions {
  min-width: 0 !important;
  flex: 0 0 auto !important;
  justify-self: end;
  overflow: visible !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon {
  flex: 0 0 36px !important;
  width: 36px !important;
  min-width: 36px !important;
  height: 36px !important;
  min-height: 36px !important;
  padding: 0 !important;
  overflow: visible !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-svg {
  display: block;
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

/* Every desktop tool popover gets viewport width, never the trigger's width. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-popover {
  max-width: min(315px, calc(100vw - 16px)) !important;
  box-sizing: border-box !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace details[data-pdfe-menu="shapes"] > .pdfe-tool-popover {
  left: auto !important;
  right: 0 !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-menu > .pdfe-more-popover {
  width: min(370px, calc(100vw - 16px)) !important;
  min-width: min(300px, calc(100vw - 16px)) !important;
  max-width: min(370px, calc(100vw - 16px)) !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-popover .pdfe-more-actions,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-popover .pdfe-more-section,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-popover .pdfe-more-note {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-page-actions {
  grid-template-columns: repeat(auto-fit, minmax(46px, 1fr)) !important;
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-popover button,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-popover small,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-popover span {
  min-width: 0;
}

/* PDF pages are opaque. A neutral canvas gives separation without the harsh
   black/checkerboard treatment normally used for transparent-image editors. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
  background: #2b333c !important;
  background-image: none !important;
}
html[data-theme="light"] body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
  background: #dfe4e8 !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage {
  box-shadow: 0 12px 34px rgba(0,0,0,.24) !important;
}

/* In select/edit modes, swiping on the PDF itself scrolls/pans the document.
   Drawing tools keep touch-action:none so strokes remain precise. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage,
body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-overlay {
  touch-action: pan-x pan-y !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-overlay[data-tool="pen"],
body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-overlay[data-tool="rect"],
body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-overlay[data-tool="ellipse"],
body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-overlay[data-tool="line"],
body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-overlay[data-tool="highlight"] {
  touch-action: none !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-annotation,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-added-text-box,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-text-resize-handle,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-text-rotate-handle {
  touch-action: none !important;
}

/* Tablet/narrow desktop: tool labels collapse but functionality stays identical. */
@media (min-width: 701px) and (max-width: 980px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-sejda-toolbar {
    justify-content: center !important;
    gap: 1px !important;
    padding-inline: 4px;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-trigger {
    min-width: 38px !important;
    padding-inline: 6px !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-label,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-menu-caret {
    display: none !important;
  }
}

/* Phones: filename sacrifices space before the primary download action does. */
@media (max-width: 520px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-header {
    grid-template-columns: 34px minmax(0,1fr) 38px !important;
    gap: 5px !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-local-badge {
    display: none !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon {
    width: 38px !important;
    min-width: 38px !important;
    height: 34px !important;
    min-height: 34px !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-document strong {
    font-size: .66rem !important;
  }
}

/* Very small phones keep full-size touch targets and allow the bottom toolbar
   to scroll horizontally rather than crushing or clipping buttons. */
@media (max-width: 430px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock {
    display: flex !important;
    align-items: stretch !important;
    gap: 3px !important;
    overflow-x: auto !important;
    overflow-y: hidden !important;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock::-webkit-scrollbar { display: none; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock button {
    flex: 0 0 52px !important;
    width: 52px !important;
    min-width: 52px !important;
  }
}


/* =========================================================
   PDF Editor v7 — exact-font-height preview + protected modern download action.
   Scoped to PDF editor fullscreen only; no other tool is affected.
========================================================= */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-hit.is-editing {
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none;
  overscroll-behavior-inline: contain;
  white-space: pre !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-hit.is-editing::-webkit-scrollbar { display:none; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-hit.is-overflowing {
  border-color: rgba(255,184,77,.78) !important;
  box-shadow: 0 0 0 2px rgba(255,184,77,.12) !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-hit.is-edited:not(.is-editing) {
  overflow: hidden !important;
  text-overflow: clip !important;
}

/* A familiar download-to-tray icon, kept inside the safe viewport on every width. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-header {
  grid-template-columns: 36px minmax(0,1fr) 40px !important;
  column-gap: 6px !important;
  overflow: visible !important;
  padding-right: max(8px, env(safe-area-inset-right)) !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-actions {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  justify-self: end !important;
  overflow: visible !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-local-badge { display:none !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon {
  width: 40px !important;
  min-width: 40px !important;
  max-width: 40px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  display: inline-grid !important;
  place-items: center !important;
  overflow: hidden !important;
  transform: none !important;
  margin: 0 !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-svg {
  width: 21px !important;
  height: 21px !important;
  display:block !important;
  fill:none !important;
  stroke:currentColor !important;
  stroke-width:1.9 !important;
  stroke-linecap:round !important;
  stroke-linejoin:round !important;
}
@media (max-width:700px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-header {
    grid-template-columns: 34px minmax(0,1fr) 40px !important;
    padding-left:max(5px,env(safe-area-inset-left)) !important;
    padding-right:max(8px,env(safe-area-inset-right)) !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-actions,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon {
    width:40px !important;
    min-width:40px !important;
    max-width:40px !important;
  }
}


/* =========================================================
   PDF Editor v8 — clear tools + isolated document scrolling.
   PDF-editor scoped only. Other PixelOrigen tools are untouched.
========================================================= */
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-svg {
  width: 18px !important;
  height: 18px !important;
  display: block !important;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  overflow: visible;
  pointer-events: none;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-svg .pdfe-svg-fill {
  fill: currentColor;
  stroke: none;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-glyph,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-dock-icon {
  color: var(--text-soft) !important;
  letter-spacing: 0 !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-trigger.is-active .pdfe-tool-glyph,
body.pdfe-fullscreen-mode #pdfe-workspace details[open] > .pdfe-tool-trigger .pdfe-tool-glyph,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock button.is-active .pdfe-dock-icon {
  color: var(--primary) !important;
}

/* Keep labels readable on tablet/narrow desktop instead of collapsing to
   ambiguous glyph-only controls. Seven compact groups fit comfortably at 701px+. */
@media (min-width: 701px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-sejda-toolbar {
    justify-content: center !important;
    gap: 3px !important;
    padding-inline: 6px !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-trigger {
    min-width: 0 !important;
    padding-inline: 8px !important;
    gap: 5px !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-label {
    display: inline !important;
    font-size: .65rem !important;
    font-weight: 820 !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-menu-caret {
    display: inline !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace #pdfe-more-trigger {
    width: 38px !important;
    min-width: 38px !important;
  }
}
@media (min-width: 701px) and (max-width: 780px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-trigger {
    padding-inline: 6px !important;
    gap: 3px !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-label { font-size: .58rem !important; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-svg { width: 16px !important; height: 16px !important; }
}

/* Only the document viewport scrolls. Hide its native track on touch/narrow
   screens so it can never visually run under the fixed Download action. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-content,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-layout,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-main {
  overflow: hidden !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
  overscroll-behavior: contain !important;
  -webkit-overflow-scrolling: touch;
}
@media (max-width: 1024px), (pointer: coarse) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
    scrollbar-width: none !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
  }
}
@media (min-width: 1025px) and (pointer: fine) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
    scrollbar-width: thin !important;
    scrollbar-color: rgba(130,150,168,.56) transparent !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap::-webkit-scrollbar-track { background: transparent; }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap::-webkit-scrollbar-thumb {
    background: rgba(130,150,168,.50);
    border: 2px solid transparent;
    background-clip: padding-box;
    border-radius: 999px;
  }
}

/* Modern compact download action: familiar arrow-to-tray icon, never a large
   gradient CTA inside the editor chrome. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon {
  appearance: none !important;
  -webkit-appearance: none !important;
  display: inline-grid !important;
  place-items: center !important;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--primary) 42%, var(--line)) !important;
  background: color-mix(in srgb, var(--bg) 88%, var(--primary) 12%) !important;
  color: var(--primary) !important;
  box-shadow: none !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon:hover,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon:focus-visible {
  background: color-mix(in srgb, var(--bg) 76%, var(--primary) 24%) !important;
  border-color: color-mix(in srgb, var(--primary) 70%, var(--line)) !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon:disabled {
  opacity: .48 !important;
  cursor: not-allowed;
}

/* Mobile dock: keep both icon and short label readable. */
@media (max-width: 700px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock button {
    grid-template-rows: 27px auto !important;
    color: var(--text-soft) !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock .pdfe-tool-svg {
    width: 20px !important;
    height: 20px !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-mobile-tool-dock small {
    color: currentColor !important;
    font-size: .53rem !important;
    font-weight: 800 !important;
  }
}

/* =========================================================
   PDF Editor v9 — final viewport isolation + readable tools
   Strictly scoped to the PDF editor fullscreen state.
========================================================= */
html.pdfe-fullscreen-mode,
html.pdfe-fullscreen-mode body {
  width: 100% !important;
  height: 100% !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
}
body.pdfe-fullscreen-mode {
  position: fixed !important;
  inset: 0 !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace {
  width: 100% !important;
  height: 100dvh !important;
  max-height: 100dvh !important;
  overflow: hidden !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
  touch-action: pan-x pan-y !important;
  overscroll-behavior: contain !important;
}
/* The document viewport is still scrollable, but touch/narrow devices never show
   a second scrollbar beside or beneath the fixed header/download action. */
@media (max-width: 1024px), (pointer: coarse) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap::-webkit-scrollbar {
    width: 0 !important;
    height: 0 !important;
    display: none !important;
  }
}

/* Clear, opaque More menu. No glass/transparency over document text. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-menu > .pdfe-more-popover {
  width: min(380px, calc(100vw - 20px)) !important;
  min-width: min(300px, calc(100vw - 20px)) !important;
  max-width: min(380px, calc(100vw - 20px)) !important;
  max-height: min(72dvh, 600px) !important;
  padding: 11px !important;
  gap: 11px !important;
  color: var(--text) !important;
  background: var(--bg-soft) !important;
  border: 1px solid var(--line-strong) !important;
  border-radius: 13px !important;
  box-shadow: 0 20px 54px rgba(0,0,0,.34) !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
}
html[data-theme="light"] body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-menu > .pdfe-more-popover {
  background: #ffffff !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-section {
  min-width: 0 !important;
  gap: 7px !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-section > strong {
  padding: 0 2px !important;
  color: var(--text-soft) !important;
  font-size: .68rem !important;
  letter-spacing: .055em !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 6px !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-actions > button {
  min-width: 0 !important;
  min-height: 46px !important;
  padding: 8px 9px !important;
  border: 1px solid var(--line) !important;
  background: color-mix(in srgb, var(--bg) 72%, transparent) !important;
  color: var(--text) !important;
  white-space: normal !important;
  line-height: 1.25 !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-page-actions {
  display: flex !important;
  width: 100% !important;
  gap: 6px !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  scrollbar-width: none !important;
  padding-bottom: 2px !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-page-actions::-webkit-scrollbar { display: none !important; }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-page-actions button {
  flex: 0 0 54px !important;
  width: 54px !important;
  min-width: 54px !important;
  min-height: 52px !important;
  border: 1px solid var(--line) !important;
  background: color-mix(in srgb, var(--bg) 72%, transparent) !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-page-actions button small {
  font-size: .58rem !important;
  color: var(--text-soft) !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-note {
  padding: 8px 9px !important;
  border: 1px solid var(--line) !important;
  border-radius: 8px !important;
  background: color-mix(in srgb, var(--bg) 72%, transparent) !important;
  color: var(--text-muted) !important;
  font-size: .62rem !important;
  line-height: 1.45 !important;
}
@media (max-width: 480px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-menu > .pdfe-more-popover {
    width: min(330px, calc(100vw - 14px)) !important;
    min-width: 0 !important;
    right: -2px !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-more-actions {
    grid-template-columns: 1fr !important;
  }
}

/* Modern, fixed header download action. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon {
  width: 38px !important;
  min-width: 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  border-radius: 10px !important;
  border: 1px solid color-mix(in srgb, var(--primary) 48%, var(--line)) !important;
  color: var(--primary) !important;
  background: color-mix(in srgb, var(--primary) 9%, var(--bg)) !important;
  box-shadow: none !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon:hover:not(:disabled) {
  background: color-mix(in srgb, var(--primary) 16%, var(--bg)) !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-download-icon:disabled { opacity: .45; }

/* =========================================================
   PixelOrigen standalone browser tools: Scanner / QR / Favicon / Watermark
   Scoped so existing image/PDF tools are unaffected.
   ========================================================= */
.standalone-tool-panel{display:grid;gap:16px;max-width:1040px;margin-inline:auto;width:100%}
.local-tool-note{display:flex;align-items:flex-start;gap:12px;padding:14px 16px;border:1px solid var(--line);border-radius:16px;background:rgba(114,230,255,.045)}
.local-tool-note>span{display:grid;place-items:center;flex:0 0 auto;min-width:42px;height:36px;padding:0 8px;border-radius:10px;color:var(--primary);background:rgba(114,230,255,.09);font-size:.66rem;font-weight:900;letter-spacing:.05em}
.local-tool-note strong{display:block;font-size:.82rem}.local-tool-note p{margin:4px 0 0;color:var(--text-muted);font-size:.7rem;line-height:1.55}
.new-tool-drop{position:relative;display:grid;justify-items:center;gap:7px;min-height:210px;padding:26px 18px;text-align:center;border:1.5px dashed rgba(114,230,255,.42);border-radius:18px;background:rgba(5,16,29,.42)}
.new-tool-drop.compact{min-height:160px;padding:21px 16px}.new-tool-drop.is-dragging{border-color:var(--primary);background:rgba(114,230,255,.08)}
.new-tool-drop-icon{display:grid;place-items:center;width:48px;height:48px;border-radius:14px;color:var(--primary);background:rgba(114,230,255,.08);font-size:1.35rem;font-weight:900}
.new-tool-drop strong{font-size:.88rem}.new-tool-drop p{margin:0;color:var(--text-muted);font-size:.72rem}.new-tool-drop small{max-width:680px;color:var(--text-muted);font-size:.64rem;line-height:1.45}
.new-tool-status{padding:11px 13px;border:1px solid var(--line);border-radius:12px;color:var(--text-soft);background:rgba(255,255,255,.025);font-size:.69rem;line-height:1.5}
.new-tool-status[data-kind="ok"]{border-color:rgba(114,224,161,.28);color:var(--green)}.new-tool-status[data-kind="warn"]{border-color:rgba(255,196,90,.32);color:#f4c96f}.new-tool-status[data-kind="error"]{border-color:rgba(255,108,125,.35);color:#ff9aa8}
.new-tool-settings-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}.new-tool-settings-grid .field,.favicon-initial-grid .field{min-width:0}
.standalone-tool-panel .field>input:not([type="range"]):not([type="color"]):not([type="checkbox"]),.standalone-tool-panel .field>select,.standalone-tool-panel textarea{width:100%;min-height:44px;margin-top:7px;padding:10px 12px;border:1px solid var(--line);border-radius:11px;color:var(--text);background:var(--bg-soft);font:inherit;font-size:.76rem;outline:none}
.standalone-tool-panel textarea{resize:vertical;min-height:90px}.standalone-tool-panel .field>input[type="color"]{width:100%;height:44px;margin-top:7px;padding:4px;border:1px solid var(--line);border-radius:11px;background:var(--bg-soft)}
.standalone-tool-panel .field>input:focus,.standalone-tool-panel .field>select:focus,.standalone-tool-panel textarea:focus{border-color:rgba(114,230,255,.55);box-shadow:0 0 0 3px rgba(114,230,255,.08)}
.new-tool-button-row,.qr-camera-actions{display:flex;flex-wrap:wrap;align-items:center;gap:8px}.qr-camera-actions small{color:var(--text-muted);font-size:.65rem}
.new-tool-result{display:grid;gap:12px;padding:14px;border:1px solid var(--line);border-radius:16px;background:rgba(255,255,255,.025)}.new-tool-result-preview{display:grid;place-items:center;max-height:520px;overflow:auto;border-radius:12px;background:rgba(0,0,0,.12)}.new-tool-result-preview img{display:block;max-width:100%;max-height:500px;object-fit:contain}
.new-tool-download{justify-self:start}.new-tool-tabs{display:inline-flex;justify-self:start;padding:4px;border:1px solid var(--line);border-radius:12px;background:rgba(255,255,255,.025)}.new-tool-tabs button{min-height:36px;padding:7px 13px;border:0;border-radius:9px;color:var(--text-muted);background:transparent;font:inherit;font-size:.7rem;font-weight:800;cursor:pointer}.new-tool-tabs button.is-active{color:#06101d;background:var(--primary)}
.new-tool-advanced{margin:0}.new-tool-file-list{display:flex;flex-wrap:wrap;gap:6px}.new-tool-file-list span{max-width:220px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;padding:6px 9px;border:1px solid var(--line);border-radius:999px;color:var(--text-soft);font-size:.62rem}
/* Scanner */
.scanner-editor{display:grid;gap:12px}.scanner-canvas-wrap{position:relative;display:grid;place-items:center;width:fit-content;max-width:min(100%,820px);margin-inline:auto;overflow:hidden;border:1px solid var(--line);border-radius:15px;background:#3f4852;touch-action:none}.scanner-canvas-wrap canvas{display:block;width:auto;max-width:100%;height:auto;max-height:70vh;object-fit:contain}.scanner-overlay{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}.scanner-overlay polygon{fill:rgba(114,230,255,.08);stroke:var(--primary);stroke-width:.65;vector-effect:non-scaling-stroke}.scanner-corner{position:absolute;width:30px;height:30px;margin:-15px 0 0 -15px;border:3px solid #fff;border-radius:50%;background:var(--primary);box-shadow:0 3px 12px rgba(0,0,0,.35);cursor:grab;touch-action:none}.scanner-corner:active{cursor:grabbing;transform:scale(1.08)}
/* QR */
.qr-result{justify-items:center}.qr-result-card{display:grid;place-items:center;padding:12px;border-radius:14px;background:#fff}.qr-result-card img{width:min(100%,420px);height:auto;image-rendering:pixelated}.qr-fields-group{margin-top:10px}.qr-camera-wrap{position:relative;max-width:620px;margin-inline:auto;overflow:hidden;border-radius:16px;background:#03070c}.qr-camera-wrap video{display:block;width:100%;max-height:70vh;object-fit:cover}.qr-camera-frame{position:absolute;inset:18%;border:2px solid var(--primary);border-radius:18px;box-shadow:0 0 0 999px rgba(0,0,0,.24)}.qr-scan-results{display:grid;gap:9px}.qr-scan-item{display:grid;gap:9px;padding:12px;border:1px solid var(--line);border-radius:12px;background:rgba(255,255,255,.025)}.qr-scan-item p{margin:0;overflow-wrap:anywhere;font-size:.74rem;line-height:1.5}.qr-scan-item>div{display:flex;flex-wrap:wrap;gap:7px}
/* Favicon */
.favicon-initial-grid{display:grid;grid-template-columns:minmax(180px,1fr) repeat(2,minmax(120px,.5fr));gap:12px}.favicon-result{grid-template-columns:auto 1fr;align-items:center}.favicon-result>div{display:flex;align-items:center;gap:10px}.favicon-result img{width:88px;height:88px;border-radius:18px;object-fit:contain;background:#fff}.favicon-result p{color:var(--text-muted);font-size:.65rem}
/* Watermark */
.watermark-preview-wrap{display:grid;justify-items:center;gap:7px;padding:12px;border:1px solid var(--line);border-radius:15px;background:rgba(0,0,0,.1)}.watermark-preview-wrap img{display:block;max-width:100%;max-height:480px;object-fit:contain}.watermark-preview-wrap small{color:var(--text-muted);font-size:.64rem}
html[data-theme="light"] .new-tool-drop,html[data-theme="light"] .scanner-canvas-wrap,html[data-theme="light"] .watermark-preview-wrap{background:#e7edf2}.standalone-tool-panel .process-btn{width:100%;max-width:360px;justify-self:center}
@media(max-width:720px){.standalone-tool-panel{gap:13px}.local-tool-note{padding:12px}.new-tool-settings-grid,.favicon-initial-grid{grid-template-columns:1fr}.new-tool-drop{min-height:180px;padding:20px 12px}.new-tool-drop.compact{min-height:145px}.scanner-canvas-wrap canvas{max-height:62vh}.scanner-corner{width:34px;height:34px;margin:-17px 0 0 -17px}.new-tool-tabs{width:100%}.new-tool-tabs button{flex:1}.favicon-result{grid-template-columns:1fr;justify-items:center}.new-tool-button-row .btn,.qr-camera-actions .btn{flex:1}.standalone-tool-panel .process-btn{max-width:none}}

/* =========================================================
   New tools compact UI v2 — scoped to the four standalone tools only.
   Existing PixelOrigen tools are intentionally unaffected.
========================================================= */
.standalone-tool-panel [hidden] { display: none !important; }

.standalone-tool-panel {
  --nt-control-h: 38px;
  --nt-radius: 10px;
  max-width: 920px;
  gap: 12px;
}
.standalone-tool-panel .local-tool-note {
  gap: 10px;
  padding: 10px 12px;
  border-radius: 12px;
}
.standalone-tool-panel .local-tool-note > span {
  min-width: 36px;
  height: 32px;
  border-radius: 9px;
  font-size: .60rem;
}
.standalone-tool-panel .local-tool-note strong { font-size: .76rem; }
.standalone-tool-panel .local-tool-note p { margin-top: 2px; font-size: .63rem; line-height: 1.45; }

.standalone-tool-panel .new-tool-drop {
  min-height: 142px;
  gap: 5px;
  padding: 16px 14px;
  border-radius: 14px;
}
.standalone-tool-panel .new-tool-drop.compact { min-height: 124px; padding: 14px 12px; }
.standalone-tool-panel .new-tool-drop-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 1rem;
}
.standalone-tool-panel .new-tool-drop strong { font-size: .78rem; }
.standalone-tool-panel .new-tool-drop p { font-size: .64rem; }
.standalone-tool-panel .new-tool-drop small { font-size: .58rem; }
.standalone-tool-panel .drop-zone-action {
  min-height: 36px;
  padding: 7px 13px;
  border-radius: 9px;
  font-size: .68rem;
}

.standalone-tool-panel .new-tool-status {
  padding: 8px 10px;
  border-radius: 10px;
  font-size: .62rem;
  line-height: 1.45;
}
.standalone-tool-panel .new-tool-settings-grid,
.standalone-tool-panel .favicon-initial-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px 10px;
}
.standalone-tool-panel .field,
.standalone-tool-panel .checkbox-row {
  font-size: .65rem;
}
.standalone-tool-panel .field-header { min-height: 20px; }
.standalone-tool-panel .field > input:not([type="range"]):not([type="color"]):not([type="checkbox"]),
.standalone-tool-panel .field > select,
.standalone-tool-panel textarea {
  min-height: var(--nt-control-h);
  height: var(--nt-control-h);
  margin-top: 5px;
  padding: 7px 10px;
  border-radius: var(--nt-radius);
  font-size: .69rem;
}
.standalone-tool-panel textarea {
  height: auto;
  min-height: 76px;
  line-height: 1.45;
}
.standalone-tool-panel input[type="file"] {
  min-height: 36px !important;
  height: auto !important;
  padding: 4px !important;
  font-size: .62rem !important;
}
.standalone-tool-panel input[type="file"]::file-selector-button {
  min-height: 30px;
  margin-right: 8px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--bg-soft);
  font: inherit;
  font-weight: 750;
  cursor: pointer;
}
/* Compact swatch instead of a full-width 44px-tall color bar. */
.standalone-tool-panel .field > input[type="color"] {
  display: block;
  width: 42px;
  min-width: 42px;
  height: 32px;
  margin-top: 5px;
  padding: 2px;
  border-radius: 8px;
  cursor: pointer;
}
.standalone-tool-panel input[type="range"] { min-height: 26px; }
.standalone-tool-panel .checkbox-row {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 0;
}
.standalone-tool-panel .checkbox-row input { width: 16px; height: 16px; }

.standalone-tool-panel .btn,
.standalone-tool-panel .process-btn,
.standalone-tool-panel .new-tool-download {
  min-height: 38px;
  height: auto;
  padding: 7px 13px;
  border-radius: 10px;
  font-size: .69rem;
  line-height: 1.2;
}
.standalone-tool-panel .process-btn {
  width: auto;
  min-width: 170px;
  max-width: 260px;
  justify-self: start;
}
.standalone-tool-panel .new-tool-button-row,
.standalone-tool-panel .qr-camera-actions {
  gap: 6px;
}
.standalone-tool-panel .new-tool-button-row .btn,
.standalone-tool-panel .qr-camera-actions .btn { flex: 0 0 auto; }

.standalone-tool-panel .new-tool-tabs {
  padding: 3px;
  border-radius: 10px;
}
.standalone-tool-panel .new-tool-tabs button {
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 7px;
  font-size: .64rem;
}
.standalone-tool-panel .new-tool-file-list { gap: 5px; }
.standalone-tool-panel .new-tool-file-list span {
  max-width: 180px;
  padding: 5px 8px;
  font-size: .58rem;
}
.standalone-tool-panel .new-tool-result {
  gap: 9px;
  padding: 10px;
  border-radius: 12px;
}
.standalone-tool-panel .new-tool-result-preview { max-height: 440px; border-radius: 10px; }

/* Scanner editor uses the image box as the exact coordinate system for handles. */
.standalone-tool-panel .scanner-editor { gap: 9px; }
.standalone-tool-panel .scanner-canvas-wrap {
  max-width: 760px;
  border-radius: 12px;
}
.standalone-tool-panel .scanner-corner {
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-width: 2px;
}

/* Watermark preview is never shown until a valid preview image has loaded. */
.standalone-tool-panel .watermark-preview-wrap {
  gap: 6px;
  min-height: 0;
  padding: 9px;
  border-radius: 12px;
}
.standalone-tool-panel .watermark-preview-wrap img:not([src]),
.standalone-tool-panel .watermark-preview-wrap img[src=""] { display: none !important; }
.standalone-tool-panel .watermark-preview-wrap img {
  max-height: 390px;
  border-radius: 8px;
}
.standalone-tool-panel .watermark-preview-wrap small { font-size: .57rem; }

.standalone-tool-panel .qr-result-card { padding: 9px; border-radius: 11px; }
.standalone-tool-panel .qr-camera-wrap { border-radius: 12px; }
.standalone-tool-panel .qr-scan-item { gap: 7px; padding: 9px; border-radius: 10px; }
.standalone-tool-panel .qr-scan-item p { font-size: .66rem; }

.standalone-tool-panel .favicon-result img {
  width: 72px;
  height: 72px;
  border-radius: 15px;
}
.standalone-tool-panel .favicon-result p { font-size: .58rem; }

@media (max-width: 760px) {
  .standalone-tool-panel { max-width: 100%; gap: 10px; }
  .standalone-tool-panel .new-tool-settings-grid,
  .standalone-tool-panel .favicon-initial-grid { grid-template-columns: 1fr; gap: 8px; }
  .standalone-tool-panel .new-tool-drop { min-height: 132px; padding: 14px 10px; }
  .standalone-tool-panel .new-tool-drop.compact { min-height: 116px; }
  .standalone-tool-panel .new-tool-tabs { width: 100%; }
  .standalone-tool-panel .new-tool-tabs button { flex: 1; }
  .standalone-tool-panel .process-btn { width: 100%; max-width: none; justify-self: stretch; }
  .standalone-tool-panel .new-tool-button-row,
  .standalone-tool-panel .qr-camera-actions { align-items: stretch; }
  .standalone-tool-panel .new-tool-button-row .btn,
  .standalone-tool-panel .qr-camera-actions .btn { flex: 1 1 120px; min-width: 0; }
  .standalone-tool-panel .scanner-canvas-wrap canvas { max-height: 58vh; }
  .standalone-tool-panel .scanner-corner { width: 30px; height: 30px; margin: -15px 0 0 -15px; }
  .standalone-tool-panel .watermark-preview-wrap img { max-height: 52vh; }
}
@media (max-width: 420px) {
  .standalone-tool-panel { --nt-control-h: 36px; }
  .standalone-tool-panel .local-tool-note { padding: 9px 10px; }
  .standalone-tool-panel .local-tool-note > span { display: none; }
  .standalone-tool-panel .new-tool-drop { min-height: 122px; }
  .standalone-tool-panel .new-tool-button-row .btn { flex-basis: calc(50% - 4px); }
  .standalone-tool-panel .new-tool-button-row .btn:last-child { flex-basis: 100%; }
  .standalone-tool-panel .field > input[type="color"] { width: 38px; min-width: 38px; height: 30px; }
}

/* =========================================================
   New tools compact UI v3 — strict scope: only the 4 standalone tools.
   Fixes broken/empty previews and oversized controls on phone/tablet/desktop.
========================================================= */
.standalone-tool-panel [hidden],
.standalone-tool-panel img[hidden],
.standalone-tool-panel a[hidden],
.standalone-tool-panel button[hidden] { display: none !important; }

.standalone-tool-panel {
  --nt-control-h: 36px;
  --nt-button-h: 36px;
  --nt-radius: 9px;
  max-width: 900px;
  gap: 10px;
}

.standalone-tool-panel .local-tool-note {
  padding: 9px 11px;
  border-radius: 11px;
}
.standalone-tool-panel .local-tool-note > span {
  min-width: 34px;
  height: 30px;
  border-radius: 8px;
  font-size: .56rem;
}
.standalone-tool-panel .local-tool-note strong { font-size: .72rem; }
.standalone-tool-panel .local-tool-note p { font-size: .60rem; }

.standalone-tool-panel .new-tool-drop,
.standalone-tool-panel .new-tool-drop.compact {
  min-height: 112px;
  padding: 12px;
  gap: 4px;
  border-radius: 12px;
}
.standalone-tool-panel .new-tool-drop-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  font-size: .88rem;
}
.standalone-tool-panel .new-tool-drop strong { font-size: .72rem; }
.standalone-tool-panel .new-tool-drop p { font-size: .59rem; }
.standalone-tool-panel .new-tool-drop small { font-size: .54rem; }
.standalone-tool-panel .drop-zone-action {
  min-height: 34px;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: .63rem;
}

.standalone-tool-panel .new-tool-status {
  padding: 7px 9px;
  border-radius: 9px;
  font-size: .59rem;
}
.standalone-tool-panel .new-tool-settings-grid,
.standalone-tool-panel .favicon-initial-grid {
  gap: 8px 10px;
}
.standalone-tool-panel .field,
.standalone-tool-panel .checkbox-row { font-size: .61rem; }
.standalone-tool-panel .field > input:not([type="range"]):not([type="color"]):not([type="checkbox"]),
.standalone-tool-panel .field > select,
.standalone-tool-panel textarea {
  min-height: var(--nt-control-h);
  height: var(--nt-control-h);
  margin-top: 4px;
  padding: 6px 9px;
  border-radius: var(--nt-radius);
  font-size: .65rem;
}
.standalone-tool-panel textarea { min-height: 68px; height: auto; }
.standalone-tool-panel input[type="file"] {
  min-height: 34px !important;
  font-size: .58rem !important;
}
.standalone-tool-panel input[type="file"]::file-selector-button {
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: .58rem;
}

/* Color controls are compact swatches, not large full-width controls. */
.standalone-tool-panel .compact-color-field {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 7px 5px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: color-mix(in srgb, var(--bg-soft) 84%, transparent);
}
.standalone-tool-panel .compact-color-field > input[type="color"],
.standalone-tool-panel .field > input[type="color"] {
  flex: 0 0 34px;
  width: 34px;
  min-width: 34px;
  height: 28px;
  margin: 0;
  padding: 2px;
  border-radius: 7px;
  cursor: pointer;
}
.standalone-tool-panel input[type="range"] { min-height: 22px; }
.standalone-tool-panel .checkbox-row { min-height: 30px; padding: 3px 0; }
.standalone-tool-panel .checkbox-row input { width: 15px; height: 15px; }

/* Compact actions. Primary buttons do not become giant full-width bars on phones. */
.standalone-tool-panel .btn,
.standalone-tool-panel .process-btn,
.standalone-tool-panel .new-tool-download {
  min-height: var(--nt-button-h) !important;
  height: var(--nt-button-h) !important;
  width: auto !important;
  min-width: 0 !important;
  max-width: 230px !important;
  padding: 6px 12px !important;
  border-radius: 9px !important;
  font-size: .64rem !important;
  line-height: 1 !important;
  justify-self: start;
}
.standalone-tool-panel .process-btn {
  min-width: 150px !important;
  justify-self: start !important;
}
.standalone-tool-panel .new-tool-button-row,
.standalone-tool-panel .qr-camera-actions {
  gap: 6px;
  align-items: center !important;
}
.standalone-tool-panel .new-tool-button-row .btn,
.standalone-tool-panel .qr-camera-actions .btn {
  flex: 0 0 auto !important;
}
.standalone-tool-panel .new-tool-tabs {
  width: auto !important;
  padding: 2px;
  border-radius: 9px;
}
.standalone-tool-panel .new-tool-tabs button {
  min-height: 30px;
  padding: 4px 9px;
  font-size: .60rem;
  border-radius: 7px;
}

/* Preview/result areas are zero-height while hidden and show only valid images. */
.standalone-tool-panel .new-tool-result,
.standalone-tool-panel .watermark-preview-wrap {
  min-height: 0;
  padding: 9px;
}
.standalone-tool-panel .new-tool-result-preview:has(> img[hidden]),
.standalone-tool-panel .qr-result-card:has(> img[hidden]) { display: none !important; }
.standalone-tool-panel .new-tool-result img,
.standalone-tool-panel .watermark-preview-wrap img {
  display: block;
  max-width: 100%;
  border-radius: 8px;
}

/* Scanner uses the displayed source image itself as the exact corner coordinate box. */
.standalone-tool-panel .scanner-canvas-wrap {
  display: inline-grid;
  justify-self: center;
  width: fit-content;
  max-width: min(100%, 720px);
  background: #424b54;
}
.standalone-tool-panel .scanner-canvas-wrap > #scanner-preview {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 58vh;
  object-fit: contain;
}
.standalone-tool-panel .scanner-corner {
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
}

.standalone-tool-panel .qr-result-card { padding: 8px; }
.standalone-tool-panel .qr-result-card img { width: min(100%, 320px); }
.standalone-tool-panel .favicon-result img { width: 64px; height: 64px; border-radius: 13px; }
.standalone-tool-panel .watermark-preview-wrap img { max-height: 360px; }

@media (max-width: 760px) {
  .standalone-tool-panel { max-width: 100%; gap: 9px; }
  .standalone-tool-panel .new-tool-settings-grid,
  .standalone-tool-panel .favicon-initial-grid { grid-template-columns: 1fr; gap: 7px; }
  .standalone-tool-panel .compact-color-field { max-width: 210px; }
  .standalone-tool-panel .process-btn,
  .standalone-tool-panel .new-tool-download {
    width: min(100%, 210px) !important;
    max-width: 210px !important;
    justify-self: center !important;
  }
  .standalone-tool-panel .new-tool-button-row,
  .standalone-tool-panel .qr-camera-actions {
    align-items: center !important;
  }
  .standalone-tool-panel .new-tool-button-row .btn,
  .standalone-tool-panel .qr-camera-actions .btn {
    flex: 0 1 auto !important;
  }
  .standalone-tool-panel .new-tool-tabs { justify-self: start; }
  .standalone-tool-panel .new-tool-tabs button { flex: 0 0 auto; }
  .standalone-tool-panel .scanner-canvas-wrap > #scanner-preview { max-height: 52vh; }
}

@media (max-width: 420px) {
  .standalone-tool-panel { --nt-control-h: 34px; --nt-button-h: 36px; }
  .standalone-tool-panel .local-tool-note > span { display: none; }
  .standalone-tool-panel .new-tool-drop,
  .standalone-tool-panel .new-tool-drop.compact { min-height: 104px; padding: 10px; }
  .standalone-tool-panel .compact-color-field { max-width: 190px; }
  .standalone-tool-panel .new-tool-button-row .btn {
    flex: 0 0 auto !important;
    width: auto !important;
  }
  .standalone-tool-panel .field > input[type="color"],
  .standalone-tool-panel .compact-color-field > input[type="color"] {
    width: 32px;
    min-width: 32px;
    height: 27px;
  }
}

/* =========================================================
   Favicon Generator UI v4 — live context preview + 1:1 crop
   Strictly scoped to #panel-favicon-generator.
   Generation worker/output logic is intentionally untouched.
========================================================= */
#panel-favicon-generator {
  --fav-preview-bg: color-mix(in srgb, var(--bg-soft) 90%, var(--primary) 10%);
  --fav-card-bg: color-mix(in srgb, var(--bg) 94%, var(--primary) 6%);
  max-width: 900px;
}
#panel-favicon-generator .favicon-basic-flow {
  display: grid;
  gap: 12px;
}
#panel-favicon-generator .favicon-source-tabs {
  justify-self: start;
}
#panel-favicon-generator .favicon-upload-drop {
  min-height: 116px;
}
#panel-favicon-generator .favicon-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
#panel-favicon-generator .favicon-section-heading > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}
#panel-favicon-generator .favicon-section-heading strong {
  font-size: .76rem;
}
#panel-favicon-generator .favicon-section-heading small {
  color: var(--text-muted);
  font-size: .59rem;
  line-height: 1.4;
}
#panel-favicon-generator .favicon-step-chip,
#panel-favicon-generator .favicon-live-badge {
  flex: 0 0 auto;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--bg-soft);
  font-size: .58rem;
  font-weight: 850;
}
#panel-favicon-generator .favicon-live-badge i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 15%, transparent);
}

/* Reuse PixelOrigen's existing touch crop controller, fixed to 1:1. */
#panel-favicon-generator .favicon-crop-section {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--fav-card-bg);
}
#panel-favicon-generator .favicon-crop-controls {
  display: grid;
  gap: 6px;
}
#panel-favicon-generator .favicon-crop-actions {
  justify-content: flex-end;
  margin: 0;
}
#panel-favicon-generator .favicon-crop-actions button {
  min-height: 32px;
  padding: 5px 9px;
  border-radius: 8px;
  font-size: .60rem;
}
#panel-favicon-generator .favicon-crop-stage {
  margin: 0 auto;
  max-width: 100%;
  max-height: 300px;
  border-radius: 12px;
}
#panel-favicon-generator .favicon-crop-status {
  margin: 0;
  font-size: .58rem;
}
#panel-favicon-generator .favicon-crop-stage .crop-box i {
  width: 26px;
  height: 26px;
  border-width: 3px;
}
#panel-favicon-generator .favicon-crop-stage .crop-box [data-handle="nw"] { left: -13px; top: -13px; }
#panel-favicon-generator .favicon-crop-stage .crop-box [data-handle="ne"] { right: -13px; top: -13px; }
#panel-favicon-generator .favicon-crop-stage .crop-box [data-handle="sw"] { left: -13px; bottom: -13px; }
#panel-favicon-generator .favicon-crop-stage .crop-box [data-handle="se"] { right: -13px; bottom: -13px; }

/* Initials basic mode — compact, obvious swatches. */
#panel-favicon-generator .favicon-initial-basic {
  display: grid;
  grid-template-columns: minmax(150px, 1.2fr) minmax(130px, .8fr) minmax(130px, .8fr);
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--fav-card-bg);
}
#panel-favicon-generator .favicon-color-field {
  align-content: start;
}
#panel-favicon-generator .favicon-color-control {
  width: max-content;
  max-width: 100%;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  padding: 3px 8px 3px 3px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--bg-soft);
}
#panel-favicon-generator .favicon-color-control > input[type="color"] {
  width: 30px !important;
  min-width: 30px !important;
  height: 26px !important;
  margin: 0 !important;
  padding: 1px !important;
  border: 0 !important;
  border-radius: 7px !important;
  background: transparent !important;
  cursor: pointer;
}
#panel-favicon-generator .favicon-hex-input {
  width: 82px !important;
  min-width: 82px !important;
  height: 27px !important;
  min-height: 27px !important;
  margin: 0 !important;
  padding: 3px 6px !important;
  border: 0 !important;
  border-left: 1px solid var(--line) !important;
  border-radius: 0 7px 7px 0 !important;
  outline: none !important;
  color: var(--text-soft) !important;
  background: transparent !important;
  font: 750 .60rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important;
  letter-spacing: .01em;
  text-transform: uppercase;
}
#panel-favicon-generator .favicon-hex-input:focus {
  background: color-mix(in srgb, var(--primary) 8%, transparent) !important;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 48%, transparent);
}
#panel-favicon-generator .favicon-hex-input[aria-invalid="true"] {
  background: color-mix(in srgb, #ff6b6b 10%, transparent) !important;
  box-shadow: inset 0 0 0 1px rgba(255,107,107,.55);
}

/* Live preview contexts. */
#panel-favicon-generator .favicon-live-preview {
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--fav-card-bg);
}
#panel-favicon-generator .favicon-live-empty {
  min-height: 86px;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 11px;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg-soft) 72%, transparent);
  text-align: center;
  font-size: .63rem;
  line-height: 1.5;
}
#panel-favicon-generator .favicon-preview-contexts {
  display: grid;
  grid-template-columns: minmax(280px, 1.55fr) repeat(2, minmax(150px, .72fr));
  gap: 9px;
}
#panel-favicon-generator .favicon-browser-preview,
#panel-favicon-generator .favicon-device-preview {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
}
#panel-favicon-generator .favicon-browser-chrome {
  height: 25px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 9px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg) 84%, var(--text) 3%);
}
#panel-favicon-generator .favicon-browser-chrome span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--line-strong);
}
#panel-favicon-generator .favicon-browser-tabs {
  min-height: 67px;
  display: flex;
  align-items: end;
  gap: 5px;
  padding: 10px 9px 0;
  overflow: hidden;
}
#panel-favicon-generator .favicon-browser-tab {
  min-width: 0;
  max-width: 210px;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 9px 9px 0 0;
  color: var(--text-muted);
  background: color-mix(in srgb, var(--bg) 88%, var(--primary) 4%);
  font-size: .60rem;
}
#panel-favicon-generator .favicon-browser-tab.is-active {
  flex: 1 1 180px;
  color: var(--text);
  background: var(--bg);
}
#panel-favicon-generator .favicon-browser-tab > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#panel-favicon-generator .favicon-browser-tab b {
  margin-left: auto;
  color: var(--text-muted);
  font-weight: 600;
}
#panel-favicon-generator #favicon-live-16 {
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
}
#panel-favicon-generator #favicon-live-32 {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
}
#panel-favicon-generator .favicon-browser-preview > small {
  display: block;
  padding: 7px 9px 8px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: .54rem;
}
#panel-favicon-generator .favicon-device-top {
  min-height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  font-size: .56rem;
  font-weight: 800;
}
#panel-favicon-generator .favicon-device-top small {
  color: var(--text-muted);
  font-size: .50rem;
  font-weight: 650;
}
#panel-favicon-generator .favicon-device-stage {
  min-height: 122px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 7px;
  padding: 11px;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--favicon-theme-color, var(--primary)) 18%, transparent), transparent 42%),
    linear-gradient(145deg, color-mix(in srgb, var(--bg) 94%, var(--primary) 6%), var(--bg-soft));
}
#panel-favicon-generator .favicon-device-stage canvas {
  width: 74px;
  height: 74px;
  display: block;
  object-fit: contain;
  box-shadow: 0 8px 20px rgba(0,0,0,.16);
}
#panel-favicon-generator .favicon-android-preview canvas {
  border-radius: 19px;
}
#panel-favicon-generator .favicon-ios-preview canvas {
  border-radius: 22%;
}
#panel-favicon-generator .favicon-device-stage > span {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-soft);
  font-size: .57rem;
}

/* Progressive disclosure for PWA-only settings. */
#panel-favicon-generator .favicon-pwa-settings {
  margin: 0;
}
#panel-favicon-generator .favicon-pwa-settings summary em {
  color: var(--text-muted);
  font-style: normal;
  font-weight: 650;
}
#panel-favicon-generator .favicon-advanced-grid {
  align-items: start;
}
#panel-favicon-generator .favicon-theme-demo {
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(170px, .8fr) minmax(220px, 1.2fr);
  gap: 0;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: color-mix(in srgb, var(--bg-soft) 84%, transparent);
}
#panel-favicon-generator .favicon-theme-demo-bar {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 11px;
  color: var(--favicon-demo-contrast, #fff);
  background: var(--favicon-demo-theme, #0B1F33);
  transition: background-color .12s ease;
}
#panel-favicon-generator .favicon-theme-demo-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  border: 1px solid color-mix(in srgb, currentColor 30%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, currentColor 12%, transparent);
  font-size: .64rem;
}
#panel-favicon-generator .favicon-theme-demo-bar strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: .66rem;
}
#panel-favicon-generator .favicon-theme-demo-menu { margin-left: auto; font-weight: 900; letter-spacing: .08em; }
#panel-favicon-generator .favicon-theme-demo-copy {
  display: grid;
  align-content: center;
  gap: 2px;
  padding: 9px 11px;
}
#panel-favicon-generator .favicon-theme-demo-copy strong { font-size: .62rem; }
#panel-favicon-generator .favicon-theme-demo-copy small { color: var(--text-muted); font-size: .56rem; line-height: 1.45; }
#panel-favicon-generator .favicon-color-help { margin: 7px 0 0; }
#panel-favicon-generator .favicon-color-help strong { color: var(--text-soft); }
#panel-favicon-generator .favicon-package-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  padding: 10px 11px;
  border: 1px solid color-mix(in srgb, var(--green) 24%, var(--line));
  border-radius: 11px;
  background: color-mix(in srgb, var(--green) 5%, transparent);
}
#panel-favicon-generator .favicon-package-summary span {
  color: var(--text-soft);
  font-size: .60rem;
  line-height: 1.4;
}
#panel-favicon-generator .favicon-technical-details {
  width: fit-content;
  max-width: 100%;
  color: var(--text-muted);
  font-size: .58rem;
}
#panel-favicon-generator .favicon-technical-details summary {
  cursor: pointer;
  color: var(--text-soft);
  font-weight: 800;
}
#panel-favicon-generator .favicon-technical-details p {
  max-width: 680px;
  margin: 7px 0 0;
  line-height: 1.5;
}
#panel-favicon-generator .favicon-generate-button {
  width: auto;
  min-width: 220px;
  max-width: 320px;
  justify-self: center;
}
#panel-favicon-generator .favicon-result {
  grid-template-columns: minmax(0,1fr) auto;
  align-items: center;
}
#panel-favicon-generator .favicon-result-icon {
  display: flex;
  align-items: center;
  gap: 9px;
}
#panel-favicon-generator .favicon-result-icon img {
  width: 54px;
  height: 54px;
  border-radius: 12px;
  object-fit: contain;
  background: #fff;
}
#panel-favicon-generator .favicon-result-icon strong {
  display: block;
  font-size: .68rem;
}
#panel-favicon-generator .favicon-result-icon p {
  margin: 2px 0 0;
  color: var(--text-muted);
  font-size: .56rem;
}

html[data-theme="light"] #panel-favicon-generator {
  --fav-card-bg: #f8fbfd;
}
html[data-theme="light"] #panel-favicon-generator .favicon-browser-tab.is-active {
  background: #fff;
}

@media (max-width: 760px) {
  #panel-favicon-generator .favicon-preview-contexts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #panel-favicon-generator .favicon-browser-preview {
    grid-column: 1 / -1;
  }
  #panel-favicon-generator .favicon-initial-basic {
    grid-template-columns: minmax(0,1fr) minmax(118px,.65fr) minmax(118px,.65fr);
  }
  #panel-favicon-generator .favicon-package-summary {
    grid-template-columns: 1fr;
  }
  #panel-favicon-generator .favicon-result {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }
  #panel-favicon-generator .favicon-result .new-tool-download {
    width: auto;
    justify-self: start;
  }
}

@media (max-width: 520px) {
  #panel-favicon-generator {
    gap: 9px;
  }
  #panel-favicon-generator .favicon-initial-basic {
    grid-template-columns: 1fr 1fr;
    padding: 9px;
  }
  #panel-favicon-generator .favicon-initial-text {
    grid-column: 1 / -1;
  }
  #panel-favicon-generator .favicon-preview-contexts {
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }
  #panel-favicon-generator .favicon-browser-tabs {
    padding-inline: 7px;
  }
  #panel-favicon-generator .favicon-browser-tab-32 {
    max-width: 105px;
  }
  #panel-favicon-generator .favicon-device-stage {
    min-height: 108px;
    padding: 9px 6px;
  }
  #panel-favicon-generator .favicon-device-stage canvas {
    width: 64px;
    height: 64px;
  }
  #panel-favicon-generator .favicon-device-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 1px;
  }
  #panel-favicon-generator .favicon-color-control {
    min-height: 32px;
    gap: 6px;
    padding-right: 6px;
  }
  #panel-favicon-generator .favicon-color-control > input[type="color"] {
    width: 28px !important;
    min-width: 28px !important;
    height: 24px !important;
  }
  #panel-favicon-generator .favicon-hex-input {
    width: 76px !important;
    min-width: 76px !important;
    font-size: .55rem !important;
  }
  #panel-favicon-generator .favicon-theme-demo {
    grid-template-columns: 1fr;
  }
  #panel-favicon-generator .favicon-crop-stage {
    max-height: 250px;
  }
  #panel-favicon-generator .favicon-crop-stage .crop-box i {
    width: 30px;
    height: 30px;
  }
  #panel-favicon-generator .favicon-crop-stage .crop-box [data-handle="nw"] { left: -15px; top: -15px; }
  #panel-favicon-generator .favicon-crop-stage .crop-box [data-handle="ne"] { right: -15px; top: -15px; }
  #panel-favicon-generator .favicon-crop-stage .crop-box [data-handle="sw"] { left: -15px; bottom: -15px; }
  #panel-favicon-generator .favicon-crop-stage .crop-box [data-handle="se"] { right: -15px; bottom: -15px; }
  #panel-favicon-generator .favicon-generate-button {
    width: 100%;
    min-width: 0;
    max-width: 280px;
  }
}

/* =========================================================
   New tools v5 — explicit local-file confirmation + scanner precision crop.
   Strict scope: only the four standalone browser tools.
========================================================= */
.standalone-tool-panel .new-tool-file-confirm {
  display: grid;
  grid-template-columns: 48px minmax(0,1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 7px 9px;
  border: 1px solid color-mix(in srgb, var(--green) 30%, var(--line));
  border-radius: 11px;
  background: color-mix(in srgb, var(--green) 5%, var(--bg-soft));
}
.standalone-tool-panel .new-tool-file-confirm > img {
  display: block;
  width: 48px;
  height: 44px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
.standalone-tool-panel .new-tool-file-confirm-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.standalone-tool-panel .new-tool-file-confirm-copy strong {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text);
  font-size: .66rem;
}
.standalone-tool-panel .new-tool-file-confirm-copy strong > span:first-child { color: var(--green); }
.standalone-tool-panel .new-tool-file-confirm-copy > span,
.standalone-tool-panel .new-tool-file-confirm-copy > small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.standalone-tool-panel .new-tool-file-confirm-copy > span { color: var(--text-soft); font-size: .61rem; font-weight: 700; }
.standalone-tool-panel .new-tool-file-confirm-copy > small { color: var(--text-muted); font-size: .54rem; }
.standalone-tool-panel .new-tool-change-file {
  min-height: 30px;
  height: 30px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text-soft);
  background: var(--bg-soft);
  font: inherit;
  font-size: .57rem;
  font-weight: 800;
  cursor: pointer;
}
.standalone-tool-panel .new-tool-change-file:hover { border-color: color-mix(in srgb, var(--primary) 55%, var(--line)); color: var(--text); }
.standalone-tool-panel .new-tool-inline-confirm {
  display: block;
  margin-top: 5px;
  color: var(--green);
  font-size: .56rem;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Scanner crop-review layout mirrors established mobile scanner behavior:
   precise corner handles, auto detect, rotation and a drag-time magnifier. */
#panel-doc-scanner .scanner-review-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 0 2px;
}
#panel-doc-scanner .scanner-review-heading > div { display: grid; gap: 2px; min-width: 0; }
#panel-doc-scanner .scanner-review-heading strong { font-size: .68rem; color: var(--text); }
#panel-doc-scanner .scanner-review-heading small { font-size: .55rem; color: var(--text-muted); line-height: 1.4; }
#panel-doc-scanner #scanner-rotation-label {
  flex: 0 0 auto;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--bg-soft);
  font-size: .56rem;
  font-weight: 800;
}
#panel-doc-scanner .scanner-canvas-wrap {
  position: relative;
  overflow: visible !important;
  isolation: isolate;
}
#panel-doc-scanner .scanner-canvas-wrap > #scanner-preview {
  border-radius: 10px;
  user-select: none;
  -webkit-user-drag: none;
}
#panel-doc-scanner .scanner-overlay { z-index: 2; }
#panel-doc-scanner .scanner-corner { z-index: 4; }
#panel-doc-scanner .scanner-loupe {
  position: absolute;
  z-index: 9;
  width: 132px;
  height: 132px;
  border: 4px solid #078fca;
  border-radius: 50%;
  background: #0b1721;
  box-shadow: 0 10px 26px rgba(0,0,0,.34), 0 0 0 2px rgba(255,255,255,.75) inset;
  pointer-events: none;
}
#panel-doc-scanner .scanner-review-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 2px 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}
#panel-doc-scanner .scanner-review-toolbar::-webkit-scrollbar { display: none; }
#panel-doc-scanner .scanner-review-toolbar .btn {
  flex: 0 0 auto !important;
  min-width: 0 !important;
  max-width: none !important;
  height: 34px !important;
  min-height: 34px !important;
  padding: 5px 9px !important;
  white-space: nowrap;
  font-size: .59rem !important;
}
#panel-doc-scanner .scanner-review-toolbar .btn > span { color: var(--primary); font-weight: 900; }

@media (max-width: 560px) {
  .standalone-tool-panel .new-tool-file-confirm {
    grid-template-columns: 42px minmax(0,1fr) auto;
    gap: 7px;
    min-height: 52px;
    padding: 6px 7px;
  }
  .standalone-tool-panel .new-tool-file-confirm > img { width: 42px; height: 40px; border-radius: 7px; }
  .standalone-tool-panel .new-tool-file-confirm-copy strong { font-size: .61rem; }
  .standalone-tool-panel .new-tool-file-confirm-copy > span { font-size: .56rem; }
  .standalone-tool-panel .new-tool-file-confirm-copy > small { font-size: .50rem; }
  .standalone-tool-panel .new-tool-change-file { height: 29px; min-height: 29px; padding: 4px 7px; font-size: .53rem; }
  #panel-doc-scanner .scanner-loupe { width: 116px; height: 116px; }
  #panel-doc-scanner .scanner-review-toolbar { margin-inline: -2px; padding-inline: 2px; }
  #panel-doc-scanner .scanner-review-toolbar .btn { height: 33px !important; min-height: 33px !important; padding-inline: 8px !important; }
}

@media (max-width: 360px) {
  .standalone-tool-panel .new-tool-file-confirm { grid-template-columns: 38px minmax(0,1fr); }
  .standalone-tool-panel .new-tool-file-confirm > img { width: 38px; height: 38px; }
  .standalone-tool-panel .new-tool-change-file { grid-column: 2; justify-self: start; }
}


/* =========================================================
   PDF Editor v10 — usable pan/zoom + safer inline text editing.
   Strictly scoped to fullscreen PDF editor; no other tool is affected.
========================================================= */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
  display: flex !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: auto !important;
  scroll-behavior: auto !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-contained-page {
  align-items: center !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage {
  flex: 0 0 auto !important;
  margin-left: auto !important;
  margin-right: auto !important;
  transform-origin: center center !important;
  will-change: transform;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-pan-enabled {
  touch-action: pan-x pan-y !important;
  cursor: grab;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-grabbing-page {
  cursor: grabbing !important;
  user-select: none !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-pan-enabled .pdf-editor-stage,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-pan-enabled #pdfe-overlay {
  touch-action: pan-x pan-y !important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-pan-hint {
  margin-right: auto;
  color: var(--text-muted);
  font-size: .56rem;
  font-weight: 750;
  white-space: nowrap;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-text-fit-guide {
  display: grid;
  gap: 6px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  color: var(--text-muted);
  font-size: .62rem;
  line-height: 1.42;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-text-fit-guide > span {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-text-fit-guide strong { color: var(--text-soft); }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-fit-swatch {
  flex: 0 0 auto;
  width: 18px;
  height: 4px;
  margin-top: .42em;
  border-radius: 999px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-fit-swatch.is-normal { background: rgba(76, 196, 128, .88); }
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-fit-swatch.is-wide { background: rgba(255, 184, 77, .95); }
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-hit.is-overflowing {
  border-color: rgba(255,184,77,.9) !important;
  box-shadow: 0 0 0 2px rgba(255,184,77,.16) !important;
}
@media (max-width: 700px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap {
    padding: 52px 6px calc(14px + env(safe-area-inset-bottom)) !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-contained-page {
    align-items: center !important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-pan-hint {
    display: none;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-text-fit-guide {
    font-size: .59rem;
    padding: 8px 9px;
  }
}


/* =========================================================
   v94 — PDF Converter Images→PDF review flow only.
   Scoped to .pdfc-* classes so every other tool remains unchanged.
   ========================================================= */
.pdfc-review-flow,
.pdfc-final-review,
.pdfc-pdf-ready {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255,255,255,.022);
}
.pdfc-review-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:14px; }
.pdfc-review-heading > div { min-width:0; }
.pdfc-review-heading strong,.pdfc-review-heading small { display:block; }
.pdfc-review-heading strong { margin-top:3px; color:var(--text); font-size:.84rem; }
.pdfc-review-heading small { margin-top:4px; max-width:660px; color:var(--text-muted); font-size:.66rem; line-height:1.5; }
.pdfc-step-label { color:var(--primary); font-size:.58rem; font-weight:900; letter-spacing:.12em; }
.pdfc-page-pill,.pdfc-ready-badge { flex:0 0 auto; padding:6px 9px; border:1px solid rgba(114,230,255,.25); border-radius:999px; color:var(--primary); background:rgba(114,230,255,.055); font-size:.63rem; font-weight:850; white-space:nowrap; }
.pdfc-ready-badge { color:var(--green); border-color:rgba(114,224,161,.28); background:rgba(114,224,161,.055); }
.pdfc-review-current { display:flex; align-items:center; justify-content:space-between; gap:10px; padding:9px 11px; border:1px solid var(--line); border-radius:11px; background:rgba(3,13,24,.18); }
.pdfc-review-current strong { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.7rem; }
.pdfc-review-current small { flex:0 0 auto; color:var(--text-muted); font-size:.62rem; }
.pdfc-crop-controls { min-width:0; }
.pdfc-crop-stage { max-width:760px; max-height:min(64vh,660px); background:#d7dee4; }
.pdfc-crop-stage.is-ready { max-height:min(64vh,660px); }
.pdfc-review-tools { margin:0 0 8px; }
.pdfc-review-tools button { min-height:36px; padding:6px 10px; font-size:.65rem; }
.pdfc-review-nav { display:grid; grid-template-columns:auto minmax(0,1fr) auto; align-items:center; gap:10px; }
.pdfc-review-nav .btn { min-height:40px; }
.pdfc-review-dots { display:flex; justify-content:center; flex-wrap:wrap; gap:5px; min-width:0; }
.pdfc-review-dots button { width:9px; height:9px; padding:0; border:0; border-radius:50%; background:rgba(148,165,182,.35); cursor:pointer; }
.pdfc-review-dots button.is-current { background:var(--primary); box-shadow:0 0 0 3px rgba(114,230,255,.12); }
.pdfc-review-dots button.is-reviewed { background:var(--green); }
.pdfc-final-pages { display:grid; grid-template-columns:repeat(auto-fill,minmax(125px,1fr)); gap:10px; max-height:440px; padding:10px; overflow:auto; border:1px solid var(--line); border-radius:13px; background:rgba(3,13,24,.18); }
.pdfc-final-page { display:grid; gap:7px; min-width:0; padding:7px; border:1px solid var(--line); border-radius:10px; background:rgba(255,255,255,.025); cursor:pointer; }
.pdfc-final-page:hover { border-color:rgba(114,230,255,.34); }
.pdfc-final-page canvas { display:block; width:100%; height:auto; border-radius:5px; background:#fff; }
.pdfc-final-page strong { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:.63rem; }
.pdfc-final-page small { color:var(--text-muted); font-size:.58rem; }
.pdfc-pdf-preview { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); align-items:start; gap:10px; width:100%; max-height:min(62vh,640px); min-height:180px; padding:10px; overflow:auto; border:1px solid var(--line); border-radius:12px; background:rgba(3,13,24,.18); }
.pdfc-pdf-preview canvas { display:block; width:100%; height:auto; border-radius:7px; background:#fff; box-shadow:0 8px 20px rgba(0,0,0,.16); }
.pdfc-pdf-preview .pdfc-preview-note { grid-column:1/-1; margin:0; color:var(--text-muted); font-size:.64rem; text-align:center; }
.pdfc-image-clear-row { margin-top:10px; padding-top:10px; border-top:1px solid var(--line); }
.pdf-file-card.is-reviewed { border-color:rgba(114,224,161,.22); }
.pdf-file-card .pdf-reviewed-badge { display:inline-flex; margin-top:5px; padding:3px 7px; border-radius:999px; color:var(--green); background:rgba(114,224,161,.07); font-size:.56rem; font-weight:850; }
html[data-theme="light"] .pdfc-review-flow,html[data-theme="light"] .pdfc-final-review,html[data-theme="light"] .pdfc-pdf-ready { background:rgba(255,255,255,.62); }
html[data-theme="light"] .pdfc-review-current,html[data-theme="light"] .pdfc-final-pages { background:rgba(225,236,244,.48); }
@media (max-width:620px) {
  .pdfc-review-flow,.pdfc-final-review,.pdfc-pdf-ready { padding:11px; border-radius:14px; }
  .pdfc-review-heading { align-items:flex-start; }
  .pdfc-review-heading small { font-size:.64rem; }
  .pdfc-review-current { align-items:flex-start; flex-direction:column; gap:3px; }
  .pdfc-review-current small { flex:none; }
  .pdfc-crop-stage,.pdfc-crop-stage.is-ready { max-height:58vh; }
  .pdfc-review-nav { grid-template-columns:1fr 1fr; }
  .pdfc-review-dots { grid-column:1/-1; grid-row:1; order:-1; }
  .pdfc-review-nav #pdfc-review-prev,.pdfc-review-nav #pdfc-review-next { width:100%; min-height:44px; }
  .pdfc-final-pages { grid-template-columns:repeat(2,minmax(0,1fr)); max-height:52vh; padding:7px; }
  .pdfc-pdf-preview { grid-template-columns:1fr; min-height:220px; max-height:58vh; }
  .pdfc-ready-actions,.pdfc-final-actions { flex-direction:column-reverse; }
  .pdfc-ready-actions .btn,.pdfc-final-actions .btn { width:100%; }
}

/* =========================================================
   PDF Converter v16 — focused page review
   Scoped to #panel-pdf-converter so no other tool is affected.
   ========================================================= */
#panel-pdf-converter #pdfc-image-drop.pdfc-has-selection {
  min-height: 64px;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-style: solid;
}
#panel-pdf-converter #pdfc-image-drop.pdfc-has-selection .pdf-drop-icon,
#panel-pdf-converter #pdfc-image-drop.pdfc-has-selection > strong,
#panel-pdf-converter #pdfc-image-drop.pdfc-has-selection > p,
#panel-pdf-converter #pdfc-image-drop.pdfc-has-selection > small { display: none; }
#panel-pdf-converter #pdfc-image-drop.pdfc-has-selection .drop-zone-action { margin: 0; }

#panel-pdf-converter .pdfc-review-flow {
  gap: 10px;
  padding: 12px;
  border-radius: 14px;
}
#panel-pdf-converter .pdfc-review-heading-compact small { max-width: 720px; }
#panel-pdf-converter .pdfc-review-current {
  min-height: 42px;
  padding: 7px 9px;
  flex-direction: row;
  align-items: center;
}
#panel-pdf-converter .pdfc-review-current > div { min-width: 0; display: grid; gap: 1px; }
#panel-pdf-converter .pdfc-review-current strong { font-size: .69rem; }
#panel-pdf-converter .pdfc-review-current small { font-size: .59rem; }
#panel-pdf-converter .pdfc-add-more {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(114,230,255,.28);
  border-radius: 10px;
  background: rgba(114,230,255,.07);
  color: var(--primary);
  font: 800 1rem/1 inherit;
  cursor: pointer;
}

#panel-pdf-converter .pdfc-crop-controls { min-width: 0; }
#panel-pdf-converter .pdfc-crop-stage,
#panel-pdf-converter .pdfc-crop-stage.is-ready {
  width: 100%;
  max-width: 920px;
  max-height: min(70vh, 760px);
  margin: 0 auto;
  border-radius: 12px;
  background: #d8dee4;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
}
#panel-pdf-converter .pdfc-crop-stage:not(.is-ready)::after {
  content: "Preview appears here";
}
#panel-pdf-converter .pdfc-crop-stage .crop-box {
  border-width: 2px;
  box-shadow: 0 0 0 9999px rgb(2 9 17 / .48), 0 0 0 1px rgb(255 255 255 / .5), 0 0 16px rgb(99 229 255 / .3);
}
#panel-pdf-converter .pdfc-crop-stage .crop-box i {
  width: 24px;
  height: 24px;
  border-width: 3px;
}
#panel-pdf-converter .pdfc-crop-stage .crop-box [data-handle="nw"] { left: -12px; top: -12px; }
#panel-pdf-converter .pdfc-crop-stage .crop-box [data-handle="ne"] { right: -12px; top: -12px; }
#panel-pdf-converter .pdfc-crop-stage .crop-box [data-handle="sw"] { left: -12px; bottom: -12px; }
#panel-pdf-converter .pdfc-crop-stage .crop-box [data-handle="se"] { right: -12px; bottom: -12px; }
#panel-pdf-converter .pdfc-crop-status {
  margin: 6px 0 0;
  text-align: center;
  font-size: .58rem;
}

#panel-pdf-converter .pdfc-review-toolbar {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
  padding: 2px 0;
}
#panel-pdf-converter .pdfc-icon-btn,
#panel-pdf-converter .pdfc-nav-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
  color: var(--text);
  cursor: pointer;
  box-shadow: none;
}
#panel-pdf-converter .pdfc-icon-btn svg,
#panel-pdf-converter .pdfc-nav-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
#panel-pdf-converter .pdfc-icon-btn:hover,
#panel-pdf-converter .pdfc-nav-icon:hover { border-color: rgba(114,230,255,.38); }
#panel-pdf-converter .pdfc-icon-btn:disabled,
#panel-pdf-converter .pdfc-nav-icon:disabled { opacity: .34; cursor: default; }
#panel-pdf-converter .pdfc-icon-btn.is-danger { color: #ff7f8d; }
#panel-pdf-converter .pdfc-nav-icon.is-primary {
  border-color: transparent;
  color: #071522;
  background: linear-gradient(135deg, #77e7f8, #8b7bff);
}
#panel-pdf-converter .pdfc-next-check { display: none; }
#panel-pdf-converter #pdfc-review-next[data-finish="true"] .pdfc-next-arrow { display: none; }
#panel-pdf-converter #pdfc-review-next[data-finish="true"] .pdfc-next-check { display: block; }

#panel-pdf-converter .pdfc-review-nav {
  display: grid;
  grid-template-columns: 42px minmax(0,1fr) 42px;
  align-items: center;
  gap: 8px;
  width: min(100%, 520px);
  margin: 0 auto;
}
#panel-pdf-converter .pdfc-review-progress {
  display: grid;
  justify-items: center;
  gap: 5px;
  min-width: 0;
}
#panel-pdf-converter .pdfc-review-progress > span {
  color: var(--text-muted);
  font-size: .58rem;
  font-weight: 750;
}
#panel-pdf-converter .pdfc-review-dots { max-width: 100%; flex-wrap: nowrap; overflow: hidden; }
#panel-pdf-converter .pdfc-review-dots button { flex: 0 0 auto; width: 7px; height: 7px; }

html[data-theme="light"] #panel-pdf-converter .pdfc-crop-stage { background: #e6eaee; }

@media (max-width: 720px) {
  #panel-pdf-converter .pdfc-review-flow { padding: 9px; gap: 8px; }
  #panel-pdf-converter .pdfc-review-heading { gap: 8px; }
  #panel-pdf-converter .pdfc-review-heading strong { font-size: .76rem; }
  #panel-pdf-converter .pdfc-review-heading small { font-size: .59rem; line-height: 1.4; }
  #panel-pdf-converter .pdfc-page-pill { padding: 5px 7px; font-size: .57rem; }
  #panel-pdf-converter .pdfc-review-current { flex-direction: row; align-items: center; }
  #panel-pdf-converter .pdfc-crop-stage,
  #panel-pdf-converter .pdfc-crop-stage.is-ready { max-height: 64vh; }
  #panel-pdf-converter .pdfc-crop-stage .crop-box i { width: 28px; height: 28px; }
  #panel-pdf-converter .pdfc-crop-stage .crop-box [data-handle="nw"] { left: -14px; top: -14px; }
  #panel-pdf-converter .pdfc-crop-stage .crop-box [data-handle="ne"] { right: -14px; top: -14px; }
  #panel-pdf-converter .pdfc-crop-stage .crop-box [data-handle="sw"] { left: -14px; bottom: -14px; }
  #panel-pdf-converter .pdfc-crop-stage .crop-box [data-handle="se"] { right: -14px; bottom: -14px; }
  #panel-pdf-converter .pdfc-icon-btn,
  #panel-pdf-converter .pdfc-nav-icon { width: 44px; height: 44px; border-radius: 12px; }
  #panel-pdf-converter .pdfc-review-nav { grid-template-columns: 44px minmax(0,1fr) 44px; }
  #panel-pdf-converter #pdfc-image-drop.pdfc-has-selection { min-height: 54px; padding: 7px 9px; }
}

/* =========================================================
   PDF Converter v17 — directional page preview slide transition.
   Strictly scoped to the Images→PDF review preview.
   ========================================================= */
#panel-pdf-converter .pdfc-crop-stage {
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  will-change: transform, opacity;
}
#panel-pdf-converter .pdfc-crop-stage.pdfc-slide-out-left {
  animation: pdfcPreviewOutLeft 180ms cubic-bezier(.4, 0, 1, 1) both;
  pointer-events: none;
}
#panel-pdf-converter .pdfc-crop-stage.pdfc-slide-out-right {
  animation: pdfcPreviewOutRight 180ms cubic-bezier(.4, 0, 1, 1) both;
  pointer-events: none;
}
#panel-pdf-converter .pdfc-crop-stage.pdfc-slide-in-from-right {
  animation: pdfcPreviewInRight 220ms cubic-bezier(.2, .8, .2, 1) both;
}
#panel-pdf-converter .pdfc-crop-stage.pdfc-slide-in-from-left {
  animation: pdfcPreviewInLeft 220ms cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes pdfcPreviewOutLeft {
  from { transform: translate3d(0,0,0); opacity: 1; }
  to { transform: translate3d(-16%,0,0); opacity: 0; }
}
@keyframes pdfcPreviewOutRight {
  from { transform: translate3d(0,0,0); opacity: 1; }
  to { transform: translate3d(16%,0,0); opacity: 0; }
}
@keyframes pdfcPreviewInRight {
  from { transform: translate3d(16%,0,0); opacity: 0; }
  to { transform: translate3d(0,0,0); opacity: 1; }
}
@keyframes pdfcPreviewInLeft {
  from { transform: translate3d(-16%,0,0); opacity: 0; }
  to { transform: translate3d(0,0,0); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #panel-pdf-converter .pdfc-crop-stage.pdfc-slide-out-left,
  #panel-pdf-converter .pdfc-crop-stage.pdfc-slide-out-right,
  #panel-pdf-converter .pdfc-crop-stage.pdfc-slide-in-from-right,
  #panel-pdf-converter .pdfc-crop-stage.pdfc-slide-in-from-left {
    animation: none !important;
  }
}


/* =========================================================
   v95 — Doc Scanner real processing animation only.
   Visible only while the scan worker is actually processing.
   ========================================================= */
#panel-doc-scanner .scanner-processing-overlay[hidden] { display: none !important; }
#panel-doc-scanner .scanner-processing-overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  overflow: hidden;
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(3,14,23,.20), rgba(3,14,23,.42));
  pointer-events: auto;
}
#panel-doc-scanner .scanner-processing-beam {
  position: absolute;
  left: 5%;
  right: 5%;
  top: 8%;
  height: 2px;
  border-radius: 999px;
  background: #62f7e0;
  box-shadow: 0 0 6px #62f7e0, 0 0 18px rgba(98,247,224,.95), 0 0 34px rgba(56,220,255,.62);
  animation: scanner-real-sweep 1.55s cubic-bezier(.45,.05,.55,.95) infinite alternate;
}
#panel-doc-scanner .scanner-processing-beam::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -18px;
  height: 38px;
  background: linear-gradient(180deg, transparent, rgba(98,247,224,.12), transparent);
}
#panel-doc-scanner .scanner-processing-label {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 36px);
  padding: 5px 10px;
  overflow: hidden;
  border: 1px solid rgba(98,247,224,.28);
  border-radius: 999px;
  color: #bffdf5;
  background: rgba(6,22,31,.72);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  font-size: .53rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#panel-doc-scanner .scanner-processing-corner {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: #62f7e0;
  filter: drop-shadow(0 0 5px rgba(98,247,224,.72));
}
#panel-doc-scanner .scanner-processing-corner.is-tl { top: 13px; left: 13px; border-top: 3px solid; border-left: 3px solid; border-radius: 9px 0 0 0; }
#panel-doc-scanner .scanner-processing-corner.is-tr { top: 13px; right: 13px; border-top: 3px solid; border-right: 3px solid; border-radius: 0 9px 0 0; }
#panel-doc-scanner .scanner-processing-corner.is-bl { bottom: 13px; left: 13px; border-bottom: 3px solid; border-left: 3px solid; border-radius: 0 0 0 9px; }
#panel-doc-scanner .scanner-processing-corner.is-br { bottom: 13px; right: 13px; border-bottom: 3px solid; border-right: 3px solid; border-radius: 0 0 9px 0; }
#panel-doc-scanner .scanner-canvas-wrap.is-processing-scan .scanner-overlay,
#panel-doc-scanner .scanner-canvas-wrap.is-processing-scan .scanner-corner,
#panel-doc-scanner .scanner-canvas-wrap.is-processing-scan .scanner-loupe { visibility: hidden !important; }
@keyframes scanner-real-sweep {
  from { top: 9%; opacity: .76; }
  to { top: 91%; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  #panel-doc-scanner .scanner-processing-beam { animation: none; top: 50%; }
}
@media (max-width: 560px) {
  #panel-doc-scanner .scanner-processing-corner { width: 24px; height: 24px; }
  #panel-doc-scanner .scanner-processing-label { top: 9px; font-size: .49rem; }
}

/* =========================================================
   Background Remover — scoped standalone tool styles.
   ========================================================= */
.background-remover-tool-panel { display: grid; gap: 14px; }
.bgrem-settings { align-items: end; }
.bgrem-actions { margin-top: 0; }
.bgrem-progress { display: grid; gap: 7px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 11px; background: rgba(114,230,255,.035); }
.bgrem-progress-track { position: relative; height: 7px; overflow: hidden; border-radius: 999px; background: rgba(142,163,181,.18); }
.bgrem-progress-track i { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--primary),#79f3c9); transition: width .22s ease; }
.bgrem-progress span { color: var(--text-muted); font-size: .64rem; line-height: 1.4; }
.bgrem-result { display: grid; gap: 12px; padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.02); }
.bgrem-result-heading { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.bgrem-result-heading strong,.bgrem-result-heading small { display:block; }
.bgrem-result-heading strong { font-size:.8rem; color:var(--text); }
.bgrem-result-heading small { margin-top:3px; color:var(--text-muted); font-size:.62rem; }
.bgrem-local-badge { flex:0 0 auto; padding:5px 8px; border:1px solid rgba(105,224,163,.25); border-radius:999px; color:var(--green); background:rgba(105,224,163,.055); font-size:.58rem; font-weight:850; }
.bgrem-checker-preview,
.bgrem-compare-host .pixora-compare-after { background-color:#dbe4ea; background-image:linear-gradient(45deg,#b9c6cf 25%,transparent 25%),linear-gradient(-45deg,#b9c6cf 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#b9c6cf 75%),linear-gradient(-45deg,transparent 75%,#b9c6cf 75%); background-size:24px 24px; background-position:0 0,0 12px,12px -12px,-12px 0; }
.bgrem-checker-preview { display:grid; place-items:center; width:100%; min-height:260px; max-height:58vh; overflow:hidden; border:1px solid var(--line-strong); border-radius:13px; }
.bgrem-checker-preview img { display:block; width:100%; height:100%; max-height:58vh; object-fit:contain; }
.bgrem-compare-host .pixora-compare { margin-top:0; padding-top:0; border-top:0; }
html[data-theme="dark"] .bgrem-checker-preview,
html[data-theme="dark"] .bgrem-compare-host .pixora-compare-after { background-color:#203141; background-image:linear-gradient(45deg,#31475a 25%,transparent 25%),linear-gradient(-45deg,#31475a 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#31475a 75%),linear-gradient(-45deg,transparent 75%,#31475a 75%); }
@media (max-width:620px) {
  .bgrem-checker-preview { min-height:220px; }
  .bgrem-result-heading { flex-direction:column; gap:7px; }
  .bgrem-local-badge { align-self:flex-start; }
  .bgrem-actions { flex-direction:column-reverse; }
  .bgrem-actions .btn { width:100%; }
}
@media (prefers-reduced-motion: reduce) { .bgrem-progress-track i { transition:none; } }


/* =========================================================
   Favicon Generator v20 — optional local background removal.
   Strictly scoped to #panel-favicon-generator.
   ========================================================= */
#panel-favicon-generator .favicon-bgrem-option {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(114,230,255,.026);
}
#panel-favicon-generator .favicon-bgrem-toggle {
  align-items: flex-start;
  gap: 9px;
  margin: 0;
  cursor: pointer;
}
#panel-favicon-generator .favicon-bgrem-toggle input {
  flex: 0 0 auto;
  margin-top: 2px;
}
#panel-favicon-generator .favicon-bgrem-toggle > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}
#panel-favicon-generator .favicon-bgrem-toggle strong {
  color: var(--text);
  font-size: .69rem;
  line-height: 1.35;
}
#panel-favicon-generator .favicon-bgrem-toggle small {
  color: var(--text-muted);
  font-size: .61rem;
  line-height: 1.45;
}
#panel-favicon-generator .favicon-bgrem-option.is-ready {
  border-color: rgba(105,224,163,.34);
  background: rgba(105,224,163,.045);
}
#panel-favicon-generator .favicon-bgrem-progress { display:grid; gap:6px; }
#panel-favicon-generator .favicon-bgrem-progress-track {
  position: relative;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(142,163,181,.18);
}
#panel-favicon-generator .favicon-bgrem-progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg,var(--primary),#79f3c9);
  transition: width .22s ease;
}
#panel-favicon-generator .favicon-bgrem-progress > span { color:var(--text-muted); font-size:.6rem; line-height:1.4; }
#panel-favicon-generator .favicon-bgrem-toggle input:disabled + span { opacity:.65; }
@media (max-width:560px) {
  #panel-favicon-generator .favicon-bgrem-option { padding:10px; }
  #panel-favicon-generator .favicon-bgrem-toggle strong { font-size:.67rem; }
  #panel-favicon-generator .favicon-bgrem-toggle small { font-size:.59rem; }
}
@media (prefers-reduced-motion: reduce) {
  #panel-favicon-generator .favicon-bgrem-progress-track i { transition:none; }
}


/* =========================================================
   PDF Converter production transition stability.
   Holds the outgoing preview geometry only during the hidden file swap so
   crop-ui's temporary empty state cannot collapse to its placeholder height.
   ========================================================= */
#panel-pdf-converter .pdfc-crop-stage.pdfc-preview-switching {
  min-height: var(--pdfc-switch-height, 0px) !important;
}
@media (max-width: 800px) {
  #panel-pdf-converter .pdfc-crop-stage.pdfc-preview-switching {
    min-height: var(--pdfc-switch-height, 0px) !important;
  }
}

/* =========================================================
   v103 · Favicon professional picker + OCR-style Doc Scanner chooser
   ========================================================= */

/* Doc Scanner: one browser-owned file chooser trigger, exactly like the OCR
   interaction pattern. No capture attribute is used in HTML, so the platform
   can expose Camera / Photos / Files according to browser/device support. */
#panel-doc-scanner #scanner-drop > .drop-zone-action {
  margin-top: 2px;
  min-width: 126px;
  text-align: center;
}

/* The native <input type="color"> remains only as a compact state holder for
   existing generation logic. It is never shown, so Android's limited native
   palette cannot replace PixelOrigen's full picker. */
#panel-favicon-generator .favicon-native-color-input {
  display: none !important;
}

#panel-favicon-generator .favicon-color-control {
  width: max-content;
  max-width: 100%;
  display: inline-grid;
  grid-template-columns: 48px 82px;
  align-items: center;
  gap: 9px;
}

#panel-favicon-generator .favicon-color-swatch {
  --favicon-swatch-color: #000000;
  width: 48px;
  min-width: 48px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  touch-action: manipulation;
}
#panel-favicon-generator .favicon-color-swatch > span {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 7px;
  background: var(--favicon-swatch-color);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
}
#panel-favicon-generator .favicon-color-swatch:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Keep the page behind the picker still. */
html.favicon-picker-open,
html.favicon-picker-open body {
  overflow: hidden !important;
  overscroll-behavior: none;
}

/* IMPORTANT: picker styles are intentionally global. favicon-generator.js
   reparents #favicon-color-picker directly under <body>, escaping the
   workspace card's overflow clipping. This is what makes the picker a real
   viewport overlay instead of inline content on mobile. */
.favicon-color-picker-layer {
  position: fixed !important;
  inset: 0 !important;
  z-index: 2147483000 !important;
  display: grid;
  place-items: center;
  padding:
    max(14px, env(safe-area-inset-top))
    14px
    max(14px, env(safe-area-inset-bottom));
  background: rgba(5, 8, 13, .72);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  overscroll-behavior: contain;
}
.favicon-color-picker-layer[hidden] {
  display: none !important;
}

.favicon-color-picker-dialog {
  width: min(440px, calc(100vw - 28px));
  max-height: min(760px, calc(100dvh - 28px));
  overflow: auto;
  overscroll-behavior: contain;
  display: grid;
  gap: 13px;
  padding: 17px;
  border: 1px solid var(--line-strong);
  border-radius: 24px;
  color: var(--text);
  background: color-mix(in srgb, var(--bg) 97%, var(--primary) 3%);
  box-shadow: 0 24px 80px rgba(0,0,0,.45);
}

.favicon-color-picker-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.favicon-color-picker-header > div {
  display: grid;
  gap: 3px;
}
.favicon-color-picker-header strong {
  color: var(--text);
  font-size: 1.12rem;
  line-height: 1.2;
}
.favicon-color-picker-header small {
  color: var(--text-muted);
  font-size: .66rem;
  line-height: 1.35;
}
.favicon-picker-close {
  width: 38px;
  min-width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text-soft);
  background: var(--bg-soft);
  font: 500 1.35rem/1 system-ui, sans-serif;
  cursor: pointer;
}

/* Framework7-style wheel + saturation/brightness surface, implemented with
   native CSS/JS only so no new framework or runtime is added to PixelOrigen. */
.favicon-picker-wheel {
  position: relative;
  width: min(350px, 82vw);
  aspect-ratio: 1;
  justify-self: center;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    #ff0000 0deg,
    #ffff00 60deg,
    #00ff00 120deg,
    #00ffff 180deg,
    #0000ff 240deg,
    #ff00ff 300deg,
    #ff0000 360deg
  );
  box-shadow:
    inset 0 0 0 1px rgba(255,255,255,.18),
    0 10px 28px rgba(0,0,0,.18);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.favicon-picker-wheel::after {
  content: "";
  position: absolute;
  inset: 18.5%;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--line) 76%, transparent);
  pointer-events: none;
}
.favicon-picker-square {
  --favicon-picker-hue: #ff0000;
  position: absolute;
  z-index: 2;
  left: 25%;
  top: 25%;
  width: 50%;
  height: 50%;
  border: 1px solid rgba(255,255,255,.62);
  border-radius: 7px;
  background:
    linear-gradient(to top, #000 0%, transparent 100%),
    linear-gradient(to right, #fff 0%, var(--favicon-picker-hue) 100%);
  box-shadow: 0 6px 20px rgba(0,0,0,.32);
  touch-action: none;
  cursor: crosshair;
}
.favicon-picker-hue-cursor,
.favicon-picker-sv-cursor {
  position: absolute;
  z-index: 4;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 1px 7px rgba(0,0,0,.65), inset 0 0 0 1px rgba(0,0,0,.2);
  pointer-events: none;
}
.favicon-picker-hue-cursor {
  width: 34px;
  height: 34px;
  margin: -17px 0 0 -17px;
}
.favicon-picker-sv-cursor {
  width: 21px;
  height: 21px;
  margin: -10.5px 0 0 -10.5px;
}
.favicon-picker-hint {
  margin: -2px 0 0;
  color: var(--text-muted);
  font-size: .63rem;
  line-height: 1.45;
  text-align: center;
}

.favicon-picker-value-row {
  display: grid;
  grid-template-columns: 44px auto minmax(130px, 1fr);
  align-items: center;
  gap: 9px;
}
.favicon-picker-preview {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.24);
}
.favicon-picker-value-row label {
  color: var(--text-soft);
  font-size: .70rem;
  font-weight: 800;
}
#favicon-picker-hex {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: var(--bg-soft);
  font: 750 .78rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}
#favicon-picker-hex:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 12%, transparent);
}
#favicon-picker-hex[aria-invalid="true"] {
  border-color: #ff6b6b;
}

.favicon-picker-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}
.favicon-picker-actions .btn {
  min-width: 108px;
}

@media (max-width: 560px) {
  #panel-favicon-generator .favicon-color-control {
    grid-template-columns: 48px 82px;
  }
  .favicon-color-picker-layer {
    place-items: end center;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
  }
  .favicon-color-picker-dialog {
    width: 100%;
    max-height: calc(100dvh - 12px);
    padding: 15px 14px max(14px, env(safe-area-inset-bottom));
    border-radius: 26px 26px 16px 16px;
  }
  .favicon-picker-wheel {
    width: min(352px, 90vw);
  }
  .favicon-picker-value-row {
    grid-template-columns: 40px auto minmax(0, 1fr);
  }
  .favicon-picker-preview {
    width: 40px;
    height: 40px;
  }
  .favicon-picker-actions .btn {
    flex: 1 1 0;
    min-width: 0;
  }
}


/* =========================================================
   v104 — PDF Converter review cleanup + Doc Scanner source sheet.
   ========================================================= */
#panel-pdf-converter .pdfc-review-toolbar {
  /* Only real edit actions live here. Previous/Next remain in the single nav row below. */
  gap: 10px;
}
#panel-pdf-converter .pdfc-crop-stage.pdfc-rotation-swap {
  /* A rotated image is pre-decoded and swapped atomically; never expose the empty placeholder. */
  opacity: 1 !important;
  animation: none !important;
}
#panel-pdf-converter .pdfc-crop-stage[aria-busy="true"] { cursor: progress; }
#panel-pdf-converter #pdfc-rotate-right[aria-busy="true"] { opacity: .72; cursor: progress; }

body.scanner-source-open { overflow: hidden; }
.scanner-source-chooser[hidden] { display: none !important; }
.scanner-source-chooser {
  position: fixed;
  inset: 0;
  z-index: 12000;
  display: grid;
  align-items: end;
  justify-items: stretch;
}
.scanner-source-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  background: rgba(2, 8, 15, .62);
  backdrop-filter: blur(3px);
  cursor: default;
}
.scanner-source-sheet {
  position: relative;
  z-index: 1;
  width: min(100% - 20px, 520px);
  margin: 0 auto max(10px, env(safe-area-inset-bottom));
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--bg-card);
  box-shadow: 0 -12px 50px rgba(0,0,0,.34);
}
.scanner-source-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; }
.scanner-source-head > div { min-width:0; }
.scanner-source-head strong,.scanner-source-head small { display:block; }
.scanner-source-head strong { color:var(--text); font-size:.92rem; }
.scanner-source-head small { margin-top:3px; color:var(--text-muted); font-size:.66rem; line-height:1.45; }
.scanner-source-close {
  flex:0 0 auto; width:38px; height:38px; padding:0; border:1px solid var(--line); border-radius:11px;
  background:var(--bg-soft); color:var(--text); font:500 1.45rem/1 inherit; cursor:pointer;
}
.scanner-source-actions { display:grid; gap:10px; margin-top:14px; }
.scanner-source-option {
  display:grid; grid-template-columns:46px minmax(0,1fr) auto; align-items:center; gap:11px; width:100%; min-height:68px;
  padding:10px 12px; border:1px solid var(--line); border-radius:15px; background:var(--bg-soft); color:var(--text); text-align:left; cursor:pointer;
}
.scanner-source-option:hover,.scanner-source-option:focus-visible { border-color:rgba(114,230,255,.46); outline:none; box-shadow:0 0 0 3px rgba(114,230,255,.10); }
.scanner-source-option > span:nth-child(2) { min-width:0; }
.scanner-source-option strong,.scanner-source-option small { display:block; }
.scanner-source-option strong { font-size:.77rem; }
.scanner-source-option small { margin-top:2px; color:var(--text-muted); font-size:.61rem; }
.scanner-source-icon { display:grid; place-items:center; width:44px; height:44px; border-radius:13px; background:rgba(114,230,255,.09); color:var(--primary); font-size:1.15rem; }
.scanner-source-chevron { color:var(--text-muted); font-size:1.35rem; line-height:1; }
@media (min-width: 720px) {
  .scanner-source-chooser { align-items:center; }
  .scanner-source-sheet { margin:0 auto; border-radius:20px; }
}
@media (max-width: 520px) {
  .scanner-source-sheet { width:calc(100% - 16px); padding:14px; border-radius:20px; }
  .scanner-source-option { min-height:64px; }
}


/* =========================================================
   v105 — shared full-spectrum color picker + compact BG actions
   + visible PDF Editor mobile back arrow.
   ========================================================= */

/* QR Generator and Watermark use the same custom hue-wheel picker UI as
   Favicon Generator. The native color input remains state only and never
   opens Android's limited platform palette. */
.pixel-color-control {
  width: max-content;
  max-width: 100%;
  display: inline-grid;
  grid-template-columns: 48px minmax(76px, auto);
  align-items: center;
  gap: 9px;
}
.pixel-color-control .favicon-native-color-input { display: none !important; }
.pixel-color-control .favicon-color-swatch {
  --favicon-swatch-color: #000000;
  width: 48px;
  min-width: 48px;
  height: 40px;
  display: grid;
  place-items: center;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--bg);
  cursor: pointer;
  touch-action: manipulation;
}
.pixel-color-control .favicon-color-swatch > span {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 7px;
  background: var(--favicon-swatch-color);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18);
}
.pixel-color-control .favicon-color-swatch:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
.pixel-color-value {
  min-width: 76px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-soft);
  background: color-mix(in srgb, var(--bg-soft) 92%, transparent);
  font: 800 .72rem/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-transform: uppercase;
}

/* Background Remover: Clear + Remove Background stay compact and on one row,
   including narrow phones. */
#panel-background-remover .bgrem-actions {
  display: grid !important;
  grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr) !important;
  align-items: stretch !important;
  gap: 10px !important;
  width: 100%;
  margin-top: 0 !important;
}
#panel-background-remover .bgrem-actions .btn {
  width: 100% !important;
  min-width: 0 !important;
  min-height: 44px !important;
  margin: 0 !important;
  padding: 9px 11px !important;
  justify-content: center;
  white-space: nowrap;
  font-size: clamp(.70rem, 2.7vw, .82rem);
}
#panel-background-remover .bgrem-actions #bgrem-process.process-btn {
  min-height: 44px !important;
}

/* The old mobile rule hid every span inside the back button, including the
   actual arrow. Keep the icon visible while the accessible label remains
   visually hidden through .pdfe-visually-hidden. */
@media (max-width: 700px) {
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-fullscreen-back > span[aria-hidden="true"] {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    color: var(--text) !important;
    font-size: 1.2rem !important;
    line-height: 1 !important;
  }
}



/* ========================================================================== */
/* v100 — Task-first workspace cleanup                                         */
/* UI-only overrides. Tool processing controllers and algorithms are untouched. */
/* ========================================================================== */
.workspace-page.task-first-workspace .workspace-shell{max-width:1180px;padding-top:calc(var(--header-height) + clamp(18px,3vw,30px));padding-bottom:44px}
.task-tool-header{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;margin:0 0 18px;padding:0 2px}
.task-tool-copy{min-width:0;max-width:760px}
.task-title-line{display:flex;align-items:center;gap:10px;min-width:0}
.task-title-line h1{margin:0;color:var(--text);font-size:clamp(1.65rem,3.2vw,2.35rem);line-height:1.08;letter-spacing:-.035em}
.task-tool-copy>p{margin:7px 0 0;color:var(--text-muted);font-size:.9rem;line-height:1.5}
.task-privacy-line{display:flex;align-items:center;gap:7px!important;margin-top:9px!important;color:var(--text-soft)!important;font-size:.72rem!important;font-weight:750}
.task-help-button{position:relative;display:grid;place-items:center;flex:0 0 44px;width:44px;height:44px;margin:-3px 0 0;border:0;background:transparent;color:var(--text-muted);font:900 .9rem/1 inherit;cursor:pointer;border-radius:50%}
.task-help-button::before{content:"";position:absolute;width:32px;height:32px;border:1px solid var(--line-strong);border-radius:50%;background:rgba(255,255,255,.025)}
.task-help-button:hover{color:var(--primary)}
.task-help-button:hover::before{border-color:rgba(114,230,255,.48);background:rgba(114,230,255,.07)}
.task-help-button:active{transform:scale(.96)}
.task-help-button:focus-visible{outline:3px solid rgba(114,230,255,.28);outline-offset:1px}

/* Remove duplicate marketing/support chrome from active workflows. */
.workspace-page.task-first-workspace .tool-control-card>.card-heading,
.workspace-page.task-first-workspace .form-tool-notice,
.workspace-page.task-first-workspace .form-trust-grid,
.workspace-page.task-first-workspace .local-tool-note,
.workspace-page.task-first-workspace .pdf-privacy-note,
.workspace-page.task-first-workspace .favicon-technical-details{display:none!important}

.workspace-page.task-first-workspace .workspace-grid{align-items:start;gap:16px}
.workspace-page.task-first-workspace .workspace-controls{gap:16px}
.workspace-page.task-first-workspace .workspace-card{border-radius:18px}
.workspace-page.task-first-workspace .upload-card,
.workspace-page.task-first-workspace .tool-control-card,
.workspace-page.task-first-workspace .preview-card{padding:18px}
.workspace-page.task-first-workspace .tool-control-card{background:var(--surface);box-shadow:var(--shadow-soft)}
.workspace-page.task-first-workspace .tool-panel{gap:14px}
.workspace-page.task-first-workspace .settings-group-heading{margin-bottom:10px}
.workspace-page.task-first-workspace .settings-group-heading strong{font-size:.82rem}
.workspace-page.task-first-workspace .settings-group-heading small{font-size:.66rem}
.workspace-page.task-first-workspace .field{gap:7px}
.workspace-page.task-first-workspace .field input:not([type=range]):not([type=checkbox]):not([type=radio]),
.workspace-page.task-first-workspace .field select{min-height:46px}
.workspace-page.task-first-workspace .process-btn{min-height:50px;margin-top:2px}
.workspace-page.task-first-workspace .results-box{margin-top:10px}

/* Initial state: the task starts with file selection, not an empty settings wall. */
.workspace-page.task-first-generic:not(.has-primary-file) .tool-control-card,
.workspace-page.task-first-generic:not(.has-primary-file) .workspace-preview{display:none!important}
.workspace-page.task-first-generic.has-primary-file #upload-section{display:none!important}
.workspace-page.task-first-bulk:not(.has-primary-file) .workspace-preview{display:none!important}
.workspace-page.task-first-passport:not(.has-primary-file) .tool-control-card{display:none!important}

/* Upload is deliberately compact; native label/input behavior is preserved. */
.workspace-page.task-first-workspace .upload-card .card-heading{margin-bottom:12px}
.workspace-page.task-first-workspace .upload-card .step-number{display:none}
.workspace-page.task-first-workspace .upload-card .card-heading h2{font-size:1rem}
.workspace-page.task-first-workspace .upload-card .card-heading p{font-size:.7rem}
.workspace-page.task-first-workspace .drop-zone{min-height:230px;padding:24px 18px;border-radius:17px;gap:9px}
.workspace-page.task-first-workspace .drop-zone .upload-orbit{width:62px;height:62px;margin-bottom:3px}
.workspace-page.task-first-workspace .drop-zone .upload-glyph{width:44px;height:44px;font-size:1.5rem}
.workspace-page.task-first-workspace .drop-zone strong{font-size:1.12rem}
.workspace-page.task-first-workspace .drop-zone>span{font-size:.8rem}
.workspace-page.task-first-workspace .drop-zone-action{min-height:46px;padding:0 22px;margin-top:4px}
.workspace-page.task-first-workspace .drop-zone small{margin-top:5px;font-size:.68rem}
.workspace-page.task-first-workspace .status-text{min-height:20px;margin-top:8px;font-size:.72rem}

/* Before/after preview is not a giant empty marketing component anymore. */
.workspace-page.task-first-workspace .empty-preview{min-height:240px;padding:22px}
.workspace-page.task-first-workspace .empty-preview-copy strong{font-size:.95rem}
.workspace-page.task-first-workspace .empty-preview-copy p,
.workspace-page.task-first-workspace .preview-capabilities,
.workspace-page.task-first-workspace .compare-hint{display:none!important}
.workspace-page.task-first-workspace .preview-heading{margin-bottom:12px}
.workspace-page.task-first-workspace .preview-heading .step-number{display:none}
.workspace-page.task-first-workspace .preview-heading h2{font-size:1rem}
.workspace-page.task-first-workspace .preview-heading p{font-size:.68rem}
.workspace-page.task-first-workspace .source-preview .preview-toolbar{min-height:42px}
.workspace-page.task-first-workspace .source-preview .preview-toolbar button{min-height:40px}

/* Functional document/utility workspaces keep their dedicated controls, but lose outer nesting. */
.workspace-page.task-first-document .workspace-grid,
.workspace-page.task-first-standalone .workspace-grid{grid-template-columns:1fr;max-width:1180px;margin-inline:auto}
.workspace-page.task-first-document .tool-control-card,
.workspace-page.task-first-standalone .tool-control-card{padding:0;border:0;background:transparent;box-shadow:none}
.workspace-page.task-first-document .tool-panel,
.workspace-page.task-first-standalone .tool-panel{margin:0}
.workspace-page.task-first-standalone .new-tool-drop,
.workspace-page.task-first-standalone .new-tool-drop.compact{margin-top:0}
.workspace-page.task-first-workspace .new-tool-status,
.workspace-page.task-first-workspace .pdf-status{min-height:18px;margin-top:8px;padding:0;background:transparent;border:0;font-size:.72rem}

/* Passport: keep official-source functionality but remove introductory trust cards. */
.workspace-page.task-first-passport .form-primary-upload{gap:12px}
.workspace-page.task-first-passport .form-upload-grid{gap:12px}
.workspace-page.task-first-passport .form-upload-card{padding:14px;border-radius:14px}
.workspace-page.task-first-passport .tool-control-card{margin-top:0}

/* Lightweight help popover / small-screen bottom sheet. */
.tool-help-layer[hidden]{display:none!important}
.tool-help-layer{position:fixed;inset:0;z-index:180;pointer-events:none}
.tool-help-popover{position:fixed;left:var(--help-left,12px);top:var(--help-top,80px);width:var(--help-width,min(360px,calc(100vw - 24px)));max-height:min(470px,calc(100dvh - 24px));overflow:auto;padding:16px;border:1px solid var(--line-strong);border-radius:16px;background:var(--surface);color:var(--text);box-shadow:0 22px 60px rgba(0,0,0,.3);pointer-events:auto;overscroll-behavior:contain}
.tool-help-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:9px}
.tool-help-head strong{font-size:.92rem}
.tool-help-head button{display:grid;place-items:center;width:40px;height:40px;margin:-8px -8px -8px 0;border:0;border-radius:12px;background:transparent;color:var(--text-muted);font-size:1.35rem;cursor:pointer}
.tool-help-head button:hover{background:rgba(114,230,255,.08);color:var(--text)}
.tool-help-head button:focus-visible{outline:3px solid rgba(114,230,255,.28)}
.tool-help-popover>p{margin:0 0 10px;color:var(--text-muted);font-size:.76rem;line-height:1.5}
.tool-help-popover ol{margin:0;padding:0 0 0 20px;display:grid;gap:7px;color:var(--text-soft);font-size:.76rem;line-height:1.45}
.tool-help-tip,.tool-help-privacy{margin-top:12px!important;padding-top:10px;border-top:1px solid var(--line);font-size:.7rem!important}
.tool-help-privacy{color:var(--text-soft)!important;font-weight:700}

/* Keep Feedback reachable without covering task actions on phones. */
@media (max-width:600px){
  .workspace-page #feedback-widget .feedback-launch{display:none!important}
  .workspace-mobile-menu .workspace-mobile-feedback{min-height:44px;display:flex;align-items:center;width:100%;padding:10px 12px;border:0;border-radius:10px;background:transparent;color:var(--text);font:inherit;font-weight:750;text-align:left}
  .workspace-mobile-menu .workspace-mobile-feedback:hover,.workspace-mobile-menu .workspace-mobile-feedback:focus-visible{background:rgba(114,230,255,.08);color:var(--primary);outline:none}
}

@media (max-width:760px){
  .workspace-page.task-first-workspace .workspace-shell{padding:14px 12px calc(34px + env(safe-area-inset-bottom))}
  .task-tool-header{margin-bottom:12px;padding:0 2px}
  .task-title-line h1{font-size:clamp(1.45rem,7vw,1.8rem)}
  .task-tool-copy>p{margin-top:5px;font-size:.8rem;line-height:1.4}
  .task-privacy-line{margin-top:7px!important;font-size:.68rem!important}
  .workspace-page.task-first-workspace .workspace-grid{display:flex;flex-direction:column;gap:12px}
  .workspace-page.task-first-generic .workspace-controls{display:contents}
  .workspace-page.task-first-generic #upload-section{order:1}
  .workspace-page.task-first-generic .workspace-preview{order:2;width:100%}
  .workspace-page.task-first-generic .tool-control-card{order:3;width:100%}
  .workspace-page.task-first-workspace .upload-card,
  .workspace-page.task-first-workspace .tool-control-card,
  .workspace-page.task-first-workspace .preview-card{padding:14px;border-radius:16px}
  .workspace-page.task-first-workspace .drop-zone{min-height:190px;padding:20px 14px}
  .workspace-page.task-first-workspace .drop-zone .upload-orbit{width:54px;height:54px}
  .workspace-page.task-first-workspace .drop-zone .upload-glyph{width:40px;height:40px;font-size:1.35rem}
  .workspace-page.task-first-workspace .drop-zone strong{font-size:1rem}
  .workspace-page.task-first-workspace .drop-zone-action{min-height:44px;padding-inline:20px}
  .workspace-page.task-first-workspace .process-btn{min-height:48px}
  .workspace-page.task-first-workspace .split-fields{grid-template-columns:1fr 1fr;gap:9px}
  .workspace-page.task-first-workspace .preset-row{gap:7px}
  .workspace-page.task-first-workspace .preset-row button{min-height:42px;padding:0 10px}
  .workspace-page.task-first-workspace .source-preview .image-preview-wrap{max-height:42dvh}
  .workspace-page.task-first-workspace .source-preview .image-preview{max-height:42dvh;object-fit:contain}
  .workspace-page.task-first-passport .workspace-controls{width:100%}
  .workspace-page.task-first-passport .form-upload-grid{grid-template-columns:1fr}

  .tool-help-layer{pointer-events:auto;background:rgba(5,14,23,.36);backdrop-filter:blur(2px)}
  .tool-help-popover{left:10px!important;right:10px;top:auto!important;bottom:calc(10px + env(safe-area-inset-bottom));width:auto!important;max-height:min(58dvh,440px);border-radius:18px;padding:16px 16px 18px;box-shadow:0 24px 70px rgba(0,0,0,.32)}
  body.tool-help-open{overflow:hidden}
}

@media (max-width:390px){
  .workspace-page.task-first-workspace .workspace-shell{padding-inline:10px}
  .task-title-line{gap:6px}
  .task-help-button{flex-basis:42px;width:42px;height:42px}
  .task-help-button::before{width:30px;height:30px}
  .workspace-page.task-first-workspace .split-fields{grid-template-columns:1fr}
  .workspace-page.task-first-workspace .drop-zone{min-height:178px}
}

@media (prefers-reduced-motion:reduce){
  .task-help-button,.tool-help-popover{transition:none!important;animation:none!important}
}

/* ========================================================================== */
/* v101 — compact task-first correction                                        */
/* UI-only. Processing controllers, routes and security architecture unchanged. */
/* ========================================================================== */

/* Generic simple-tool empty state: one functional upload surface, not card-in-card. */
.workspace-page.task-first-generic:not(.has-primary-file) #upload-section{
  padding:0;
  border:0;
  background:transparent;
  box-shadow:none;
}
.workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content{width:100%}
.workspace-page.task-first-generic:not(.has-primary-file) .drop-zone{
  min-height:148px;
  padding:14px 16px;
  gap:6px;
  border-radius:14px;
  background:color-mix(in srgb,var(--surface) 58%,transparent);
}
.workspace-page.task-first-generic:not(.has-primary-file) .drop-zone .upload-orbit{
  width:46px;height:46px;margin:0;
}
.workspace-page.task-first-generic:not(.has-primary-file) .drop-zone .upload-glyph{
  width:34px;height:34px;font-size:1.1rem;
}
.workspace-page.task-first-generic:not(.has-primary-file) .drop-zone strong{font-size:.86rem}
.workspace-page.task-first-generic:not(.has-primary-file) .drop-zone-action{
  min-height:42px;margin:0;padding:0 18px;border-radius:10px;
}
.workspace-page.task-first-generic:not(.has-primary-file) .drop-zone small{margin:0;font-size:.62rem}
.workspace-page.task-first-generic:not(.has-primary-file) .status-text{min-height:0;margin-top:5px}

/* Dedicated document tools: compact file chooser before the actual workspace. */
#panel-pdf-editor>.pdf-drop-zone,
#panel-pdf-converter>.pdf-mode-switch~[data-pdf-converter-panel]>.pdf-drop-zone{
  margin-top:0;
}
#panel-pdf-editor>.pdf-drop-zone,
#panel-pdf-converter .pdf-drop-zone{
  min-height:132px;
  padding:12px 14px;
  gap:5px;
  border-radius:14px;
  background:color-mix(in srgb,var(--surface) 60%,transparent);
}
#panel-pdf-editor>.pdf-drop-zone .pdf-drop-icon,
#panel-pdf-converter .pdf-drop-zone .pdf-drop-icon{
  width:40px;height:40px;margin:0;border-radius:11px;font-size:.7rem;
}
#panel-pdf-editor>.pdf-drop-zone strong,
#panel-pdf-converter .pdf-drop-zone strong{font-size:.8rem}
#panel-pdf-editor>.pdf-drop-zone p,
#panel-pdf-converter .pdf-drop-zone p{display:none!important}
#panel-pdf-editor>.pdf-drop-zone .drop-zone-action,
#panel-pdf-converter .pdf-drop-zone .drop-zone-action{
  min-height:40px;margin:0;padding:0 16px;border-radius:10px;font-size:.72rem;
}
#panel-pdf-editor>.pdf-drop-zone small,
#panel-pdf-converter .pdf-drop-zone small{margin:0;font-size:.6rem;line-height:1.3}
#panel-pdf-editor>.pdf-status,
#panel-pdf-converter .pdf-status{margin-top:5px;min-height:16px;font-size:.64rem;line-height:1.35}

/* PDF Converter direction choice becomes a small segmented switch. */
#panel-pdf-converter .pdf-mode-chooser.pdf-mode-switch{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:4px;
  width:min(100%,430px);
  margin:0 auto 10px;
  padding:4px;
  border:1px solid var(--line);
  border-radius:12px;
  background:color-mix(in srgb,var(--surface) 72%,transparent);
}
#panel-pdf-converter .pdf-mode-switch .pdf-mode-choice{
  min-width:0;
  min-height:42px;
  height:42px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  padding:0 10px;
  border:0;
  border-radius:9px;
  background:transparent;
  color:var(--text-muted);
  box-shadow:none;
  transform:none;
  text-align:center;
}
#panel-pdf-converter .pdf-mode-switch .pdf-mode-choice>span{font-size:.66rem;font-weight:900;color:var(--primary)}
#panel-pdf-converter .pdf-mode-switch .pdf-mode-choice>strong{font-size:.68rem;line-height:1;white-space:nowrap}
#panel-pdf-converter .pdf-mode-switch .pdf-mode-choice:hover,
#panel-pdf-converter .pdf-mode-switch .pdf-mode-choice:focus-visible{
  transform:none;
  border:0;
  background:color-mix(in srgb,var(--primary) 7%,transparent);
  box-shadow:none;
}
#panel-pdf-converter .pdf-mode-switch .pdf-mode-choice.is-active{
  color:var(--text);
  background:color-mix(in srgb,var(--primary) 13%,var(--surface));
  box-shadow:0 2px 8px rgba(0,0,0,.09);
}

/* Fixed mobile header safety: retain the fixed-header offset after v100 cleanup. */
@media(max-width:760px){
  .workspace-page.task-first-workspace .workspace-shell{
    padding-top:calc(var(--header-height) + 12px)!important;
    padding-right:12px;
    padding-bottom:calc(26px + env(safe-area-inset-bottom));
    padding-left:12px;
  }
  .task-tool-header{margin-bottom:9px}
  .task-title-line h1{font-size:clamp(1.34rem,6.2vw,1.65rem);line-height:1.08}
  .task-tool-copy>p{font-size:.74rem;line-height:1.35}
  .task-privacy-line{margin-top:5px!important;font-size:.62rem!important}
  .workspace-page.task-first-generic:not(.has-primary-file) .drop-zone{
    min-height:128px;
    padding:10px 12px;
    gap:4px;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) .drop-zone .upload-orbit{width:40px;height:40px}
  .workspace-page.task-first-generic:not(.has-primary-file) .drop-zone .upload-glyph{width:30px;height:30px;font-size:1rem}
  .workspace-page.task-first-generic:not(.has-primary-file) .drop-zone strong{font-size:.78rem}
  .workspace-page.task-first-generic:not(.has-primary-file) .drop-zone-action{min-height:40px;padding-inline:16px;font-size:.7rem}
  #panel-pdf-editor>.pdf-drop-zone,
  #panel-pdf-converter .pdf-drop-zone{min-height:126px;padding:10px 12px}
  #panel-pdf-converter .pdf-mode-chooser.pdf-mode-switch{width:100%;margin-bottom:8px}
  #panel-pdf-converter .pdf-mode-switch .pdf-mode-choice{min-height:40px;height:40px;padding:0 7px}
  #panel-pdf-converter .pdf-mode-switch .pdf-mode-choice>strong{font-size:.64rem}
}
@media(max-width:390px){
  .workspace-page.task-first-workspace .workspace-shell{
    padding-top:calc(var(--header-height) + 10px)!important;
    padding-inline:10px;
  }
  .task-tool-header{margin-bottom:8px}
  .task-title-line h1{font-size:1.3rem}
  #panel-pdf-converter .pdf-mode-switch .pdf-mode-choice>span{display:none}
}

/* Footer stays present but no longer consumes a large mobile block. */
.workspace-footer .container{min-height:52px;padding-block:8px;font-size:.62rem}
.workspace-footer nav{gap:9px}
.workspace-footer button{padding:5px 8px;border-radius:8px;font-size:.62rem}
@media(max-width:700px){
  .workspace-footer .container{
    min-height:46px;
    padding:7px 10px calc(7px + env(safe-area-inset-bottom));
    gap:6px;
    align-items:center;
    flex-direction:row;
    overflow-x:auto;
    white-space:nowrap;
    scrollbar-width:none;
  }
  .workspace-footer .container::-webkit-scrollbar{display:none}
  .workspace-footer .container>span{flex:0 0 auto;font-size:.56rem}
  .workspace-footer nav{flex:0 0 auto;gap:7px}
  .workspace-footer a,.workspace-footer button{font-size:.58rem}
  .workspace-footer button{min-height:34px;padding:4px 7px}
}

/* v101.1 — intrinsic mobile height + full-width empty-state correction. */
.workspace-page.task-first-generic:not(.has-primary-file) #upload-section,
.workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content,
.workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone{
  width:100%;
  max-width:none;
  box-sizing:border-box;
}

@media(max-width:760px){
  /* On phones the file action itself is the visual anchor. Removing the
     decorative glyph/title keeps the chooser compact without shrinking the
     44px touch target. */
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .upload-orbit,
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone>strong{
    display:none!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone{
    min-height:128px!important;
    height:128px;
    padding:14px 12px!important;
    gap:8px!important;
    align-content:center;
    justify-items:center;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone-action{
    min-height:44px!important;
    height:44px;
    padding-inline:20px;
    font-size:.72rem;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone small{
    font-size:.61rem;
    line-height:1.25;
    text-align:center;
  }

  #panel-pdf-editor>.pdf-drop-zone .pdf-drop-icon,
  #panel-pdf-editor>.pdf-drop-zone>strong,
  #panel-pdf-converter .pdf-drop-zone .pdf-drop-icon,
  #panel-pdf-converter .pdf-drop-zone>strong{
    display:none!important;
  }
  #panel-pdf-editor>.pdf-drop-zone,
  #panel-pdf-converter .pdf-drop-zone{
    min-height:126px!important;
    height:126px;
    padding:14px 12px!important;
    gap:8px!important;
    align-content:center;
    justify-items:center;
    box-sizing:border-box;
  }
  #panel-pdf-editor>.pdf-drop-zone .drop-zone-action,
  #panel-pdf-converter .pdf-drop-zone .drop-zone-action{
    min-height:44px!important;
    height:44px;
    padding-inline:18px;
    font-size:.72rem;
  }
  #panel-pdf-editor>.pdf-drop-zone small,
  #panel-pdf-converter .pdf-drop-zone small{
    font-size:.6rem;
    line-height:1.25;
    text-align:center;
  }
}

/* ========================================================================== */
/* v102 — mobile alignment, compact upload cards & true page-footer placement */
/* UI-only. No processing/controller/security logic changed.                   */
/* ========================================================================== */

/* Keep the legal footer outside the active task region on short tool pages. */
.workspace-page.task-first-workspace{
  min-height:100vh;
  min-height:100dvh;
  display:flex;
  flex-direction:column;
}
.workspace-page.task-first-workspace .workspace-shell{
  flex:1 0 auto;
  width:100%;
}
.workspace-page.task-first-workspace .workspace-footer{
  flex:0 0 auto;
  margin-top:auto;
}

/* File-picker labels must center their text as real buttons on every browser. */
.workspace-page.task-first-workspace .drop-zone-action,
.workspace-page.task-first-passport .form-file-button{
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  text-align:center!important;
  line-height:1!important;
  box-sizing:border-box;
}

/* Generic empty state: smaller than v101 while preserving a 44px tap target. */
.workspace-page.task-first-generic:not(.has-primary-file) .drop-zone{
  min-height:132px;
  padding:12px 14px;
}
.workspace-page.task-first-generic:not(.has-primary-file) .drop-zone-action{
  min-height:44px;
}

/* Passport/Form Photo initial chooser: flatten the outer card and make each
   optional file action a compact, beginner-readable functional group. */
.workspace-page.task-first-passport:not(.has-primary-file) #upload-section{
  padding:0!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
  overflow:visible;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-heading{
  margin:0 0 10px!important;
  padding:0 2px;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary{
  gap:10px;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card{
  min-height:154px;
  padding:12px;
  gap:10px;
  align-content:start;
  border-radius:13px;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head>span{
  width:44px;
  height:44px;
  border-radius:12px;
  font-size:.6rem;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head strong{
  font-size:.84rem;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head small{
  font-size:.64rem;
  line-height:1.3;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-file-button{
  min-height:44px;
  height:44px;
  margin:0;
  padding:0 12px;
  font-size:.72rem;
}

.workspace-footer .footer-copy-short{display:none}

@media(max-width:760px){
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone{
    min-height:108px!important;
    height:108px!important;
    padding:10px 12px!important;
    gap:6px!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone-action{
    min-height:44px!important;
    height:44px!important;
    margin:0!important;
    padding:0 18px!important;
    font-size:.72rem!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone small{
    margin:0!important;
    font-size:.58rem!important;
    line-height:1.2!important;
  }

  .workspace-page.task-first-passport:not(.has-primary-file) .form-primary-upload{
    gap:9px;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card{
    min-height:132px!important;
    padding:10px 11px!important;
    gap:8px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head>span{
    width:40px!important;
    height:40px!important;
    border-radius:11px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head strong{
    font-size:.78rem!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head small{
    margin-top:1px!important;
    font-size:.6rem!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-file-button{
    min-height:44px!important;
    height:44px!important;
    font-size:.7rem!important;
  }

  /* One compact footer row at the true bottom of short pages; no horizontal
     scroll and no clipped copyright text. */
  .workspace-footer .container{
    min-height:44px!important;
    padding:6px 10px calc(6px + env(safe-area-inset-bottom))!important;
    display:flex!important;
    flex-direction:row!important;
    align-items:center!important;
    justify-content:center!important;
    gap:8px!important;
    overflow:visible!important;
    white-space:nowrap;
  }
  .workspace-footer .footer-copy-long{display:none}
  .workspace-footer .footer-copy-short{display:inline}
  .workspace-footer .workspace-footer-copy{flex:0 0 auto;font-size:.52rem}
  .workspace-footer nav{display:flex;flex:0 1 auto;gap:6px!important;min-width:0}
  .workspace-footer a,.workspace-footer button{font-size:.56rem!important}
  .workspace-footer button{min-height:32px!important;padding:4px 6px!important}
}

@media(max-width:390px){
  .workspace-footer .workspace-footer-copy{display:none}
  .workspace-footer .container{gap:6px!important}
  .workspace-footer nav{justify-content:center;width:100%}
}

/* ========================================================================== */
/* v103 — researched balanced upload sizing                                    */
/* UI-only. Restores breathing room without returning to oversized empty cards. */
/* ========================================================================== */

/* Desktop: enough room for drag/drop, but still task-first and restrained. */
.workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone{
  min-height:200px!important;
  height:200px!important;
  padding:22px 20px!important;
  gap:10px!important;
}
.workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone-action{
  min-height:50px!important;
  height:50px!important;
  min-width:210px;
  padding:0 24px!important;
  font-size:.86rem!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  text-align:center!important;
  line-height:1!important;
}
.workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone small{
  margin:2px 0 0!important;
  font-size:.68rem!important;
  line-height:1.3!important;
}

/* Form Photo & Signature: each card gets its own readable functional space. */
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card{
  min-height:210px!important;
  padding:16px!important;
  gap:12px!important;
  border-radius:15px!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head>span{
  width:48px!important;
  height:48px!important;
  border-radius:13px!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head strong{
  font-size:.94rem!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head small{
  font-size:.68rem!important;
  line-height:1.35!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-file-button{
  min-height:50px!important;
  height:50px!important;
  padding:0 18px!important;
  font-size:.82rem!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  text-align:center!important;
  line-height:1!important;
}

/* Portrait tablets / compact desktop windows. */
@media (min-width:761px) and (max-width:1024px){
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone{
    min-height:175px!important;
    height:175px!important;
    padding:18px 18px!important;
    gap:9px!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone-action{
    min-height:48px!important;
    height:48px!important;
    min-width:200px;
    font-size:.82rem!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card{
    min-height:195px!important;
    padding:15px!important;
    gap:11px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-file-button{
    min-height:48px!important;
    height:48px!important;
  }
}

/* Phones: balanced target selected after researching common file-upload patterns
   and preserving a 48px primary touch target. */
@media (max-width:760px){
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone{
    min-height:156px!important;
    height:156px!important;
    padding:16px 14px!important;
    gap:9px!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone-action{
    min-height:48px!important;
    height:48px!important;
    min-width:196px;
    max-width:min(220px,calc(100vw - 74px));
    padding:0 20px!important;
    margin:0!important;
    font-size:.8rem!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone small{
    margin:2px 0 0!important;
    font-size:.64rem!important;
    line-height:1.25!important;
  }

  .workspace-page.task-first-passport:not(.has-primary-file) .form-primary-upload{
    gap:11px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary{
    gap:12px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card{
    min-height:180px!important;
    height:auto!important;
    padding:14px!important;
    gap:10px!important;
    border-radius:14px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head>span{
    width:44px!important;
    height:44px!important;
    border-radius:12px!important;
    font-size:.62rem!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head strong{
    font-size:.88rem!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head small{
    margin-top:2px!important;
    font-size:.64rem!important;
    line-height:1.3!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-file-button{
    min-height:48px!important;
    height:48px!important;
    margin:0!important;
    padding:0 14px!important;
    font-size:.78rem!important;
  }
}

/* Very narrow phones keep the same tap target; only horizontal padding relaxes. */
@media (max-width:340px){
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone-action{
    min-width:176px;
    max-width:calc(100vw - 64px);
    padding-inline:16px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card{
    min-height:176px!important;
  }
}


/* ========================================================================== */
/* v103.1 — preserve the approved Form Photo & Signature mobile layout        */
/* Generic upload sizing stays researched/balanced; passport visual stays     */
/* spacious like the user-approved reference screenshot.                      */
/* ========================================================================== */

/* Restore the meaningful outer form group instead of the v102 flattened shell. */
.workspace-page.task-first-passport:not(.has-primary-file) #upload-section{
  padding:18px!important;
  border:1px solid var(--line)!important;
  border-radius:18px!important;
  background:linear-gradient(145deg,rgba(16,35,56,.94),rgba(9,23,38,.94))!important;
  box-shadow:0 18px 48px rgba(0,0,0,.16)!important;
  overflow:hidden!important;
}
html[data-theme="light"] .workspace-page.task-first-passport:not(.has-primary-file) #upload-section{
  background:linear-gradient(145deg,rgba(255,255,255,.98),rgba(237,245,251,.96))!important;
  box-shadow:0 16px 42px rgba(32,67,92,.1)!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-heading{
  margin:0 0 12px!important;
  padding:0!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-primary-upload,
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary{
  gap:12px!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card{
  min-height:210px!important;
  height:auto!important;
  padding:14px!important;
  gap:12px!important;
  border-radius:14px!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head>span{
  width:54px!important;
  height:54px!important;
  border-radius:15px!important;
  font-size:.66rem!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head strong{
  font-size:.94rem!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head small{
  margin-top:2px!important;
  font-size:.7rem!important;
  line-height:1.35!important;
}
.workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-file-button{
  min-height:52px!important;
  height:52px!important;
  margin-top:4px!important;
  padding:0 16px!important;
  font-size:.78rem!important;
  font-weight:900!important;
}

@media(max-width:760px){
  .workspace-page.task-first-passport:not(.has-primary-file) #upload-section{
    padding:14px!important;
    border-radius:16px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-heading{
    margin-bottom:10px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-primary-upload,
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary{
    gap:12px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card{
    min-height:185px!important;
    height:auto!important;
    padding:14px!important;
    gap:11px!important;
    border-radius:14px!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head>span{
    width:48px!important;
    height:48px!important;
    border-radius:13px!important;
    font-size:.64rem!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head strong{
    font-size:.9rem!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card-head small{
    margin-top:2px!important;
    font-size:.67rem!important;
    line-height:1.3!important;
  }
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-file-button{
    min-height:54px!important;
    height:54px!important;
    margin-top:2px!important;
    padding:0 14px!important;
    font-size:.8rem!important;
  }
}

@media(max-width:340px){
  .workspace-page.task-first-passport:not(.has-primary-file) .form-upload-grid-primary .form-upload-card{
    min-height:180px!important;
  }
}

/* ========================================================================== */
/* v104 — PDF tool containment, researched upload placement & editor Edit UX  */
/* UI containment only. PDF conversion/security algorithms are unchanged.      */
/* ========================================================================== */

/* PDF workspaces must never establish a width larger than the task viewport. */
.workspace-page.task-first-document .workspace-grid,
.workspace-page.task-first-document .workspace-controls,
.workspace-page.task-first-document .tool-control-card,
.workspace-page.task-first-document .pdf-tool-panel,
#panel-pdf-converter,
#panel-pdf-converter > [data-pdf-converter-panel],
#panel-pdf-editor,
#panel-pdf-editor > * {
  width: 100%;
  min-width: 0 !important;
  max-width: 100%;
  box-sizing: border-box;
}

#panel-pdf-converter .pdf-mode-chooser,
#panel-pdf-converter .pdf-drop-zone,
#panel-pdf-converter .pdf-document-info,
#panel-pdf-converter .pdf-page-grid,
#panel-pdf-converter .pdf-settings-grid,
#panel-pdf-converter .pdf-results,
#panel-pdf-editor > .pdf-drop-zone,
#panel-pdf-editor > .pdf-document-info,
#panel-pdf-editor > .pdf-editor-entry-actions {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

/* Research pattern: major PDF tools place file selection immediately after the
   tool heading/short mode choice, centered horizontally, rather than vertically
   centering it in the whole viewport. Give it breathing room without a huge gap. */
#panel-pdf-editor > .pdf-drop-zone,
#panel-pdf-converter .pdf-drop-zone {
  width: min(100%, 640px);
  min-height: 184px;
  margin: 22px auto 0;
  padding: 22px 18px;
  align-content: center;
  justify-items: center;
  gap: 9px;
}
#panel-pdf-editor > .pdf-drop-zone .drop-zone-action,
#panel-pdf-converter .pdf-drop-zone .drop-zone-action {
  min-height: 48px;
  height: 48px;
  min-width: 188px;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box;
  text-align: center;
  line-height: 1;
}

/* The converter mode switch is a bounded segmented control, not a source of
   document overflow. Width includes its own padding/border. */
#panel-pdf-converter .pdf-mode-chooser.pdf-mode-switch {
  width: min(100%, 640px) !important;
  max-width: 640px !important;
  margin: 0 auto !important;
  padding: 4px !important;
  box-sizing: border-box !important;
  overflow: hidden;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}
#panel-pdf-converter .pdf-mode-switch .pdf-mode-choice {
  width: 100%;
  max-width: 100%;
  min-width: 0 !important;
  overflow: hidden;
  box-sizing: border-box;
}
#panel-pdf-converter .pdf-mode-switch .pdf-mode-choice > strong {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* After a PDF is selected, established PDF workflows move on to the document.
   Collapse the large picker and expose a compact Change PDF action instead. */
#panel-pdf-editor.has-pdf-document > .pdf-drop-zone,
#panel-pdf-converter.has-pdf-document [data-pdf-converter-panel="pdf-to-images"] > .pdf-drop-zone {
  display: none !important;
}

.pdf-document-info {
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px 12px;
  overflow: hidden;
}
.pdf-document-copy {
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}
.pdf-document-copy strong {
  flex: 1 1 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pdf-document-copy span {
  min-width: 0;
}
.pdf-change-file {
  min-height: 42px;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: var(--text-soft);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  font-size: .66rem;
  font-weight: 850;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  box-sizing: border-box;
}
.pdf-change-file:hover,
.pdf-change-file:focus-visible {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 48%, var(--line-strong));
  outline: none;
}

/* Page-preview containment. Long filenames or rendered canvases must never
   enlarge the page/grid outside the viewport. */
#panel-pdf-converter .pdf-page-grid {
  min-width: 0 !important;
  max-width: 100% !important;
  width: 100% !important;
  box-sizing: border-box !important;
  overflow-x: hidden !important;
  overflow-y: auto;
  grid-template-columns: repeat(auto-fit, minmax(min(168px, 100%), 1fr));
}
#panel-pdf-converter .pdf-page-card {
  min-width: 0 !important;
  max-width: 100%;
  overflow: hidden;
  box-sizing: border-box;
}
#panel-pdf-converter .pdf-page-card canvas {
  display: block;
  width: 100% !important;
  max-width: 100% !important;
  height: auto !important;
  box-sizing: border-box;
}

/* Edit mode must give an immediate, touch-visible affordance. Desktop hover-only
   feedback looked like a dead tool on phones even when the text layer existed. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage[data-text-edit="true"] .pdf-editor-text-layer {
  pointer-events: auto !important;
  touch-action: manipulation;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage[data-text-edit="true"] .pdf-existing-text-hit {
  pointer-events: auto !important;
  touch-action: manipulation;
  border-color: rgba(114,230,255,.24);
  background: rgba(114,230,255,.035);
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage[data-text-edit="true"] .pdf-existing-text-hit.is-ocr {
  border-color: rgba(114,224,161,.3);
  background: rgba(114,224,161,.045);
}

@media (max-width: 760px) {
  /* Keep the fixed 60px site header fully clear even with browser UI resizing.
     This also prevents the tool title/top border from sliding underneath it. */
  .workspace-page.task-first-document .workspace-shell {
    padding-top: calc(var(--header-height) + 28px) !important;
  }
  .workspace-page.task-first-document .task-tool-header {
    margin-bottom: 16px;
  }

  #panel-pdf-converter .pdf-mode-chooser.pdf-mode-switch {
    width: min(100%, 620px) !important;
    margin: 0 auto 18px !important;
  }
  #panel-pdf-converter .pdf-mode-switch .pdf-mode-choice {
    min-height: 44px !important;
    height: 44px !important;
    padding: 0 9px !important;
  }
  #panel-pdf-converter .pdf-mode-switch .pdf-mode-choice > strong {
    font-size: .67rem !important;
  }

  #panel-pdf-editor > .pdf-drop-zone,
  #panel-pdf-converter .pdf-drop-zone {
    width: min(100%, 620px) !important;
    min-height: 168px !important;
    height: 168px !important;
    margin: 18px auto 0 !important;
    padding: 18px 14px !important;
    gap: 9px !important;
  }
  #panel-pdf-editor > .pdf-drop-zone .pdf-drop-icon,
  #panel-pdf-editor > .pdf-drop-zone > strong,
  #panel-pdf-converter .pdf-drop-zone .pdf-drop-icon,
  #panel-pdf-converter .pdf-drop-zone > strong {
    display: none !important;
  }
  #panel-pdf-editor > .pdf-drop-zone .drop-zone-action,
  #panel-pdf-converter .pdf-drop-zone .drop-zone-action {
    min-width: 190px;
    min-height: 48px !important;
    height: 48px !important;
    padding: 0 20px !important;
    font-size: .76rem !important;
  }
  #panel-pdf-editor > .pdf-drop-zone small,
  #panel-pdf-converter .pdf-drop-zone small {
    margin: 2px 0 0 !important;
    max-width: 90%;
    font-size: .62rem !important;
    line-height: 1.3 !important;
    text-align: center;
  }

  .pdf-document-info {
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100% !important;
    max-width: 100% !important;
    padding: 10px 11px;
    gap: 8px;
  }
  .pdf-document-copy {
    gap: 4px 9px;
  }
  .pdf-document-copy strong {
    font-size: .7rem;
  }
  .pdf-document-copy span {
    font-size: .61rem;
  }
  .pdf-change-file {
    min-height: 40px;
    padding: 0 10px;
    font-size: .61rem;
  }

  #panel-pdf-converter .pdf-page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 9px !important;
    padding: 9px !important;
  }
  #panel-pdf-converter .pdf-page-card {
    padding: 7px !important;
  }
}

@media (max-width: 360px) {
  #panel-pdf-converter .pdf-mode-switch .pdf-mode-choice > strong {
    font-size: .62rem !important;
  }
  #panel-pdf-editor > .pdf-drop-zone,
  #panel-pdf-converter .pdf-drop-zone {
    min-height: 164px !important;
    height: 164px !important;
  }
  .pdf-document-info {
    grid-template-columns: minmax(0, 1fr);
  }
  .pdf-change-file {
    justify-self: start;
  }
  #panel-pdf-converter .pdf-page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 7px !important;
    padding: 7px !important;
  }
}


/* ========================================================================== */
/* v105 — unified task-first file pickers + PDF mobile containment/edit UX   */
/* Research direction: file selection stays high in the workflow, directly   */
/* below the title/mode choice; it is horizontally centered, never vertically */
/* centered in the whole viewport. Processing logic is intentionally untouched.*/
/* ========================================================================== */

.workspace-page.task-first-workspace{
  overflow-x:clip;
}
.workspace-page.task-first-workspace .task-tool-header{
  margin-bottom:18px;
}
.workspace-page.task-first-workspace .workspace-grid,
.workspace-page.task-first-workspace .workspace-controls,
.workspace-page.task-first-workspace .tool-control-card,
.workspace-page.task-first-workspace [data-tool-panel]{
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
}

/* Keep simple empty states focused and centered below the tool introduction. */
.workspace-page.task-first-generic:not(.has-primary-file) .workspace-grid{
  width:min(100%,760px);
  margin-inline:auto;
}
.workspace-page.task-first-generic:not(.has-primary-file) #upload-section{
  width:100%;
  max-width:760px;
  margin-inline:auto;
}

/* Dedicated upload surfaces use the same comfortable visual language as the
   generic tools instead of the older 104px over-compacted drop targets. */
.workspace-page.task-first-document #itt-drop,
.workspace-page.task-first-standalone .new-tool-drop,
.workspace-page.task-first-bulk .bulk-drop{
  width:min(100%,720px);
  min-width:0;
  max-width:100%;
  margin-inline:auto;
  min-height:184px;
  padding:20px 16px;
  gap:8px;
  align-content:center;
  justify-items:center;
  box-sizing:border-box;
}
.workspace-page.task-first-standalone .new-tool-drop.compact{
  min-height:168px;
}
.workspace-page.task-first-document #itt-drop .drop-zone-action,
.workspace-page.task-first-standalone .new-tool-drop .drop-zone-action,
.workspace-page.task-first-bulk .bulk-drop .drop-zone-action{
  min-height:48px!important;
  height:48px!important;
  min-width:184px;
  padding:0 20px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  text-align:center!important;
  line-height:1!important;
  box-sizing:border-box;
  font-size:.76rem!important;
}
.workspace-page.task-first-standalone .new-tool-drop-icon{
  width:42px;
  height:42px;
  border-radius:11px;
  font-size:1rem;
}
.workspace-page.task-first-standalone .new-tool-drop strong{font-size:.78rem}
.workspace-page.task-first-standalone .new-tool-drop p{font-size:.64rem}
.workspace-page.task-first-standalone .new-tool-drop small{font-size:.58rem;line-height:1.35}

/* PDF-specific picker: slightly roomier than an image picker because the next
   stage is a document workspace. It still sits immediately below the mode/title. */
#panel-pdf-editor > .pdf-drop-zone,
#panel-pdf-converter .pdf-drop-zone{
  width:min(100%,680px)!important;
  max-width:100%!important;
  min-width:0!important;
  min-height:210px!important;
  height:auto!important;
  margin:20px auto 0!important;
  padding:22px 18px!important;
  gap:10px!important;
  align-content:center;
  justify-items:center;
  box-sizing:border-box!important;
}
#panel-pdf-editor > .pdf-drop-zone .drop-zone-action,
#panel-pdf-converter .pdf-drop-zone .drop-zone-action{
  min-height:50px!important;
  height:50px!important;
  min-width:196px;
  max-width:100%;
  padding:0 22px!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  text-align:center!important;
  line-height:1!important;
  box-sizing:border-box;
}

/* PDF Converter must never be widened by its tabs, long filename or canvases. */
#panel-pdf-converter,
#panel-pdf-converter > [data-pdf-converter-panel],
#panel-pdf-converter .pdf-mode-switch,
#panel-pdf-converter .pdf-document-info,
#panel-pdf-converter .pdf-page-grid,
#panel-pdf-converter .pdf-page-card,
#panel-pdf-converter .pdf-settings-grid,
#panel-pdf-converter .pdf-action-row{
  min-width:0!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}
#panel-pdf-converter .pdf-mode-chooser.pdf-mode-switch{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;
  width:min(100%,680px)!important;
  max-width:680px!important;
  margin:0 auto 18px!important;
  padding:4px!important;
  overflow:hidden!important;
}
#panel-pdf-converter .pdf-mode-switch .pdf-mode-choice{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  padding-inline:8px!important;
  box-sizing:border-box!important;
}
#panel-pdf-converter .pdf-mode-switch .pdf-mode-choice strong{
  display:block;
  min-width:0;
  max-width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  text-align:center;
}
#panel-pdf-converter .pdf-document-info,
#panel-pdf-editor .pdf-document-info{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  box-sizing:border-box!important;
}
#panel-pdf-converter .pdf-document-copy,
#panel-pdf-editor .pdf-document-copy{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden;
}
#panel-pdf-converter .pdf-document-copy strong,
#panel-pdf-editor .pdf-document-copy strong{
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
}
#panel-pdf-converter .pdf-page-grid{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  overflow-x:hidden!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
}
#panel-pdf-converter .pdf-page-card{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  overflow:hidden!important;
  contain:inline-size;
}
#panel-pdf-converter .pdf-page-card canvas{
  display:block!important;
  width:100%!important;
  max-width:100%!important;
  height:auto!important;
  object-fit:contain;
}

/* Existing PDF text runs can be only a few CSS pixels tall. In Edit mode the
   visual geometry stays exact, but browser text selection is disabled until the
   run actually becomes contenteditable. JS adds proximity snapping for fingers. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage[data-text-edit="true"] .pdf-existing-text-hit:not(.is-editing){
  -webkit-user-select:none!important;
  user-select:none!important;
  touch-action:manipulation!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage[data-text-edit="true"] .pdf-existing-text-hit.is-editing{
  -webkit-user-select:text!important;
  user-select:text!important;
  touch-action:manipulation!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-content,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-layout{
  min-width:0!important;
  max-width:100vw!important;
  box-sizing:border-box!important;
}

@media (max-width:760px){
  /* Keep all task titles clear of the fixed PixelOrigen header on dynamic mobile
     browser chrome, while retaining a compact first viewport. */
  .workspace-page.task-first-workspace .workspace-shell{
    padding-top:calc(var(--header-height) + 22px)!important;
  }
  .workspace-page.task-first-document .workspace-shell{
    padding-top:calc(var(--header-height) + 30px)!important;
  }
  .workspace-page.task-first-workspace .task-tool-header{
    margin-bottom:18px!important;
  }

  /* Slightly larger than v103's 156px after user feedback; still far below the
     original oversized cards. Form Photo & Signature is intentionally excluded. */
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone{
    min-height:172px!important;
    height:172px!important;
    padding:16px 14px!important;
    gap:10px!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone-action{
    min-height:50px!important;
    height:50px!important;
    min-width:196px!important;
    max-width:min(230px,calc(100vw - 70px))!important;
    padding:0 20px!important;
    font-size:.8rem!important;
  }

  .workspace-page.task-first-document #itt-drop,
  .workspace-page.task-first-standalone .new-tool-drop,
  .workspace-page.task-first-standalone .new-tool-drop.compact,
  .workspace-page.task-first-bulk .bulk-drop{
    width:100%!important;
    max-width:100%!important;
    min-height:168px!important;
    height:auto!important;
    padding:16px 12px!important;
    gap:8px!important;
  }
  .workspace-page.task-first-document #itt-drop .drop-zone-action,
  .workspace-page.task-first-standalone .new-tool-drop .drop-zone-action,
  .workspace-page.task-first-bulk .bulk-drop .drop-zone-action{
    min-height:48px!important;
    height:48px!important;
    min-width:184px!important;
    font-size:.74rem!important;
  }

  #panel-pdf-editor > .pdf-drop-zone,
  #panel-pdf-converter .pdf-drop-zone{
    width:100%!important;
    max-width:100%!important;
    min-height:184px!important;
    height:184px!important;
    margin:18px auto 0!important;
    padding:18px 14px!important;
    gap:10px!important;
  }
  #panel-pdf-editor > .pdf-drop-zone .drop-zone-action,
  #panel-pdf-converter .pdf-drop-zone .drop-zone-action{
    min-height:50px!important;
    height:50px!important;
    min-width:196px!important;
    padding:0 20px!important;
    font-size:.78rem!important;
  }
  #panel-pdf-editor > .pdf-drop-zone small,
  #panel-pdf-converter .pdf-drop-zone small{
    max-width:92%;
    margin:2px 0 0!important;
    font-size:.62rem!important;
    line-height:1.3!important;
    text-align:center;
  }

  #panel-pdf-converter .pdf-mode-chooser.pdf-mode-switch{
    width:100%!important;
    max-width:100%!important;
    min-height:52px!important;
    margin:0 auto 18px!important;
  }
  #panel-pdf-converter .pdf-mode-switch .pdf-mode-choice{
    min-height:44px!important;
    height:44px!important;
    padding:0 6px!important;
    gap:4px!important;
  }
  #panel-pdf-converter .pdf-mode-switch .pdf-mode-choice > span[aria-hidden="true"]{
    display:none!important;
  }
  #panel-pdf-converter .pdf-mode-switch .pdf-mode-choice strong{
    font-size:clamp(.61rem,3.2vw,.7rem)!important;
    overflow:visible!important;
    text-overflow:clip!important;
  }

  #panel-pdf-converter .pdf-document-info,
  #panel-pdf-editor .pdf-document-info{
    grid-template-columns:minmax(0,1fr) auto!important;
    gap:8px!important;
    padding:10px 11px!important;
  }
  #panel-pdf-converter .pdf-change-file,
  #panel-pdf-editor .pdf-change-file{
    min-width:72px;
    max-width:82px;
    min-height:40px;
    padding:0 8px;
    justify-content:center;
  }
  #panel-pdf-converter .pdf-page-grid{
    grid-template-columns:repeat(2,minmax(0,1fr))!important;
    gap:8px!important;
    padding:8px!important;
  }
  #panel-pdf-converter .pdf-page-card{
    padding:6px!important;
  }
}

@media (max-width:360px){
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone{
    min-height:168px!important;
    height:168px!important;
  }
  .workspace-page.task-first-document #itt-drop,
  .workspace-page.task-first-standalone .new-tool-drop,
  .workspace-page.task-first-standalone .new-tool-drop.compact,
  .workspace-page.task-first-bulk .bulk-drop{
    min-height:164px!important;
  }
  #panel-pdf-editor > .pdf-drop-zone,
  #panel-pdf-converter .pdf-drop-zone{
    min-height:180px!important;
    height:180px!important;
  }
  #panel-pdf-converter .pdf-mode-switch .pdf-mode-choice strong{
    font-size:.61rem!important;
  }
  #panel-pdf-converter .pdf-document-info,
  #panel-pdf-editor .pdf-document-info{
    grid-template-columns:minmax(0,1fr) 70px!important;
  }
}

/* ========================================================================== */
/* v106 — progressive task-first disclosure for file-driven specialist tools  */
/* Keeps QR generator and Favicon typed-initials workflows intentionally live. */
/* ========================================================================== */

/* Image to Text: choose the source first. OCR settings/result UI appears after
   a valid image/PDF is accepted by the existing controller. */
#panel-image-to-text:not(.has-tool-source) #itt-status,
#panel-image-to-text:not(.has-tool-source) .image-to-text-settings,
#panel-image-to-text:not(.has-tool-source) #itt-mode-note,
#panel-image-to-text:not(.has-tool-source) .image-to-text-run-actions,
#panel-image-to-text:not(.has-tool-source) #itt-init-panel,
#panel-image-to-text:not(.has-tool-source) #itt-progress,
#panel-image-to-text:not(.has-tool-source) #itt-pdf-result,
#panel-image-to-text:not(.has-tool-source) .image-to-text-output{
  display:none!important;
}
#panel-image-to-text.has-tool-source #itt-drop{
  min-height:116px!important;
  padding:12px 14px!important;
  gap:5px!important;
}
#panel-image-to-text.has-tool-source #itt-drop .pdf-drop-icon,
#panel-image-to-text.has-tool-source #itt-drop>strong,
#panel-image-to-text.has-tool-source #itt-drop>p,
#panel-image-to-text.has-tool-source #itt-drop>small{
  display:none!important;
}
#panel-image-to-text.has-tool-source #itt-drop .drop-zone-action{
  min-height:42px!important;
  height:42px!important;
  min-width:150px!important;
  font-size:.68rem!important;
}

/* Document Scanner: before selection, do not expose enhancement/export controls.
   After selection, the original large chooser collapses and the existing
   selected-file row + Change control take over. */
#panel-doc-scanner:not(.has-tool-source) #scanner-status,
#panel-doc-scanner:not(.has-tool-source) #scanner-stage,
#panel-doc-scanner:not(.has-tool-source) .new-tool-settings-grid,
#panel-doc-scanner:not(.has-tool-source) .scanner-clean-note,
#panel-doc-scanner:not(.has-tool-source) #scanner-process{
  display:none!important;
}
#panel-doc-scanner.has-tool-source #scanner-drop{display:none!important}

/* Background Remover: file first, then processing choices. */
#panel-background-remover:not(.has-tool-source) .bgrem-settings,
#panel-background-remover:not(.has-tool-source) #bgrem-status,
#panel-background-remover:not(.has-tool-source) #bgrem-progress-wrap,
#panel-background-remover:not(.has-tool-source) .bgrem-actions,
#panel-background-remover:not(.has-tool-source) #bgrem-result{
  display:none!important;
}
#panel-background-remover.has-tool-source #bgrem-drop{display:none!important}

/* Watermark: choosing images is the first task. Detailed watermark configuration
   is progressively revealed only after the existing controller accepts files. */
#panel-watermark:not(.has-tool-source) .new-tool-file-list,
#panel-watermark:not(.has-tool-source)> .new-tool-settings-grid,
#panel-watermark:not(.has-tool-source)> #watermark-text-options,
#panel-watermark:not(.has-tool-source)> #watermark-logo-options,
#panel-watermark:not(.has-tool-source)> .new-tool-advanced,
#panel-watermark:not(.has-tool-source)> #watermark-status,
#panel-watermark:not(.has-tool-source)> #watermark-preview-wrap,
#panel-watermark:not(.has-tool-source)> #watermark-process,
#panel-watermark:not(.has-tool-source)> #watermark-download{
  display:none!important;
}
#panel-watermark.has-tool-source> .new-tool-drop{display:none!important}

/* Selected-file rows should read as compact continuation controls across all
   specialist tools, not a second oversized upload card. */
#panel-doc-scanner.has-tool-source #scanner-file-confirm,
#panel-background-remover.has-tool-source #bgrem-file-confirm,
#panel-watermark.has-tool-source #watermark-file-confirm{
  width:100%;
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
}

@media(max-width:760px){
  /* Keep the empty specialist upload experience consistent with generic tools
     without forcing the approved Form Photo & Signature layout to change. */
  #panel-image-to-text:not(.has-tool-source) #itt-drop,
  #panel-doc-scanner:not(.has-tool-source) #scanner-drop,
  #panel-background-remover:not(.has-tool-source) #bgrem-drop,
  #panel-watermark:not(.has-tool-source)> .new-tool-drop{
    width:100%!important;
    min-height:172px!important;
    height:172px!important;
    margin:4px auto 0!important;
    padding:16px 14px!important;
    gap:8px!important;
  }
  #panel-image-to-text:not(.has-tool-source) #itt-drop .drop-zone-action,
  #panel-doc-scanner:not(.has-tool-source) #scanner-drop .drop-zone-action,
  #panel-background-remover:not(.has-tool-source) #bgrem-drop .drop-zone-action,
  #panel-watermark:not(.has-tool-source)> .new-tool-drop .drop-zone-action{
    min-width:196px!important;
    max-width:min(230px,calc(100vw - 70px))!important;
    min-height:50px!important;
    height:50px!important;
    display:inline-flex!important;
    align-items:center!important;
    justify-content:center!important;
    text-align:center!important;
  }
  #panel-doc-scanner.has-tool-source #scanner-file-confirm,
  #panel-background-remover.has-tool-source #bgrem-file-confirm,
  #panel-watermark.has-tool-source #watermark-file-confirm{
    margin-top:2px;
  }
}

@media(max-width:360px){
  #panel-image-to-text:not(.has-tool-source) #itt-drop,
  #panel-doc-scanner:not(.has-tool-source) #scanner-drop,
  #panel-background-remover:not(.has-tool-source) #bgrem-drop,
  #panel-watermark:not(.has-tool-source)> .new-tool-drop{
    min-height:168px!important;
    height:168px!important;
  }
}

/* ========================================================================== */
/* v107 — specialist uploader content-fit + favicon mobile containment         */
/* Fixes v106 fixed-height clipping without changing tool processing logic.    */
/* ========================================================================== */

/* Specialist file pickers contain more copy than the generic image picker.
   Let content determine height; keep a balanced minimum instead of forcing
   172px, which caused buttons/help text to cross the dashed boundary. */
#panel-image-to-text:not(.has-tool-source) #itt-drop,
#panel-doc-scanner:not(.has-tool-source) #scanner-drop,
#panel-background-remover:not(.has-tool-source) #bgrem-drop,
#panel-watermark:not(.has-tool-source) > .new-tool-drop {
  height:auto!important;
  min-height:208px!important;
  padding:20px 16px!important;
  row-gap:10px!important;
  align-content:center!important;
  overflow:visible!important;
  box-sizing:border-box!important;
}

/* OCR has one extra memory-safety line, so give it a little more breathing
   room and keep every line inside the dashed upload surface. */
#panel-image-to-text:not(.has-tool-source) #itt-drop {
  min-height:226px!important;
}
#panel-image-to-text:not(.has-tool-source) #itt-drop > small,
#panel-doc-scanner:not(.has-tool-source) #scanner-drop > small,
#panel-background-remover:not(.has-tool-source) #bgrem-drop > small,
#panel-watermark:not(.has-tool-source) > .new-tool-drop > small {
  position:static!important;
  display:block!important;
  width:min(100%,560px)!important;
  max-width:100%!important;
  margin:2px auto 0!important;
  line-height:1.4!important;
  text-align:center!important;
  overflow-wrap:anywhere!important;
}

/* Scanner copy is already precise in the title/format line. Keep the source
   helper readable but safely contained. */
#panel-doc-scanner:not(.has-tool-source) #scanner-drop {
  min-height:218px!important;
}
#panel-doc-scanner:not(.has-tool-source) #scanner-drop > small {
  font-size:.60rem!important;
}

/* Watermark has icon + heading + explanatory line + CTA. */
#panel-watermark:not(.has-tool-source) > .new-tool-drop {
  min-height:214px!important;
}

/* Keep the visible file CTA centered and away from the dashed border. */
#panel-image-to-text:not(.has-tool-source) #itt-drop .drop-zone-action,
#panel-doc-scanner:not(.has-tool-source) #scanner-drop .drop-zone-action,
#panel-background-remover:not(.has-tool-source) #bgrem-drop .drop-zone-action,
#panel-watermark:not(.has-tool-source) > .new-tool-drop .drop-zone-action {
  margin:2px auto!important;
  flex:0 0 auto!important;
}

/* Favicon typed-initials mode: every grid child must be allowed to shrink.
   Shared color controls previously retained intrinsic widths on narrow phones. */
#panel-favicon-generator,
#panel-favicon-generator .favicon-basic-flow,
#panel-favicon-generator .favicon-initial-basic,
#panel-favicon-generator .favicon-live-preview,
#panel-favicon-generator .favicon-preview-contexts,
#panel-favicon-generator .favicon-color-field,
#panel-favicon-generator .favicon-color-control {
  min-width:0!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}
#panel-favicon-generator .favicon-color-control {
  width:100%!important;
  grid-template-columns:48px minmax(0,1fr)!important;
}
#panel-favicon-generator .favicon-hex-input,
#panel-favicon-generator .pixel-color-value {
  min-width:0!important;
  width:100%!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}

@media (max-width:520px) {
  #panel-image-to-text:not(.has-tool-source) #itt-drop,
  #panel-doc-scanner:not(.has-tool-source) #scanner-drop,
  #panel-background-remover:not(.has-tool-source) #bgrem-drop,
  #panel-watermark:not(.has-tool-source) > .new-tool-drop {
    height:auto!important;
    padding:18px 14px!important;
    row-gap:9px!important;
  }
  #panel-image-to-text:not(.has-tool-source) #itt-drop { min-height:220px!important; }
  #panel-doc-scanner:not(.has-tool-source) #scanner-drop { min-height:212px!important; }
  #panel-background-remover:not(.has-tool-source) #bgrem-drop { min-height:204px!important; }
  #panel-watermark:not(.has-tool-source) > .new-tool-drop { min-height:208px!important; }

  /* At phone widths stack the two favicon color choices. This avoids a dense
     two-column squeeze while keeping the live preview immediately below. */
  #panel-favicon-generator .favicon-initial-basic {
    grid-template-columns:1fr!important;
    gap:10px!important;
  }
  #panel-favicon-generator .favicon-initial-text {
    grid-column:auto!important;
  }
  #panel-favicon-generator .favicon-color-control {
    width:min(100%,260px)!important;
  }
  #panel-favicon-generator .favicon-preview-contexts {
    grid-template-columns:1fr!important;
  }
  #panel-favicon-generator .favicon-browser-preview {
    grid-column:auto!important;
  }
}


/* ========================================================================== */
/* v108 — true responsive task clusters + post-file mobile header stability  */
/* UI-only. Fixes desktop under-sizing and mobile disclosure/header overlap.  */
/* ========================================================================== */

/* A fixed site header needs a real scroll safety zone. This also helps browser
   file-picker return behavior on mobile, where layout disclosure can otherwise
   leave the task heading underneath the fixed PixelOrigen header. */
html { scroll-padding-top: calc(var(--header-height) + 18px); }
.workspace-page.task-first-workspace .task-tool-header {
  scroll-margin-top: calc(var(--header-height) + 18px);
}

/* Large screens: the empty task should read as one deliberate cluster instead
   of a two-column grid with its second (hidden) column still reserving width. */
@media (min-width:1025px) {
  .workspace-page.task-first-generic:not(.has-primary-file) .task-tool-header,
  .workspace-page.task-first-generic:not(.has-primary-file) .workspace-grid {
    width:min(100%,820px)!important;
    max-width:820px!important;
    margin-inline:auto!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) .workspace-grid {
    grid-template-columns:minmax(0,1fr)!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #upload-section {
    width:100%!important;
    max-width:820px!important;
    margin-inline:auto!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone {
    width:100%!important;
    min-height:214px!important;
    height:214px!important;
    padding:24px 26px!important;
  }

  /* File-driven document/specialist tools get a slightly wider task column.
     Once a real editor/result opens, its own existing workspace can still use
     the full 1180px shell. */
  .workspace-page.task-first-document .task-tool-header,
  .workspace-page.task-first-standalone .task-tool-header,
  .workspace-page.task-first-bulk .task-tool-header {
    width:min(100%,920px)!important;
    max-width:920px!important;
    margin-inline:auto!important;
  }
  .workspace-page.task-first-document .workspace-grid,
  .workspace-page.task-first-standalone .workspace-grid,
  .workspace-page.task-first-bulk .workspace-grid {
    width:min(100%,920px)!important;
    max-width:920px!important;
    margin-inline:auto!important;
  }
  #panel-pdf-editor:not(.has-pdf-document) > .pdf-drop-zone,
  #panel-pdf-converter:not(.has-pdf-document) .pdf-drop-zone,
  #panel-image-to-text:not(.has-tool-source) #itt-drop,
  #panel-doc-scanner:not(.has-tool-source) #scanner-drop,
  #panel-background-remover:not(.has-tool-source) #bgrem-drop,
  #panel-watermark:not(.has-tool-source) > .new-tool-drop {
    width:min(100%,820px)!important;
    max-width:820px!important;
    margin-inline:auto!important;
  }
  #panel-pdf-editor:not(.has-pdf-document) > .pdf-drop-zone,
  #panel-pdf-converter:not(.has-pdf-document) .pdf-drop-zone {
    min-height:232px!important;
    padding:26px 24px!important;
  }
  #panel-pdf-editor:not(.has-pdf-document) > .pdf-drop-zone .drop-zone-action,
  #panel-pdf-converter:not(.has-pdf-document) .pdf-drop-zone .drop-zone-action {
    min-width:220px!important;
    min-height:52px!important;
    height:52px!important;
  }
}

/* Tablet / small-laptop: keep the same structure, scale width rather than
   falling back to the old split empty grid. */
@media (min-width:761px) and (max-width:1024px) {
  .workspace-page.task-first-generic:not(.has-primary-file) .task-tool-header,
  .workspace-page.task-first-generic:not(.has-primary-file) .workspace-grid {
    width:min(100%,760px)!important;
    max-width:760px!important;
    margin-inline:auto!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) .workspace-grid {
    grid-template-columns:minmax(0,1fr)!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #upload-section {
    width:100%!important;
    max-width:760px!important;
    margin-inline:auto!important;
  }
  .workspace-page.task-first-document .task-tool-header,
  .workspace-page.task-first-standalone .task-tool-header,
  .workspace-page.task-first-bulk .task-tool-header,
  .workspace-page.task-first-document .workspace-grid,
  .workspace-page.task-first-standalone .workspace-grid,
  .workspace-page.task-first-bulk .workspace-grid {
    width:min(100%,820px)!important;
    max-width:820px!important;
    margin-inline:auto!important;
  }
}

@media (max-width:760px) {
  /* Keep the first line comfortably below the real fixed header even after the
     native file chooser closes and hidden/revealed blocks change page height. */
  .workspace-page.task-first-workspace .workspace-shell {
    padding-top:calc(var(--header-height) + 18px)!important;
  }
  .workspace-page.task-first-document .workspace-shell {
    padding-top:calc(var(--header-height) + 22px)!important;
  }
  .workspace-page.task-first-workspace .task-tool-header {
    scroll-margin-top:calc(var(--header-height) + 12px)!important;
  }

  /* Mobile remains full-width; only the large-screen empty-state split is
     changed above. */
  .workspace-page.task-first-generic:not(.has-primary-file) .workspace-grid,
  .workspace-page.task-first-generic:not(.has-primary-file) #upload-section,
  .workspace-page.task-first-document .workspace-grid,
  .workspace-page.task-first-standalone .workspace-grid {
    width:100%!important;
    max-width:100%!important;
  }
}

@media (max-width:390px) {
  .workspace-page.task-first-workspace .workspace-shell {
    padding-top:calc(var(--header-height) + 16px)!important;
  }
  .workspace-page.task-first-document .workspace-shell {
    padding-top:calc(var(--header-height) + 20px)!important;
  }
}

/* Keep empty PDF guidance visually attached to its chooser instead of floating
   at the panel's far left on wide desktop layouts. */
#panel-pdf-editor:not(.has-pdf-document) > .pdf-status,
#panel-pdf-converter:not(.has-pdf-document) .pdf-status {
  width:min(100%,820px)!important;
  max-width:820px!important;
  margin:10px auto 0!important;
  text-align:center!important;
}
@media(max-width:760px){
  #panel-pdf-editor:not(.has-pdf-document) > .pdf-status,
  #panel-pdf-converter:not(.has-pdf-document) .pdf-status {
    width:100%!important;
    margin-top:7px!important;
  }
}

/* Prefer the task heading as the visual anchor when large pickers collapse. */
.workspace-page.task-first-workspace { overflow-anchor:none; }
.workspace-page.task-first-workspace #workspace-main,
.workspace-page.task-first-workspace .task-tool-header { overflow-anchor:none; }
.workspace-page.task-first-workspace #upload-section,
.workspace-page.task-first-workspace .pdf-drop-zone,
.workspace-page.task-first-workspace .new-tool-drop,
.workspace-page.task-first-workspace #itt-drop { overflow-anchor:none; }

/* Final mobile breathing room: keep at least a small visual gap below the fixed
   header even when the browser cannot scroll any farther upward. */
@media(max-width:760px){
  .workspace-page.task-first-workspace .workspace-shell{padding-top:calc(var(--header-height) + 24px)!important}
  .workspace-page.task-first-document .workspace-shell{padding-top:calc(var(--header-height) + 28px)!important}
}
@media(max-width:390px){
  .workspace-page.task-first-workspace .workspace-shell{padding-top:calc(var(--header-height) + 24px)!important}
  .workspace-page.task-first-document .workspace-shell{padding-top:calc(var(--header-height) + 28px)!important}
}


/* v109 — native file-picker return / fixed-header title stability */
.workspace-page.task-first-workspace .task-tool-header{
  scroll-margin-top:calc(var(--header-height) + 22px)!important;
}
@media(max-width:760px){
  html{scroll-padding-top:calc(var(--header-height) + 24px)!important}
  .workspace-page.task-first-workspace .task-tool-header{
    scroll-margin-top:calc(var(--header-height) + 20px)!important;
  }
}


/* ========================================================================== */
/* v110 — robust native file-picker return / fixed-header task anchor          */
/* ========================================================================== */
.workspace-page.task-first-workspace #workspace-main,
.workspace-page.task-first-workspace .task-tool-header,
.workspace-page.task-first-workspace #upload-section,
.workspace-page.task-first-workspace .pdf-drop-zone,
.workspace-page.task-first-workspace .new-tool-drop,
.workspace-page.task-first-workspace #itt-drop{overflow-anchor:none!important}
.workspace-page.task-first-workspace .task-tool-header{
  scroll-margin-top:calc(var(--header-height) + 26px)!important;
}
@media(max-width:760px){
  html{scroll-padding-top:calc(var(--header-height) + 28px)!important}
  .workspace-page.task-first-workspace .task-tool-header{
    scroll-margin-top:calc(var(--header-height) + 24px)!important;
  }
}


/* ========================================================================== */
/* v111 — true top-of-task restoration + a little more desktop breathing room */
/* ========================================================================== */
/* The hidden upper line was caused by restored/anchored scroll position, not by
   the drop-zone height itself. Keep a clearer visual gap and only enlarge the
   wide-screen generic chooser slightly so the task still feels balanced. */
.workspace-page.task-first-generic:not(.has-primary-file) #upload-section{
  margin-top:10px!important;
}
@media (min-width:1025px){
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone{
    min-height:228px!important;
    height:228px!important;
  }
}
@media (min-width:761px) and (max-width:1024px){
  .workspace-page.task-first-generic:not(.has-primary-file) #upload-section{
    margin-top:8px!important;
  }
  .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone{
    min-height:212px!important;
    height:212px!important;
  }
}
@media (max-width:760px){
  .workspace-page.task-first-generic:not(.has-primary-file) #upload-section{
    margin-top:8px!important;
  }
}

/* ========================================================================== */
/* v112 — picker scroll preservation, visible help, action containment, camera */
/* ========================================================================== */

/* Keep contextual help legible in both themes. The decorative circle remains
   subtle, but the actual ? glyph no longer inherits a low-contrast muted tone. */
.workspace-page .task-help-button{
  color:color-mix(in srgb,var(--text) 84%,var(--primary) 16%)!important;
  text-shadow:0 1px 1px rgba(0,0,0,.18);
}
.workspace-page .task-help-button::before{
  border-color:color-mix(in srgb,var(--line-strong) 74%,var(--primary) 26%)!important;
  background:color-mix(in srgb,var(--surface) 92%,var(--primary) 8%)!important;
}
html[data-theme="dark"] .workspace-page .task-help-button{color:#edf8ff!important}

/* Safe action containment. A tool result/action must never create an off-screen
   button just because its label is longer or the current zoom is unusual. */
.workspace-page .pdf-action-row,
.workspace-page .new-tool-button-row,
.workspace-page .bgrem-actions{
  width:100%;max-width:100%;min-width:0;box-sizing:border-box;flex-wrap:wrap;
}
.workspace-page .btn,
.workspace-page a.btn,
.workspace-page .process-btn,
.workspace-page .new-tool-download{
  max-width:100%;box-sizing:border-box;
}
@media(max-width:760px){
  .workspace-page .pdf-action-row>.btn,
  .workspace-page .pdf-action-row>a.btn,
  .workspace-page .new-tool-button-row>.btn,
  .workspace-page .new-tool-button-row>a.btn{
    min-width:0!important;max-width:100%!important;
  }
}

/* Real document-camera capture UI. `capture` on a file input is not reliable on
   desktop browsers, so the Camera action uses getUserMedia and only keeps the
   old capture input as a mobile fallback. */
body.scanner-camera-open{overflow:hidden}
.scanner-camera-capture[hidden]{display:none!important}
.scanner-camera-capture{
  position:fixed;inset:0;z-index:2200;display:grid;place-items:center;padding:16px;
}
.scanner-camera-backdrop{position:absolute;inset:0;border:0;background:rgba(2,9,17,.76);backdrop-filter:blur(5px);cursor:default}
.scanner-camera-sheet{
  position:relative;z-index:1;width:min(720px,100%);max-height:min(88dvh,760px);overflow:auto;
  padding:16px;border:1px solid var(--line-strong);border-radius:20px;background:var(--bg-card);box-shadow:0 28px 80px rgba(0,0,0,.42)
}
.scanner-camera-head{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;margin-bottom:12px}
.scanner-camera-head>div{min-width:0}.scanner-camera-head strong,.scanner-camera-head small{display:block}
.scanner-camera-head strong{color:var(--text);font-size:1rem}.scanner-camera-head small{margin-top:3px;color:var(--text-muted);font-size:.7rem;line-height:1.45}
.scanner-camera-close{flex:0 0 42px;width:42px;height:42px;border:1px solid var(--line);border-radius:12px;background:var(--bg-soft);color:var(--text);font:700 1.3rem/1 inherit;cursor:pointer}
.scanner-camera-view{position:relative;overflow:hidden;width:100%;aspect-ratio:4/3;border:1px solid var(--line);border-radius:16px;background:#02070d}
.scanner-camera-view video{display:block;width:100%;height:100%;object-fit:cover;background:#02070d}
.scanner-camera-frame{position:absolute;inset:8%;border:2px solid rgba(114,230,255,.74);border-radius:10px;box-shadow:0 0 0 999px rgba(0,0,0,.08);pointer-events:none}
.scanner-camera-loading{position:absolute;inset:0;display:grid;place-items:center;color:#eaf9ff;background:rgba(2,7,13,.54);font-weight:800;font-size:.82rem}
.scanner-camera-loading[hidden]{display:none!important}
.scanner-camera-status{min-height:22px;margin:9px 2px 0;color:var(--text-muted);font-size:.7rem;line-height:1.4}
.scanner-camera-actions{display:flex;justify-content:flex-end;gap:9px;margin-top:10px;min-width:0}
.scanner-camera-actions .btn{min-width:130px;justify-content:center}
@media(max-width:600px){
  .scanner-camera-capture{padding:8px;align-items:end}
  .scanner-camera-sheet{width:100%;max-height:82dvh;padding:13px;border-radius:20px}
  .scanner-camera-view{aspect-ratio:3/4}
  .scanner-camera-actions{display:grid;grid-template-columns:1fr 1fr}
  .scanner-camera-actions .btn{width:100%;min-width:0;min-height:46px}
}

/* v112 follow-up: keep the native generic input accessible but fixed to the
   viewport, so browser focus cannot scroll the document to its layout position. */
.workspace-page .native-file-input{
  position:fixed!important;top:0!important;left:0!important;width:1px!important;height:1px!important;
  margin:0!important;padding:0!important;border:0!important;opacity:0!important;
  clip-path:inset(50%)!important;overflow:hidden!important;white-space:nowrap!important;
}
/* The file surface itself should not jump when hovered/pressed. */
.workspace-page.task-first-workspace .drop-zone:hover,
.workspace-page.task-first-workspace .drop-zone:focus-visible,
.workspace-page.task-first-workspace .drop-zone.is-dragging{transform:none!important}
.workspace-page .native-file-input{display:block!important}


/* ========================================================================== */
/* v113 — visible help glyph, true bulk picker scale, no clipped task surfaces */
/*          and stable post-file layout without repeated scroll corrections.   */
/* ========================================================================== */

/* The old help circle used an opaque ::before child without a separately
   stacked glyph. On some paint/compositing paths that decorative layer could
   cover the literal text node. Give the glyph its own layer above the circle. */
.workspace-page .task-help-button{
  isolation:isolate;
  color:var(--text)!important;
}
.workspace-page .task-help-button::before{
  z-index:0;
  pointer-events:none;
}
.workspace-page .task-help-glyph{
  position:relative;
  z-index:2;
  display:grid;
  place-items:center;
  width:100%;
  height:100%;
  color:inherit;
  font:900 1rem/1 system-ui,-apple-system,"Segoe UI",sans-serif;
}
html[data-theme="dark"] .workspace-page .task-help-glyph{color:#f2fbff!important}
html[data-theme="light"] .workspace-page .task-help-glyph{color:#16354a!important}

/* `overflow: clip` hides ink/content instead of solving the width that caused
   it. Keep the task surface measurable and constrain the real children. */
.workspace-page.task-first-workspace{overflow-x:visible!important}
.workspace-page.task-first-workspace .workspace-shell,
.workspace-page.task-first-workspace .workspace-grid,
.workspace-page.task-first-workspace .workspace-controls,
.workspace-page.task-first-workspace .workspace-card,
.workspace-page.task-first-workspace .tool-panel,
.workspace-page.task-first-workspace .drop-zone,
.workspace-page.task-first-workspace .new-tool-drop,
.workspace-page.task-first-workspace .bulk-drop,
.workspace-page.task-first-workspace .bulk-picker{
  min-width:0!important;
  max-width:100%!important;
  box-sizing:border-box!important;
}
.workspace-page.task-first-generic:not(.has-primary-file) .upload-card,
.workspace-page.task-first-bulk:not(.has-primary-file) .tool-control-card{
  overflow:visible!important;
}

/* Bulk was still sitting in the old first column while the preview column was
   hidden, which made its chooser roughly half the intended width. The empty
   batch state now uses the same deliberate one-column task scale as the other
   upload-first tools. */
.workspace-page.task-first-bulk:not(.has-primary-file) .workspace-grid{
  grid-template-columns:minmax(0,1fr)!important;
  width:min(100%,820px)!important;
  max-width:820px!important;
  margin-inline:auto!important;
}
.workspace-page.task-first-bulk:not(.has-primary-file) .workspace-controls,
.workspace-page.task-first-bulk:not(.has-primary-file) .tool-control-card,
.workspace-page.task-first-bulk:not(.has-primary-file) #panel-bulk,
.workspace-page.task-first-bulk:not(.has-primary-file) .bulk-drop{
  width:100%!important;
}
.workspace-page.task-first-bulk:not(.has-primary-file) .tool-control-card{
  padding:18px!important;
}
.workspace-page.task-first-bulk:not(.has-primary-file) #panel-bulk{
  gap:16px!important;
}
.workspace-page.task-first-bulk:not(.has-primary-file) .bulk-picker{
  display:grid!important;
  place-items:center!important;
  align-content:center!important;
  gap:12px!important;
  width:100%!important;
  min-height:214px!important;
  padding:24px 20px!important;
  border:1.5px dashed rgba(114,230,255,.52)!important;
  border-radius:17px!important;
  background:rgba(5,16,29,.52)!important;
  color:var(--text)!important;
  text-align:center;
}
.workspace-page.task-first-bulk .bulk-picker-icon{
  display:grid;
  place-items:center;
  width:48px;
  height:48px;
  border-radius:14px;
  color:#06101d;
  background:linear-gradient(135deg,var(--primary),#a4f2ff);
  font-size:1.35rem;
  font-weight:950;
  box-shadow:0 10px 24px rgba(114,230,255,.16);
}
.workspace-page.task-first-bulk .bulk-picker strong{
  color:var(--text);
  font-size:.9rem;
  line-height:1.3;
}
.workspace-page.task-first-bulk .bulk-picker-action{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:210px;
  min-height:50px;
  padding:0 22px;
  border-radius:11px;
  color:#06101d;
  background:var(--primary);
  font-size:.78rem;
  font-weight:900;
  line-height:1;
  box-shadow:0 9px 22px rgba(114,230,255,.16);
}
.workspace-page.task-first-bulk .bulk-picker small{
  color:var(--text-muted);
  font-size:.66rem;
  line-height:1.4;
}
html[data-theme="light"] .workspace-page.task-first-bulk .bulk-picker{
  background:rgba(227,239,248,.68)!important;
}
@media(max-width:760px){
  .workspace-page.task-first-bulk:not(.has-primary-file) .workspace-grid{
    width:100%!important;
  }
  .workspace-page.task-first-bulk:not(.has-primary-file) .tool-control-card{
    padding:14px!important;
  }
  .workspace-page.task-first-bulk:not(.has-primary-file) .bulk-picker{
    min-height:178px!important;
    padding:18px 14px!important;
    gap:9px!important;
  }
  .workspace-page.task-first-bulk .bulk-picker-icon{width:42px;height:42px;font-size:1.15rem}
  .workspace-page.task-first-bulk .bulk-picker-action{
    width:min(100%,240px);
    min-width:0;
    min-height:48px;
  }
}

/* Once files exist, keep the picker usable but let quality/result controls take
   priority. This is still the same native label/input behavior. */
.workspace-page.task-first-bulk.has-primary-file .bulk-picker{
  min-height:72px!important;
  display:flex!important;
  align-items:center!important;
  justify-content:center!important;
  gap:10px!important;
  padding:10px 14px!important;
}
.workspace-page.task-first-bulk.has-primary-file .bulk-picker-icon,
.workspace-page.task-first-bulk.has-primary-file .bulk-picker small{display:none!important}
.workspace-page.task-first-bulk.has-primary-file .bulk-picker-action{display:none!important}

/* Avoid small transform-driven paint shifts on core task controls. */
.workspace-page.task-first-workspace .task-help-button:active,
.workspace-page.task-first-workspace .bulk-picker:active,
.workspace-page.task-first-workspace .drop-zone:active{
  transform:none!important;
}


/* v113 final containment: buttons/borders stay inside their real task width. */
.workspace-page.task-first-workspace .tool-panel>.btn,
.workspace-page.task-first-workspace .tool-panel>a.btn,
.workspace-page.task-first-workspace .drop-zone-action,
.workspace-page.task-first-workspace .bulk-picker-action{
  min-width:0;
  max-width:100%;
  box-sizing:border-box;
}
.workspace-page.task-first-workspace .drop-zone,
.workspace-page.task-first-workspace .bulk-picker{
  background-clip:padding-box;
}
.workspace-page.task-first-workspace .drop-zone{
  transition:border-color .12s ease,background-color .12s ease!important;
}
@media(prefers-reduced-motion:reduce){
  .workspace-page.task-first-workspace *,
  .workspace-page.task-first-workspace *::before,
  .workspace-page.task-first-workspace *::after{
    scroll-behavior:auto!important;
  }
}
/* Keep the visible batch action comfortably sized on tablet/desktop. */
@media(min-width:761px){
  .workspace-page.task-first-bulk:not(.has-primary-file) .bulk-picker-action{
    min-width:220px!important;
  }
}

/* ========================================================================== */
/* v114 — compact loaded-tool workspace                                       */
/* Bulk empty chooser is intentionally untouched.                             */
/* ========================================================================== */

/* v113's generic containment max-width:100% was correct for overflow safety,
   but on large screens it also allowed loaded simple tools to stretch across
   the entire viewport. Keep the task compact and let the preview dominate. */
@media (min-width: 901px) {
  .workspace-page.task-first-generic.has-primary-file .workspace-shell {
    width: min(calc(100% - 40px), 1240px) !important;
    max-width: 1240px !important;
    margin-inline: auto !important;
  }
  .workspace-page.task-first-generic.has-primary-file .task-tool-header,
  .workspace-page.task-first-generic.has-primary-file .workspace-grid {
    width: 100% !important;
    max-width: 1240px !important;
    margin-inline: auto !important;
  }
  .workspace-page.task-first-generic.has-primary-file .workspace-grid {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr) !important;
    gap: 16px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .workspace-controls {
    gap: 12px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .tool-control-card,
  .workspace-page.task-first-generic.has-primary-file .preview-card {
    padding: 14px !important;
    border-radius: 16px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .tool-panel {
    gap: 10px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .settings-group-heading {
    margin-bottom: 7px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .settings-group-heading strong {
    font-size: .76rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .settings-group-heading small {
    font-size: .6rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .field {
    gap: 5px !important;
    margin-bottom: 10px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .field label,
  .workspace-page.task-first-generic.has-primary-file .field-header label {
    font-size: .72rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .field input:not([type=range]):not([type=checkbox]):not([type=radio]),
  .workspace-page.task-first-generic.has-primary-file .field select {
    min-height: 40px !important;
    padding: 8px 10px !important;
    border-radius: 10px !important;
    font-size: .76rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .preset-row {
    gap: 6px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .preset-row button {
    min-height: 34px !important;
    padding: 0 10px !important;
    border-radius: 8px !important;
    font-size: .66rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .process-btn {
    min-height: 44px !important;
    margin-top: 0 !important;
    font-size: .76rem !important;
  }

  /* Preview is a preview, not the before/after component. Keep it useful but
     stop the card from forcing a 630px wall on every desktop tool. */
  .workspace-page.task-first-generic.has-primary-file .preview-card {
    min-height: 0 !important;
  }
  .workspace-page.task-first-generic.has-primary-file .preview-heading {
    margin-bottom: 8px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .preview-heading h2 {
    font-size: .9rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .preview-heading p {
    font-size: .61rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .preview-toolbar {
    min-height: 34px !important;
    margin-bottom: 8px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .preview-toolbar > span {
    padding: 4px 7px !important;
    font-size: .62rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .preview-toolbar button {
    min-height: 34px !important;
    padding: 5px 8px !important;
    font-size: .64rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview-wrap {
    min-height: 300px !important;
    height: min(48vh, 470px) !important;
    max-height: 470px !important;
    border-radius: 14px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview {
    max-height: 470px !important;
    object-fit: contain !important;
  }
  .workspace-page.task-first-generic.has-primary-file .info-grid {
    gap: 6px !important;
    margin-top: 8px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .info-grid div {
    padding: 7px 8px !important;
    border-radius: 8px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .info-grid dt {
    font-size: .58rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .info-grid dd {
    font-size: .68rem !important;
  }
}

/* Tablet keeps the same hierarchy without tiny controls. */
@media (min-width: 761px) and (max-width: 900px) {
  .workspace-page.task-first-generic.has-primary-file .workspace-shell {
    width: min(calc(100% - 28px), 820px) !important;
    max-width: 820px !important;
    margin-inline: auto !important;
  }
  .workspace-page.task-first-generic.has-primary-file .workspace-grid {
    gap: 12px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .tool-control-card,
  .workspace-page.task-first-generic.has-primary-file .preview-card {
    padding: 14px !important;
  }
}

/* ========================================================================== */
/* v122 — smaller source preview + compact metadata + stronger light uploads  */
/* ========================================================================== */

/* The source preview is contextual, not the result comparison. Keep more room
   for the task controls and later result state. */
.workspace-page.task-first-generic.has-primary-file .source-preview .compare-hint {
  display: none !important;
}

@media (min-width: 901px) {
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview-wrap {
    min-height: 220px !important;
    height: min(36vh, 360px) !important;
    max-height: 360px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview {
    max-height: 360px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .info-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
    margin-top: 7px !important;
  }
}

@media (max-width: 900px) {
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview-wrap {
    min-height: 180px !important;
    height: min(34vh, 300px) !important;
    max-height: 300px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview {
    max-height: 300px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .info-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 6px !important;
    margin-top: 7px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .info-grid div {
    min-width: 0 !important;
    padding: 7px 8px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .info-grid dt {
    font-size: .55rem !important;
  }
  .workspace-page.task-first-generic.has-primary-file .info-grid dd {
    font-size: .65rem !important;
  }
}

@media (max-width: 390px) {
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview-wrap {
    min-height: 165px !important;
    height: min(31vh, 260px) !important;
    max-height: 260px !important;
  }
}

/* Stronger light-mode affordance for file-picking surfaces. Large utilities
   use a quiet white/blue surface with a clearly visible dashed outline rather
   than blending into the page background. Sizes/processing are unchanged. */
html[data-theme="light"] .workspace-page.task-first-generic:not(.has-primary-file) #generic-upload-content .drop-zone,
html[data-theme="light"] .workspace-page.task-first-document #itt-drop,
html[data-theme="light"] .workspace-page.task-first-standalone .new-tool-drop,
html[data-theme="light"] #panel-doc-scanner:not(.has-tool-source) #scanner-drop,
html[data-theme="light"] #panel-background-remover:not(.has-tool-source) #bgrem-drop,
html[data-theme="light"] #panel-watermark:not(.has-tool-source) > .new-tool-drop,
html[data-theme="light"] #panel-pdf-editor:not(.has-pdf-document) > .pdf-drop-zone,
html[data-theme="light"] #panel-pdf-converter:not(.has-pdf-document) .pdf-drop-zone {
  border-color: #86aabd !important;
  background: rgba(255, 255, 255, .78) !important;
  box-shadow: 0 10px 26px rgba(35, 78, 104, .07), inset 0 0 0 1px rgba(31, 91, 120, .04) !important;
}
html[data-theme="light"] .workspace-page.task-first-workspace .drop-zone strong,
html[data-theme="light"] .workspace-page.task-first-workspace .new-tool-drop strong,
html[data-theme="light"] .workspace-page.task-first-workspace .pdf-drop-zone strong {
  color: #18394f !important;
}
html[data-theme="light"] .workspace-page.task-first-workspace .drop-zone small,
html[data-theme="light"] .workspace-page.task-first-workspace .new-tool-drop small,
html[data-theme="light"] .workspace-page.task-first-workspace .pdf-drop-zone small {
  color: #527188 !important;
}

@media (max-width: 390px) {
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview-wrap {
    min-height: 150px !important;
    height: min(28vh, 230px) !important;
    max-height: 230px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview {
    max-height: 230px !important;
  }
}

/* ========================================================================== */
/* v123 — compact preview + stacked QR source actions + horizontal PDF media   */
/* ========================================================================== */

/* Keep the loaded simple-tool workspace compact on wide screens. The source
   preview should support the task, not become a desktop-sized wall. */
@media (min-width: 901px) {
  .workspace-page.task-first-generic.has-primary-file .workspace-shell,
  .workspace-page.task-first-generic.has-primary-file .task-tool-header,
  .workspace-page.task-first-generic.has-primary-file .workspace-grid {
    max-width: 1060px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .workspace-grid {
    grid-template-columns: minmax(290px, 340px) minmax(0, 680px) !important;
    justify-content: center !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview-wrap {
    min-height: 200px !important;
    height: min(32vh, 320px) !important;
    max-height: 320px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview {
    max-height: 320px !important;
  }
}

/* File / Dimensions on the first row and Size / Format on the second row at
   every breakpoint. This avoids a needlessly wide metadata band. */
.workspace-page.task-first-generic.has-primary-file .info-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 6px !important;
}

@media (max-width: 900px) {
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview-wrap {
    min-height: 170px !important;
    height: min(30vh, 260px) !important;
    max-height: 260px !important;
  }
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview {
    max-height: 260px !important;
  }
}
@media (max-width: 390px) {
  .workspace-page.task-first-generic.has-primary-file .source-preview .image-preview-wrap {
    min-height: 150px !important;
    height: min(27vh, 220px) !important;
    max-height: 220px !important;
  }
}

/* QR scanner source choice: two obvious, vertically stacked actions. This is
   easier to scan than placing Camera in a separate row below the upload card. */
#panel-qr-code #qr-scan-pane .qr-scan-source-card {
  min-height: 220px !important;
  align-content: center;
}
#panel-qr-code #qr-scan-pane .qr-scan-source-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  width: min(100%, 470px);
  margin: 8px auto 0;
}
#panel-qr-code #qr-scan-pane .qr-scan-source-actions .drop-zone-action,
#panel-qr-code #qr-scan-pane .qr-scan-source-actions .btn {
  width: 100% !important;
  max-width: none !important;
  min-width: 0 !important;
  min-height: 48px !important;
  height: 48px !important;
  margin: 0 !important;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  justify-self: stretch !important;
}
#panel-qr-code #qr-scan-pane .qr-camera-note {
  display: block;
  max-width: 470px;
  margin: 8px auto 0;
  text-align: center;
}
@media (max-width: 520px) {
  #panel-qr-code #qr-scan-pane .qr-scan-source-card {
    min-height: 224px !important;
    padding-inline: 14px !important;
  }
  #panel-qr-code #qr-scan-pane .qr-scan-source-actions {
    width: 100%;
    max-width: none;
  }
  #panel-qr-code #qr-scan-pane .qr-scan-source-actions .drop-zone-action,
  #panel-qr-code #qr-scan-pane .qr-scan-source-actions .btn {
    min-height: 52px !important;
    height: 52px !important;
  }
}

/* Images -> PDF: selected pages become a native horizontal thumbnail
   collection. Swipe left/right on touch devices; tapping a thumbnail opens it. */
#panel-pdf-converter .pdfc-review-thumbs {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 2px 2px 8px;
  margin: 2px 0 4px;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 2px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: thin;
}
#panel-pdf-converter .pdfc-review-thumbs[hidden] { display: none !important; }
#panel-pdf-converter .pdfc-review-thumb {
  position: relative;
  flex: 0 0 78px;
  width: 78px;
  min-width: 78px;
  height: 74px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--bg-soft);
  color: var(--text-soft);
  cursor: pointer;
  scroll-snap-align: start;
  overflow: hidden;
}
#panel-pdf-converter .pdfc-review-thumb img {
  display: block;
  width: 100%;
  height: 54px;
  object-fit: cover;
  border-radius: 7px;
  background: rgba(255,255,255,.06);
}
#panel-pdf-converter .pdfc-review-thumb span {
  position: absolute;
  left: 7px;
  bottom: 5px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(4,15,27,.82);
  color: #fff;
  font-size: .56rem;
  font-weight: 800;
}
#panel-pdf-converter .pdfc-review-thumb i {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(53,190,118,.92);
  color: #fff;
  font-size: .55rem;
  font-style: normal;
  font-weight: 900;
}
#panel-pdf-converter .pdfc-review-thumb.is-current {
  border-color: color-mix(in srgb, var(--primary) 82%, white 18%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 18%, transparent);
}
@media (max-width: 520px) {
  #panel-pdf-converter .pdfc-review-thumb {
    flex-basis: 70px;
    width: 70px;
    min-width: 70px;
    height: 68px;
  }
  #panel-pdf-converter .pdfc-review-thumb img { height: 50px; }
}

/* PDF -> Images: page previews browse horizontally instead of creating a tall
   page of thumbnails. Partial next cards signal that the row can be swiped. */
#panel-pdf-converter .pdf-page-grid {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 10px !important;
  width: 100% !important;
  max-width: 100% !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 8px 4px 10px !important;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 4px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: thin;
}
#panel-pdf-converter .pdf-page-card {
  flex: 0 0 clamp(150px, 24vw, 210px) !important;
  width: clamp(150px, 24vw, 210px) !important;
  min-width: clamp(150px, 24vw, 210px) !important;
  max-width: 210px !important;
  scroll-snap-align: start;
  contain: content;
}
@media (max-width: 520px) {
  #panel-pdf-converter .pdf-page-card {
    flex-basis: min(72vw, 220px) !important;
    width: min(72vw, 220px) !important;
    min-width: min(72vw, 220px) !important;
  }
}

/* Converted PDF pages: show the actual images in a horizontal strip with the
   Download and Remove actions on each image card. */
#panel-pdf-converter .pdf-output-strip {
  display: flex;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 2px 10px;
  scroll-snap-type: x proximity;
  scroll-padding-inline: 2px;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  scrollbar-width: thin;
}
#panel-pdf-converter .pdf-output-card {
  flex: 0 0 clamp(190px, 28vw, 250px);
  width: clamp(190px, 28vw, 250px);
  min-width: clamp(190px, 28vw, 250px);
  max-width: 250px;
  display: grid;
  grid-template-rows: minmax(0, auto) auto auto;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
  scroll-snap-align: start;
  box-sizing: border-box;
}
#panel-pdf-converter .pdf-output-preview {
  display: grid;
  place-items: center;
  height: 220px;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(0,0,0,.12);
}
#panel-pdf-converter .pdf-output-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
}
#panel-pdf-converter .pdf-output-copy {
  min-width: 0;
}
#panel-pdf-converter .pdf-output-copy strong,
#panel-pdf-converter .pdf-output-copy small {
  display: block;
}
#panel-pdf-converter .pdf-output-copy strong {
  font-size: .72rem;
}
#panel-pdf-converter .pdf-output-copy small {
  margin-top: 2px;
  color: var(--text-muted);
  font-size: .62rem;
}
#panel-pdf-converter .pdf-output-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 7px;
}
#panel-pdf-converter .pdf-output-actions .btn {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding-inline: 8px;
  font-size: .62rem;
}
#panel-pdf-converter .pdf-output-empty {
  min-width: min(420px, calc(100vw - 64px));
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--text-muted);
  font-size: .68rem;
}
@media (max-width: 520px) {
  #panel-pdf-converter .pdf-output-card {
    flex-basis: min(78vw, 245px);
    width: min(78vw, 245px);
    min-width: min(78vw, 245px);
  }
  #panel-pdf-converter .pdf-output-preview { height: 205px; }
}

/* Stronger, brand-neutral light upload surfaces: clear boundary, white task
   surface, restrained shadow. Dimensions and processing stay unchanged. */
html[data-theme="light"] .workspace-page.task-first-workspace .drop-zone,
html[data-theme="light"] .workspace-page.task-first-workspace .new-tool-drop,
html[data-theme="light"] .workspace-page.task-first-workspace .pdf-drop-zone,
html[data-theme="light"] .workspace-page.task-first-workspace .bulk-drop {
  border-color: #78a8bf !important;
  border-width: 1.5px !important;
  background: #ffffff !important;
  box-shadow: 0 8px 22px rgba(41, 79, 101, .08), inset 0 0 0 1px rgba(63, 118, 146, .035) !important;
}
html[data-theme="light"] .workspace-page.task-first-workspace .drop-zone:hover,
html[data-theme="light"] .workspace-page.task-first-workspace .new-tool-drop:hover,
html[data-theme="light"] .workspace-page.task-first-workspace .pdf-drop-zone:hover {
  border-color: #4f91af !important;
  background: #fbfdff !important;
}

/* ========================================================================== */
/* v124 — touch reorder grip for Images → PDF thumbnail rail                  */
/* ========================================================================== */
#panel-pdf-converter .pdfc-review-thumb {
  isolation: isolate;
  transition: border-color .16s ease, box-shadow .16s ease, opacity .16s ease;
}
#panel-pdf-converter .pdfc-review-thumb-open {
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
#panel-pdf-converter .pdfc-review-thumb-open img {
  pointer-events: none;
}
#panel-pdf-converter .pdfc-review-thumb-number,
#panel-pdf-converter .pdfc-review-thumb-state {
  pointer-events: none;
}
#panel-pdf-converter .pdfc-review-thumb-grip {
  position: absolute;
  right: 5px;
  bottom: 4px;
  z-index: 3;
  width: 26px;
  height: 24px;
  min-width: 26px;
  min-height: 24px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--bg-soft) 88%, #081525 12%);
  color: var(--text);
  font-size: .76rem;
  font-weight: 900;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
#panel-pdf-converter .pdfc-review-thumb-grip:active,
#panel-pdf-converter .pdfc-review-thumb.is-dragging .pdfc-review-thumb-grip {
  cursor: grabbing;
}
#panel-pdf-converter .pdfc-review-thumb.is-dragging {
  z-index: 5;
  opacity: .9;
  box-shadow: 0 10px 24px rgba(0,0,0,.22);
  transition: none;
}
#panel-pdf-converter .pdfc-review-thumb.is-drop-target {
  border-color: color-mix(in srgb, var(--primary) 88%, white 12%);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--primary) 22%, transparent);
}
#panel-pdf-converter .pdfc-review-thumb-grip:focus-visible,
#panel-pdf-converter .pdfc-review-thumb-open:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--primary) 82%, white 18%);
  outline-offset: 1px;
}
@media (max-width: 520px) {
  #panel-pdf-converter .pdfc-review-thumb-grip {
    width: 28px;
    height: 26px;
    min-width: 28px;
    min-height: 26px;
  }
}

/* Final Images → PDF review also stays horizontal so multi-page jobs do not
   turn into a long vertical wall on phones. */
#panel-pdf-converter .pdfc-final-pages {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: stretch;
  gap: 9px !important;
  width: 100%;
  max-width: 100%;
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  padding: 8px 4px 10px !important;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
}
#panel-pdf-converter .pdfc-final-page {
  flex: 0 0 132px;
  width: 132px;
  min-width: 132px;
  max-width: 132px;
  scroll-snap-align: start;
}
@media (max-width: 520px) {
  #panel-pdf-converter .pdfc-final-page {
    flex-basis: 118px;
    width: 118px;
    min-width: 118px;
    max-width: 118px;
  }
}

/* ========================================================================== */
/* v125 — loaded preview hard containment for 320px-class viewports           */
/* ========================================================================== */
.workspace-page.task-first-generic.has-primary-file .workspace-grid,
.workspace-page.task-first-generic.has-primary-file .tool-control-card,
.workspace-page.task-first-generic.has-primary-file .preview-card,
.workspace-page.task-first-generic.has-primary-file .source-preview,
.workspace-page.task-first-generic.has-primary-file .image-preview-wrap,
.workspace-page.task-first-generic.has-primary-file .info-grid {
  min-width: 0 !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}
.workspace-page.task-first-generic.has-primary-file .preview-card,
.workspace-page.task-first-generic.has-primary-file .source-preview {
  width: 100% !important;
}


/* ========================================================================== */
/* v126 — centered loaded-image preview on narrow screens                     */
/* Mobile preview height rules + aspect-ratio previously let the browser      */
/* derive a narrower auto width, leaving the preview visually left-shifted.   */
/* Force the preview viewport to occupy the full available source-preview      */
/* width; image bytes, processing and result logic remain untouched.           */
/* ========================================================================== */
.workspace-page.task-first-generic.has-primary-file
.source-preview .image-preview-wrap {
  width: 100% !important;
  min-width: 0 !important;
  max-width: 100% !important;
  margin-inline: auto !important;
  justify-self: stretch !important;
  box-sizing: border-box !important;
}

.workspace-page.task-first-generic.has-primary-file
.source-preview .image-preview {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  margin-inline: auto !important;
  object-fit: contain !important;
  object-position: center center !important;
}

/* =========================================================
   v127 — MOBILE WORKSPACE SCROLL COMPOSITING
   The fixed workspace header remains visually stable without live backdrop
   blur on mobile/tablet. Tool logic and workspace behavior are unchanged.
========================================================= */
@media (max-width: 900px) {
  .workspace-header,
  .workspace-header.site-header,
  .workspace-header.site-header.scrolled {
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    background: #06101d !important;
    box-shadow: 0 4px 16px rgba(0, 0, 0, .14) !important;
  }

  html[data-theme="light"] .workspace-header,
  html[data-theme="light"] .workspace-header.site-header,
  html[data-theme="light"] .workspace-header.site-header.scrolled {
    background: #f4f8fc !important;
    box-shadow: 0 4px 15px rgba(25, 56, 78, .08) !important;
  }
}


/* ========================================================================== */
/* v128 — Bulk batch preview alignment + horizontal removable thumbnails       */
/* ========================================================================== */
.workspace-page.task-first-bulk.has-primary-file .workspace-grid {
  width: min(100%, 1180px);
  max-width: 1180px;
  margin-inline: auto;
}
.workspace-page.task-first-bulk .workspace-preview,
.workspace-page.task-first-bulk .preview-card,
.workspace-page.task-first-bulk .bulk-preview-pane,
.workspace-page.task-first-bulk .bulk-preview-grid {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  margin-inline: 0;
  box-sizing: border-box;
}
.workspace-page.task-first-bulk .bulk-preview-pane {
  min-height: 0;
}
.workspace-page.task-first-bulk .bulk-preview-pane .bulk-preview-grid {
  display: flex !important;
  grid-template-columns: none !important;
  gap: 10px;
  margin: 0 0 14px;
  padding: 2px 2px 8px;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-inline: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}
.workspace-page.task-first-bulk .bulk-preview-item {
  position: relative;
  flex: 0 0 clamp(145px, 23%, 205px);
  min-width: 0;
  margin: 0;
  scroll-snap-align: start;
}
.workspace-page.task-first-bulk .bulk-preview-pane .bulk-preview-grid .bulk-preview-item img {
  display: block;
  width: 100%;
  height: 148px;
  aspect-ratio: auto !important;
  object-fit: contain !important;
  object-position: center;
  border-radius: 12px;
  background: #07111f;
}
.workspace-page.task-first-bulk .bulk-preview-item figcaption {
  margin-top: 6px;
  padding-inline: 2px;
  color: var(--text-muted);
  font-size: .66rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace-page.task-first-bulk .bulk-preview-remove {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.58);
  border-radius: 50%;
  color: #fff;
  background: rgba(7,17,31,.82);
  box-shadow: 0 4px 14px rgba(0,0,0,.24);
  font: 800 1.35rem/1 system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.workspace-page.task-first-bulk .bulk-preview-remove:hover,
.workspace-page.task-first-bulk .bulk-preview-remove:focus-visible {
  background: rgba(180,35,57,.94);
  outline: 3px solid rgba(114,230,255,.28);
  outline-offset: 1px;
}
html[data-theme="light"] .workspace-page.task-first-bulk .bulk-preview-pane .bulk-preview-grid .bulk-preview-item img {
  background: #eef5f9;
}
html[data-theme="light"] .workspace-page.task-first-bulk .bulk-preview-remove {
  border-color: rgba(255,255,255,.9);
  color: #fff;
  background: rgba(11,34,53,.86);
}
@media (max-width: 760px) {
  .workspace-page.task-first-bulk.has-primary-file .workspace-grid,
  .workspace-page.task-first-bulk.has-primary-file .workspace-controls,
  .workspace-page.task-first-bulk.has-primary-file .workspace-preview {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-inline: 0 !important;
  }
  .workspace-page.task-first-bulk .bulk-preview-pane .preview-toolbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .workspace-page.task-first-bulk .bulk-preview-pane .preview-toolbar > div {
    margin-left: auto;
  }
  .workspace-page.task-first-bulk .bulk-preview-item {
    flex-basis: min(52vw, 190px);
  }
  .workspace-page.task-first-bulk .bulk-preview-pane .bulk-preview-grid .bulk-preview-item img {
    height: 142px;
  }
}
@media (max-width: 380px) {
  .workspace-page.task-first-bulk .bulk-preview-pane .bulk-preview-grid {
    grid-template-columns: none !important;
  }
  .workspace-page.task-first-bulk .bulk-preview-item {
    flex-basis: min(60vw, 180px);
  }
}

/* ========================================================================== */
/* v129 — Watermark selected-image rail (tool-scoped, no other tool changes)  */
/* ========================================================================== */
#panel-watermark .new-tool-file-confirm{
  grid-template-columns:minmax(0,1fr) auto!important;
}
#panel-watermark .new-tool-change-file:disabled{
  opacity:.58;
  cursor:not-allowed;
}
#panel-watermark .watermark-selected-rail{
  display:flex!important;
  flex-wrap:nowrap!important;
  align-items:flex-start;
  gap:10px!important;
  width:100%;
  min-width:0;
  padding:3px 2px 9px;
  overflow-x:auto;
  overflow-y:hidden;
  overscroll-behavior-inline:contain;
  scroll-snap-type:x proximity;
  scrollbar-width:thin;
  -webkit-overflow-scrolling:touch;
}
#panel-watermark .watermark-selected-rail[hidden]{display:none!important}
#panel-watermark .watermark-selected-item{
  --wm-thumb-w:104px;
  flex:0 0 var(--wm-thumb-w);
  width:var(--wm-thumb-w);
  min-width:74px;
  max-width:154px;
  display:grid;
  gap:5px;
  scroll-snap-align:start;
}
#panel-watermark .watermark-selected-frame{
  position:relative;
  display:grid;
  place-items:center;
  width:100%;
  height:92px;
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--primary) 24%,var(--line));
  border-radius:11px;
  background:color-mix(in srgb,var(--bg-soft) 92%,transparent);
}
#panel-watermark .watermark-selected-frame img{
  display:block;
  width:100%;
  height:100%;
  max-width:none!important;
  max-height:none!important;
  object-fit:contain;
  object-position:center;
  background:transparent;
}
#panel-watermark .watermark-selected-remove{
  position:absolute;
  top:5px;
  right:5px;
  z-index:2;
  display:grid;
  place-items:center;
  width:32px;
  height:32px;
  min-width:32px;
  min-height:32px;
  padding:0;
  border:1px solid rgba(255,255,255,.72);
  border-radius:999px;
  background:rgba(8,18,30,.88);
  color:#fff;
  box-shadow:0 4px 12px rgba(0,0,0,.26);
  font:800 1.05rem/1 system-ui,-apple-system,"Segoe UI",sans-serif;
  cursor:pointer;
  touch-action:manipulation;
}
#panel-watermark .watermark-selected-remove::before{
  content:"";
  position:absolute;
  inset:-7px;
  border-radius:999px;
}
#panel-watermark .watermark-selected-remove:focus-visible{
  outline:3px solid color-mix(in srgb,var(--primary) 55%,transparent);
  outline-offset:2px;
}
#panel-watermark .watermark-selected-meta{
  display:block;
  width:100%;
  max-width:100%!important;
  padding:0 2px!important;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  border:0!important;
  border-radius:0!important;
  color:var(--text-muted)!important;
  background:transparent!important;
  font-size:.54rem!important;
  line-height:1.25;
}
#panel-watermark .watermark-preview-wrap{
  width:min(100%,600px);
  justify-self:center;
}
#panel-watermark .watermark-preview-wrap img{
  width:auto!important;
  max-width:100%!important;
  max-height:min(42vh,320px)!important;
  object-fit:contain!important;
}
@media(max-width:760px){
  #panel-watermark .watermark-selected-rail{
    gap:8px!important;
    padding-bottom:8px;
    scrollbar-width:none;
  }
  #panel-watermark .watermark-selected-rail::-webkit-scrollbar{display:none}
  #panel-watermark .watermark-selected-item{
    min-width:70px;
    max-width:142px;
  }
  #panel-watermark .watermark-selected-frame{height:86px;border-radius:10px}
  #panel-watermark .watermark-selected-remove{top:4px;right:4px;width:30px;height:30px;min-width:30px;min-height:30px;font-size:1rem}
  #panel-watermark .watermark-preview-wrap{width:100%}
  #panel-watermark .watermark-preview-wrap img{max-height:min(36vh,260px)!important}
}
@media(max-width:380px){
  #panel-watermark .watermark-selected-frame{height:80px}
  #panel-watermark .watermark-selected-item{max-width:132px}
}


/* ========================================================================== */
/* v130 — Watermark thumbnail-controlled live preview                         */
/* ========================================================================== */
#panel-watermark .watermark-tuning-popover{
  position:fixed;
  left:50%;
  top:calc(88px + env(safe-area-inset-top,0px));
  z-index:1200;
  width:min(92vw,560px);
  display:grid;
  gap:8px;
  padding:12px;
  border:1px solid color-mix(in srgb,var(--primary) 22%,var(--line));
  border-radius:18px;
  background:linear-gradient(180deg,rgba(4,13,23,.96),rgba(6,17,29,.94));
  box-shadow:0 18px 42px rgba(0,0,0,.34);
  transform:translate(-50%,-6px) scale(.98);
  opacity:0;
  pointer-events:none;
  transition:opacity .14s ease,transform .14s ease;
  backdrop-filter:blur(8px);
}
#panel-watermark .watermark-tuning-popover.is-visible{
  opacity:1;
  transform:translate(-50%,0) scale(1);
}
#panel-watermark .watermark-tuning-popover-badge{
  justify-self:start;
  padding:5px 9px;
  border:1px solid rgba(114,230,255,.22);
  border-radius:999px;
  background:rgba(114,230,255,.08);
  color:var(--primary);
  font-size:.68rem;
  font-weight:800;
  letter-spacing:.01em;
}
#panel-watermark .watermark-tuning-popover-frame{
  display:grid;
  place-items:center;
  min-height:180px;
  max-height:52vh;
  overflow:hidden;
  border:1px solid var(--line);
  border-radius:14px;
  background:rgba(2,8,14,.88);
}
#panel-watermark .watermark-tuning-popover-frame img{
  display:block;
  width:auto;
  max-width:100%;
  max-height:min(48vh,420px);
  object-fit:contain;
}
#panel-watermark .watermark-tuning-popover-meta{
  color:var(--text-soft);
  font-size:.72rem;
  line-height:1.35;
}
@media(max-width:760px){
  #panel-watermark .watermark-tuning-popover{
    top:calc(78px + env(safe-area-inset-top,0px));
    width:min(94vw,500px);
    padding:10px;
    border-radius:16px;
  }
  #panel-watermark .watermark-tuning-popover-frame{
    min-height:160px;
    max-height:46vh;
  }
  #panel-watermark .watermark-tuning-popover-frame img{
    max-height:min(42vh,340px);
  }
}
@media(prefers-reduced-motion:reduce){
  #panel-watermark .watermark-tuning-popover{transition:none}
}

#panel-watermark .watermark-selected-item{
  position:relative;
}
#panel-watermark .watermark-selected-select{
  appearance:none;
  -webkit-appearance:none;
  padding:0;
  margin:0;
  color:inherit;
  font:inherit;
  cursor:pointer;
  touch-action:manipulation;
  transition:border-color .16s ease,box-shadow .16s ease,transform .16s ease;
}
#panel-watermark .watermark-selected-select:active{
  transform:scale(.985);
}
#panel-watermark .watermark-selected-select:focus-visible{
  outline:3px solid color-mix(in srgb,var(--primary) 48%,transparent);
  outline-offset:2px;
}
#panel-watermark .watermark-selected-item.is-previewing .watermark-selected-frame{
  border-color:color-mix(in srgb,var(--primary) 82%,#fff 18%);
  box-shadow:0 0 0 3px color-mix(in srgb,var(--primary) 24%,transparent),0 8px 20px rgba(0,0,0,.12);
}
#panel-watermark .watermark-selected-item.is-previewing .watermark-selected-meta{
  color:var(--text)!important;
  font-weight:750!important;
}
#panel-watermark .watermark-selected-item.is-previewing::after{
  content:"Preview";
  position:absolute;
  left:6px;
  top:6px;
  z-index:2;
  max-width:calc(100% - 44px);
  padding:3px 6px;
  border-radius:999px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  background:rgba(8,18,30,.82);
  color:#fff;
  font:800 .48rem/1.15 system-ui,-apple-system,"Segoe UI",sans-serif;
  pointer-events:none;
}
@media(max-width:760px){
  #panel-watermark .watermark-selected-select{
    -webkit-tap-highlight-color:transparent;
  }
}


/* v132 — keep Watermark preview visible while switching selected thumbnails */
#panel-watermark .watermark-preview-wrap.is-switching img{opacity:.92}
#panel-watermark .watermark-preview-wrap img{transition:opacity .12s ease}
@media(prefers-reduced-motion:reduce){#panel-watermark .watermark-preview-wrap img{transition:none}}

/* ========================================================================== */
/* v141 — route first-paint guard, Page Pin, reachable PDF zoom, UI polish    */
/* ========================================================================== */
.workspace-route-loader{
  display:none;
  align-items:center;
  justify-content:center;
  gap:14px;
  min-height:min(48vh,420px);
  padding:40px 20px;
  color:var(--text-soft);
  text-align:left;
}
.workspace-route-pending .workspace-route-loader{display:flex}
.workspace-route-pending .workspace-grid{display:none!important}
.workspace-route-loader strong{display:block;color:var(--text);font-size:.92rem}
.workspace-route-loader small{display:block;margin-top:4px;line-height:1.45}
.workspace-route-loader-mark{
  display:grid;
  grid-template-columns:repeat(2,8px);
  gap:4px;
  width:28px;
  height:28px;
}
.workspace-route-loader-mark i{
  display:block;
  border-radius:3px;
  background:linear-gradient(145deg,var(--primary),#7f72ff);
  animation:workspace-loader-pulse .9s ease-in-out infinite alternate;
}
.workspace-route-loader-mark i:nth-child(2),.workspace-route-loader-mark i:nth-child(3){animation-delay:-.45s}
@keyframes workspace-loader-pulse{to{opacity:.35;transform:scale(.76)}}

#panel-watermark .watermark-source-actions{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:10px;
  width:min(100%,430px);
  margin:14px auto 0;
}
#panel-watermark .watermark-source-actions .drop-zone-action{
  width:100%;
  min-width:0;
  min-height:48px;
  margin:0!important;
  display:flex;
  align-items:center;
  justify-content:center;
  padding:9px 12px;
  border-radius:13px;
  text-align:center;
  line-height:1.2;
}
#panel-watermark .watermark-camera-action{
  border:1px solid color-mix(in srgb,var(--primary) 38%,var(--line))!important;
  background:color-mix(in srgb,var(--primary) 7%,var(--surface-strong))!important;
}

body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap{
  display:flex!important;
  align-items:flex-start!important;
  justify-content:flex-start!important;
  min-width:0!important;
  min-height:0!important;
  overflow:auto!important;
  padding:58px clamp(6px,1.8vw,20px) calc(clamp(24px,4vw,54px) + env(safe-area-inset-bottom))!important;
  scroll-padding:58px 12px calc(34px + env(safe-area-inset-bottom));
  overscroll-behavior:contain!important;
  touch-action:pan-x pan-y!important;
  -webkit-overflow-scrolling:touch;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap:not(.is-overflow-x) .pdf-editor-stage{
  margin-left:auto!important;
  margin-right:auto!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-overflow-x .pdf-editor-stage{
  margin-left:0!important;
  margin-right:0!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-contained-y{
  align-items:center!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-overflow-y{
  align-items:flex-start!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage{
  flex:none!important;
  box-shadow:0 22px 55px rgba(0,0,0,.3),0 2px 8px rgba(0,0,0,.16)!important;
}
.pdfe-pin-controls{position:relative;display:flex;align-items:center;gap:6px;margin-left:auto}
.pdfe-page-pin,.pdfe-pinned-jump{
  min-height:40px!important;
  border:1px solid var(--line)!important;
  border-radius:11px!important;
  background:color-mix(in srgb,var(--surface-strong) 94%,transparent)!important;
  color:var(--text)!important;
  font:inherit;
  font-size:.68rem!important;
  font-weight:850!important;
  cursor:pointer;
}
.pdfe-page-pin{width:44px!important;min-width:44px!important;padding:0!important;font-size:1rem!important}
.pdfe-pinned-jump{width:auto!important;min-width:0!important;padding:0 10px!important;color:var(--primary)!important}
.pdfe-page-pin.is-active{
  border-color:color-mix(in srgb,var(--primary) 52%,var(--line))!important;
  background:color-mix(in srgb,var(--primary) 13%,var(--surface-strong))!important;
  color:var(--primary)!important;
}
.pdfe-page-pin.is-active span{display:inline-block;transform:rotate(-18deg)}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-view-locked,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-view-locked .pdf-editor-stage,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-view-locked #pdfe-overlay{
  touch-action:none!important;
  overscroll-behavior:none!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-view-locked{
  overflow:hidden!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage{
  will-change:auto!important;
  max-width:none!important;
  max-height:none!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-pinching-page .pdf-editor-stage{
  will-change:transform!important;
  backface-visibility:hidden;
}
.pdfe-page-pin.is-pinning{animation:pdfe-pin-pop .28s ease}
.pdfe-pin-feedback{
  position:fixed;
  left:50%;
  top:76px;
  z-index:260;
  transform:translate(-50%,-7px);
  width:max-content;
  max-width:min(86vw,340px);
  padding:10px 14px;
  border:1px solid rgba(102,219,255,.34);
  border-radius:13px;
  background:#0b1b2b;
  color:#f7fbff;
  font-size:.68rem;
  font-weight:850;
  line-height:1.38;
  text-align:center;
  white-space:normal;
  box-shadow:0 12px 32px rgba(0,0,0,.25);
  opacity:0;
  pointer-events:none;
  transition:opacity .18s ease,transform .18s ease;
  backdrop-filter:none;
}
.pdfe-pin-feedback.is-visible{opacity:1;transform:translate(-50%,0)}
.pdf-editor-stage.is-pin-arrival{animation:pdfe-pin-arrival .3s ease}
.pdf-editor-thumb{position:relative}
.pdf-editor-thumb.is-pinned::after{
  content:"📌";
  position:absolute;
  top:7px;
  right:7px;
  display:grid;
  place-items:center;
  width:25px;
  height:25px;
  border:1px solid var(--line);
  border-radius:8px;
  background:var(--surface-strong);
  font-size:.72rem;
  box-shadow:0 5px 14px rgba(0,0,0,.18);
}
@keyframes pdfe-pin-pop{50%{transform:scale(1.12) rotate(-5deg)}}
@keyframes pdfe-pin-arrival{50%{box-shadow:0 0 0 5px color-mix(in srgb,var(--primary) 25%,transparent),0 22px 55px rgba(0,0,0,.28)}}

@media(max-width:620px){
  #panel-watermark .watermark-source-actions{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  #panel-watermark .watermark-source-actions .drop-zone-action{min-height:46px;padding:8px 7px;font-size:.76rem}
  .pdfe-pin-feedback{top:104px;font-size:.65rem}
  .pdf-editor-viewbar{gap:4px!important}
  .pdfe-pinned-jump{max-width:86px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
}
@media(max-width:960px),(pointer:coarse){
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-overflow-y .pdf-editor-stage{
    margin-bottom:max(260px,calc(72dvh + env(safe-area-inset-bottom)))!important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-pan-enabled,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-pan-enabled .pdf-editor-stage,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-pan-enabled #pdfe-overlay{
    touch-action:none!important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.has-mobile-obstruction{
    align-items:flex-start!important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.has-mobile-obstruction .pdf-editor-stage{
    margin-bottom:max(260px,calc(var(--pdfe-mobile-obstruction-height,0px) + 24px))!important;
  }
}
@media(prefers-reduced-motion:reduce){
  .workspace-route-loader-mark i,.pdfe-page-pin.is-pinning,.pdf-editor-stage.is-pin-arrival{animation:none!important}
  .pdfe-pin-feedback,.workspace-page button,.workspace-page .drop-zone-action{transition:none!important}
}

/* v150 — keep the mobile document below its controls and lock feedback readable */
.pdfe-pin-feedback{
  background:#0b1b2b!important;
  color:#f7fbff!important;
  border-color:rgba(102,219,255,.52)!important;
  text-shadow:0 1px 1px rgba(0,0,0,.32);
}
@media(max-width:700px){
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-main{
    display:grid!important;
    grid-template-rows:auto minmax(0,1fr)!important;
    align-content:stretch!important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-viewbar{
    position:relative!important;
    inset:auto!important;
    grid-row:1;
    width:calc(100% - 12px)!important;
    margin:5px 6px 0!important;
  }
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap{
    grid-row:2;
    width:100%!important;
    height:auto!important;
    min-height:0!important;
    padding:10px 7px calc(18px + env(safe-area-inset-bottom))!important;
    scroll-padding:10px 8px calc(24px + env(safe-area-inset-bottom))!important;
  }
}

/* v151 cascade endpoint — remove the duplicate square layer after all legacy rules. */
html[data-route-tool="pdf-editor"] body.task-first-document .tool-control-card,
html[data-route-tool="background-remover"] body.task-first-standalone .tool-control-card,
html[data-route-tool="watermark"] body.task-first-standalone .tool-control-card{
  padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important;overflow:visible!important;
}
html[data-route-tool="pdf-editor"] #panel-pdf-editor,
html[data-route-tool="background-remover"] #panel-background-remover,
html[data-route-tool="watermark"] #panel-watermark{
  border:0!important;background:transparent!important;box-shadow:none!important;
}
.workspace-page.task-first-bulk:not(.has-primary-file) .bulk-drop{
  padding:0!important;border:0!important;background:transparent!important;box-shadow:none!important;
}
#panel-watermark .watermark-source-actions{max-width:100%!important}
#panel-watermark .watermark-source-actions .drop-zone-action{
  min-width:0!important;max-width:none!important;width:100%!important;box-sizing:border-box!important;
}
html[data-route-tool="background-remover"] #bgrem-drop,
html[data-route-tool="watermark"] #panel-watermark:not(.has-tool-source) > .new-tool-drop,
.workspace-page.task-first-bulk:not(.has-primary-file) .bulk-picker{
  overflow:hidden!important;background-clip:padding-box!important;
}
@media(max-width:430px){
  #panel-watermark .watermark-source-actions{width:100%!important;grid-template-columns:repeat(2,minmax(0,1fr))!important}
}

/* v152 — one visible picker surface; no legacy white rectangle behind it. */
html[data-route-tool="pdf-editor"] #panel-pdf-editor > .pdf-drop-zone,
html[data-route-tool="background-remover"] #bgrem-drop,
html[data-route-tool="watermark"] #panel-watermark:not(.has-tool-source) > .new-tool-drop,
.workspace-page.task-first-bulk:not(.has-primary-file) .bulk-picker{
  margin-inline:auto!important;
  background:color-mix(in srgb,var(--panel) 88%,transparent)!important;
  box-shadow:none!important;
  border-radius:18px!important;
}
html[data-theme="light"][data-route-tool="pdf-editor"] #panel-pdf-editor > .pdf-drop-zone,
html[data-theme="light"][data-route-tool="background-remover"] #bgrem-drop,
html[data-theme="light"][data-route-tool="watermark"] #panel-watermark:not(.has-tool-source) > .new-tool-drop,
html[data-theme="light"] .workspace-page.task-first-bulk:not(.has-primary-file) .bulk-picker{
  background:#f8fcff!important;
}

/* v153 — the empty batch workflow has one surface, never a padded card behind it. */
.workspace-page.task-first-bulk:not(.has-primary-file) .tool-control-card{
  padding:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  overflow:visible!important;
}

/* v154 — restore the proven task card and align Passport with its workspace. */
.workspace-page.task-first-bulk:not(.has-primary-file) .tool-control-card{
  padding:18px!important;
  border:1px solid var(--line)!important;
  border-radius:18px!important;
  background:var(--surface)!important;
  box-shadow:0 18px 42px rgba(24,55,78,.14)!important;
  overflow:hidden!important;
}
html[data-theme="dark"] .workspace-page.task-first-bulk:not(.has-primary-file) .tool-control-card{
  box-shadow:0 18px 42px rgba(0,0,0,.28)!important;
}
@media(min-width:1025px){
  .workspace-page.task-first-passport .task-tool-header,
  .workspace-page.task-first-passport .workspace-grid{
    width:min(100%,920px)!important;
    max-width:920px!important;
    margin-inline:auto!important;
  }
}
@media(min-width:761px) and (max-width:1024px){
  .workspace-page.task-first-passport .task-tool-header,
  .workspace-page.task-first-passport .workspace-grid{
    width:min(100%,820px)!important;
    max-width:820px!important;
    margin-inline:auto!important;
  }
}
@media(max-width:760px){
  .workspace-page.task-first-bulk:not(.has-primary-file) .tool-control-card{padding:14px!important}
  .workspace-page.task-first-passport .task-tool-header,
  .workspace-page.task-first-passport .workspace-grid{width:100%!important}
}

/* ========================================================================== */
/* v155 — clean upload surfaces, responsive Watermark actions, editable pin   */
/* ========================================================================== */

/* The upload surface owns its rounding. Parent panels stay transparent so a
   square light rectangle cannot show behind the dashed card on any route. */
html[data-route-tool="image-to-text"] #panel-image-to-text,
html[data-route-tool="doc-scanner"] #panel-doc-scanner,
html[data-route-tool="favicon-generator"] #panel-favicon-generator,
html[data-route-tool="watermark"] #panel-watermark,
html[data-route-tool="background-remover"] #panel-background-remover{
  min-width:0!important;
  max-width:100%!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
}
html[data-route-tool="image-to-text"] #itt-drop,
html[data-route-tool="doc-scanner"] #scanner-drop,
html[data-route-tool="favicon-generator"] .favicon-upload-drop,
html[data-route-tool="watermark"] #panel-watermark:not(.has-tool-source)>.new-tool-drop,
html[data-route-tool="background-remover"] #bgrem-drop{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  margin-inline:auto!important;
  border-radius:18px!important;
  overflow:hidden!important;
  background-clip:padding-box!important;
  isolation:isolate;
}

/* Match the proven Target Size card rhythm: one rounded outer task card with
   an inset picker, never a full-bleed square layer. */
html[data-route-tool="bulk"] body.task-first-bulk:not(.has-primary-file) .tool-control-card{
  width:100%!important;
  padding:18px!important;
  border:1px solid var(--line)!important;
  border-radius:18px!important;
  background:var(--surface)!important;
  box-shadow:0 18px 42px rgba(24,55,78,.14)!important;
  overflow:hidden!important;
}
html[data-route-tool="bulk"] body.task-first-bulk:not(.has-primary-file) #panel-bulk,
html[data-route-tool="bulk"] body.task-first-bulk:not(.has-primary-file) .bulk-drop{
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  margin:0!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
  box-shadow:none!important;
}
html[data-route-tool="bulk"] body.task-first-bulk:not(.has-primary-file) .bulk-picker{
  width:100%!important;
  max-width:100%!important;
  min-width:0!important;
  margin:0!important;
  border-radius:16px!important;
  overflow:hidden!important;
  background-clip:padding-box!important;
}

/* Both Watermark sources always remain in their own grid tracks. */
#panel-watermark .watermark-source-actions{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:10px!important;
  width:min(100%,430px)!important;
  max-width:100%!important;
  min-width:0!important;
  margin:14px auto 0!important;
}
#panel-watermark .watermark-source-actions>.drop-zone-action{
  inline-size:100%!important;
  width:100%!important;
  min-width:0!important;
  max-width:100%!important;
  margin:0!important;
  padding-inline:10px!important;
  overflow:hidden!important;
  text-overflow:ellipsis;
  white-space:nowrap;
  box-sizing:border-box!important;
}

/* Page Pin freezes navigation, not the editable objects above the PDF. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-view-locked,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap.is-view-locked .pdf-editor-stage{
  touch-action:none!important;
  overscroll-behavior:none!important;
}
@media(max-width:760px){
  html[data-route-tool="bulk"] body.task-first-bulk:not(.has-primary-file) .tool-control-card{
    padding:12px!important;
    border-radius:17px!important;
  }
  #panel-watermark .watermark-source-actions{gap:8px!important}
  #panel-watermark .watermark-source-actions>.drop-zone-action{
    min-height:48px!important;
    padding-inline:8px!important;
    font-size:.72rem!important;
  }
}
@media(max-width:360px){
  #panel-watermark .watermark-source-actions{gap:6px!important}
  #panel-watermark .watermark-source-actions>.drop-zone-action{
    min-height:46px!important;
    padding-inline:6px!important;
    font-size:.67rem!important;
  }
}

/* v156 — UI-only alignment: keep selected added-text actions on one row. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-added-text-box.is-selected .pdf-text-delete,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-added-text-box.is-selected .pdf-text-edit{
  top:-40px!important;
  width:32px!important;
  height:32px!important;
  min-width:32px!important;
  min-height:32px!important;
}

/* v162 — one immediate, native source-picker pattern across image tools.
   Labels activate their file inputs synchronously, including before deferred
   tool scripts finish loading. Camera capture remains a separate explicit
   action only where a fresh photo is useful. */
.instant-source-actions{
  display:grid!important;
  grid-template-columns:repeat(2,minmax(0,1fr))!important;
  gap:10px!important;
  width:min(100%,470px)!important;
  max-width:100%!important;
  margin:14px auto 0!important;
}
.instant-source-actions>.drop-zone-action,
.instant-source-actions>.form-file-button{
  width:100%!important;
  min-width:0!important;
  max-width:none!important;
  min-height:48px!important;
  height:48px!important;
  margin:0!important;
  display:inline-flex!important;
  align-items:center!important;
  justify-content:center!important;
  box-sizing:border-box!important;
  touch-action:manipulation!important;
  -webkit-tap-highlight-color:transparent!important;
}
.instant-source-actions>.secondary-source-action,
.form-photo-source-actions>.form-file-button:last-child{
  border:1px solid color-mix(in srgb,var(--primary) 42%,var(--line))!important;
  background:color-mix(in srgb,var(--primary) 7%,var(--surface-strong))!important;
  color:var(--text)!important;
}
.form-photo-source-actions{width:100%!important;margin:4px 0 0!important}
#panel-watermark .watermark-source-actions{
  grid-template-columns:minmax(0,1fr)!important;
  width:min(100%,320px)!important;
}
#panel-watermark .watermark-source-actions>.drop-zone-action{
  min-height:48px!important;
  font-size:.82rem!important;
}
@media(max-width:560px){
  .instant-source-actions{
    grid-template-columns:minmax(0,1fr)!important;
    width:100%!important;
    gap:8px!important;
  }
  .instant-source-actions>.drop-zone-action,
  .instant-source-actions>.form-file-button{
    min-height:52px!important;
    height:52px!important;
  }
}

/* v158 — targeted interaction and theme fixes. */
#panel-qr-code #qr-camera-toggle.is-active{
  border-color:color-mix(in srgb,var(--primary) 58%,var(--line))!important;
  background:color-mix(in srgb,var(--primary) 13%,var(--surface-strong))!important;
  color:var(--primary)!important;
}

/* v164 — QR live scanning uses a dedicated full-screen camera surface.
   The decoder and local frame-processing loop stay unchanged; this layer only
   gives the camera a focused, payment-app-style viewport on every device. */
body.qr-camera-open{overflow:hidden!important;overscroll-behavior:none}
#panel-qr-code .qr-camera-wrap[hidden]{display:none!important}
#panel-qr-code .qr-camera-wrap{
  position:fixed!important;
  inset:0!important;
  z-index:5000!important;
  display:block!important;
  width:100vw!important;
  max-width:none!important;
  height:100vh!important;
  height:100dvh!important;
  max-height:none!important;
  margin:0!important;
  overflow:hidden!important;
  border:0!important;
  border-radius:0!important;
  background:#02070c!important;
  color:#fff;
  isolation:isolate;
  touch-action:none;
}
#panel-qr-code .qr-camera-wrap::before{
  content:"";
  position:absolute;
  inset:0;
  z-index:1;
  pointer-events:none;
  background:linear-gradient(180deg,rgba(0,0,0,.72) 0,rgba(0,0,0,.08) 24%,rgba(0,0,0,.02) 62%,rgba(0,0,0,.78) 100%);
}
#panel-qr-code .qr-camera-wrap video{
  position:absolute;
  inset:0;
  z-index:0;
  display:block;
  width:100%!important;
  height:100%!important;
  max-height:none!important;
  object-fit:cover;
  background:#02070c;
}
#panel-qr-code .qr-camera-topbar{
  position:absolute;
  top:0;
  left:0;
  right:0;
  z-index:4;
  display:grid;
  grid-template-columns:46px minmax(0,1fr) auto;
  align-items:center;
  gap:12px;
  min-height:72px;
  padding:calc(12px + env(safe-area-inset-top,0px)) max(16px,env(safe-area-inset-right,0px)) 12px max(16px,env(safe-area-inset-left,0px));
}
#panel-qr-code .qr-camera-topbar>div{min-width:0;text-align:left}
#panel-qr-code .qr-camera-topbar strong,
#panel-qr-code .qr-camera-topbar small{display:block;color:#fff}
#panel-qr-code .qr-camera-topbar strong{font-size:1rem;line-height:1.25}
#panel-qr-code .qr-camera-topbar small{margin-top:3px;color:rgba(255,255,255,.74);font-size:.72rem;line-height:1.35;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#panel-qr-code .qr-camera-close{
  position:relative;
  display:grid;
  place-items:center;
  width:44px;
  height:44px;
  padding:0;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.28);
  border-radius:50%;
  background:rgba(0,0,0,.64);
  color:transparent;
  font-size:0;
  line-height:0;
  cursor:pointer;
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
#panel-qr-code .qr-camera-close::before,
#panel-qr-code .qr-camera-close::after{
  content:"";
  position:absolute;
  left:50%;
  top:50%;
  width:17px;
  height:2px;
  border-radius:999px;
  background:#fff;
  transform-origin:50% 50%;
}
#panel-qr-code .qr-camera-close::before{transform:translate(-50%,-50%) rotate(45deg)}
#panel-qr-code .qr-camera-close::after{transform:translate(-50%,-50%) rotate(-45deg)}
#panel-qr-code .qr-camera-close:focus-visible,
#panel-qr-code .qr-camera-gallery:focus-visible{outline:3px solid #72e6ff;outline-offset:3px}
#panel-qr-code .qr-camera-local-badge{
  display:inline-flex;
  align-items:center;
  min-height:30px;
  padding:0 10px;
  border:1px solid rgba(255,255,255,.22);
  border-radius:999px;
  background:rgba(0,0,0,.48);
  color:rgba(255,255,255,.86);
  font-size:.62rem;
  font-weight:900;
  letter-spacing:.08em;
}
#panel-qr-code .qr-camera-target{
  position:absolute;
  inset:0;
  z-index:3;
  display:grid;
  place-items:center;
  pointer-events:none;
}
#panel-qr-code .qr-camera-frame{
  position:relative!important;
  inset:auto!important;
  display:block;
  width:min(68vw,380px);
  aspect-ratio:1;
  border:0!important;
  border-radius:26px!important;
  box-shadow:0 0 0 999vmax rgba(0,0,0,.22)!important;
  overflow:hidden;
}
#panel-qr-code .qr-camera-frame::before,
#panel-qr-code .qr-camera-frame::after{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  pointer-events:none;
}
#panel-qr-code .qr-camera-frame::before{
  border:2px solid rgba(255,255,255,.34);
  background:
    linear-gradient(#72e6ff,#72e6ff) left top/42px 4px no-repeat,
    linear-gradient(#72e6ff,#72e6ff) left top/4px 42px no-repeat,
    linear-gradient(#72e6ff,#72e6ff) right top/42px 4px no-repeat,
    linear-gradient(#72e6ff,#72e6ff) right top/4px 42px no-repeat,
    linear-gradient(#72e6ff,#72e6ff) left bottom/42px 4px no-repeat,
    linear-gradient(#72e6ff,#72e6ff) left bottom/4px 42px no-repeat,
    linear-gradient(#72e6ff,#72e6ff) right bottom/42px 4px no-repeat,
    linear-gradient(#72e6ff,#72e6ff) right bottom/4px 42px no-repeat;
}
#panel-qr-code .qr-camera-frame>i{
  position:absolute;
  left:10%;
  right:10%;
  top:18%;
  height:2px;
  border-radius:2px;
  background:#72e6ff;
  box-shadow:0 0 14px rgba(114,230,255,.9);
  animation:qr-camera-scan-line 2.2s ease-in-out infinite alternate;
}
#panel-qr-code .qr-camera-wrap.is-starting .qr-camera-frame>i{animation-play-state:paused;opacity:.35}
@keyframes qr-camera-scan-line{to{transform:translateY(calc(min(68vw,380px) * .64))}}
#panel-qr-code .qr-camera-bottom-bar{
  position:absolute;
  left:0;
  right:0;
  bottom:0;
  z-index:4;
  display:grid;
  justify-items:center;
  gap:14px;
  padding:20px max(18px,env(safe-area-inset-right,0px)) calc(20px + env(safe-area-inset-bottom,0px)) max(18px,env(safe-area-inset-left,0px));
  text-align:center;
}
#panel-qr-code .qr-camera-bottom-bar p{margin:0;color:rgba(255,255,255,.88);font-size:.82rem;font-weight:750}
#panel-qr-code .qr-camera-gallery{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:min(100%,280px);
  min-height:48px;
  padding:10px 20px;
  border:1px solid rgba(255,255,255,.34);
  border-radius:14px;
  background:rgba(0,0,0,.62);
  color:#fff;
  font-size:.8rem;
  font-weight:850;
  cursor:pointer;
  backdrop-filter:blur(10px);
  -webkit-tap-highlight-color:transparent;
  touch-action:manipulation;
}
@media(max-width:520px){
  #panel-qr-code .qr-camera-topbar{grid-template-columns:44px minmax(0,1fr);padding-inline:14px}
  #panel-qr-code .qr-camera-local-badge{display:none}
  #panel-qr-code .qr-camera-frame{width:min(78vw,340px);border-radius:22px!important}
  @keyframes qr-camera-scan-line{to{transform:translateY(calc(min(78vw,340px) * .64))}}
  #panel-qr-code .qr-camera-bottom-bar{padding-inline:20px}
  #panel-qr-code .qr-camera-gallery{width:100%;max-width:360px}
}
@media(prefers-reduced-motion:reduce){#panel-qr-code .qr-camera-frame>i{animation:none;top:50%}}

#panel-watermark .watermark-camera-action{
  color:var(--text)!important;
  text-shadow:none!important;
}

#panel-pdf-converter .pdfc-crop-stage,
#panel-pdf-converter .pdfc-crop-stage.is-ready{
  max-width:720px!important;
  max-height:min(62vh,600px)!important;
}

body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar{
  scrollbar-width:thin;
  scrollbar-color:color-mix(in srgb,var(--primary) 70%,var(--text-muted)) color-mix(in srgb,var(--surface-strong) 88%,transparent);
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap::-webkit-scrollbar,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar::-webkit-scrollbar,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector::-webkit-scrollbar,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar::-webkit-scrollbar{
  width:9px;
  height:9px;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap::-webkit-scrollbar-track,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar::-webkit-scrollbar-track,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector::-webkit-scrollbar-track,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar::-webkit-scrollbar-track{
  background:color-mix(in srgb,var(--surface-strong) 88%,transparent);
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage-wrap::-webkit-scrollbar-thumb,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-sidebar::-webkit-scrollbar-thumb,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-inspector::-webkit-scrollbar-thumb,
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-context-formatbar::-webkit-scrollbar-thumb{
  border:2px solid color-mix(in srgb,var(--surface-strong) 88%,transparent);
  border-radius:999px;
  background:color-mix(in srgb,var(--primary) 72%,var(--text-muted));
}

@media(max-width:720px){
  #panel-pdf-converter .pdfc-crop-stage,
  #panel-pdf-converter .pdfc-crop-stage.is-ready{
    max-width:100%!important;
    max-height:58vh!important;
  }
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-added-text-box.is-selected .pdf-text-delete{right:-10px!important}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-added-text-box.is-selected .pdf-text-edit{right:26px!important}
@media(max-width:640px){
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-added-text-box.is-selected .pdf-text-delete,
  body.pdfe-fullscreen-mode #pdfe-workspace .pdf-added-text-box.is-selected .pdf-text-edit{top:-42px!important}
}


/* v19 — brand palette alignment; visual only. */
.workspace-page{
  background:
    radial-gradient(circle at 88% 4%,rgba(24,207,227,.09),transparent 29%),
    radial-gradient(circle at 8% 22%,rgba(11,103,242,.055),transparent 30%),
    var(--bg);
}
.workspace-card{
  background:linear-gradient(145deg,color-mix(in srgb,var(--surface) 94%,#0b67f2 6%),color-mix(in srgb,var(--bg-soft) 96%,#18c5a9 4%));
}
html[data-theme="light"] .workspace-card{
  background:linear-gradient(145deg,#ffffff,#f0f7fb);
  box-shadow:0 20px 55px rgba(7,42,82,.09);
}
.upload-glyph,
.pdf-editor-toolbar button.is-active{
  background:linear-gradient(135deg,var(--brand-cyan),var(--brand-blue))!important;
}


/* v34: tool menus must always open above object context bars. */
body.pdfe-fullscreen-mode #pdfe-workspace .pdfe-tool-popover,
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-more-tools > .advanced-options-content.pdfe-tool-popover{z-index:5600!important}


/* =========================================================
   v36 — existing PDF text editing: clean selection geometry
   The selectable PDF.js hit box can be shorter than the glyphs. Drawing a
   border around that geometry can cross through the text itself. Highlight
   with a quiet fill only; never draw a line through the edited run.
========================================================= */
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage[data-text-edit="true"] .pdf-existing-text-hit{
  border-color:transparent!important;
  box-shadow:none!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage[data-text-edit="true"] .pdf-existing-text-hit:not(.is-editing):not(.is-edited){
  background:transparent!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-editor-stage[data-text-edit="true"] .pdf-existing-text-hit:not(.is-editing):not(.is-edited):hover{
  background:rgba(114,230,255,.08)!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-hit.is-editing{
  border:0!important;
  outline:0!important;
  box-shadow:none!important;
  border-radius:2px!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-hit.is-edited:not(.is-editing){
  border:0!important;
  outline:0!important;
  box-shadow:none!important;
}
body.pdfe-fullscreen-mode #pdfe-workspace .pdf-existing-text-hit.is-overflowing{
  border:0!important;
  outline:0!important;
  box-shadow:none!important;
  background-image:linear-gradient(to bottom,transparent calc(100% - 2px),rgba(255,184,77,.78) 0)!important;
  background-repeat:no-repeat!important;
}
