/* BitePDF editor mobile final overrides.
   Loaded after the large legacy stylesheet so phone layout stays readable. */

@media (max-width: 760px) {
  body[data-has-docs="false"] .drop-panel,
  body[data-has-docs="false"] .drop-panel h2,
  body[data-has-docs="false"] .drop-panel p,
  body[data-has-docs="false"] .drop-panel small {
    color: #111827 !important;
  }

  body[data-has-docs="false"] .drop-panel {
    background: #fffaf2 !important;
    border-color: #dfd0b9 !important;
  }

  body[data-has-docs="false"] .drop-panel p,
  body[data-has-docs="false"] .drop-panel small {
    color: #4b5563 !important;
  }

  body[data-has-docs="true"] .topbar,
  body[data-has-docs="true"] .workspace,
  body[data-has-docs="true"] .preview-toolbar,
  body[data-has-docs="true"] .workspace-actions,
  body[data-has-docs="true"] .preview-stage,
  body[data-has-docs="true"] .preview-shell,
  body[data-has-docs="true"] .status-strip {
    color: #111827 !important;
    background-color: #fffaf2 !important;
    background-image:
      linear-gradient(rgba(15, 23, 42, 0.055) 1px, transparent 1px),
      linear-gradient(90deg, rgba(15, 23, 42, 0.055) 1px, transparent 1px) !important;
    border-color: #dfd0b9 !important;
  }

  body[data-has-docs="true"] .workspace {
    padding: 12px 12px calc(96px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body[data-has-docs="true"] .preview-toolbar,
  body[data-has-docs="true"] .workspace-actions {
    gap: 8px !important;
    padding: 8px !important;
    border-radius: 18px !important;
  }

  body[data-has-docs="true"] .workspace-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    overflow: visible !important;
  }

  body[data-has-docs="true"][data-mobile-mode] .workspace-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  body[data-has-docs="true"] .workspace-actions > button:nth-of-type(n + 5) {
    display: none !important;
  }

  body[data-has-docs="true"] .workspace-actions button {
    min-width: 0 !important;
    width: 100% !important;
    min-height: 48px !important;
    padding: 0 10px !important;
    overflow: hidden !important;
    color: #111827 !important;
    background: #fffdfa !important;
    border-color: #d9c8ac !important;
    font-size: 0 !important;
    white-space: nowrap !important;
  }

  body[data-has-docs="true"] .workspace-actions button::after {
    content: attr(data-short-label) !important;
    display: block !important;
    max-width: 100% !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    color: #111827 !important;
    font-size: 15px !important;
    line-height: 1 !important;
  }

  body[data-has-docs="true"] .workspace-actions button::before {
    display: none !important;
  }

  body[data-has-docs="true"] .workspace-actions button.active::after {
    color: #fffaf2 !important;
  }

  body[data-has-docs="true"] .workspace-more {
    display: block !important;
    grid-column: span 2 !important;
  }

  body[data-has-docs="true"] .workspace-more summary {
    width: 100% !important;
    min-height: 42px !important;
    justify-content: center !important;
    color: #111827 !important;
    background: #f4ead9 !important;
    border-color: #d9c8ac !important;
    font-size: 13px !important;
  }

  body[data-has-docs="true"] .multi-doc-card {
    color: #111827 !important;
    background: #fffdfa !important;
    border-color: #d9c8ac !important;
  }
}

/* Final explicit theme contract. This file loads last, so theme=light/dark wins over OS preference. */
html[data-bitepdf-theme="light"] body {
  --text: #101827;
  --muted: #4b5563;
  --faint: #6b6258;
  --surface: #fffaf2;
  --surface-soft: #f4ecdf;
  --line: #d9c8ae;
  background: #f8f3ea !important;
  color: #101827 !important;
}

html[data-bitepdf-theme="light"] body :where(
  .topbar,
  .sidebar,
  .workspace,
  .inspector,
  .agent-panel,
  .workspace-switcher,
  .side-section,
  .setting-block,
  .agent-message,
  .agent-work-card,
  .agent-ai-result,
  .agent-ai-box,
  .preview-toolbar,
  .workspace-actions,
  .output-card,
  .multi-doc-card
) {
  background-color: #fffaf2 !important;
  color: #101827 !important;
  border-color: #d9c8ae !important;
}

html[data-bitepdf-theme="light"] body :where(
  p,
  small,
  .hint,
  .muted,
  .agent-message p,
  .agent-ai-box textarea,
  .side-section p,
  .setting-block p
) {
  color: #4b5563 !important;
}

html[data-bitepdf-theme="light"] body :where(
  h1,
  h2,
  h3,
  strong,
  label,
  .eyebrow,
  .sidebar h2,
  .agent-head strong,
  .agent-panel strong
) {
  color: #101827 !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="light"] body :where(button, .tool-button, .icon-button, .workspace-actions button, .agent-panel button) {
  color: #101827 !important;
  background: #fffdf8 !important;
  border-color: #bfa77f !important;
}

html[data-bitepdf-theme="light"] body :where(button.active, button:hover, .primary-action, .download-action, .download-button, .workspace-actions button.active, .agent-panel button.active) {
  color: #fffaf2 !important;
  background: #101827 !important;
  border-color: #101827 !important;
}

html[data-bitepdf-theme="light"] body #accessModal:not([hidden]) :where(
  .modal,
  .modal-auth,
  .modal-plans,
  .unlock-result,
  .checkout-stage,
  .local-pricing-note,
  .launch-promo-note,
  .public-service-note,
  .modal-note,
  .plan-button
) {
  background: #fffaf2 !important;
  color: #101827 !important;
  border-color: #d9c8ae !important;
}

html[data-bitepdf-theme="light"] body #accessModal:not([hidden]) :where(.modal-auth p, .modal-auth small, .plan-button small, .unlock-result p, .checkout-stage p) {
  color: #4b5563 !important;
}

html[data-bitepdf-theme="light"] body #accessModal:not([hidden]) :where(.modal-auth h2, .modal-auth strong, .modal-auth label, .modal-plans strong, .unlock-result strong, .checkout-stage strong) {
  color: #101827 !important;
}

html[data-bitepdf-theme="light"] body #accessModal:not([hidden]) :where(.plan-button strong, .plan-button span, .public-service-note strong, .public-service-note a) {
  color: #9a5a12 !important;
}

html[data-bitepdf-theme="dark"] body {
  --text: #fff7ed;
  --muted: #d8cbbb;
  --faint: #a99a87;
  --surface: #17120d;
  --surface-soft: #21170f;
  --line: #4a3827;
  background: #0f0c09 !important;
  color: #fff7ed !important;
}

html[data-bitepdf-theme="dark"] body :where(
  .topbar,
  .sidebar,
  .workspace,
  .inspector,
  .agent-panel,
  .workspace-switcher,
  .side-section,
  .setting-block,
  .agent-message,
  .agent-work-card,
  .agent-ai-result,
  .agent-ai-box,
  .preview-toolbar,
  .workspace-actions,
  .output-card,
  .multi-doc-card
) {
  background-color: #17120d !important;
  color: #fff7ed !important;
  border-color: #4a3827 !important;
}

html[data-bitepdf-theme="dark"] body :where(
  p,
  small,
  .hint,
  .muted,
  .agent-message p,
  .agent-ai-box textarea,
  .side-section p,
  .setting-block p
) {
  color: #d8cbbb !important;
}

html[data-bitepdf-theme="dark"] body :where(
  h1,
  h2,
  h3,
  strong,
  label,
  .eyebrow,
  .sidebar h2,
  .agent-head strong,
  .agent-panel strong
) {
  color: #fff7ed !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="dark"] body :where(button, .tool-button, .icon-button, .workspace-actions button, .agent-panel button) {
  color: #fff7ed !important;
  background: #21170f !important;
  border-color: #5a432f !important;
}

html[data-bitepdf-theme="dark"] body :where(button.active, button:hover, .primary-action, .download-action, .download-button, .workspace-actions button.active, .agent-panel button.active) {
  color: #11100e !important;
  background: #d8b77a !important;
  border-color: #efbd6b !important;
}

html[data-bitepdf-theme="dark"] body #accessModal:not([hidden]) :where(
  .modal,
  .modal-auth,
  .modal-plans,
  .unlock-result,
  .checkout-stage,
  .local-pricing-note,
  .launch-promo-note,
  .public-service-note,
  .modal-note,
  .plan-button
) {
  background: #17120d !important;
  color: #fff7ed !important;
  border-color: #5a432f !important;
}

