/* Editor authority. Keep the document, tools and conversation on one palette.
   Loaded last so legacy uploaded-state rules cannot change the selected theme. */
/* More keeps common actions visible; secondary controls expand by task. */
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more #workspaceActions>button,html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more-content>button { min-height: 44px !important; font-weight: 500 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more #workspaceActions>.document-menu-group { display: block !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more-content .document-menu-group { grid-column: 1 / -1; width: 100%; margin: 6px 0 0; border: 1px solid var(--editor-line); border-radius: 7px; background: var(--editor-surface); color: var(--editor-ink); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-menu-group>summary { display: list-item !important; padding: 12px !important; min-height: 44px !important; cursor: pointer; font: 500 13px/1.5 var(--font-body) !important; color: var(--editor-ink) !important; background: transparent !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-menu-options { display: grid; gap: 6px; padding: 8px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-menu-options button { display: inline-flex !important; align-items: center; justify-content: flex-start; gap: 6px; min-height: 44px !important; width: 100% !important; font-weight: 500 !important; color: var(--editor-ink) !important; background: var(--editor-surface) !important; border: 1px solid var(--editor-line) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more .document-edit-tools .viewport-edit-tools { display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)); padding: 0 !important; gap: 6px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more .document-menu-options .preview-toolbar { margin: 0 !important; padding: 0 !important; }
/* Empty workspace: one file choice, then optional tasks and help. Loaded and
   restored documents keep their existing controls and conversation layout. */
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) #dropScreen .entry-hero { background: transparent !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) #mainDropZone > p { display: block !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) #entryAssistantButton { color: var(--editor-ink) !important; background: var(--editor-surface) !important; border-color: var(--editor-line) !important; font-weight: 500 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) #free-download-limits nav a { background: transparent !important; border: 0 !important; border-radius: 0 !important; padding: 0 !important; font-weight: 500 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .topbar .brand { display: inline-flex !important; align-items: center !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) #dropScreen::before, #dropScreen::after { content: none !important; display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) #dropScreen > * { order: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .entry-hero, .entry-hero p, .drop-panel > p { display: block !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .entry-hero h2 { font-family: inherit !important; font-weight: 600 !important; color: var(--editor-ink) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) #dropScreen { background: transparent !important; box-shadow: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .drop-panel { margin: 0 !important; background: var(--editor-surface) !important; color: var(--editor-ink) !important; border: 1px dashed var(--editor-line) !important; box-shadow: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .drop-panel > svg { padding: 0 !important; background: transparent !important; color: var(--editor-muted) !important; filter: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) #dropOpenButton { order: 0 !important; width: 100% !important; min-height: 48px !important; padding: 10px 16px !important; background: var(--editor-accent) !important; color: var(--editor-accent-ink) !important; font-size: 16px !important; font-weight: 600 !important; border-radius: 7px !important; box-shadow: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-start-panel button { background: var(--editor-surface) !important; color: var(--editor-ink) !important; }
@media(max-width:760px) { html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-menu-button { display: flex !important; } }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) :is(.left-rail,.sidebar-resizer,#mobileModeTabs,.toolbar) { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .top-actions > :not(#accountButton):not(#supportButton):not(#accountMenu) { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:not(.assistant-open):has(.app-shell) .inspector { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .app-shell { grid-template-columns: minmax(0,1fr) !important; grid-template-rows: auto 1fr !important; height: auto !important; min-height: 100dvh !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .topbar { display: flex !important; flex-wrap: nowrap !important; grid-column: 1 !important; grid-row: 1 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .top-actions { margin-left: auto !important; width: auto !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .workspace { grid-column: 1 !important; grid-row: 2 !important; width: 100% !important; padding: 24px 16px !important; overflow: visible !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) #dropScreen { display: flex !important; flex-direction: column !important; align-items: stretch !important; gap: 16px !important; width: min(100%,600px) !important; margin: 0 auto !important; padding: 0 !important; min-height: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .entry-hero { margin: 0 !important; padding: 0 !important; text-align: center !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .entry-hero h2 { font-size: clamp(26px,4vw,36px) !important; margin: 0 0 8px !important; line-height: 1.2 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .entry-hero p { margin: 0 !important; font-size: 15px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .drop-panel { display: flex !important; flex-direction: column !important; align-items: center !important; gap: 12px !important; padding: 24px 20px !important; width: 100% !important; min-height: 0 !important; border-radius: 12px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .drop-panel > svg { width: 36px !important; height: 36px !important; margin: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .drop-panel > p { margin: 0 !important; font-size: 14px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-drop-promise { display: block !important; max-width: 420px !important; margin: 0 !important; font-size: 12px !important; line-height: 1.6 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) :is(.mobile-drop-promise a,.mobile-empty-footer a) { color: var(--editor-accent) !important; text-decoration: underline !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .entry-assistant-button { align-self: center; min-height: 44px; padding: 8px 16px; color: var(--editor-ink); background: var(--editor-surface); border: 1px solid var(--editor-line); border-radius: 7px; font-size: 14px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-start-panel { display: grid !important; grid-template-columns: repeat(4,minmax(0,1fr)) !important; gap: 8px !important; margin: 0 !important; padding: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-start-panel button { display: flex !important; flex-direction: column !important; gap: 4px !important; align-items: center !important; min-height: 60px !important; padding: 10px 4px !important; border: 1px solid var(--editor-line) !important; border-radius: 7px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-start-panel :is(.mobile-tool-icon,button>span:last-child) { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-start-panel strong { font-size: 13px !important; font-weight: 500 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-empty-footer { display: block !important; margin: 0 !important; padding: 16px 0 !important; border: 0 !important; background: transparent !important; text-align: center !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-empty-footer p { font-size: 12px !important; margin: 0 0 10px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-empty-footer nav { display: flex !important; justify-content: center !important; gap: 16px !important; flex-wrap: wrap !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-empty-footer a { font-size: 13px !important; min-height: 44px !important; display: inline-flex !important; align-items: center !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"].assistant-open:has(.app-shell) .inspector { display: flex !important; position: fixed !important; inset: 0 !important; width: min(100%,780px) !important; height: 100dvh !important; max-height: 100dvh !important; margin: auto !important; z-index: 40 !important; padding: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"].assistant-open:has(.app-shell) #agentPanel { width: 100% !important; height: 100% !important; max-height: 100dvh !important; }
@media(max-width:760px) {
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .top-actions { display: none !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor)[data-has-docs="false"]:has(.app-shell) .mobile-menu-button { margin-left: auto !important; }
}
.checkout-reward.is-recovery {
  top: auto;
  bottom: calc(82px + env(safe-area-inset-bottom));
  pointer-events: auto;
  max-height: calc(100dvh - 130px);
  overflow: auto;
  background: var(--editor-surface, #fff);
  color: var(--editor-ink, #17272c);
  border-color: var(--editor-line, #ccd8dc);
}
.checkout-recovery-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  margin-top: 12px;
}
.checkout-recovery-actions[hidden] { display: none; }
.checkout-recovery-actions [hidden] { display: none; }
.checkout-recovery-actions button {
  min-height: 44px;
  padding: 8px 12px;
  font-size: 14px;
  color: var(--editor-accent-ink, #fff);
  background: var(--editor-accent, #087f72);
  border: 1px solid var(--editor-accent, #087f72);
  border-radius: 7px;
}
.checkout-recovery-actions a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 0;
  color: var(--editor-accent, #087f72);
  text-decoration: underline;
  text-underline-offset: 3px;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #checkoutRewardRetry {
  min-height: 44px !important;
  background: var(--editor-accent) !important;
  color: var(--editor-accent-ink) !important;
  border-color: var(--editor-accent) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .restored-export-icon {
  background: var(--editor-accent-soft) !important;
  color: var(--editor-accent) !important;
  border-color: var(--editor-line) !important;
}
@media (prefers-reduced-motion: reduce) {
  .checkout-reward { transition: none; }
}
/* The signing dialog shares the workspace palette; white paper previews the actual mark. */
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureModal {
  padding: 12px !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureModal .signature-modal {
  width: min(620px,100%) !important;
  max-height: calc(100dvh - 24px) !important;
  padding: 20px !important;
  overflow: auto !important;
  background: var(--editor-surface) !important;
  color: var(--editor-ink) !important;
  border: 1px solid var(--editor-line) !important;
  border-radius: 16px !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureModal h2 {
  margin: 0 48px 16px 0 !important;
  color: var(--editor-ink) !important;
  font: 500 22px/1.3 var(--font-body) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureModal button {
  min-height: 44px !important;
  padding: 8px 14px !important;
  background: var(--editor-soft) !important;
  color: var(--editor-ink) !important;
  border: 1px solid var(--editor-line) !important;
  border-radius: 10px !important;
  font: 500 14px/1.4 var(--font-body) !important;
  box-shadow: none !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureModal .modal-close {
  width: 44px !important;
  top: 8px !important;
  right: 8px !important;
  font-size: 24px !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureModal .signature-modes {
  display: flex !important;
  gap: 8px !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureModal button[aria-pressed=true] {
  border-color: var(--editor-ink) !important;
  background: var(--editor-surface) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureNameField:not([hidden]) {
  display: grid !important;
  gap: 6px !important;
  margin-top: 12px !important;
  color: var(--editor-ink) !important;
  font: 400 14px/1.4 var(--font-body) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureName {
  width: 100% !important;
  min-height: 44px !important;
  padding: 8px 12px !important;
  background: var(--editor-surface) !important;
  color: var(--editor-ink) !important;
  border: 1px solid var(--editor-line) !important;
  border-radius: 8px !important;
  font: 400 16px/1.4 var(--font-body) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureCanvas {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 620 / 220 !important;
  margin: 12px 0 !important;
  background: #fff !important;
  border: 1px solid #76858c !important;
  border-radius: 8px !important;
  touch-action: none !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureStatus {
  margin: 0 0 12px !important;
  color: var(--editor-muted) !important;
  font: 400 13px/1.5 var(--font-body) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureModal #saveSignatureButton {
  background: var(--editor-accent) !important;
  color: var(--editor-accent-ink) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureModal #saveSignatureButton:disabled {
  background: var(--editor-soft) !important;
  color: var(--editor-muted) !important;
  opacity: 1 !important;
  cursor: not-allowed !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #signatureModal :is(button,input):focus-visible {
  outline: 2px solid var(--editor-ink) !important;
  outline-offset: 2px !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) {
  --editor-bg: #f4f6f7;
  --editor-surface: #ffffff;
  --editor-soft: #edf2f3;
  --editor-ink: #17272c;
  --editor-muted: #53666e;
  --editor-line: #ccd8dc;
  --editor-accent: #087f72;
  --editor-accent-ink: #ffffff;
  --editor-accent-soft: #e7f5f1;
  --editor-danger: #ac363d;
  --editor-warning: #80570f;
  --bg: var(--editor-bg);
  --surface: var(--editor-surface);
  --surface-soft: var(--editor-soft);
  --panel: var(--editor-surface);
  --panel-strong: var(--editor-surface);
  --text: var(--editor-ink);
  --muted: var(--editor-muted);
  --text-muted: var(--editor-muted);
  --border: var(--editor-line);
  --line: var(--editor-line);
  --accent: var(--editor-accent);
  --ink: var(--editor-ink);
  --ui-fill: var(--editor-surface);
  --ui-ink: var(--editor-ink);
  --ui-muted: var(--editor-muted);
  --ui-edge: var(--editor-line);
  --chat-bg: var(--editor-bg);
  --chat-surface: var(--editor-surface);
  --chat-ink: var(--editor-ink);
  --chat-muted: var(--editor-muted);
  --chat-edge: var(--editor-line);
  --chat-tint: var(--editor-soft);
  --chat-accent: var(--editor-accent);
  --chat-on-accent: var(--editor-accent-ink);
  --font-body: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
  background: var(--editor-bg) !important;
  color: var(--editor-ink) !important;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  font-size: 14px !important;
  line-height: 1.5;
}
html[data-bitepdf-theme="dark"] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) {
  --editor-bg: #141a20;
  --editor-surface: #1c252c;
  --editor-soft: #26323a;
  --editor-ink: #f0f5f7;
  --editor-muted: #b2c2ca;
  --editor-line: #46565f;
  --editor-accent: #66d5c2;
  --editor-accent-ink: #102925;
  --editor-accent-soft: #203c37;
  --editor-danger: #ff9da4;
  --editor-warning: #f0ce8d;
  color-scheme: dark;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) * { box-sizing: border-box; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(h1,h2,h3,strong,b) {
  color: var(--editor-ink) !important;
  font-weight: 600 !important;
  letter-spacing: normal !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(button,input,select,textarea,summary) {
  font-family: inherit !important;
  letter-spacing: normal !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(button,summary) { font-weight: 550 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(button,a,input,select,textarea,summary):focus-visible {
  outline: 3px solid var(--editor-accent) !important;
  outline-offset: 3px !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.app-shell,.workspace,#editorScreen,.preview-stage,.compare-stage,.page-sidebar,.page-rail) {
  min-width: 0 !important;
  background: var(--editor-bg) !important;
  color: var(--editor-ink) !important;
  background-image: none !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.topbar,.toolbar,.top-actions,.left-rail,.sidebar,.inspector,.agent-panel,.agent-head,.agent-session,.agent-ai-box,.preview-toolbar,.workspace-actions,.quick-target-form,.status-strip,.result-dock,.mobile-drawer-sheet,.mobile-drawer-account,.mobile-drawer-pricing,.document-more-content,.document-tools-panel) {
  background: var(--editor-surface) !important;
  color: var(--editor-ink) !important;
  border-color: var(--editor-line) !important;
  box-shadow: none !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(p,small,.hint,.eyebrow,#statusText,#agentSignal,.document-tools-status,.document-ocr-count) {
  color: var(--editor-muted) !important;
  background: transparent !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.tool-button,.icon-button,.rail-icon-button,.workspace-actions button,.workspace-more summary,.document-tools button,.document-more>summary,.agent-composer-actions button,.mobile-menu-button,.mobile-drawer button,.page-dock button,.result-dock button) {
  min-height: 36px !important;
  color: var(--editor-ink) !important;
  background: var(--editor-surface) !important;
  border: 1px solid var(--editor-line) !important;
  border-radius: 7px !important;
  box-shadow: none !important;
  font-size: 13px !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) button svg { stroke: currentColor !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(button,summary):hover:not(:disabled) { background: var(--editor-soft) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) button:disabled { opacity: .55 !important; cursor: not-allowed; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(input,select,textarea) {
  color: var(--editor-ink) !important;
  background: var(--editor-surface) !important;
  border-color: var(--editor-line) !important;
  font-size: 14px !important;
  box-shadow: none !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(input,textarea)::placeholder { color: var(--editor-muted) !important; opacity: 1; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(input[type=checkbox],input[type=range]) { accent-color: var(--editor-accent); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(#downloadButton,#agentAiButton,#resultActionButton,.document-save,.primary-drop-button,.agent-apply-button) {
  background: var(--editor-accent) !important;
  color: var(--editor-accent-ink) !important;
  border-color: var(--editor-accent) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(#downloadButton,#agentAiButton,#resultActionButton,.document-save,.primary-drop-button,.agent-apply-button) :is(span,strong,b,small) { color: inherit !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(#downloadButton,#agentAiButton,#resultActionButton,.document-save,.primary-drop-button,.agent-apply-button):hover:not(:disabled) { filter: brightness(.93); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-save img { filter: brightness(0) invert(1); }
html[data-bitepdf-theme="dark"] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-save img { filter: brightness(0); }
html[data-bitepdf-theme="dark"] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.document-tools-bar,.document-more,.agent-composer-actions,.agent-head) img:not(.document-save img) { filter: brightness(0) invert(1); }
html[data-bitepdf-theme="dark"] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-panel button img { filter: brightness(0) invert(1); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.danger-soft,.remove-visible-page,.document-tools-bar>button[aria-label^="Remove"],.document-tools-bar>button[aria-label^="Stop"]) { color: var(--editor-danger) !important; }

/* One compact file bar, one operation row, then the document. */
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-taskbar {
  display: flex; gap: 6px; margin-bottom: 6px; min-width: 0;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-taskbar[hidden] { display: none; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-taskbar button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px !important; padding: 8px 12px !important; white-space: nowrap;
  color: var(--editor-ink) !important; font-size: 13px !important;
}
html[data-bitepdf-theme="dark"] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-taskbar img { filter: brightness(0) invert(1); }
@media(max-width:760px) {
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-taskbar button {
    flex: 1 1 0; min-width: 0; padding: 8px 4px !important; gap: 4px;
  }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-taskbar img { width: 16px; height: 16px; }
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .topbar { min-height: 58px !important; padding: 8px 16px !important; gap: 16px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .brand { width: 146px !important; min-width: 146px !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .brand-logo-full { max-width: 146px !important; max-height: 38px !important; object-fit: contain; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .toolbar { padding: 0 !important; gap: 6px !important; border: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .top-actions { padding: 0 !important; gap: 6px !important; border: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .tool-button { padding: 7px 10px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editorScreen { padding: 12px !important; gap: 8px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .preview-toolbar { padding: 6px 10px !important; gap: 10px !important; min-height: 44px !important; border-radius: 7px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .preview-toolbar :is(p,strong) { font-size: 12px !important; margin: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .zoom-tools { flex-wrap: nowrap !important; gap: 4px !important; width: auto !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .zoom-tools>button { width: 34px !important; min-width: 34px !important; height: 34px !important; min-height: 34px !important; padding: 6px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .zoom-tools #zoomResetButton { width: auto !important; min-width: 44px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #workspaceActions { padding: 5px !important; gap: 4px !important; flex-wrap: wrap !important; border-radius: 7px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #workspaceActions>button { padding: 7px 10px !important; min-height: 34px !important; flex: 0 1 auto !important; font-size: 13px !important; }
/* Legacy mobile rules hide later toolbar children. These secondary actions
   must remain reachable inside More, including after a prepared result. */
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more #workspaceActions>button:is([data-workspace-action="compare"],[data-workspace-action="humanize"],[data-workspace-action="rewrite"]) {
  display: inline-flex !important;
  min-height: 44px !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .size-target-disclosure { flex: 0 0 auto; border: 1px solid var(--editor-line); border-radius: 7px; background: var(--editor-surface); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .size-target-disclosure>summary { display: flex; gap: 10px; align-items: center; min-height: 36px; padding: 7px 10px; cursor: pointer; color: var(--editor-ink); font-size: 13px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .size-target-disclosure>summary::before { content: "›"; font-size: 20px; line-height: 1; color: var(--editor-muted); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .size-target-disclosure[open]>summary::before { transform: rotate(90deg); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .size-target-disclosure>summary span { color: var(--editor-muted); font-size: 12px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #quickTargetForm { padding: 10px !important; gap: 8px !important; margin: 0 !important; border: 0 !important; border-top: 1px solid var(--editor-line) !important; border-radius: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #quickTargetForm input[type=number] { height: 36px !important; padding: 6px 8px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #quickTargetForm select { height: 36px !important; padding: 6px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #quickTargetForm label { color: var(--editor-ink) !important; font-size: 13px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #quickTargetForm small { display: block !important; color: var(--editor-muted); font-size: 12px; line-height: 1.5; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-body #quickTargetForm { display: grid !important; grid-template-columns: minmax(0,1fr) 80px; padding: 0 !important; border: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-body #quickTargetForm :is(label,button,small) { grid-column: 1 / -1; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-body #quickTargetForm :is(input[type=number],select) { width: 100% !important; height: 44px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #quickTargetForm :is(button,.quick-target-quality) { min-height: 44px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools { background: transparent !important; color: var(--editor-ink) !important; min-height: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-bar { min-height: 44px !important; padding: 4px 0 !important; gap: 5px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-filename { max-width: 200px; min-width: 0; color: var(--editor-muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-bar>button:not(.document-save) { width: 36px !important; min-width: 36px !important; padding: 7px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-page-control { margin-right: auto !important; gap: 4px !important; color: var(--editor-muted) !important; font-size: 12px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-page-control input { width: 42px !important; height: 36px !important; min-height: 36px !important; padding: 4px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more>summary { width: 36px !important; height: 36px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more-content { padding: 12px !important; width: 300px !important; max-height: min(620px,65dvh,calc(100dvh - 150px)) !important; overflow-y: auto !important; border-radius: 8px !important; box-shadow: 0 12px 28px #0002 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more-content h3 { font-size: 12px !important; margin: 0 0 8px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-surface { min-height: 0 !important; gap: 10px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-surface:has(.document-tools-panel:not([hidden])) { grid-template-columns: minmax(0,1fr) minmax(280px,330px); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .preview-stage { flex: 1 1 auto !important; min-height: 320px !important; border: 1px solid var(--editor-line) !important; border-radius: 8px !important; padding: 16px !important; }
/* Comparison replaces the single canvas; author display rules must not reveal
   its empty frame above the actual before/after documents. */
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(#previewFrame,#compareStage)[hidden] { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools .preview-stage { min-height: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .preview-frame { border: 0 !important; border-radius: 1px !important; background: white !important; box-shadow: 0 3px 16px #0002 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .status-strip { flex: 0 0 auto !important; padding: 7px 10px !important; min-height: 32px !important; border-radius: 7px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .status-strip :is(p,strong,span,#statusText) { font-size: 12px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-dock { display: grid !important; width: 100% !important; max-width: none !important; grid-template-columns: minmax(0,1fr) auto auto !important; padding: 8px 12px !important; gap: 6px 12px !important; margin: 0 !important; border-radius: 7px !important; box-shadow: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-dock[hidden] { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-dock>div { grid-column: 1 !important; grid-row: 1 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #resultEyebrow { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-dock h3 { font-size: 15px !important; line-height: 1.35 !important; margin: 0 !important; font-weight: 550 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #resultSummary { font-size: 12px !important; margin: 2px 0 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-details>summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--editor-muted); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-details>summary::before { content: "›"; font-size: 18px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-details[open] { grid-column: 1 / -1; grid-row: 2; border-top: 1px solid var(--editor-line); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-details[open]>summary::before { transform: rotate(90deg); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #resultActionButton { grid-column: 3; grid-row: 1; min-height: 44px !important; font-size: 13px !important; padding: 8px 12px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #resultWarning { grid-column: 1 / -1; margin: 0 !important; font-size: 13px !important; color: var(--editor-danger) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #resultWarning[hidden] { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #resultWarning[data-tone="info"] { color: var(--editor-muted) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #resultSizeOptions { grid-column: 1 / -1; justify-self: start; min-height: 44px !important; padding: 8px 12px; color: var(--editor-ink); background: var(--editor-surface); border: 1px solid var(--editor-line); border-radius: 7px; font-size: 13px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #resultSizeOptions[hidden] { display: none !important; }
@media(max-width:760px) {
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-dock { grid-template-columns: minmax(0,1fr) auto !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-dock>div { grid-column: 1 / -1 !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #resultActionButton { grid-column: 2; grid-row: 2; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-details[open] { grid-row: 3; }
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.result-stats>span,.result-stats>div,.file-chip,.page-row,.document-panel,.rail-disclosure,.queue-summary,.restored-export-panel) { background: var(--editor-surface) !important; color: var(--editor-ink) !important; border-color: var(--editor-line) !important; border-radius: 7px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.file-chip small,.file-chip strong,.page-meta,.page-row strong) { color: var(--editor-ink) !important; background: transparent !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.file-chip.active,.page-row.active,button[aria-pressed=true]) { background: var(--editor-accent-soft) !important; color: var(--editor-ink) !important; border-color: var(--editor-accent) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.workspace-dot,.workspace-dot.add) { color: var(--editor-ink) !important; background: var(--editor-surface) !important; border-color: var(--editor-line) !important; font-weight: 550 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .workspace-dot.active { background: var(--editor-accent-soft) !important; border-color: var(--editor-accent) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .workspace-file-dot { width: 44px !important; height: 44px !important; min-width: 44px !important; min-height: 44px !important; padding: 0 !important; border: 0 !important; border-radius: 7px; color: var(--editor-muted) !important; background: transparent !important; font-size: 24px !important; position: relative; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .workspace-file-dot::before { content: ""; position: absolute; left: 12px; top: 0; bottom: 50%; width: 5px; border-left: 1px solid var(--editor-line); border-bottom: 1px solid var(--editor-line); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .workspace-file-dot[aria-current] { color: var(--editor-accent) !important; background: var(--editor-accent-soft) !important; }
@media(min-width:1280px) {
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):not(.assistant-open) .document-ribbon { display: flex; gap: 12px; align-items: center; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):not(.assistant-open) .document-taskbar { margin: 0; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):not(.assistant-open) .document-tools-bar { flex: 1; min-width: 0; }
}

/* A searchable context browser, with unavailable connectors clearly separated. */
.workspace-context { width: min(640px,calc(100vw - 24px)); max-height: calc(100dvh - 24px); overflow: auto; box-sizing: border-box; padding: 20px; border: 1px solid var(--editor-line,#cbd5db); border-radius: 14px; background: var(--editor-surface,#fff); color: var(--editor-ink,#172c30); box-shadow: 0 16px 64px #0003; }
.workspace-context::backdrop { background: #08121899; }
.project-switcher-list { display: grid; gap: 8px; }
.project-switcher-list button { display: flex; flex-direction: column; align-items: start; text-align: start; width: 100%; gap: 4px; overflow-wrap: anywhere; white-space: normal; }
.project-switcher-list small { color: var(--editor-muted); font-size: 12px; font-weight: 400; }
.project-switcher-list [aria-current=true] { border-color: var(--editor-accent) !important; background: var(--editor-accent-soft) !important; }
.project-switcher [data-new] { margin-top: 16px; width: 100%; }
.project-switcher-status:empty { display: none; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .project-switcher-trigger { display: inline-flex !important; align-items: center; justify-content: center; flex-shrink: 0; min-height: 44px !important; padding: 8px 12px !important; font: 500 13px/1.3 var(--font-body) !important; background: var(--editor-surface) !important; color: var(--editor-ink) !important; border: 1px solid var(--editor-line) !important; border-radius: 7px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .project-switcher-trigger:focus-visible { outline: 2px solid var(--editor-accent); outline-offset: 2px; }
@media(max-width:760px) {
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .topbar:has(.project-switcher-trigger) .brand { max-width: 125px !important; min-width: 0 !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .agent-head:has(.project-switcher-trigger) { flex-wrap: wrap !important; }
}
.workspace-context header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.workspace-context h2 { font-size: 20px; font-weight: 550; margin: 0 0 16px; }
.workspace-context h3 { font-size: 15px; font-weight: 550; margin: 22px 0 12px; }
.workspace-context label { display: block; font-size: 13px; margin: 8px 0; }
.workspace-context input { width: 100%; min-height: 44px; padding: 10px; border: 1px solid var(--editor-line); border-radius: 8px; background: var(--editor-surface); color: var(--editor-ink); font-size: 16px; }
.workspace-context button { min-height: 44px; padding: 8px 12px; border: 1px solid var(--editor-line); border-radius: 8px; background: var(--editor-surface); color: var(--editor-ink); font: inherit; cursor: pointer; }
.workspace-context :is(button,input,a):focus-visible { outline: 2px solid var(--editor-accent); outline-offset: 3px; }
.context-scope { font-size: 12px; line-height: 1.5; color: var(--editor-muted); }
.context-files { display: grid; gap: 6px; margin: 12px 0; max-height: 200px; overflow: auto; }
.context-files button { text-align: left; overflow-wrap: anywhere; }
.context-connectors { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 8px; }
.context-connectors article { padding: 12px; border: 1px solid var(--editor-line); border-radius: 8px; display: grid; gap: 8px; font-size: 13px; }
.context-connectors strong { font-weight: 550; }
.context-connectors span { color: var(--editor-muted); line-height: 1.5; }
.context-connectors a { color: var(--editor-accent); min-height: 44px; display: flex; align-items: center; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .workspace-context :is(button,input) { background: var(--editor-surface) !important; color: var(--editor-ink) !important; border-color: var(--editor-line) !important; font-family: inherit !important; font-weight: 450 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .workspace-context [data-close] { min-width: 44px !important; padding: 8px !important; font-size: 24px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .workspace-context .context-scope { margin: 10px 0 !important; color: var(--editor-muted) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .workspace-context h2 { color: var(--editor-ink) !important; font-weight: 550 !important; font-size: 18px !important; }
@media(max-width:480px) { .context-connectors { grid-template-columns: 1fr; } .workspace-context { padding: 16px; } }

/* Editing uses the same theme as the PDF workspace, not legacy brown cards. */
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel {
  height: 100% !important; min-height: 0 !important; max-height: 100% !important;
  overflow-y: auto !important; overscroll-behavior: contain;
  padding: 12px !important; gap: 10px !important; align-content: start !important;
  background: var(--editor-surface) !important; color: var(--editor-ink) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel[hidden] { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .edit-panel-navigation {
  position: sticky; top: -12px; z-index: 6; display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; padding: 8px 0; background: var(--editor-surface);
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .setting-block {
  padding: 12px !important; margin: 0 !important; border: 1px solid var(--editor-line) !important;
  border-radius: 7px !important; box-shadow: none !important;
  background: var(--editor-surface) !important; color: var(--editor-ink) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel :is(.setting-label,.range-row label,.check-row span,.tool-readout,output,.annotation-item span) {
  color: var(--editor-ink) !important; font-size: 13px !important; font-weight: 500 !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .setting-label { display: block; margin: 0 0 8px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel :is(.hint,.annotation-list) {
  color: var(--editor-muted) !important; font-size: 13px !important; line-height: 1.5 !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel :is(button:not([data-sign-color]),input:not([type=range]):not([type=checkbox]),select,textarea) {
  min-height: 44px !important; padding: 8px 10px !important; border: 1px solid var(--editor-line) !important;
  border-radius: 7px !important; background: var(--editor-surface) !important; color: var(--editor-ink) !important;
  font-size: 14px !important; font-weight: 450 !important; box-shadow: none !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel :is(select,textarea,input[type=text]) { width: 100% !important; max-width: 100% !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel textarea { min-height: 88px !important; resize: vertical; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel input[type=range] { width: 100%; min-height: 44px; margin: 0 0 8px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .back-to-agent-button { position: static !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .annotation-item {
  grid-template-columns: minmax(0,1fr) 44px; background: var(--editor-soft) !important;
  border-color: var(--editor-line) !important; color: var(--editor-ink) !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .annotation-item.selected { border-color: var(--editor-accent) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .annotation-item span { overflow-wrap: anywhere; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel :is(.annotation-item button,#clearEditsButton) { color: var(--editor-danger) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .annotation-item button { width: 44px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .stamp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .stamp-grid button.active { background: var(--editor-accent-soft) !important; border-color: var(--editor-accent) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editPanel .swatch-row button { width: 44px !important; height: 44px !important; min-height: 44px !important; background: var(--swatch) !important; border: 2px solid var(--editor-line) !important; }

/* Conversation fits its panel; the transcript gets remaining height. */
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .inspector { min-height: 0 !important; overflow: hidden !important; padding: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #accessPanel { height: 100% !important; min-height: 0 !important; padding: 0 !important; overflow: hidden !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentPanel {
  --composer-ink: var(--editor-ink);
  --composer-muted: var(--editor-muted);
  --composer-fill: var(--editor-surface);
  --composer-edge: var(--editor-line);
  --composer-focus: var(--editor-accent);
  display: flex !important; flex-direction: column !important; height: 100% !important; max-height: none !important; min-height: 0 !important; padding: 14px !important; gap: 10px !important; border: 0 !important; border-radius: 0 !important;
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentPanel :is(.agent-runtime-strip,.agent-ai-head,.agent-memory,.agent-integrations,.agent-support-strip,.agent-mobile-controls,.agent-surface-bar,.agent-surface-suggestions) { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentPanel .agent-head { flex: 0 0 auto !important; padding: 0 0 8px !important; gap: 8px !important; border-bottom: 1px solid var(--editor-line) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentTitle { font-size: 15px !important; font-weight: 600 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentSignal { font-size: 11px !important; border: 0 !important; padding: 3px 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentTranscript { flex: 1 1 0 !important; min-height: 0 !important; max-height: none !important; overflow: auto !important; overscroll-behavior: contain; padding: 4px 2px !important; border: 0 !important; border-radius: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentTranscript .agent-message { background: transparent !important; color: var(--editor-ink) !important; border: 0 !important; padding: 10px 2px !important; box-shadow: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentTranscript .agent-message.user { background: var(--editor-soft) !important; padding: 10px 12px !important; border-radius: 8px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentTranscript :is(p,li,strong,span,.agent-message-role) { color: var(--editor-ink) !important; font-size: 14px !important; line-height: 1.6 !important; background: transparent !important; overflow-wrap: anywhere; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentTranscript :is(.agent-message-role,.agent-message>span) { color: var(--editor-muted) !important; font-size: 11px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentTranscript a { color: var(--editor-accent) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .agent-ai-box { flex: 0 0 auto !important; position: static !important; width: 100% !important; padding: 9px !important; gap: 5px !important; border: 1px solid var(--editor-line) !important; border-radius: 10px !important; max-height: none !important; overflow: visible !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentGoalInput { width: 100% !important; min-height: 56px !important; max-height: 132px !important; padding: 5px 6px !important; font-size: 14px !important; line-height: 1.5 !important; border: 0 !important; border-radius: 4px !important; resize: vertical !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .agent-context-consent { margin: 0 !important; padding: 4px 2px !important; color: var(--editor-muted) !important; font-size: 12px !important; line-height: 1.4 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentContextStatus { margin: 0 !important; font-size: 11px !important; line-height: 1.4 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .agent-composer-actions { margin: 0 !important; gap: 5px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentPanel .agent-composer-actions button { width: auto !important; min-width: 44px !important; max-width: none !important; flex: 0 0 auto !important; padding: 7px 8px !important; height: 44px !important; min-height: 44px !important; border-radius: 6px !important; font: 450 13px/1.4 var(--font-body) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .agent-composer-actions button::before { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .agent-composer-actions #agentAiButton { min-width: 64px !important; font-size: 13px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.agent-thinking,.agent-result-artifact,.agent-work-card,.agent-citations button) { background: var(--editor-soft) !important; color: var(--editor-ink) !important; border-color: var(--editor-line) !important; box-shadow: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.agent-result-artifact button,.agent-approval-row button,.agent-integrations button) { background: var(--editor-surface) !important; color: var(--editor-ink) !important; border-color: var(--editor-line) !important; }

/* Extraction and rewriting remain readable beside the source document. */
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .pdf-selection-region { position: absolute; border: 1px solid var(--editor-accent); background: color-mix(in srgb,var(--editor-accent) 12%,transparent); pointer-events: auto; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .pdf-selection-region.native { pointer-events: none; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .pdf-selection-actions { position: absolute; z-index: 5; display: flex; flex-wrap: wrap; gap: 4px; padding: 5px; border: 1px solid var(--editor-line); border-radius: 8px; background: var(--editor-surface); box-shadow: 0 4px 16px #0002; pointer-events: auto; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .pdf-selection-actions button { min-height: 36px; padding: 6px 9px; border: 0; border-radius: 5px; background: var(--editor-surface); color: var(--editor-ink); font-size: 12px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .pdf-selection-actions button[data-selection-action=reword] { color: var(--editor-accent); background: var(--editor-accent-soft); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-surface:has(.document-tools-panel:not([hidden])) .pdf-selection-actions { visibility: hidden; pointer-events: none; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-panel { min-width: 0 !important; padding: 12px !important; border: 1px solid var(--editor-line) !important; border-radius: 8px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-heading h2 { font-size: 15px !important; line-height: 1.4 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-status { margin: 6px 0 !important; font-size: 12px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-body { min-height: 0 !important; overflow: auto !important; max-height: none !important; padding: 2px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.document-extract-range,.document-extract-choice) :is(h3,p) { width: 100%; margin: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.document-extract-range,.document-extract-choice) h3 { font-size: 13px !important; line-height: 1.5 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.document-extract-range,.document-extract-choice) p { font-size: 12px !important; line-height: 1.5 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-extract-choice { display: grid; gap: 6px; margin-block: 10px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-extract-choice button { justify-content: flex-start; text-align: left; min-height: 44px !important; padding: 10px !important; white-space: normal; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-extract-range { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-block: 10px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-extract-range input { flex: 1 1 140px; min-width: 0; width: 100%; }
.document-extract-presets, .document-extract-modes { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.document-extract-range,.document-extract-modes) button { min-height: 44px !important; }
.document-extract-modes button { flex: 1; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-extract-modes [aria-selected=true] { background: var(--editor-accent-soft) !important; border-color: var(--editor-accent) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.document-extract-range,.document-extract-choice)[hidden] { display: none !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.document-ocr-consent,.document-text-source) { color: var(--editor-muted); font-size: 12px; line-height: 1.5; margin-block: 8px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-ocr-consent { display: flex; align-items: start; gap: 8px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-ocr-consent input { margin-top: 3px; flex: 0 0 auto; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-text-source summary { min-height: 40px; padding-block: 8px; color: var(--editor-muted); cursor: pointer; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools .document-ocr-text { height: clamp(120px,22dvh,240px) !important; max-height: 46dvh !important; min-height: 120px !important; color: var(--editor-ink) !important; background: var(--editor-surface) !important; border-color: var(--editor-line) !important; font-family: inherit !important; font-size: 14px !important; line-height: 1.65 !important; padding: 10px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-panel > .document-ocr-footer { flex: 0 0 auto; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-ocr-footer button { min-height: 44px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-ocr-footer { display: grid !important; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-ocr-count { grid-column: 1 / -1; }
/* Match the document-surface stacking breakpoint. Between 901px and 1050px,
   the generic 38dvh panel cap otherwise lets the footer hide the text body. */
@media (max-width: 1050px) {
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.document-tools-panel:not([hidden]) > .document-ocr-footer) .preview-stage { align-items: start !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-panel:has(> .document-ocr-footer) { align-self: start; max-height: min(60dvh,540px) !important; }
  /* Let short reviews use their content height rather than stretching a
     16-row textarea and its body across the source preview. Keep the body
     scrollable for original passages/tables and the actions outside it. */
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-panel:has(> .document-ocr-footer) .document-tools-body { flex: 0 1 auto; gap: 6px; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools .document-ocr-text { height: clamp(104px,15dvh,160px) !important; min-height: 104px !important; font-size: 16px !important; line-height: 1.5 !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-text-source { margin-block: 0; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-ocr-footer { gap: 6px; padding-top: 8px; }
  /* Text review is the active task. Restore the prepared PDF summary when
     this panel closes instead of squeezing the source into a tiny thumbnail. */
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell):has(.document-tools-panel:not([hidden]) > .document-ocr-footer) #resultDock { display: none !important; }
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-saved-draft { padding: 12px 0; border-bottom: 1px solid var(--editor-line); }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-saved-draft button { min-height: 44px !important; white-space: normal; text-align: start; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-saved-draft p { overflow-wrap: anywhere; font-size: 13px !important; }
@media (max-width: 1050px) and (max-height: 640px) {
  /* Short phones / landscape: scroll the review and source together instead
     of leaving a sliver of PDF beneath a fixed-height review. */
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-surface:has(.document-tools-panel:not([hidden]) > .document-ocr-footer) { display: flex; flex-direction: column; overflow-y: auto; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-panel:has(> .document-ocr-footer) { flex: 0 0 auto; width: 100%; max-height: none !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.document-tools-panel:not([hidden]) > .document-ocr-footer) .preview-stage { flex: 0 0 220px; min-height: 220px !important; }
}
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.document-ocr-footer,.document-search,.document-table-scroll th,.document-table-scroll td) { background: var(--editor-surface) !important; color: var(--editor-ink) !important; border-color: var(--editor-line) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-table-scroll th { background: var(--editor-soft) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.document-field label,.document-extracted-table summary,.document-match span,.document-change>span) { color: var(--editor-ink) !important; font-size: 13px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .compare-card { background: var(--editor-surface) !important; color: var(--editor-ink) !important; border-color: var(--editor-line) !important; border-radius: 7px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .compare-card-thumb { background: var(--editor-soft) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .compare-card-copy { background: var(--editor-surface) !important; color: var(--editor-ink) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .compare-card-copy :is(strong,b,small,span) { color: var(--editor-ink) !important; }

/* Review the document at available width, not a height-constrained thumbnail.
   Keep the multi-document grid compact; only before/after review expands. */
  html[data-bitepdf-theme] body#bitepdf-workspace #compareStage.compare-mode .compare-card { height: auto !important; grid-template-rows: auto auto !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace #compareStage.compare-mode .compare-card-thumb { height: auto !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace #compareStage.compare-mode .compare-card-thumb img { position: static !important; inset: auto !important; width: 100% !important; height: auto !important; max-height: none !important; }
@media (max-width: 760px) and (max-height: 640px) {
  html[data-bitepdf-theme] body#bitepdf-workspace #editorScreen:has(#compareStage.compare-mode:not([hidden])) { overflow-y: auto !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace #editorScreen:has(#compareStage.compare-mode:not([hidden])) > :is(.document-tools,.result-dock,.multi-doc-strip) { flex: 0 0 auto !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace #editorScreen:has(#compareStage.compare-mode:not([hidden])) :is(.document-surface,.preview-stage,#compareStage) { height: auto !important; min-height: 0 !important; overflow: visible !important; flex: 0 0 auto !important; }
}

/* Menus keep the selected theme and touch-sized, recognisable actions. */
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-menu-button { width: 42px !important; height: 42px !important; min-width: 42px !important; padding: 10px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-menu-button span { background: var(--editor-ink) !important; height: 2px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-drawer-sheet { width: min(480px,calc(100vw - 20px)) !important; max-height: calc(100dvh - 20px) !important; padding: 20px !important; border: 1px solid var(--editor-line) !important; border-radius: 14px !important; overflow-y: auto !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-drawer-head strong { font-size: 21px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-drawer-head>div>span { font-size: 12px !important; color: var(--editor-muted) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-drawer :is(p,span,a) { color: var(--editor-muted) !important; font-size: 13px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-drawer button { min-height: 44px !important; text-transform: none !important; letter-spacing: normal !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-drawer-nav { gap: 7px !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-drawer-nav>a { display: flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--editor-ink) !important; text-decoration: underline; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-drawer-pricing { padding: 12px 0 0 !important; border: 0 !important; border-top: 1px solid var(--editor-line) !important; border-radius: 0 !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-drawer-pricing a { color: var(--editor-accent) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(.drop-panel,.mobile-empty-footer,.mobile-start-panel button) { background: var(--editor-surface) !important; color: var(--editor-ink) !important; border-color: var(--editor-line) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .drop-panel :is(h2,p,small),html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-empty-footer :is(strong,p,a) { color: var(--editor-ink) !important; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .drop-panel svg { color: var(--editor-accent) !important; stroke: var(--editor-accent) !important; }

@media (min-width: 761px) {
  html[data-bitepdf-theme] body#bitepdf-workspace.assistant-open .app-shell { grid-template-columns: 64px minmax(0,1fr) 5px minmax(320px,360px) !important; height:100dvh!important; min-height:0!important; }
  html[data-bitepdf-theme] body#bitepdf-workspace.assistant-open:has(.app-shell) .inspector { display: block !important; grid-column: 4 !important; position:relative!important; inset:auto!important; height:100%!important; max-height:100%!important; min-height:0!important; align-self:stretch!important; }
  html[data-bitepdf-theme] body#bitepdf-workspace .inspector { border-left: 1px solid var(--editor-line) !important; }
}
@media (max-width: 1050px) and (min-width: 761px) {
  html[data-bitepdf-theme] body#bitepdf-workspace.assistant-open .app-shell { grid-template-columns: 52px minmax(0,1fr) 4px 320px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-surface:has(.document-tools-panel:not([hidden])) { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-panel { order: -1; max-height: 38dvh; }
  /* A tablet needs a full-height conversation, not a collapsed desktop rail. */
  html[data-bitepdf-theme] body#bitepdf-workspace.assistant-open:has(.app-shell) .inspector { position:fixed!important; inset:0!important; width:100%!important; height:100dvh!important; max-height:100dvh!important; z-index:100!important; }
}
/* The narrow desktop rail contains sessions, not clipped settings paragraphs. */
@media (min-width: 761px) and (max-width: 1179px) {
  html[data-bitepdf-theme] body#bitepdf-workspace .left-rail { width: auto !important; min-width: 0 !important; padding: 8px 4px !important; overflow: auto !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace .left-rail>:not(.workspace-switcher) { display: none !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace .workspace-switcher { display: flex !important; flex-direction: column !important; width: 100% !important; padding: 0 !important; border: 0 !important; background: transparent !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace .workspace-switcher :is(.workspace-switcher-head,.workspace-chip,.hint) { display: none !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace .workspace-orbit { display: flex !important; flex-direction: column !important; align-items: center !important; gap: 10px !important; width: 100% !important; min-height: 0 !important; padding: 0 !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace .workspace-dot { width: 40px !important; min-width: 40px !important; height: 40px !important; min-height: 40px !important; }
}
@media (max-width: 760px) {
  html[data-bitepdf-theme] body#bitepdf-workspace.assistant-open:has(.app-shell) .inspector:has(#editPanel:not([hidden])) { display: block !important; position: fixed !important; inset: 0 !important; height: 100dvh !important; max-height: 100dvh !important; width: 100% !important; z-index: 100 !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .pdf-selection-actions button { min-height: 44px; padding: 8px 10px; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) { overflow-x: hidden !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace .app-shell { height: 100dvh !important; min-height: 0 !important; overflow: hidden !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace .workspace { height: 100% !important; min-height: 0 !important; flex: 1 1 0 !important; padding: 0 !important; overflow: hidden !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace #editorScreen { height: 100% !important; min-height: 0 !important; flex: 1 1 0 !important; overflow: hidden !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #editorScreen { padding: 8px !important; gap: 6px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .preview-toolbar { padding: 5px !important; flex-wrap: nowrap !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .preview-toolbar>div:first-child { display: none !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .zoom-tools { width: 100% !important; overflow-x: auto !important; scrollbar-width: none; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .zoom-tools>button { min-height: 40px !important; height: 40px !important; width: 40px !important; min-width: 40px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #workspaceActions { gap: 4px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #workspaceActions>button { flex: 1 1 80px !important; min-height: 40px !important; padding: 8px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .preview-stage { min-height: 52dvh !important; padding: 10px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-surface { min-height: 52dvh !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace .document-surface { min-height: 0 !important; flex: 1 1 0 !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-surface:has(.document-tools-panel:not([hidden])) { grid-template-columns: minmax(0,1fr); grid-template-rows: auto minmax(0,1fr); }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-panel { order: -1; max-height: 48dvh; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-bar { flex-wrap: wrap !important; gap: 4px !important; padding: 4px 0 !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-filename { flex-basis: 100%; max-width: 100%; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-page-control { width: auto !important; flex: 1 0 125px !important; margin: 0 !important; justify-content: flex-start !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-bar>button:not(.document-save) { min-height: 40px !important; height: 40px !important; min-width: 36px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more>summary { height: 40px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools .document-save { flex: 0 1 auto !important; width: auto !important; margin-left: auto !important; min-height: 40px !important; padding: 8px 12px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-more-content { width: min(300px,calc(100vw - 32px)) !important; right: 0; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(input,select,textarea),html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentGoalInput { font-size: 16px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentPanel { padding: 12px !important; gap: 8px !important; }
  html[data-bitepdf-theme] body#bitepdf-workspace[data-mobile-mode=agent] #agentPanel,
  html[data-bitepdf-theme] body.assistant-open #agentPanel { position: fixed !important; inset: 0 !important; height: 100dvh !important; max-height: 100dvh !important; width: 100% !important; z-index: 40 !important; padding: 12px 12px max(12px,env(safe-area-inset-bottom)) !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentClosePanel { display: inline-flex !important; min-width: 40px !important; min-height: 40px !important; margin-left: auto !important; color: var(--editor-ink) !important; background: var(--editor-surface) !important; border: 1px solid var(--editor-line) !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentGoalInput { min-height: 52px !important; max-height: 116px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .agent-ai-box { padding: 8px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .agent-composer-actions button { min-height: 44px !important; height: 44px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .result-dock { padding: 10px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .mobile-drawer-nav { grid-template-columns: 1fr !important; }
}
@media (max-width: 360px) {
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-bar>button[aria-label="Highlight selection"] { display: none !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-tools-bar { gap: 3px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-page-control { flex-basis: 120px !important; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .size-target-disclosure>summary span { display: none; }
}
@media (prefers-reduced-motion: no-preference) {
  #agentActivityLine[data-busy=true] img { animation: agent-activity-turn 1.2s linear infinite; }
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) :is(button,summary) { transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease !important; }
}
#agentActivityLine.agent-live-activity:not([hidden]) { display:flex !important; align-items:center; gap:8px; min-width:0; margin:0; color:var(--editor-ink); font:400 12px/1.5 var(--font-body); }
#agentActivityLine span { min-width:0; overflow-wrap:anywhere; }
#agentActivityLine img { flex:0 0 16px; }
html[data-bitepdf-theme="dark"] #agentActivityLine img { filter:brightness(0) invert(1); }
#agentActivityLine[data-busy=false] img { display:none; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentActivityLine.agent-live-activity,
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) #agentActivityLine.agent-live-activity span {
  color: var(--editor-ink) !important;
}
.agent-service-row { display:flex; align-items:center; gap:8px; min-width:0; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .compare-card-loading button { min-height:44px!important; }
.agent-service-row .agent-service-status { flex:1; min-width:0; overflow-wrap:anywhere; }
html[data-bitepdf-theme] body:has(.app-shell) #agentCheckServiceButton { flex:0 0 auto; min-height:44px!important; padding:6px 8px!important; border:1px solid var(--editor-line)!important; background:var(--editor-surface)!important; color:var(--editor-ink)!important; font:400 12px/1.4 var(--font-body)!important; }
@media (prefers-reduced-motion: reduce) {
  html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) *,html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) *::before,html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* Ordered pages stay beside the preview, without expanding the editor ribbon. */
.document-merge-list { margin: 12px 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.document-merge-list li { display: grid; grid-template-columns: minmax(0,1fr) 44px 44px; align-items: center; gap: 4px; }
.document-merge-list span { min-width: 0; overflow-wrap: anywhere; font-size: 13px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-merge-list button { min-height: 44px !important; min-width: 44px !important; padding: 6px !important; }
.document-merge-actions { display: flex; flex-wrap: wrap; gap: 8px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-merge-actions button { min-height: 44px !important; white-space: normal; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-merge-create:not(:disabled) { background: var(--editor-ink) !important; color: var(--editor-surface) !important; }
.document-wording-choice { display: grid; gap: 10px; }
html[data-bitepdf-theme] body:is(#bitepdf-workspace,.compact-editor):has(.app-shell) .document-wording-choice button { min-height: 44px !important; white-space: normal; justify-content: flex-start; }
.project-switcher-row { display: grid; gap: 6px; min-width: 0; }
.project-switcher-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.project-switcher-actions button { width: auto; padding: 7px 12px; font-size: 13px; }
.project-switcher-actions input { flex: 1 1 160px; min-width: 0; width: 100%; }
#agentTranscript .agent-rich-text { max-width: 65ch; }
#agentTranscript .agent-rich-text p { margin: 0 0 12px; }
#agentTranscript .agent-rich-text :is(ol,ul) { padding-inline-start: 24px; margin: 10px 0; display: grid; gap: 16px; }
#agentTranscript .agent-rich-text li { padding-inline-start: 5px; }
#agentTranscript .agent-rich-text li::marker { color: var(--editor-accent); font-weight: 600; }
#agentTranscript .agent-rich-text h4 { margin: 16px 0 6px; font-size: 14px; font-weight: 600; }
#agentTranscript .agent-source-details { margin-top: 12px; font-size: 12px; color: var(--editor-muted); }
#agentTranscript .agent-source-details summary { cursor: pointer; padding: 6px 0; }
#agentTranscript .agent-upgrade-action a { display: inline-flex; padding: 10px 16px; border-radius: 10px; background: var(--editor-accent); color: white; text-decoration: none; font-weight: 600; }
html body:has(.app-shell) #agentTranscript .agent-rich-text ol { list-style: decimal outside !important; }
html body:has(.app-shell) #agentTranscript .agent-rich-text ul { list-style: disc outside !important; }
html body:has(.app-shell) #agentTranscript .agent-rich-text li { display: list-item !important; }
html body:has(.app-shell) textarea#agentGoalInput { min-height: 52px !important; height: 52px; max-height: 160px; }
html body:has(.app-shell) #agentTranscript .agent-rich-text :is(ol,ul) { display: block !important; }
html body:has(.app-shell) #agentTranscript .agent-rich-text li + li { margin-top: 16px; }
.cloud-library { width: min(720px,calc(100vw - 32px)); max-height: 85dvh; overflow: auto; }
.cloud-library [data-items] { display: grid; gap: 12px; }
.cloud-version { padding: 16px; border: 1px solid var(--editor-border); border-radius: 12px; }
.cloud-version h3 { margin: 0 0 6px; font-size: 15px; }
.cloud-version p { font-size: 13px; line-height: 1.5; }
.cloud-version button { margin: 4px; padding: 8px 12px; font-size: 13px; }
#agentTranscript .agent-upgrade-card { padding: 16px; margin: 12px 0; border: 1px solid var(--editor-border); border-radius: 12px; background: var(--editor-soft); }
#agentTranscript .agent-upgrade-card button { background: var(--editor-accent); color: white; border-radius: 10px; padding: 10px 14px; margin: 8px 12px 8px 0; }