html[data-bitepdf-theme="dark"] body #accessModal:not([hidden]) :where(.modal-auth p, .modal-auth small, .plan-button small, .unlock-result p, .checkout-stage p) {
  color: #d8cbbb !important;
}

html[data-bitepdf-theme="dark"] body #accessModal:not([hidden]) :where(.plan-button strong, .plan-button span, .public-service-note strong, .public-service-note a) {
  color: #efbd6b !important;
}

/* Final desktop app contract: keep rails in their own columns and prevent
   result/checkout controls from sliding under the agent runtime rail. */
@media (min-width: 981px) {
  html body[data-has-docs="true"] {
    --bitepdf-left-rail-width: 260px;
  }

  html body[data-has-docs="true"] .app-shell {
    grid-template-columns: var(--bitepdf-left-rail-width) minmax(0, 1fr) 8px minmax(390px, var(--agent-rail-width, 430px)) !important;
  }

  html body[data-has-docs="true"] .left-rail {
    display: flex !important;
    grid-column: 1 !important;
    grid-row: 2 !important;
    min-width: 0 !important;
  }

  html body[data-has-docs="true"] .workspace {
    grid-column: 2 !important;
    min-width: 0 !important;
    overflow-x: clip !important;
  }

  html body[data-has-docs="true"] .sidebar-resizer {
    display: block !important;
    grid-column: 3 !important;
    grid-row: 2 !important;
    width: 8px !important;
    min-width: 8px !important;
  }

  html body[data-has-docs="true"] .inspector {
    grid-column: 4 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
  }

  html body[data-has-docs="true"] .editor,
  html body[data-has-docs="true"] .preview-shell,
  html body[data-has-docs="true"] .preview-stage,
  html body[data-has-docs="true"] .result-dock {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  html body[data-has-docs="true"] .result-dock {
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 12px !important;
    width: calc(100vw - var(--bitepdf-left-rail-width) - var(--agent-rail-width, 430px) - 44px) !important;
    overflow: hidden !important;
  }

  html body[data-has-docs="true"] .result-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    min-width: 0 !important;
  }

  html body[data-has-docs="true"] .result-stats span,
  html body[data-has-docs="true"] .result-dock .primary-action {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }
}

@media (min-width: 981px) and (max-width: 1320px) {
  html body[data-has-docs="true"] {
    --bitepdf-left-rail-width: 230px;
    --agent-rail-width: 380px;
  }

  html body[data-has-docs="true"] .app-shell {
    grid-template-columns: var(--bitepdf-left-rail-width) minmax(0, 1fr) 8px minmax(340px, var(--agent-rail-width)) !important;
  }
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] :where(.left-rail, .workspace-switcher, .side-section, .queue-summary, .page-tools, .file-card, .workspace-chip, .workspace-dot) {
  color: #101827 !important;
  background: #fffaf2 !important;
  border-color: #d9c8ae !important;
}

html[data-bitepdf-theme="dark"] body[data-has-docs="true"] :where(.left-rail, .workspace-switcher, .side-section, .queue-summary, .page-tools, .file-card, .workspace-chip, .workspace-dot) {
  color: #fff7ed !important;
  background: #17120d !important;
  border-color: #4a3827 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] :where(.left-rail p, .left-rail small, .left-rail .hint, .file-card small, .workspace-chip small) {
  color: #4b5563 !important;
}

html[data-bitepdf-theme="dark"] body[data-has-docs="true"] :where(.left-rail p, .left-rail small, .left-rail .hint, .file-card small, .workspace-chip small) {
  color: #d8cbbb !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] :where(.left-rail h1, .left-rail strong, .left-rail .eyebrow) {
  color: #101827 !important;
}

html[data-bitepdf-theme="dark"] body[data-has-docs="true"] :where(.left-rail h1, .left-rail strong, .left-rail .eyebrow) {
  color: #fff7ed !important;
}

body[data-modal-open="access"] .sidebar-resizer,
body[data-modal-open="access"] .sidebar-resizer::after {
  display: none !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Mobile production polish: keep the upload path simple, prevent the header
   controls from stacking, and hide navigation chrome while a modal is active. */
@media (max-width: 760px) {
  .brand-mark {
    overflow: hidden !important;
    display: inline-grid !important;
    place-items: center !important;
    flex: 0 0 auto !important;
  }

  .brand-mark img,
  .brand-mark svg {
    display: block !important;
    width: 76% !important;
    height: 76% !important;
    object-fit: contain !important;
  }

  body[data-has-docs="false"] .brand-mark img,
  body[data-has-docs="false"] .brand-mark svg {
    width: 72% !important;
    height: 72% !important;
    padding: 0 !important;
  }

  body[data-has-docs="true"] .topbar {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "brand menu"
      "open download" !important;
    gap: 12px !important;
    align-items: center !important;
    padding: 14px 16px 12px !important;
    background: #fffaf2 !important;
    border-bottom: 1px solid rgba(34, 24, 16, 0.14) !important;
  }

  body[data-has-docs="true"] .brand {
    grid-area: brand !important;
    max-width: 190px !important;
    min-width: 0 !important;
    gap: 10px !important;
    overflow: hidden !important;
    color: #16110c !important;
  }

  body[data-has-docs="true"] .brand-mark {
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important;
    border-radius: 14px !important;
    overflow: hidden !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #fffdfa !important;
  }

  body[data-has-docs="true"] .brand-mark img,
  body[data-has-docs="true"] .brand-mark svg {
    width: 82% !important;
    height: 82% !important;
    padding: 0 !important;
    object-fit: contain !important;
  }

  body[data-has-docs="true"] .mobile-menu-button {
    grid-area: menu !important;
    display: inline-grid !important;
    width: 52px !important;
    height: 52px !important;
    border-radius: 18px !important;
  }

  body[data-has-docs="true"] .toolbar {
    grid-area: open !important;
    display: block !important;
    min-width: 0 !important;
  }

  body[data-has-docs="true"] .toolbar .tool-button:not(#openButton) {
    display: none !important;
  }

  body[data-has-docs="true"] #openButton,
  body[data-has-docs="true"] #downloadButton {
    width: 100% !important;
    min-height: 58px !important;
    justify-content: center !important;
    border-radius: 18px !important;
    font-size: 18px !important;
  }

  body[data-has-docs="true"] .top-actions {
    grid-area: download !important;
    display: block !important;
    min-width: 0 !important;
  }

  body[data-has-docs="true"] .top-actions > :not(#downloadButton) {
    display: none !important;
  }

  body[data-modal-open="access"] .mobile-mode-tabs,
  body[data-processing="true"] .mobile-mode-tabs,
  body.mobile-processing-active .mobile-mode-tabs {
    display: none !important;
  }

  body[data-has-docs="true"] .preview-toolbar {
    padding: 10px !important;
    gap: 10px !important;
  }

  body[data-has-docs="true"] .zoom-controls {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 8px !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  body[data-has-docs="true"] #rotateLeftButton,
  body[data-has-docs="true"] #rotateRightButton,
  body[data-has-docs="true"] #toggleIncludeButton {
    display: none !important;
  }

  body[data-has-docs="true"] .workspace-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    padding: 10px !important;
  }

  body[data-has-docs="true"] .workspace-actions > button:nth-of-type(n + 3),
  body[data-has-docs="true"] .workspace-more {
    display: none !important;
  }

  body[data-has-docs="true"] .workspace-actions > button {
    min-height: 58px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    border-radius: 16px !important;
    font-size: 18px !important;
  }

  .mobile-processing-card {
    border-radius: 30px !important;
    background: #fffaf2 !important;
    border-color: #d8c7aa !important;
    box-shadow: 0 30px 80px rgba(17, 13, 9, 0.32) !important;
    color: #111827 !important;
  }

  .mobile-processing-icon {
    background: #ffffff !important;
    animation: bitepdf-mobile-processing-pulse 1.2s ease-in-out infinite !important;
  }

  .mobile-processing-icon svg {
    stroke: #16110c !important;
  }

  .mobile-processing-bar span {
    background: linear-gradient(90deg, #f3a869, #d7b870) !important;
  }

  .mobile-processing-copy strong,
  .mobile-processing-copy span {
    color: #111827 !important;
  }

  .mobile-processing-copy span {
    color: #315cf4 !important;
  }

  .mobile-processing-card p {
    color: #475569 !important;
  }

  @keyframes bitepdf-mobile-processing-pulse {
    0%,
    100% {
      transform: scale(1);
      box-shadow: 0 0 0 0 rgba(216, 183, 122, 0.24);
    }
    50% {
      transform: scale(1.035);
      box-shadow: 0 0 0 18px rgba(216, 183, 122, 0);
    }
  }
}

/* Mobile landing lock.
   The phone entry point should be upload-first, not a compressed copy of the full editor. */
@media (max-width: 760px) {
  body[data-has-docs="false"] {
    background: #fffaf2 !important;
    color: #111827 !important;
  }

  body[data-has-docs="false"] .workspace {
    min-height: calc(100svh - 112px) !important;
    padding: 18px 18px calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    display: block !important;
    overflow: auto !important;
    background:
      radial-gradient(circle at 50% 14%, rgba(216, 183, 122, 0.18), transparent 38%),
      #fffaf2 !important;
  }

  body[data-has-docs="false"] .mobile-mode-tabs,
  body[data-has-docs="false"] .toolbar,
  body[data-has-docs="false"] .top-actions,
  body[data-has-docs="false"] .mobile-app-intro,
  body[data-has-docs="false"] .entry-hero,
  body[data-has-docs="false"] .mobile-start-panel,
  body[data-has-docs="false"] .drop-capabilities,
  body[data-has-docs="false"] .drop-panel h2,
  body[data-has-docs="false"] .drop-panel p,
  body[data-has-docs="false"] .drop-panel small {
    display: none !important;
  }

  body[data-has-docs="false"] .drop-screen {
    width: min(100%, 420px) !important;
    min-height: calc(100svh - 156px) !important;
    margin: 0 auto !important;
    padding: 4px 0 24px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 16px !important;
    text-align: center !important;
  }

  body[data-has-docs="false"] .drop-screen::before {
    content: "Compress PDF";
    order: 0;
    display: block;
    margin-top: 10px;
    color: #111827;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(42px, 13vw, 58px);
    font-weight: 900;
    line-height: 0.96;
    letter-spacing: 0;
  }

  body[data-has-docs="false"] .drop-screen::after {
    content: "Upload a PDF, shrink it, preview it, then download.";
    order: 1;
    max-width: 340px;
    color: #334155;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.35;
    display: none;
  }

  body[data-has-docs="false"] .drop-panel {
    order: 2;
    width: min(100%, 360px) !important;
    min-height: min(56svh, 430px) !important;
    margin: 12px auto 0 !important;
    padding: 26px 22px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 24px !important;
    border: 2px dashed rgba(17, 24, 39, 0.22) !important;
    border-radius: 30px !important;
    background: #f3a869 !important;
    box-shadow: 0 22px 46px rgba(61, 45, 28, 0.18) !important;
  }

  body[data-has-docs="false"] .drop-panel svg {
    order: 0;
    width: 116px !important;
    height: 116px !important;
    padding: 28px !important;
    border-radius: 999px !important;
    color: #111827 !important;
    background: #fffaf2 !important;
    border: 0 !important;
    stroke-width: 1.8 !important;
    filter: drop-shadow(0 12px 26px rgba(61, 45, 28, 0.2)) !important;
  }

  body[data-has-docs="false"] .primary-drop-button {
    order: 1;
    width: 100% !important;
    min-height: 70px !important;
    padding: 0 24px !important;
    border: 0 !important;
    border-radius: 18px !important;
    color: #111827 !important;
    background: #fffaf2 !important;
    box-shadow: 0 12px 26px rgba(61, 45, 28, 0.12) !important;
    font-size: 24px !important;
    font-weight: 950 !important;
    letter-spacing: 0 !important;
  }

  body[data-has-docs="false"] .topbar {
    min-height: 92px !important;
    padding: 16px 22px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: #fffaf2 !important;
    border: 0 !important;
    box-shadow: none !important;
  }

  body[data-has-docs="false"] .brand {
    display: inline-flex !important;
    align-items: center !important;
    gap: 10px !important;
    color: #111827 !important;
    font-size: 27px !important;
    font-weight: 950 !important;
    text-decoration: none !important;
  }

  body[data-has-docs="false"] .brand-mark {
    width: 48px !important;
    height: 48px !important;
    border-radius: 15px !important;
    background: #fff !important;
    box-shadow: 0 10px 24px rgba(61, 45, 28, 0.12) !important;
  }

  body[data-has-docs="false"] .mobile-menu-button {
    position: static !important;
    display: inline-flex !important;
    width: 58px !important;
    height: 58px !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 19px !important;
    border: 1px solid rgba(17, 24, 39, 0.12) !important;
    background: #111827 !important;
    box-shadow: 0 12px 28px rgba(61, 45, 28, 0.16) !important;
  }

  body[data-has-docs="false"] .mobile-menu-button span {
    background: #fffaf2 !important;
  }

  body[data-has-docs="false"] .left-rail,
  body[data-has-docs="false"] .asset-tray,
  body[data-has-docs="false"] .status-strip {
    display: none !important;
  }

  body[data-has-docs="false"] .workspace {
    min-height: calc(100svh - 92px) !important;
    padding: 8px 18px calc(22px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body[data-has-docs="false"] .drop-screen {
    min-height: calc(100svh - 124px) !important;
    padding: 0 0 22px !important;
    gap: 18px !important;
  }

  body[data-has-docs="false"] .drop-screen::before {
    margin-top: 2px !important;
  }

  body[data-has-docs="false"] .drop-screen::after {
    content: "" !important;
    display: none !important;
  }

  body[data-has-docs="false"] .drop-panel {
    width: min(100%, 370px) !important;
    min-height: min(64svh, 500px) !important;
    margin-top: 0 !important;
  }

  body[data-has-docs="false"] .drop-panel svg {
    flex: 0 0 auto !important;
  }
}

/* Final mobile fit/readability pass. Keep the phone path upload-first and make
   the post-compression checkout surface readable instead of heavy/dark. */
@media (max-width: 760px) {
  body[data-has-docs="false"] .topbar {
    min-height: 76px !important;
    padding: 12px 16px !important;
  }

  body[data-has-docs="false"] .brand {
    max-width: calc(100vw - 92px) !important;
    min-width: 0 !important;
    gap: 9px !important;
    overflow: hidden !important;
    font-size: 24px !important;
    line-height: 1 !important;
    white-space: nowrap !important;
  }

  body[data-has-docs="false"] .brand-mark {
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
  }

  body[data-has-docs="false"] .brand-mark img,
  body[data-has-docs="false"] .brand-mark svg {
    width: 84% !important;
    height: 84% !important;
    padding: 0 !important;
    object-fit: contain !important;
  }

  body[data-has-docs="false"] .mobile-menu-button {
    width: 48px !important;
    height: 48px !important;
    flex: 0 0 48px !important;
    border-radius: 17px !important;
  }

  body[data-has-docs="false"] .workspace {
    min-height: calc(100svh - 76px) !important;
    padding: 2px 18px calc(20px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body[data-has-docs="false"] .drop-screen {
    min-height: calc(100svh - 106px) !important;
  }

  #accessModal {
    padding: 12px !important;
    background: rgba(15, 23, 42, 0.42) !important;
    align-items: center !important;
  }

  #accessModal .modal {
    width: min(100%, 430px) !important;
    max-height: calc(100svh - 24px) !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    overflow: auto !important;
    border-radius: 28px !important;
    border: 1px solid #e5c884 !important;
    background: #fffaf2 !important;
    color: #111827 !important;
    box-shadow: 0 30px 70px rgba(17, 24, 39, 0.28) !important;
  }

  #accessModal .modal-auth,
  #accessModal .modal-plans {
    padding: 24px 22px !important;
    background: #fffaf2 !important;
    border: 0 !important;
    color: #111827 !important;
  }

  #accessModal .modal-auth {
    padding-bottom: 10px !important;
  }

  #accessModal .modal-plans {
    padding-top: 8px !important;
    gap: 10px !important;
  }

  #accessModal .modal-close {
    top: 14px !important;
    right: 14px !important;
    width: 46px !important;
    height: 46px !important;
    border-radius: 16px !important;
    color: #fffaf2 !important;
    background: #1f1712 !important;
    border: 1px solid #d9b96e !important;
  }

  #accessModal .modal-auth .eyebrow,
  #accessModal .launch-promo-note span,
  #accessModal .unlock-result span {
    color: #8a5b16 !important;
  }

  #accessModal .modal-auth h2,
  #accessModal .modal-auth p,
  #accessModal .modal-auth label,
  #accessModal .modal-auth strong,
  #accessModal .modal-plans,
  #accessModal .modal-plans strong,
  #accessModal .plan-button,
  #accessModal .plan-button strong,
  #accessModal .plan-button small,
  #accessModal .local-pricing-note,
  #accessModal .launch-promo-note,
  #accessModal .launch-promo-note small,
  #accessModal .modal-note,
  #accessModal .checkout-stage {
    color: #111827 !important;
  }

  #accessModal .modal-auth h2 {
    max-width: calc(100% - 48px) !important;
    font-family: Georgia, "Times New Roman", serif !important;
    font-size: clamp(32px, 9vw, 44px) !important;
    line-height: 1.03 !important;
    letter-spacing: 0 !important;
  }

  #accessModal .modal-auth > p:not(.eyebrow) {
    font-size: 16px !important;
    line-height: 1.45 !important;
  }

  #accessModal .unlock-result,
  #accessModal .checkout-stage,
  #accessModal .launch-promo-note,
  #accessModal .local-pricing-note {
    background: #fffdfa !important;
    border: 1px solid #e5c884 !important;
    border-radius: 18px !important;
  }

  #accessModal .unlock-result strong,
  #accessModal .unlock-result .positive,
  #accessModal .unlock-result .negative {
    color: #111827 !important;
  }

  #accessModal .modal-plan-trust {
    display: none !important;
  }

  #accessModal .plan-button {
    min-height: 78px !important;
    grid-template-columns: 1fr auto !important;
    align-items: center !important;
    padding: 16px !important;
    border-radius: 18px !important;
    background: #fffdfa !important;
    border: 1px solid #e5c884 !important;
  }

  #accessModal .plan-button.recommended {
    background: #fff3dc !important;
    box-shadow: 0 0 0 3px rgba(216, 183, 122, 0.2) !important;
  }

  #accessModal .plan-button span {
    color: #8a5b16 !important;
    font-size: 13px !important;
  }

  #accessModal .plan-button strong {
    color: #9a6416 !important;
    font-size: 30px !important;
  }

  #accessModal .plan-button small {
    grid-column: 1 / -1 !important;
    color: #475569 !important;
    font-size: 13px !important;
    line-height: 1.3 !important;
  }

  #accessModal .wide-button.primary,
  #accessModal #clerkSignInButton {
    background: #111827 !important;
    color: #fffaf2 !important;
    border-color: #111827 !important;
  }

  #accessModal .modal {
    gap: 14px !important;
  }

  #accessModal .local-pricing-note {
    font-size: 14px !important;
    line-height: 1.35 !important;
    padding: 12px 14px !important;
  }

  #accessModal .launch-promo-note {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 6px !important;
    padding: 12px 14px !important;
  }

  #accessModal .launch-promo-note span,
  #accessModal .launch-promo-note strong,
  #accessModal .launch-promo-note code,
  #accessModal .launch-promo-note small {
    min-width: 0 !important;
  }

  #accessModal .launch-promo-note small {
    grid-column: 1 / -1 !important;
  }

  #accessModal .modal-note {
    background: #fff8e8 !important;
    border: 1px solid #e5c884 !important;
    border-radius: 14px !important;
    padding: 11px 12px !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
    font-weight: 800 !important;
  }

  #accessModal .checkout-stage {
    padding: 12px 14px !important;
    gap: 10px !important;
  }

  #accessModal .checkout-stage strong {
    color: #111827 !important;
    font-size: 15px !important;
  }

  #accessModal .checkout-stage p {
    margin-top: 2px !important;
    color: #475569 !important;
    font-size: 13px !important;
    line-height: 1.35 !important;
  }

  #accessModal .plan-button {
    min-height: 66px !important;
    padding: 13px 14px !important;
  }

  #accessModal .plan-button strong {
    font-size: 26px !important;
  }
}

@media (max-width: 760px) {
  body[data-has-docs="true"][data-mobile-mode="preview"] .viewport-edit-tools {
    display: flex !important;
    gap: 8px !important;
    overflow-x: auto !important;
    flex-wrap: nowrap !important;
    padding: 8px !important;
    margin: 0 12px 8px !important;
    border: 1px solid #2f2318 !important;
    border-radius: 16px !important;
    background: rgba(24, 17, 12, 0.92) !important;
    scrollbar-width: none !important;
  }

  body[data-has-docs="true"][data-mobile-mode="preview"] .viewport-edit-tools::-webkit-scrollbar {
    display: none !important;
  }

  body[data-has-docs="true"][data-mobile-mode="preview"] .viewport-edit-tools .tool-button {
    flex: 0 0 auto !important;
    min-height: 42px !important;
    padding: 8px 13px !important;
    white-space: nowrap !important;
  }
}

/* Final phone entry guard: allow a short scroll path and show the support footer. */
.mobile-empty-footer {
  display: none;
}

@media (max-width: 760px) {
  body[data-has-docs="false"] {
    overflow: hidden !important;
  }

  body[data-has-docs="false"] .app-shell {
    min-height: 100svh !important;
    overflow: hidden !important;
  }

  body[data-has-docs="false"] .workspace {
    min-height: calc(100svh - 76px) !important;
    max-height: calc(100svh - 76px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 8px 18px calc(28px + env(safe-area-inset-bottom, 0px)) !important;
  }

  body[data-has-docs="false"] .drop-screen {
    width: min(100%, 420px) !important;
    min-height: auto !important;
    margin: 0 auto !important;
    padding: 0 0 30px !important;
    gap: 16px !important;
    isolation: isolate !important;
  }

  body[data-has-docs="false"] .drop-panel {
    min-height: clamp(310px, 52svh, 430px) !important;
    margin-top: 2px !important;
  }

  body[data-has-docs="false"] .mobile-start-panel {
    order: 3 !important;
    display: grid !important;
    width: 100% !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
  }

  body[data-has-docs="false"] .mobile-start-panel button {
    min-width: 0 !important;
    min-height: 86px !important;
    display: grid !important;
    align-content: center !important;
    justify-items: start !important;
    gap: 5px !important;
    padding: 13px !important;
    border: 1px solid rgba(74, 56, 39, 0.28) !important;
    border-radius: 18px !important;
    color: #111827 !important;
    background: rgba(255, 250, 242, 0.92) !important;
    box-shadow: none !important;
    text-align: left !important;
  }

  body[data-has-docs="false"] .mobile-start-panel button strong,
  body[data-has-docs="false"] .mobile-start-panel button span {
    color: #111827 !important;
  }

  body[data-has-docs="false"] .mobile-start-panel button > span:last-child {
    font-size: 12px !important;
    line-height: 1.2 !important;
    color: #6b5f52 !important;
  }

  body[data-has-docs="false"] .mobile-tool-icon {
    width: 28px !important;
    height: 28px !important;
    display: grid !important;
    place-items: center !important;
    color: #111827 !important;
  }

  body[data-has-docs="false"] .mobile-tool-icon svg {
    width: 22px !important;
    height: 22px !important;
    fill: none !important;
    stroke: currentColor !important;
    stroke-width: 1.9 !important;
    stroke-linecap: round !important;
    stroke-linejoin: round !important;
  }

  body[data-has-docs="false"] .mobile-empty-footer {
    order: 4 !important;
    display: grid !important;
    width: 100% !important;
    gap: 10px !important;
    margin-top: 2px !important;
    padding: 16px !important;
    border: 1px solid rgba(74, 56, 39, 0.3) !important;
    border-radius: 20px !important;
    color: #111827 !important;
    background: rgba(255, 250, 242, 0.92) !important;
    text-align: left !important;
  }

  body[data-has-docs="false"] .mobile-empty-footer strong {
    color: #111827 !important;
    font-size: 18px !important;
    line-height: 1.15 !important;
  }

  body[data-has-docs="false"] .mobile-empty-footer p {
    margin: 0 !important;
    color: #5d5248 !important;
    font-size: 13px !important;
    line-height: 1.38 !important;
  }

  body[data-has-docs="false"] .mobile-empty-footer nav {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
  }

  body[data-has-docs="false"] .mobile-empty-footer a {
    color: #111827 !important;
    font-weight: 900 !important;
    text-decoration: none !important;
  }

  body[data-has-docs="false"] .mobile-empty-footer nav a {
    min-height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    padding: 0 13px !important;
    border: 1px solid rgba(74, 56, 39, 0.32) !important;
    border-radius: 999px !important;
    background: #fffaf2 !important;
  }

  body[data-has-docs="false"] .mobile-empty-email {
    width: fit-content !important;
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
  }

  @media (max-height: 720px) {
    body[data-has-docs="false"] .drop-panel {
      min-height: 300px !important;
      padding-block: 20px !important;
    }

    body[data-has-docs="false"] .drop-panel svg {
      width: 96px !important;
      height: 96px !important;
      padding: 23px !important;
    }
  }
}

/* Absolute last BitePDF agent mobile pass: top drawer owns settings, composer docks to tabs. */
@media (max-width: 760px) {
  html body[data-has-docs="true"] .mobile-menu-button {
    width: 44px !important;
    height: 44px !important;
    border-radius: 15px !important;
    box-shadow: none !important;
  }

  html body[data-has-docs="true"] .mobile-menu-button span {
    width: 20px !important;
    height: 2px !important;
  }

  html body[data-has-docs="true"] .mobile-drawer-sheet {
    box-sizing: border-box !important;
    width: min(420px, calc(100vw - 24px)) !important;
  }

  .mobile-drawer-account {
    align-items: stretch !important;
    flex-direction: column !important;
  }

  .mobile-drawer-account-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    width: 100% !important;
    gap: 8px !important;
  }

  .mobile-drawer-account-actions button {
    justify-content: center !important;
    min-width: 0 !important;
    min-height: 38px !important;
    padding: 0 11px !important;
    border-radius: 12px !important;
    white-space: nowrap !important;
  }

  html body[data-has-docs="true"][data-mobile-mode="agent"] .agent-head {
    display: none !important;
  }

  html body[data-has-docs="true"][data-mobile-mode="agent"] .inspector {
    padding-bottom: calc(392px + env(safe-area-inset-bottom, 0px)) !important;
    overflow-y: auto !important;
  }

  html body[data-has-docs="true"][data-mobile-mode="agent"] .agent-panel {
    padding-bottom: calc(346px + env(safe-area-inset-bottom, 0px)) !important;
  }

  html body[data-has-docs="true"][data-mobile-mode="agent"] #agentTranscript.agent-session,
  html body[data-has-docs="true"][data-mobile-mode="agent"] .agent-session {
    height: min(430px, calc(100dvh - 372px)) !important;
    min-height: min(280px, calc(100dvh - 448px)) !important;
    max-height: min(430px, calc(100dvh - 372px)) !important;
    padding-bottom: 18px !important;
  }

  html body[data-has-docs="true"][data-mobile-mode="agent"] .agent-ai-box,
  html body[data-has-docs="true"][data-mobile-mode="agent"] .agent-ai-box:hover,
  html body[data-has-docs="true"][data-mobile-mode="agent"] .agent-ai-box:focus-within {
    position: fixed !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important;
    z-index: 1240 !important;
    max-height: min(330px, calc(100dvh - 220px)) !important;
    margin: 0 !important;
    overflow-y: auto !important;
    border-radius: 18px !important;
    box-shadow: 0 -8px 34px rgba(0, 0, 0, 0.45) !important;
  }

  html body[data-has-docs="true"][data-mobile-mode="agent"] .agent-mobile-controls label span {
    color: #f2a568 !important;
  }

  html body[data-has-docs="true"] .mobile-mode-tabs {
    z-index: 1250 !important;
  }

  html body[data-has-docs="true"] .modal-backdrop,
  html body[data-has-docs="true"] #agentMobileSettingsModal {
    z-index: 2000 !important;
  }

  html body[data-has-docs="true"] #agentMobileSettingsModal .agent-settings-modal {
    max-height: calc(100dvh - 28px) !important;
    margin: 0 !important;
  }

  html body #accessModal:not([hidden]) .modal,
  html body #accessModal:not([hidden]) .modal-auth,
  html body #accessModal:not([hidden]) .modal-plans,
  html body #accessModal:not([hidden]) .unlock-result,
  html body #accessModal:not([hidden]) .checkout-stage,
  html body #accessModal:not([hidden]) .local-pricing-note,
  html body #accessModal:not([hidden]) .launch-promo-note,
  html body #accessModal:not([hidden]) .public-service-note,
  html body #accessModal:not([hidden]) .modal-note {
    background: #fffaf2 !important;
    color: #111827 !important;
    border-color: #dfd0b9 !important;
  }

  html body #accessModal:not([hidden]) :where(.modal-auth h2, .modal-auth strong, .modal-auth label, .modal-plans strong, .unlock-result strong, .checkout-stage strong) {
    color: #111827 !important;
  }

  html body #accessModal:not([hidden]) :where(.modal-auth p, .modal-auth small, .launch-promo-note small, .public-service-note small, .plan-button small, .unlock-result p, .checkout-stage p) {
    color: #4b5563 !important;
  }

  html body #accessModal:not([hidden]) :where(.plan-button span, .launch-promo-note span, .public-service-note span, .public-service-note a) {
    color: #9a5a12 !important;
  }
}

/* Final readability lock: empty editor, workspace rail, and checkout modal
   must follow the selected theme without pale-on-pale or dark-on-dark states. */
html[data-bitepdf-theme="light"] body[data-has-docs="false"] :where(
  .drop-screen,
  .entry-hero,
  .drop-panel,
  .mobile-app-intro,
  .mobile-start-panel button,
  .left-rail,
  .workspace-switcher,
  .side-section,
  .queue-summary,
  .page-tools,
  .file-card
) {
  background-color: #fffaf2 !important;
  color: #101827 !important;
  border-color: #dfd0b9 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="false"] :where(
  .entry-hero h2,
  .drop-panel h2,
  .mobile-app-intro strong,
  .mobile-start-panel button strong,
  .left-rail strong,
  .left-rail h2,
  .workspace-chip strong,
  .file-card strong
) {
  color: #101827 !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="false"] :where(
  .entry-hero p,
  .drop-panel p,
  .mobile-drop-promise,
  .mobile-start-panel button > span:last-child,
  .left-rail p,
  .workspace-chip span,
  .file-card span,
  .side-section small
) {
  color: #5d5248 !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="dark"] body[data-has-docs="false"] :where(
  .drop-screen,
  .entry-hero,
  .drop-panel,
  .mobile-app-intro,
  .mobile-start-panel button,
  .left-rail,
  .workspace-switcher,
  .side-section,
  .queue-summary,
  .page-tools,
  .file-card
) {
  background-color: #17120d !important;
  color: #fff7ed !important;
  border-color: #4a3827 !important;
}

html[data-bitepdf-theme="dark"] body[data-has-docs="false"] :where(
  .entry-hero h2,
  .drop-panel h2,
  .mobile-app-intro strong,
  .mobile-start-panel button strong,
  .left-rail strong,
  .left-rail h2,
  .workspace-chip strong,
  .file-card strong
) {
  color: #fff7ed !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="dark"] body[data-has-docs="false"] :where(
  .entry-hero p,
  .drop-panel p,
  .mobile-drop-promise,
  .mobile-start-panel button > span:last-child,
  .left-rail p,
  .workspace-chip span,
  .file-card span,
  .side-section small
) {
  color: #d8cbbb !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="dark"] body[data-has-docs="false"] :where(.entry-proof span, .drop-capabilities span) {
  color: #083b34 !important;
  background: #bff4e9 !important;
  border-color: #4db6a9 !important;
}

html[data-bitepdf-theme="dark"] body[data-has-docs="false"] :where(.mobile-tool-icon, .mobile-tool-icon svg) {
  color: #efbd6b !important;
  stroke: currentColor !important;
}

html[data-bitepdf-theme="light"] body #accessModal:not([hidden]) :where(
  .modal-plan-trust span,
  .launch-promo-note span,
  .public-service-note span,
  .public-service-note a
) {
  color: #064e3b !important;
  background: #e8fff8 !important;
  border-color: #8dd8ca !important;
}

html[data-bitepdf-theme="dark"] body #accessModal:not([hidden]) :where(
  .modal-plan-trust span,
  .launch-promo-note span,
  .public-service-note span,
  .public-service-note a
) {
  color: #bdf8ef !important;
  background: #10251f !important;
  border-color: #4f8f80 !important;
}

html[data-bitepdf-theme="light"] body #accessModal:not([hidden]) :where(.plan-button span) {
  color: #8a4f0b !important;
  background: transparent !important;
  border-color: transparent !important;
}

html[data-bitepdf-theme="dark"] body #accessModal:not([hidden]) :where(.plan-button span) {
  color: #efbd6b !important;
  background: transparent !important;
  border-color: transparent !important;
}

/* 2026-06-18 final editor authority: simple workspace rail, compact readable agent. */
@media (min-width: 1180px) {
  html body[data-has-docs="true"] .app-shell {
    grid-template-columns: 72px minmax(0, 1fr) 8px minmax(340px, 380px) !important;
  }

  html body:not([data-has-docs="true"]) .app-shell {
    grid-template-columns: minmax(0, 1fr) minmax(340px, 380px) !important;
  }

  html body:not([data-has-docs="true"]) .left-rail {
    display: none !important;
  }

  html body:not([data-has-docs="true"]) .workspace {
    grid-column: 1 !important;
  }

  html body:not([data-has-docs="true"]) .inspector {
    grid-column: 2 !important;
    width: 380px !important;
    max-width: 380px !important;
    min-width: 0 !important;
  }

  html body[data-has-docs="true"] .left-rail {
    display: flex !important;
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    padding: 10px 8px !important;
    align-items: center !important;
    gap: 10px !important;
    overflow: hidden !important;
  }

  html body[data-has-docs="true"] .left-rail > :not(.workspace-switcher):not(.document-panel) {
    display: none !important;
  }

  html body[data-has-docs="true"] .workspace-switcher,
  html body[data-has-docs="true"] .document-panel {
    display: grid !important;
    width: 52px !important;
    padding: 0 !important;
    gap: 8px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html body[data-has-docs="true"] .workspace-switcher :where(.workspace-switcher-head, .workspace-chip, .hint),
  html body[data-has-docs="true"] .document-panel .document-panel-head {
    display: none !important;
  }

  html body[data-has-docs="true"] .workspace-orbit,
  html body[data-has-docs="true"] #fileList {
    display: grid !important;
    justify-items: center !important;
    gap: 8px !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  html body[data-has-docs="true"] .workspace-dot,
  html body[data-has-docs="true"] .workspace-dot.add {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    border-radius: 999px !important;
    padding: 0 !important;
    font-size: 18px !important;
  }

  html body[data-has-docs="true"] .workspace-dot.add {
    order: -1 !important;
    font-size: 24px !important;
  }

  html body[data-has-docs="true"] .file-chip {
    width: 48px !important;
    min-height: 48px !important;
    padding: 4px !important;
    border-radius: 14px !important;
    overflow: hidden !important;
  }

  html body[data-has-docs="true"] .file-chip :where(strong, small, button) {
    display: none !important;
  }

  html body[data-has-docs="true"] .file-thumb {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
  }
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] :where(.agent-panel, .agent-ai-box, .agent-session, .agent-memory, .agent-memory-list, .agent-message.assistant, .agent-runtime-strip span) {
  color: #101827 !important;
  background: rgba(255, 251, 246, 0.98) !important;
  border-color: #dcc8a8 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] .agent-panel * {
  opacity: 1 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] :where(.agent-local-plan, .agent-work-card, .agent-ai-result, .agent-message.workspace-guide, .agent-memory li) {
  color: #101827 !important;
  background: #ffffff !important;
  border-color: #d8bf92 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] :where(.agent-panel h2, .agent-panel h3, .agent-panel strong, .agent-panel label, .agent-runtime-strip em, .agent-memory strong, .agent-message strong) {
  color: #101827 !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] :where(#agentTitle, .agent-ai-head strong, .agent-memory-item strong, .agent-thinking-list strong) {
  color: #101827 !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] .agent-panel #agentTitle,
html[data-bitepdf-theme="light"] body[data-has-docs="true"] .agent-panel .agent-ai-head strong,
html[data-bitepdf-theme="light"] body[data-has-docs="true"] .agent-panel .agent-memory-item strong,
html[data-bitepdf-theme="light"] body[data-has-docs="true"] .agent-panel .agent-thinking-list strong {
  color: #101827 !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] :where(.agent-panel p, .agent-panel small, .agent-panel span, .agent-message p, .agent-memory li, .agent-runtime-strip b, .agent-kicker, #agentSignal, #agentAgentCopy) {
  color: #4b5563 !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] :where(#agentText, .agent-thinking-list p, .agent-memory-item p) {
  color: #4b5563 !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] .agent-panel #agentText,
html[data-bitepdf-theme="light"] body[data-has-docs="true"] .agent-panel .agent-thinking-list p,
html[data-bitepdf-theme="light"] body[data-has-docs="true"] .agent-panel .agent-memory-item p {
  color: #4b5563 !important;
  opacity: 1 !important;
}

html[data-bitepdf-theme="light"] body[data-has-docs="true"] .agent-ai-box textarea,
html[data-bitepdf-theme="light"] body[data-has-docs="true"] textarea#agentGoalInput {
  color: #101827 !important;
  background: #ffffff !important;
  border-color: #d8bf92 !important;
}

/* 2026-06-19 product pass: persistent workspace rail, compact export, chat-first agent. */
@media (min-width: 1180px) {
  html body:has(.app-shell) .app-shell {
    grid-template-columns: 72px minmax(0, 1fr) 8px minmax(336px, 376px) !important;
  }

  html body:has(.app-shell) .left-rail {
    display: flex !important;
    width: 72px !important;
    min-width: 72px !important;
    max-width: 72px !important;
    padding: 10px 8px !important;
    align-items: center !important;
    gap: 10px !important;
    overflow: hidden !important;
  }

  html body:has(.app-shell) .workspace {
    grid-column: 2 !important;
    min-width: 0 !important;
  }

  html body:has(.app-shell) .splitter,
  html body:has(.app-shell) .sidebar-resizer {
    grid-column: 3 !important;
  }

  html body:has(.app-shell) .inspector {
    grid-column: 4 !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: none !important;
    overflow: hidden !important;
  }

  html body:has(.app-shell) .left-rail > :not(.workspace-switcher):not(.document-panel) {
    display: none !important;
  }

  html body:has(.app-shell) .workspace-switcher,
  html body:has(.app-shell) .document-panel {
    display: grid !important;
    width: 52px !important;
    padding: 0 !important;
    gap: 8px !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  html body:has(.app-shell) .workspace-switcher {
    flex: 1 1 auto !important;
    min-height: 180px !important;
  }

  html body:has(.app-shell) .workspace-switcher :where(.workspace-switcher-head, .workspace-chip, .hint),
  html body:has(.app-shell) .document-panel .document-panel-head {
    display: none !important;
  }

  html body:has(.app-shell) .workspace-orbit {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    height: 100% !important;
    min-height: 180px !important;
    gap: 9px !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  html body:has(.app-shell) #fileList {
    display: grid !important;
    justify-items: center !important;
    gap: 8px !important;
    padding: 0 !important;
    overflow: visible !important;
  }

  html body:has(.app-shell) .workspace-dot,
  html body:has(.app-shell) .workspace-dot.add {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    border-radius: 999px !important;
    padding: 0 !important;
    font-size: 18px !important;
  }

  html body:has(.app-shell) .workspace-dot.add {
    order: 999 !important;
    margin-top: auto !important;
    font-size: 24px !important;
  }

  html body:has(.app-shell) .workspace-dot:nth-child(3n+1) {
    border-color: rgba(191, 244, 233, 0.72) !important;
  }

  html body:has(.app-shell) .workspace-dot:nth-child(3n+2) {
    border-color: rgba(239, 189, 107, 0.72) !important;
  }

  html body:has(.app-shell) .workspace-dot:nth-child(3n+3) {
    border-color: rgba(151, 175, 255, 0.72) !important;
  }

  html body:has(.app-shell) .workspace-dot.active {
    box-shadow: 0 0 0 3px rgba(191, 244, 233, 0.22) !important;
  }

  html body:has(.app-shell) .file-chip {
    width: 48px !important;
    min-height: 48px !important;
    padding: 4px !important;
    border-radius: 14px !important;
    overflow: hidden !important;
  }

  html body:has(.app-shell) .file-chip :where(strong, small, button) {
    display: none !important;
  }

  html body:has(.app-shell) .file-thumb {
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
  }
}

html body:has(.app-shell) .result-dock {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) minmax(260px, auto) minmax(160px, auto) !important;
  align-items: center !important;
  gap: 14px !important;
  padding: 12px 16px !important;
  min-height: 0 !important;
  max-height: none !important;
}

html body:has(.app-shell) .result-dock[hidden] {
  display: none !important;
}

html body:has(.app-shell) .result-dock .eyebrow {
  margin-bottom: 3px !important;
  font-size: 11px !important;
}

html body:has(.app-shell) .result-dock h3 {
  font-size: clamp(22px, 2.1vw, 34px) !important;
  line-height: 1.05 !important;
  margin: 0 !important;
}

html body:has(.app-shell) .result-dock p:not(.eyebrow) {
  max-width: 760px !important;
  margin-top: 6px !important;
  font-size: 15px !important;
  line-height: 1.45 !important;
}

html body:has(.app-shell) .result-stats {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(78px, 1fr)) !important;
  gap: 8px !important;
}

html body:has(.app-shell) .result-stats span {
  min-width: 0 !important;
  padding: 10px 12px !important;
}

html body:has(.app-shell) .result-dock .primary-action {
  min-height: 42px !important;
  padding: 0 18px !important;
  white-space: nowrap !important;
}

html body:has(.app-shell) .agent-panel {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  height: calc(100vh - 92px) !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

html body:has(.app-shell) .agent-head {
  flex: 0 0 auto !important;
}

html body:has(.app-shell) .agent-runtime-strip {
  flex: 0 0 auto !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 6px !important;
}

html body:has(.app-shell) .agent-runtime-strip span {
  padding: 8px 10px !important;
  min-height: 0 !important;
}

html body:has(.app-shell) .agent-runtime-strip small {
  font-size: 9px !important;
}

html body:has(.app-shell) .agent-runtime-strip b {
  font-size: 13px !important;
}

html body:has(.app-shell) .agent-session {
  flex: 1 1 auto !important;
  min-height: 210px !important;
  max-height: none !important;
  overflow-y: auto !important;
  padding: 10px !important;
}

html body:has(.app-shell) :where(.agent-surface-bar, .agent-surface-suggestions, .agent-memory, .agent-screenshot-state, .agent-support-strip span, .agent-thinking details) {
  display: none !important;
}

html body:has(.app-shell) .agent-local-plan {
  flex: 0 0 auto !important;
  max-height: 120px !important;
  overflow: auto !important;
  padding: 12px !important;
}

html body:has(.app-shell) .agent-local-plan h3,
html body:has(.app-shell) .agent-local-plan p {
  font-size: 13px !important;
  line-height: 1.4 !important;
}

html body:has(.app-shell) .agent-ai-box {
  flex: 0 0 auto !important;
  display: grid !important;
  gap: 8px !important;
  padding: 12px !important;
  border-radius: 14px !important;
}

html body:has(.app-shell) .agent-ai-head {
  margin: 0 !important;
}

html body:has(.app-shell) .agent-ai-box textarea {
  min-height: 62px !important;
  max-height: 96px !important;
  padding: 12px 14px !important;
  font-size: 14px !important;
  line-height: 1.4 !important;
}

html body:has(.app-shell) .agent-mobile-controls {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) !important;
  gap: 6px !important;
  margin: 0 !important;
}

html body:has(.app-shell) .agent-mobile-controls label {
  display: grid !important;
  gap: 4px !important;
}

html body:has(.app-shell) .agent-mobile-controls label span {
  font-size: 10px !important;
  text-transform: uppercase !important;
  letter-spacing: 0.08em !important;
}

html body:has(.app-shell) .agent-mobile-controls select {
  min-height: 36px !important;
  padding: 0 10px !important;
  border-radius: 10px !important;
}

html body:has(.app-shell) .agent-auto-status {
  display: none !important;
}

html body:has(.app-shell) .agent-composer-actions {
  display: grid !important;
  grid-template-columns: 0.8fr 0.9fr 1fr !important;
  gap: 8px !important;
}

html body:has(.app-shell) .agent-composer-actions button {
  min-height: 36px !important;
  padding: 0 10px !important;
  border-radius: 10px !important;
  font-size: 13px !important;
}

html body:has(.app-shell) #agentAiButton {
  grid-column: auto !important;
}

html body:has(.app-shell) .agent-support-strip {
  justify-content: flex-end !important;
  padding-top: 0 !important;
}

html body:has(.app-shell) .agent-support-strip button {
  min-height: 32px !important;
  padding: 0 12px !important;
  font-size: 12px !important;
}

html body[data-has-docs="false"] .entry-hero p {
  max-width: 760px !important;
}

html body[data-has-docs="false"] .mobile-drop-promise {
  font-size: 13px !important;
  line-height: 1.45 !important;
}

@media (max-width: 1179px) {
  html body:has(.app-shell) .result-dock {
    grid-template-columns: 1fr !important;
    gap: 10px !important;
  }

  html body:has(.app-shell) .result-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  html body:has(.app-shell) .agent-surface-bar,
  html body:has(.app-shell) .agent-surface-suggestions {
    display: none !important;
  }
}

/* 2026-06-19 cascade lock: keep editor compact after all older overrides. */
@media (min-width: 1180px) {
  html body .app-shell .result-dock {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) minmax(250px, auto) minmax(154px, auto) !important;
    align-items: center !important;
    gap: 12px !important;
    padding: 10px 14px !important;
  }

  html body .app-shell .result-dock > div:first-child {
    min-width: 0 !important;
  }

  html body .app-shell .result-dock h3 {
    font-size: clamp(21px, 1.9vw, 30px) !important;
    line-height: 1.05 !important;
  }

  html body .app-shell .result-dock p:not(.eyebrow) {
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    font-size: 14px !important;
    line-height: 1.38 !important;
  }

  html body .app-shell .result-stats {
    grid-template-columns: repeat(3, minmax(72px, 1fr)) !important;
  }

  html body .app-shell .result-stats span {
    padding: 8px 10px !important;
  }

  html body .app-shell .result-stats b {
    font-size: 17px !important;
  }

  html body .app-shell .result-dock .primary-action {
    min-height: 38px !important;
    padding: 0 16px !important;
  }
}

html body .app-shell .agent-panel .agent-surface-bar,
html body .app-shell .agent-panel .agent-surface-suggestions,
html body .app-shell .agent-panel .agent-memory,
html body .app-shell .agent-panel .agent-screenshot-state,
html body .app-shell .agent-panel .agent-support-strip span {
  display: none !important;
}

html body .app-shell .agent-panel .agent-session {
  flex: 1 1 auto !important;
  min-height: 240px !important;
  overflow-y: auto !important;
}

html body .app-shell .agent-panel .agent-ai-box {
  flex: 0 0 auto !important;
  padding: 12px !important;
}

html body .app-shell .agent-panel .agent-ai-box textarea {
  min-height: 62px !important;
  max-height: 96px !important;
}

html body .app-shell .agent-panel .agent-mobile-controls {
  display: grid !important;
}

html body .app-shell .agent-panel .agent-composer-actions {
  display: grid !important;
  grid-template-columns: 0.8fr 0.9fr 1fr !important;
  gap: 8px !important;
}

html body .app-shell .agent-panel .agent-composer-actions button {
  min-height: 36px !important;
}

/* 2026-06-19 final product shell: keep the workspace rail present before upload too. */
@media (min-width: 1180px) {
  html body:has(.app-shell) .app-shell {
    grid-template-columns: 72px minmax(0, 1fr) 8px minmax(336px, 376px) !important;
  }

  html body:not([data-has-docs="true"]):has(.app-shell) .left-rail,
  html body:has(.app-shell) .left-rail {
    display: flex !important;
    grid-column: 1 !important;
    width: 72px !important;
    min-width: 72px !important;
    padding: 12px 8px !important;
    overflow: hidden !important;
  }

  html body:not([data-has-docs="true"]):has(.app-shell) .workspace,
  html body:has(.app-shell) .workspace {
    grid-column: 2 !important;
  }

  html body:not([data-has-docs="true"]):has(.app-shell) .sidebar-resizer,
  html body:has(.app-shell) .sidebar-resizer {
    display: block !important;
    grid-column: 3 !important;
  }

  html body:not([data-has-docs="true"]):has(.app-shell) .inspector,
  html body:has(.app-shell) .inspector {
    grid-column: 4 !important;
  }

  html body:has(.app-shell) .left-rail :where(.rail-heading > div, .rail-heading-actions, .workspace-switcher-head, .workspace-chip, .workspace-switcher .hint, .document-panel-head, .empty-file-state, .file-card strong, .file-card small, .file-drop, .queue-summary, .sidebar-insight, .page-cutter, .sidebar-tools, .job-panel, .memory-panel, .legal-panel) {
    display: none !important;
  }

  html body:has(.app-shell) .workspace-switcher,
  html body:has(.app-shell) .document-panel {
    display: contents !important;
  }

  html body:has(.app-shell) .workspace-orbit,
  html body:has(.app-shell) #fileList {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 10px !important;
    min-height: 0 !important;
  }

  html body:has(.app-shell) .workspace-orbit {
    flex: 1 1 auto !important;
  }

  html body:has(.app-shell) #fileList {
    flex: 0 0 auto !important;
    max-height: 240px !important;
    overflow: hidden !important;
  }

  html body:has(.app-shell) .workspace-dot,
  html body:has(.app-shell) .workspace-dot.add {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    border-radius: 999px !important;
    display: grid !important;
    place-items: center !important;
    font-size: 18px !important;
    line-height: 1 !important;
  }

  html body:has(.app-shell) .workspace-dot.add {
    order: 999 !important;
    margin-top: auto !important;
  }

  html body:has(.app-shell) .file-card {
    width: 48px !important;
    height: 58px !important;
    padding: 4px !important;
    border-radius: 12px !important;
    display: grid !important;
    place-items: center !important;
  }

  html body:has(.app-shell) .file-card .thumb {
    width: 36px !important;
    height: 48px !important;
  }
}

/* Compact the agent into a conversation pane, not a second toolbar. */
html body:has(.app-shell) .agent-panel {
  gap: 8px !important;
}

html body:has(.app-shell) .agent-tools,
html body:has(.app-shell) .agent-local-plan {
  display: none !important;
}

html body:has(.app-shell) .agent-head {
  padding-bottom: 2px !important;
}

html body:has(.app-shell) .agent-runtime-strip {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

html body:has(.app-shell) .agent-runtime-strip span {
  min-width: 0 !important;
  padding: 10px 12px !important;
  border-radius: 12px !important;
}

html body:has(.app-shell) .agent-runtime-strip b,
html body:has(.app-shell) .agent-runtime-strip em {
  max-width: 100% !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

html body:has(.app-shell) .agent-runtime-strip b {
  font-size: 10px !important;
  letter-spacing: 0.07em !important;
}

html body:has(.app-shell) .agent-runtime-strip em {
  font-size: 15px !important;
  line-height: 1.1 !important;
}

html body:has(.app-shell) .agent-session {
  border-radius: 14px !important;
  border: 1px solid var(--border) !important;
  background: color-mix(in srgb, var(--panel) 84%, transparent) !important;
}

html body:has(.app-shell) .agent-ai-box {
  border-radius: 14px !important;
  padding: 10px !important;
}

html body:has(.app-shell) .agent-ai-head {
  display: none !important;
}

html body:has(.app-shell) .agent-ai-box textarea {
  min-height: 54px !important;
  max-height: 82px !important;
}

html body:has(.app-shell) .agent-mobile-controls {
  grid-template-columns: minmax(0, 1fr) !important;
}

  html body:has(.app-shell) .agent-composer-actions {
    grid-template-columns: 0.72fr 0.85fr 0.95fr !important;
  }

@media (min-width: 1180px) {
  html body:not([data-has-docs="true"]):has(.app-shell) .app-shell {
    grid-template-columns: 72px minmax(0, 1fr) 8px minmax(336px, 376px) !important;
  }

  html body:not([data-has-docs="true"]):has(.app-shell) .topbar {
    grid-column: 1 / -1 !important;
    width: auto !important;
  }

  html body:not([data-has-docs="true"]):has(.app-shell) .workspace {
    grid-column: 2 !important;
    width: auto !important;
  }

  html body:not([data-has-docs="true"]):has(.app-shell) .sidebar-resizer {
    grid-column: 3 !important;
    width: 8px !important;
  }

  html body:not([data-has-docs="true"]):has(.app-shell) .inspector {
    grid-column: 4 !important;
    width: auto !important;
  }
}

/* 2026-06-19 compact agent composer: keep prompt templates from owning the rail. */
html body:has(.app-shell) .agent-panel .agent-ai-box {
  padding: 8px !important;
  gap: 6px !important;
  border-radius: 12px !important;
}

html body:has(.app-shell) .agent-panel .agent-ai-box textarea {
  min-height: 42px !important;
  max-height: 58px !important;
  padding: 8px 10px !important;
  font-size: 13px !important;
  line-height: 1.3 !important;
}

html body:has(.app-shell) .agent-panel .agent-mobile-controls {
  gap: 4px !important;
}

html body:has(.app-shell) .agent-panel .agent-mobile-controls label {
  display: grid !important;
  grid-template-columns: auto minmax(0, 1fr) !important;
  align-items: center !important;
  gap: 8px !important;
}

html body:has(.app-shell) .agent-panel .agent-mobile-controls label span {
  font-size: 9px !important;
  letter-spacing: 0.08em !important;
}

html body:has(.app-shell) .agent-panel .agent-mobile-controls select {
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 28px 0 10px !important;
  border-radius: 9px !important;
  font-size: 13px !important;
}

html body:has(.app-shell) .agent-panel .agent-composer-actions {
  grid-template-columns: 64px 58px minmax(0, 1fr) !important;
  gap: 5px !important;
}

html body:has(.app-shell) .agent-panel .agent-composer-actions button {
  min-height: 30px !important;
  height: 30px !important;
  padding: 0 6px !important;
  border-radius: 9px !important;
  font-size: 11px !important;
  white-space: nowrap !important;
}

html body:has(.app-shell) .agent-panel #agentAiButton {
  min-width: 0 !important;
  grid-column: auto !important;
}

/* 2026-06-19 final compact composer override: exact ID wins over older rail rules. */
html body:has(.app-shell) .agent-panel .agent-ai-box #agentGoalInput {
  min-height: 42px !important;
  height: 42px !important;
  max-height: 56px !important;
  padding: 7px 10px !important;
  font-size: 13px !important;
  line-height: 1.25 !important;
  resize: vertical !important;
}

html body:has(.app-shell) .agent-panel .agent-mobile-controls .agent-auto-status {
  display: none !important;
}

html body:has(.app-shell) .agent-panel .agent-ai-box {
  max-height: 178px !important;
}

/* 2026-06-19 rail cleanup: the thin left rail is workspaces only, not pages. */
@media (min-width: 1180px) {
  html body:has(.app-shell) .left-rail {
    width: 64px !important;
    min-width: 64px !important;
    max-width: 64px !important;
    padding: 10px 6px !important;
  }

  html body:has(.app-shell) .document-panel,
  html body:has(.app-shell) #fileList {
    display: none !important;
  }

  html body:has(.app-shell) .workspace-switcher {
    display: flex !important;
    flex: 1 1 auto !important;
    width: 100% !important;
    min-height: 0 !important;
  }

  html body:has(.app-shell) .workspace-orbit {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    width: 100% !important;
    min-height: calc(100vh - 130px) !important;
    gap: 10px !important;
    padding: 0 !important;
  }

  html body:has(.app-shell) .workspace-dot,
  html body:has(.app-shell) .workspace-dot.add {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    border-radius: 999px !important;
    font-size: 16px !important;
    font-weight: 800 !important;
  }

  html body:has(.app-shell) .workspace-dot.add {
    order: 999 !important;
    margin-top: auto !important;
    font-size: 22px !important;
  }

  html body:has(.app-shell) .workspace-dot.active {
    outline: 2px solid color-mix(in srgb, var(--accent) 70%, white 30%) !important;
    outline-offset: 2px !important;
  }

  html body:has(.app-shell) .asset-tray {
    left: 82px !important;
    bottom: 16px !important;
  }

  html body:has(.app-shell) .workspace-orbit .workspace-dot.add {
    order: 999 !important;
    margin-top: auto !important;
  }
}
