* {
  box-sizing: border-box;
}
/* Hide all fixed/sticky elements when scanner modal is open */
body.scanner-modal-open > *:not(.scanner-fullscreen),
body.scanner-modal-open .sticky,
body.scanner-modal-open [class*="sticky"],
body.scanner-modal-open [class*="fixed"]:not(.scanner-fullscreen) {
  z-index: -1 !important;
}

html,
body,
#__nuxt,
#__layout {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Inter", "Manrope", "Segoe UI", sans-serif;
  background: #f8fafc;
  color: #0f172a;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Material Symbols */
.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-weight: normal;
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1em;
  min-width: 1em;
  max-width: 1em;
  height: 1em;
  min-height: 1em;
  max-height: 1em;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  flex-shrink: 0;
  white-space: nowrap;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "liga";
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 22px;
}

/* Active tool button in toolbar */
.active-tool {
  background-color: #6600bc !important;
  color: white !important;
  box-shadow: 0 4px 12px rgba(102, 0, 188, 0.25);
}

/* Sidebar transition */
.sidebar-transition {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button,
input {
  font: inherit;
}

/* OLD DESIGN - DISABLED */
/*
button {
  border: 1px solid #d5dcec;
  background: #ffffff;
  color: #1f2a44;
  border-radius: 10px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

button:hover:not(:disabled) {
  background: #f4f7ff;
  border-color: #c1cbdf;
}

button:disabled,
.upload-lite.disabled {
  opacity: 0.58;
  cursor: not-allowed;
}
*/
/* END OLD DESIGN */

.pdf-editor {
  height: 100vh;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5fd 35%, #eef2f8 100%);
  overflow: hidden;
}

.processing-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(95, 14, 29, 0.62);
  backdrop-filter: blur(10px);
}

.processing-modal-overlay.is-editor {
  background: rgba(13, 20, 38, 0.42);
}

.processing-modal {
  width: min(920px, calc(100vw - 48px));
  padding: 42px 46px;
  border-radius: 28px;
  background: #ffffff;
  box-shadow: 0 28px 80px rgba(34, 24, 56, 0.28);
}

.processing-modal-copy h2 {
  margin: 0;
  color: #1d1d23;
  font-size: clamp(34px, 4vw, 48px);
  line-height: 1.08;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.processing-modal-kicker {
  margin: 0 0 10px;
  color: #5a6280;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.processing-modal-file {
  margin: 12px 0 0;
  color: #66708d;
  font-size: 17px;
  font-weight: 600;
  word-break: break-word;
}

.processing-modal-progress {
  margin-top: 46px;
}

.processing-modal-progress-track {
  position: relative;
  height: 14px;
  border-radius: 999px;
  background: #dfe3ea;
  overflow: hidden;
}

.processing-modal-progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #11877a 0%, #1e9d90 100%);
  transition: width 0.24s ease;
}

.processing-modal-progress-meta {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.processing-modal-progress-meta strong {
  color: #1d1d23;
  font-size: clamp(34px, 4vw, 44px);
  line-height: 1;
  font-weight: 900;
}

.processing-modal-progress-meta span {
  color: #5f6986;
  font-size: 16px;
  font-weight: 600;
}

.processing-modal-tip {
  margin-top: 42px;
  display: grid;
  grid-template-columns: minmax(200px, 300px) 1fr;
  gap: 28px;
  align-items: center;
  padding: 30px 34px;
  border-radius: 22px;
  background: linear-gradient(135deg, #3a14ad 0%, #4218bf 100%);
  color: #ffffff;
}

.processing-modal-tip-art {
  position: relative;
  min-height: 182px;
}

.processing-art-file,
.processing-art-printer {
  position: absolute;
  border-radius: 18px;
}

.processing-art-file {
  width: 84px;
  height: 108px;
  left: 10px;
  top: 42px;
  background: #ffffff;
  box-shadow: 0 18px 38px rgba(8, 9, 43, 0.22);
}

.processing-art-file::before,
.processing-art-file::after {
  content: "";
  position: absolute;
  display: block;
}

.processing-art-file::before {
  top: 16px;
  left: 16px;
  width: 34px;
  height: 12px;
  border-radius: 6px;
  background: rgba(62, 30, 175, 0.15);
}

.processing-art-file::after {
  left: 16px;
  right: 16px;
  bottom: 18px;
  height: 30px;
  border-radius: 10px;
  background: linear-gradient(180deg, #0d9a69 0%, #0d8558 100%);
}

.processing-art-file-back {
  transform: rotate(-10deg) translateY(12px);
  opacity: 0.88;
}

.processing-art-file-mid {
  left: 52px;
  top: 28px;
  transform: rotate(8deg);
}

.processing-art-file-front {
  left: 30px;
  top: 58px;
  z-index: 2;
}

.processing-art-arrow {
  position: absolute;
  left: 150px;
  top: 84px;
  width: 58px;
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.processing-art-arrow::after {
  content: "";
  position: absolute;
  right: -3px;
  top: -7px;
  width: 24px;
  height: 24px;
  border-top: 12px solid transparent;
  border-bottom: 12px solid transparent;
  border-left: 16px solid rgba(255, 255, 255, 0.9);
  box-sizing: border-box;
}

.processing-art-printer {
  right: 12px;
  top: 52px;
  width: 112px;
  height: 88px;
  background: linear-gradient(180deg, #edeaff 0%, #d8d0ff 100%);
}

.processing-art-printer::before,
.processing-art-printer::after {
  content: "";
  position: absolute;
}

.processing-art-printer::before {
  left: 18px;
  top: -18px;
  width: 76px;
  height: 28px;
  border-radius: 12px 12px 0 0;
  background: #ffffff;
}

.processing-art-printer::after {
  left: 20px;
  bottom: 16px;
  width: 72px;
  height: 22px;
  border-radius: 8px;
  background: linear-gradient(90deg, #6600bc 0%, #d946ef 100%);
}

.processing-modal-tip-copy {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.processing-modal-tip-badge {
  align-self: flex-start;
  padding: 9px 14px;
  border-radius: 999px;
  background: rgba(205, 189, 255, 0.24);
  color: #f6f0ff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.processing-modal-tip-copy p {
  margin: 0;
  font-size: clamp(25px, 3vw, 33px);
  line-height: 1.35;
  font-weight: 800;
}

@media (max-width: 780px) {
  .processing-modal {
    width: min(100vw - 24px, 640px);
    padding: 28px 20px;
    border-radius: 22px;
  }

  .processing-modal-tip {
    grid-template-columns: 1fr;
    padding: 22px 20px;
  }

  .processing-modal-tip-art {
    min-height: 150px;
  }
}

/* OLD DESIGN - DISABLED */
/*
.top-shell {
  position: sticky;
  top: 0;
  z-index: 120;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(6px);
  box-shadow: 0 8px 18px rgba(32, 45, 74, 0.12);
}
*/
/* END OLD DESIGN */

/* OLD DESIGN - DISABLED */
/*
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 10px 18px;
  border-bottom: 1px solid #dfe5f2;
  background: #ffffff;
}

.header-left,
.header-right {
  min-width: 0;
  display: flex;
  align-items: center;
}

.header-left {
  flex: 1 1 auto;
  gap: 18px;
}

.header-right {
  flex: 0 0 auto;
  gap: 14px;
  margin-left: auto;
}

.brand-area {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: #3478F6;
  box-shadow: 0 2px 8px rgba(52, 120, 246, 0.25);
  flex-shrink: 0;
}

.brand-mark {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-weight: 800;
  font-size: 13px;
  background: linear-gradient(135deg, #4b6bff 0%, #2d4bdf 100%);
}

.brand-name {
  font-size: 26px;
  line-height: 1;
  color: #1f2333;
  letter-spacing: 0.2px;
  font-weight: 800;
}

.document-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  position: relative;
}
/* Editing: overlay that expands right without pushing buttons */
/* Editing: shell becomes an overlay expanding to the RIGHT */
.document-meta.is-editing-name .document-name-shell {
  position: absolute;
  left: 0;
  right: auto;
  top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  background: #ffffff;
  border: 1px solid #cfd6e2;
  box-shadow: 0 4px 20px rgba(0,0,0,0.1);
  border-radius: 9px;
  padding: 4px 10px 4px 12px;
  width: max-content;
  max-width: min(500px, 60vw);
  white-space: nowrap;
}

.document-name-shell {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 12px;
  border: 1px solid #cfd6e2;
  border-radius: 9px;
  background: #ffffff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.6);
}

.document-type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  height: 28px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid #d8deea;
  background: #f7f9fd;
  color: #5b6479;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.document-edit-trigger {
  width: 28px;
  height: 28px;
  min-width: 28px;
  padding: 0;
  border: 0;
  border-left: 1px solid #e3e7ef;
  border-radius: 0;
  background: transparent;
  color: #2a3447;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.document-edit-trigger:hover:not(:disabled) {
  background: transparent;
  border-color: #e3e7ef;
  color: #111827;
}

.document-edit-trigger:disabled {
  opacity: 0.5;
}

.document-edit-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.header-utility-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.header-utility-btn {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid #d9e0eb;
  background: #ffffff;
  color: #4a5266;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.header-utility-btn:hover:not(:disabled) {
  background: #f7f9fc;
  border-color: #cfd7e4;
}

.header-utility-btn.upload-lite {
  min-width: 94px;
  padding: 0 12px;
  color: #3f526f;
  background: #ffffff;
  border-color: #d9e0eb;
}

.document-name {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 600;
  color: #323849;
}

.document-name-button {
  appearance: none;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: text;
  transition: color 0.18s ease;
}

/* When editing: input expands freely (container is position:absolute) */
.is-editing-name .document-name {
  max-width: 500px;
}

.document-name-button:hover:not(:disabled) {
  color: #243555;
}

.document-name-button:disabled {
  cursor: default;
  opacity: 0.76;
}

.document-name-input {
  width: min(400px, 50vw);
  max-width: 500px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  outline: none;
  font-size: 14px;
  font-weight: 600;
  color: #323849;
}

.document-name-input:focus {
  border: 0;
  box-shadow: none;
}

.app-actions {
  display: inline-flex;
  align-items: center;
  gap: 0;
  justify-content: flex-end;
  border-left: none;
  padding-left: 12px;
}

.upload-lite {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 110px;
  padding: 9px 12px;
  border: 1px solid #5a74f5;
  border-radius: 10px;
  background: #f6f8ff;
  color: #3d56dc;
  font-weight: 600;
  cursor: pointer;
}

.upload-lite input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.top-action {
  min-width: 68px;
  min-height: 48px;
  padding: 0 10px;
  border: 0;
  border-left: 1px solid #e2e6ef;
  border-radius: 0;
  background: transparent;
  color: #232937;
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.top-icon-action {
  min-width: 68px;
}

.top-action-icon {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.top-action-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 78px;
  text-align: center;
  line-height: 1.05;
}

.top-action:hover:not(:disabled) {
  background: #f7f8fb;
  border-color: #e2e6ef;
}

.top-action:first-child {
  border-left: 0;
}

.share-action {
  min-width: 148px;
  height: 48px;
  padding: 0 18px;
  margin-left: 12px;
  border-radius: 14px;
  border: 1px solid #cfc3ff;
  background: #ffffff;
  color: #2a2a33;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}

.share-action:hover:not(:disabled) {
  background: #fbfaff;
  border-color: #b8a7ff;
}

.done-action {
  min-width: 150px;
  height: 48px;
  margin-left: 12px;
  border-radius: 12px;
  border-color: #dd284d;
  background: #dd284d;
  color: #ffffff;
  font-weight: 700;
  font-size: 15px;
}

.done-action:hover:not(:disabled) {
  background: #c91d41;
  border-color: #c91d41;
}
*/
/* END OLD DESIGN */

.document-search-panel {
  position: absolute;
  top: 100%;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px 16px;
  min-width: 380px;
  border-radius: 0 0 16px 16px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-top: none;
  box-shadow: 0 10px 30px -5px rgba(0, 0, 0, 0.1), 0 4px 12px -2px rgba(0, 0, 0, 0.05);
}

.document-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.document-search-input {
  flex: 1 1 280px;
  min-width: 220px;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #cbd5ea;
  border-radius: 10px;
  background: #ffffff;
  color: #223252;
  font-size: 14px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(25, 39, 69, 0.04);
}

.document-search-input:focus {
  border-color: #4b6bff;
  box-shadow: 0 0 0 3px rgba(75, 107, 255, 0.14);
}

.document-search-btn,
.document-search-nav,
.document-search-close {
  height: 40px;
  border: 1px solid #d5def1;
  border-radius: 10px;
  background: #ffffff;
  color: #30415f;
  font-size: 14px;
  font-weight: 600;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.document-search-btn {
  min-width: 92px;
  padding: 0 14px;
}

.document-search-nav,
.document-search-close {
  width: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.document-search-nav span,
.document-search-close {
  line-height: 1;
  font-size: 20px;
}

.document-search-btn:hover:not(:disabled),
.document-search-nav:hover:not(:disabled),
.document-search-close:hover:not(:disabled) {
  border-color: #bac8e6;
  background: #eef3ff;
  color: #2338a5;
}

.document-search-btn:disabled,
.document-search-nav:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.document-search-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  color: #5b6a87;
  font-size: 13px;
  font-weight: 600;
}

.text-layer .text-token.search-match {
  background: rgba(255, 225, 92, 0.38);
  border-radius: 3px;
}

.text-layer .text-token.search-match-active {
  background: rgba(75, 107, 255, 0.22);
  box-shadow: 0 0 0 1px rgba(75, 107, 255, 0.28);
}

.text-layer .parsed-text-block.search-match,
.text-layer .parsed-table-cell-inner.search-match {
  outline: 2px solid rgba(226, 176, 23, 0.7) !important;
  outline-offset: 1px;
}

.text-layer .parsed-text-block.search-match-active,
.text-layer .parsed-table-cell-inner.search-match-active {
  outline-color: #4b6bff !important;
  box-shadow: 0 0 0 2px rgba(75, 107, 255, 0.18);
}

/* OLD DESIGN - DISABLED */
/*
.editor-ribbon {
  display: flex;
  align-items: center;
  gap: 2px;
  overflow-x: auto;
  padding: 6px 14px;
  border-top: 1px solid #edf1f7;
  border-bottom: 1px solid #dbe2ec;
  background: #ffffff;
  position: relative;
}

.editor-ribbon::-webkit-scrollbar {
  height: 7px;
}

.editor-ribbon::-webkit-scrollbar-thumb {
  background: #cad3e6;
  border-radius: 6px;
}

.tool-btn {
  flex: 0 0 auto;
  min-width: 56px;
  min-height: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  background: transparent;
  padding: 6px 10px 5px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: #30384b;
  position: relative;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.tool-btn:hover:not(:disabled) {
  background: #f7f8fb;
}

.tool-btn.active {
  background: #f7e7ea;
  color: #d34f69;
  border-color: #d34f69;
}

.tool-btn:disabled {
  color: #c4cad6;
  background: transparent;
}

.tool-btn.tool-page-layout {
  margin-left: auto;
}

.tool-btn.tool-thumbnails {
  min-width: 72px;
  margin-right: 8px;
}

.tool-btn.tool-thumbnails.active {
  border-radius: 10px;
}

.tool-btn.tool-page-layout,
.tool-btn.tool-manage {
  min-width: 92px;
}

.tool-btn.tool-page-layout,
.tool-btn.tool-manage,
.tool-btn.tool-more-tools {
  color: #2f3546;
}

.tool-btn.has-dropdown {
  padding-right: 28px;
}

.tool-icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tool-loading-spinner {
  font-size: 20px;
  line-height: 1;
  animation: tool-ribbon-spin 0.9s linear infinite;
}

@keyframes tool-ribbon-spin {
  to {
    transform: rotate(360deg);
  }
}

.tool-icon-svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tool-label {
  max-width: 92px;
  font-size: 11px;
  line-height: 1.15;
  font-weight: 500;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tool-caret {
  position: absolute;
  right: 4px;
  top: 18px;
  transform: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #737b8f;
  opacity: 1;
  cursor: pointer;
}

.tool-caret:hover {
  background: #eef1f7;
}

.tool-caret:focus {
  outline: 2px solid rgba(87, 92, 255, 0.28);
  outline-offset: 1px;
}

.tool-caret-icon {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.16s ease;
}

.tool-caret.open .tool-caret-icon {
  transform: rotate(180deg);
}

.tool-dropdown {
  position: fixed;
  z-index: 2147483000;
  min-width: 214px;
  border: 1px solid #d9dfeb;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(22, 36, 66, 0.18);
  padding: 8px;
}

.tool-dropdown-item {
  width: 100%;
  border: 0;
  border-radius: 9px;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  color: #31384b;
  text-align: left;
}

.tool-dropdown-item:hover:not(:disabled) {
  background: #f6f7fb;
  border-color: transparent;
}

.tool-dropdown-item.active {
  background: #4a3be3;
  color: #ffffff;
}

.tool-dropdown-icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.tool-dropdown-item.active .tool-dropdown-icon {
  background: rgba(255, 255, 255, 0.12);
}

.tool-dropdown-label {
  font-size: 15px;
  font-weight: 500;
  line-height: 1.15;
}
*/
/* END OLD DESIGN */

.tool-subheader {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 118;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 8px 14px;
  border-top: 1px solid #e6ebf6;
  border-bottom: 1px solid #e2e8f3;
  background: rgba(244, 247, 252, 0.96);
  backdrop-filter: blur(8px);
  box-shadow: 0 12px 28px rgba(24, 36, 66, 0.12);
  animation: toolSubheaderSlideDown 0.22s ease forwards;
  will-change: transform, opacity;
}

@keyframes toolSubheaderSlideDown {
  from {
    opacity: 0;
    transform: translateY(-14px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pencil-subheader {
  min-height: 48px;
}

.pencil-control {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.pencil-control-label {
  font-size: 13px;
  font-weight: 700;
  color: #34435f;
}

.pencil-palette {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pencil-color-swatch {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid rgba(44, 61, 98, 0.28);
  padding: 0;
  background: var(--swatch-color);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

.pencil-color-swatch.active {
  transform: scale(1.04);
  border-color: #3153ee;
  box-shadow: 0 0 0 2px rgba(49, 83, 238, 0.2);
}

.pencil-custom-color {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 1px solid #c6cfdf;
  background: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  cursor: pointer;
}

.pencil-custom-color input {
  width: 30px;
  height: 30px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.pencil-size-control {
  gap: 8px;
}

.pencil-size-range {
  width: 136px;
}

.pencil-size-number {
  width: 58px;
  padding: 4px 6px;
  border: 1px solid #c6cfdf;
  border-radius: 7px;
  background: #ffffff;
  color: #1f2a44;
}

.pencil-size-unit {
  font-size: 13px;
  font-weight: 600;
  color: #455675;
}

.shape-subheader {
  position: fixed;
  gap: 8px;
  padding: 4px 8px;
  min-height: 46px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.shape-subheader.menu-open {
  padding-bottom: 196px;
}

.shape-subheader::-webkit-scrollbar {
  height: 6px;
}

.shape-subheader::-webkit-scrollbar-thumb {
  background: rgba(117, 133, 166, 0.45);
  border-radius: 999px;
}

.shape-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding-right: 8px;
  border-right: 1px solid #d8dfed;
  flex: 0 0 auto;
}

.shape-control:last-child {
  border-right: 0;
  padding-right: 0;
}

.shape-control.disabled {
  opacity: 0.55;
}

.shape-control-label {
  font-size: 12px;
  font-weight: 700;
  color: #34435f;
  letter-spacing: 0.01em;
}

.shape-popup-trigger,
.shape-line-trigger {
  height: 32px;
  border: 1px solid #c4cee0;
  border-radius: 8px;
  background: #ffffff;
  color: #253355;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
}

.shape-popup-trigger {
  min-width: 68px;
}

.shape-line-trigger {
  min-width: 126px;
  justify-content: space-between;
}

.shape-popup-trigger:hover:not(:disabled),
.shape-line-trigger:hover:not(:disabled) {
  background: #f2f6ff;
  border-color: #aeb9d1;
}

.shape-popup-swatch {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(43, 59, 97, 0.35);
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background-image: linear-gradient(45deg, #e2e8f7 25%, transparent 25%, transparent 75%, #e2e8f7 75%, #e2e8f7),
    linear-gradient(45deg, #e2e8f7 25%, transparent 25%, transparent 75%, #e2e8f7 75%, #e2e8f7);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

.shape-popup-swatch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--shape-swatch-color);
}

.shape-select-caret {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shape-select-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 140;
  min-width: 200px;
  border-radius: 10px;
  border: 1px solid #c6d0e4;
  background: #ffffff;
  box-shadow: 0 14px 26px rgba(22, 36, 73, 0.16);
  padding: 8px;
}

.shape-select-menu.shape-color-menu {
  width: 202px;
}

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

.shape-color-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid rgba(41, 57, 96, 0.36);
  padding: 0;
  position: relative;
  overflow: hidden;
  background-image: linear-gradient(45deg, #e2e8f7 25%, transparent 25%, transparent 75%, #e2e8f7 75%, #e2e8f7),
    linear-gradient(45deg, #e2e8f7 25%, transparent 25%, transparent 75%, #e2e8f7 75%, #e2e8f7);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

.shape-color-swatch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--shape-swatch-color);
}

.shape-color-swatch.active {
  border-color: #2f58ff;
  box-shadow: 0 0 0 2px rgba(47, 88, 255, 0.2);
}

.shape-custom-color {
  margin-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: #394a70;
}

.shape-custom-color input {
  width: 34px;
  height: 24px;
  border: 1px solid #c8d1e3;
  border-radius: 6px;
  padding: 0;
  background: #ffffff;
  cursor: pointer;
}

.shape-menu-action-btn {
  margin-top: 7px;
  width: 100%;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid #cad4e7;
  background: #f6f8ff;
  color: #33456e;
  font-size: 12px;
  font-weight: 600;
}

.shape-range {
  width: 108px;
}

.shape-number {
  width: 52px;
  padding: 4px 6px;
  border: 1px solid #c6cfdf;
  border-radius: 7px;
  background: #ffffff;
  color: #1f2a44;
}

.shape-control-unit {
  font-size: 12px;
  font-weight: 600;
  color: #455675;
}

.shape-dash-menu {
  width: 230px;
  max-height: 268px;
  overflow-y: auto;
}

.shape-dash-option {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: #ffffff;
  padding: 7px 8px;
  color: #313f62;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.shape-dash-option:hover:not(:disabled) {
  background: #f3f7ff;
  border-color: #d7e0f3;
}

.shape-dash-option.active {
  background: #eef3ff;
  border-color: #b9c9ea;
  color: #1f397c;
}

.shape-line-preview {
  width: 64px;
  height: 16px;
  flex: 0 0 auto;
}

.shape-line-preview.option {
  width: 118px;
  height: 18px;
}

.shape-line-preview line {
  stroke: #4d5568;
  stroke-width: 2.4;
  fill: none;
}

.text-subheader {
  position: fixed;
  gap: 8px;
  padding: 4px 8px;
  min-height: 46px;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
}

.text-subheader.menu-open {
  padding-bottom: 260px;
}

.text-subheader::-webkit-scrollbar {
  height: 6px;
}

.text-subheader::-webkit-scrollbar-thumb {
  background: rgba(117, 133, 166, 0.45);
  border-radius: 999px;
}

.text-control {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding-right: 8px;
  border-right: 1px solid #d8dfed;
  flex: 0 0 auto;
}

.text-control:last-child {
  border-right: 0;
  padding-right: 0;
}

.text-control-label {
  font-size: 12px;
  font-weight: 700;
  color: #34435f;
  letter-spacing: 0.01em;
}

.text-color-control {
  padding-right: 10px;
}

.text-popup-trigger {
  height: 32px;
  border: 1px solid #c4cee0;
  border-radius: 8px;
  background: #ffffff;
  color: #253355;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 8px;
  min-width: 70px;
}

.text-popup-trigger:hover:not(:disabled) {
  background: #f2f6ff;
  border-color: #aeb9d1;
}

.text-popup-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.text-popup-icon-text {
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
}

.text-popup-icon-background {
  border: 1px solid #a9b7d2;
  border-radius: 3px;
  overflow: hidden;
}

.text-popup-bg-fill {
  width: 100%;
  height: 100%;
  background-image: linear-gradient(45deg, #dde3f1 25%, transparent 25%, transparent 75%, #dde3f1 75%, #dde3f1),
    linear-gradient(45deg, #dde3f1 25%, transparent 25%, transparent 75%, #dde3f1 75%, #dde3f1);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
  position: relative;
}

.text-popup-bg-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--swatch-color);
}

.text-popup-swatch {
  width: 14px;
  height: 14px;
  border: 1px solid rgba(43, 59, 97, 0.35);
  border-radius: 50%;
  position: relative;
  overflow: hidden;
  background-image: linear-gradient(45deg, #e2e8f7 25%, transparent 25%, transparent 75%, #e2e8f7 75%, #e2e8f7),
    linear-gradient(45deg, #e2e8f7 25%, transparent 25%, transparent 75%, #e2e8f7 75%, #e2e8f7);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

.text-popup-swatch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--swatch-color);
}

.text-select-menu.text-color-menu {
  width: 188px;
  padding: 8px;
}

.text-swatch-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.text-color-palette {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.text-color-swatch {
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 1px solid rgba(41, 57, 96, 0.36);
  padding: 0;
  position: relative;
  overflow: hidden;
  background-image: linear-gradient(45deg, #e2e8f7 25%, transparent 25%, transparent 75%, #e2e8f7 75%, #e2e8f7),
    linear-gradient(45deg, #e2e8f7 25%, transparent 25%, transparent 75%, #e2e8f7 75%, #e2e8f7);
  background-size: 8px 8px;
  background-position: 0 0, 4px 4px;
}

.text-color-swatch::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--swatch-color);
}

.text-color-swatch.active {
  border-color: #2f58ff;
  box-shadow: 0 0 0 2px rgba(47, 88, 255, 0.2);
}

.text-custom-color {
  width: 21px;
  height: 21px;
  border-radius: 6px;
  border: 1px solid #b7c4dd;
  background: #ffffff;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.text-custom-color input {
  width: 24px;
  height: 24px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.text-custom-color-inline {
  width: 100%;
  height: 30px;
  margin-top: 8px;
  border-radius: 7px;
  justify-content: flex-start;
  gap: 7px;
  padding: 0 7px;
}

.text-custom-color-inline span {
  font-size: 12px;
  color: #2a3757;
  font-weight: 600;
}

.text-menu-action-btn {
  width: 100%;
  margin-top: 7px;
  height: 28px;
  border: 1px solid #c7d2e7;
  border-radius: 7px;
  background: #f6f9ff;
  color: #2c3a5f;
  font-size: 12px;
  font-weight: 600;
}

.text-menu-action-btn:hover:not(:disabled) {
  background: #eaf0ff;
}

.text-opacity-control {
  gap: 5px;
}

.text-opacity-range {
  width: 86px;
}

.text-control-icon {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: #3a4c74;
  stroke-width: 1.5;
}

.text-opacity-number,
.text-size-number {
  width: 48px;
  height: 30px;
  padding: 3px 5px;
  border: 1px solid #c3cde0;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2a44;
  font-size: 14px;
}

.text-opacity-unit {
  font-size: 11px;
  color: #4f5f7f;
  font-weight: 600;
}

/* ── Parsed table (HTML <table>) ─────────────────────────── */
.parsed-table {
  border-collapse: collapse;
  z-index: 10;
  table-layout: fixed;
}
.parsed-table td {
  border: 0 solid transparent;
  vertical-align: top;
  padding: 0;
  margin: 0;
  background-color: transparent;
  box-sizing: border-box;
}
.parsed-table-cell-inner {
  cursor: text;
  outline: none;
}
.parsed-table-cell-inner:hover {
  outline: 1px dashed rgba(62, 93, 247, 0.3);
  outline-offset: -1px;
}
.parsed-table-cell-inner:focus {
  outline: 2px solid rgba(62, 93, 247, 0.6);
  outline-offset: -2px;
  background: rgba(255, 255, 255, 0.85);
}
.parsed-table-wrap {
  position: absolute;
  z-index: 11;
}
.table-col-resize-handle {
  position: absolute;
  width: 5px;
  margin-left: 0;
  transform: translateX(-50%);
  top: 0;
  bottom: 0;
  cursor: col-resize;
  z-index: 20;
  background: transparent;
  touch-action: none;
}
.table-col-resize-handle:hover,
.table-col-resize-handle.active {
  background: rgba(62, 93, 247, 0.4);
}
.table-col-resize-handle-edge {
  z-index: 21;
}
.table-col-resize-handle-edge-left,
.table-col-resize-handle-edge-right {
  width: 7px;
}
.table-row-resize-handle {
  position: absolute;
  height: 5px;
  margin-top: 0;
  transform: translateY(-50%);
  left: 0;
  right: 0;
  cursor: row-resize;
  z-index: 20;
  background: transparent;
  touch-action: none;
}
.table-row-resize-handle:hover,
.table-row-resize-handle.active {
  background: rgba(62, 93, 247, 0.4);
}
.table-row-resize-handle-edge {
  z-index: 21;
}
.table-row-resize-handle-edge-top,
.table-row-resize-handle-edge-bottom {
  height: 7px;
}

.parsed-table-wrap--preserve .table-col-resize-handle,
.parsed-table-wrap--preserve .table-row-resize-handle {
  background: transparent;
}

.parsed-table-wrap--preserve:hover .table-col-resize-handle,
.parsed-table-wrap--preserve:hover .table-row-resize-handle {
  background: rgba(62, 93, 247, 0.14);
}

.parsed-table-wrap--preserve .table-col-resize-handle-edge,
.parsed-table-wrap--preserve .table-row-resize-handle-edge {
  background: transparent;
}

.parsed-table-wrap--preserve:hover .table-col-resize-handle-edge,
.parsed-table-wrap--preserve:hover .table-row-resize-handle-edge {
  background: rgba(62, 93, 247, 0.22);
}

.table-context-menu {
  position: fixed;
  z-index: 1200;
  min-width: 210px;
  max-width: 280px;
  background: #ffffff;
  border: 1px solid #d6deef;
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(24, 38, 71, 0.22);
  padding: 6px;
}
.table-context-menu__item {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  color: #243457;
  font-size: 13px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.table-context-menu__item:hover {
  background: #eef3ff;
}
.table-context-menu__item:disabled {
  cursor: default;
}
.table-context-menu__separator {
  height: 1px;
  background: #e3e9f5;
  margin: 6px 2px;
}

.parsed-object-context-menu__meta {
  font-size: 11px;
  color: #64748b;
}

.text-border-control {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-settings-btn {
  min-width: 170px;
  max-width: 210px;
}

.table-settings-menu {
  width: 262px;
  padding: 10px;
}

.table-settings-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 8px;
}

.table-settings-field:last-child {
  margin-bottom: 0;
}

.table-settings-field span {
  font-size: 12px;
  font-weight: 600;
  color: #2f3d61;
}

.table-settings-select,
.table-settings-number,
.table-settings-color-text {
  height: 30px;
  padding: 4px 7px;
  border: 1px solid #c3cde0;
  border-radius: 7px;
  background: #ffffff;
  color: #1f2a44;
  font-size: 13px;
}

.table-settings-select {
  width: 100%;
}

.table-settings-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.table-settings-number {
  width: 88px;
}

.table-settings-inline span {
  font-size: 11px;
  font-weight: 600;
  color: #4f5f7f;
}

.table-settings-color-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.table-settings-color-input {
  width: 34px;
  height: 30px;
  padding: 0;
  border: 1px solid #bfcce6;
  border-radius: 7px;
  background: #ffffff;
  cursor: pointer;
}

.table-settings-color-text {
  flex: 1 1 auto;
}

.text-font-control {
  min-width: 184px;
}

.text-select-wrap,
.text-size-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.text-select-btn {
  min-width: 148px;
  max-width: 188px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #c3cde0;
  border-radius: 7px;
  background: #ffffff;
  color: #1e2a44;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.text-select-value {
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-select-caret {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

.text-select-menu {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  z-index: 220;
  background: #ffffff;
  border: 1px solid #d6deef;
  border-radius: 8px;
  box-shadow: 0 14px 28px rgba(24, 38, 71, 0.22);
  overflow: auto;
  max-height: 248px;
}

.text-font-menu {
  width: min(320px, 56vw);
  max-height: 340px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.text-font-menu-search {
  padding: 7px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
}

.text-font-search-input {
  width: 100%;
  height: 30px;
  border: 1px solid #c7d3e7;
  border-radius: 7px;
  background: #ffffff;
  color: #1f2a44;
  font-size: 12px;
  font-weight: 500;
  padding: 0 9px;
}

.text-font-search-input:focus {
  outline: none;
  border-color: #4f6ff9;
  box-shadow: 0 0 0 2px rgba(79, 111, 249, 0.16);
}

.text-font-menu-list {
  overflow: auto;
  max-height: 248px;
}

.text-font-menu-empty {
  padding: 11px 10px;
  color: #64748b;
  font-size: 12px;
  text-align: center;
}

.text-font-menu-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 34px;
  padding: 6px 8px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
}

.text-font-menu-count {
  font-size: 11px;
  color: #5a6a85;
  font-weight: 600;
}

.text-font-menu-more {
  min-height: 24px;
  padding: 0 10px;
  border: 1px solid #c6d3ec;
  border-radius: 999px;
  background: #ffffff;
  color: #2c3f68;
  font-size: 11px;
  font-weight: 700;
}

.text-font-menu-more:hover {
  background: #eef3ff;
}

.text-size-menu {
  width: 82px;
}

.text-select-option {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  padding: 5px 8px;
  color: #243457;
}

.text-select-option:hover:not(:disabled) {
  background: #eef3ff;
}

.text-select-option.active {
  background: #3e5df7;
  color: #ffffff;
}

.text-font-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.text-font-option-name {
  font-size: 12px;
  font-weight: 600;
}

.text-font-option-used {
  font-size: 11px;
  color: #5b6f98;
}

.text-font-option-preview {
  font-size: 12px;
}

.text-size-wrap {
  border: 1px solid #c3cde0;
  border-radius: 7px;
  background: #ffffff;
  overflow: hidden;
  height: 32px;
}

.text-size-wrap .text-size-number {
  border: 0;
  border-radius: 0;
  width: 46px;
  height: 30px;
}

.text-size-caret-btn {
  width: 22px;
  min-width: 22px;
  height: 30px;
  border: 0;
  border-left: 1px solid #d3dcec;
  border-radius: 0;
  background: #f7f9fd;
  color: #33466f;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.text-size-caret-btn:hover:not(:disabled) {
  background: #edf2fc;
}

.text-size-option {
  display: flex;
  align-items: center;
  gap: 6px;
}

.text-size-check {
  width: 10px;
  display: inline-flex;
  justify-content: center;
}

.text-size-prefix {
  font-size: 14px;
  color: #33496f;
  font-weight: 700;
}

.text-size-unit {
  font-size: 11px;
  color: #4f5f7f;
  font-weight: 600;
}

.text-line-height-control {
  gap: 5px;
}

.text-line-height-prefix {
  font-size: 14px;
  color: #33496f;
  font-weight: 700;
}

.text-line-height-number {
  width: 58px;
  height: 30px;
  padding: 3px 5px;
  border: 1px solid #c3cde0;
  border-radius: 6px;
  background: #ffffff;
  color: #1f2a44;
  font-size: 14px;
}

.text-line-height-unit {
  font-size: 11px;
  color: #4f5f7f;
  font-weight: 600;
}

.text-toggle-control {
  gap: 3px;
}

.text-toggle-btn {
  min-width: 28px;
  height: 30px;
  border: 1px solid #c5cfdf;
  border-radius: 6px;
  background: #ffffff;
  color: #213155;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  font-size: 15px;
  font-weight: 700;
}

.text-toggle-btn:hover:not(:disabled) {
  background: #eef3ff;
}

.text-toggle-btn.active {
  border-color: #3f5efa;
  background: #3f5efa;
  color: #ffffff;
}

.text-underline-mark {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.text-toggle-btn.icon-only {
  width: 30px;
  min-width: 30px;
  padding: 0;
}

.text-toggle-btn.icon-only svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.viewer-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  width: 100%;
  padding: 14px;
  min-height: 0;
}

.viewer-shell.has-bottom-toolbar {
  padding-bottom: 14px;
}

.viewer-shell.has-bottom-toolbar .pdf-stage {
  /* Keep extra room under the page so overflow content is visible above fixed bottom toolbar. */
  padding-bottom: 126px;
}

.editor-content {
  flex: 1;
  min-height: 0;
  display: flex;
  width: 100%;
  border: 1px solid #d8deea;
  border-radius: 12px;
  background: #f4f7fd;
  overflow: hidden;
}

/* OLD DESIGN - DISABLED */
/*
.thumbs-sidebar {
  flex: 0 0 auto;
  width: 232px;
  min-width: 120px;
  max-width: 420px;
  border-right: 1px solid #d8deea;
  background: #f6f8fd;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.thumbs-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 12px 10px;
  border-bottom: 1px solid #e2e8f4;
  font-size: 13px;
  color: #304263;
  font-weight: 700;
}

.thumbs-head small {
  font-size: 12px;
  color: #697a9d;
  font-weight: 600;
}

.thumbs-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: #8fa2cc #e9eef9;
}

.thumbs-list::-webkit-scrollbar {
  width: 10px;
}

.thumbs-list::-webkit-scrollbar-track {
  background: #e9eef9;
  border-radius: 8px;
}

.thumbs-list::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #9aabd3 0%, #7f92bd 100%);
  border-radius: 8px;
  border: 2px solid #e9eef9;
}

.thumbs-list::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #8194bf 0%, #6f84b2 100%);
}

.thumb-item {
  width: 100%;
  border: 1px solid #d3dcf0;
  border-radius: 11px;
  background: #ffffff;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 7px;
}

.thumb-item.active {
  border-color: #3e5df7;
  box-shadow: 0 0 0 2px rgba(62, 93, 247, 0.16);
}

.thumb-image-wrap {
  width: 100%;
  min-height: 110px;
  border-radius: 8px;
  border: 1px solid #e2e8f4;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.thumb-image-wrap img {
  width: 100%;
  height: auto;
  display: block;
}

.thumb-loading {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  background: #f8fafc;
  font-size: 11px;
  color: #7282a2;
}

.thumb-loading-skeleton {
  width: 78%;
  max-width: 140px;
  padding: 10px;
  border: 1px solid #d9e3f4;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.thumb-loading-line {
  display: block;
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    rgba(223, 231, 247, 0.95) 0%,
    rgba(247, 250, 255, 0.98) 45%,
    rgba(223, 231, 247, 0.95) 100%
  );
  background-size: 220% 100%;
  animation: thumb-skeleton-shimmer 1.2s ease-in-out infinite;
}

.thumb-loading-line-title {
  width: 86%;
}

.thumb-loading-line-short {
  width: 62%;
}

.thumb-loading-label {
  font-size: 11px;
  font-weight: 600;
  color: #7a89a9;
  text-align: center;
}

@keyframes thumb-skeleton-shimmer {
  0% {
    background-position: 180% 0;
  }
  100% {
    background-position: -40% 0;
  }
}

.thumb-page {
  display: inline-flex;
  align-self: center;
  min-width: 30px;
  justify-content: center;
  align-items: center;
  padding: 3px 9px;
  border-radius: 8px;
  background: #eef2fb;
  color: #3d4f71;
  font-size: 12px;
  font-weight: 700;
}

.thumb-item.active .thumb-page {
  background: #3e5df7;
  color: #ffffff;
}
*/
/* END OLD DESIGN */

.thumbs-resizer {
  flex: 0 0 9px;
  background: linear-gradient(180deg, #ecf1fb 0%, #dfe7f8 100%);
  border-right: 1px solid #d7deee;
  cursor: col-resize;
  position: relative;
}

.thumbs-resizer::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 48px;
  border-radius: 2px;
  background: #bcc8df;
  transform: translate(-50%, -50%);
}

.thumb-item {
  position: relative;
}

.thumb-item--dragging {
  opacity: 0.58;
}

.thumb-item--drop-before::before,
.thumb-item--drop-after::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 3px;
  border-radius: 999px;
  background: #6600bc;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.88);
  pointer-events: none;
  z-index: 2;
}

.thumb-item--drop-before::before {
  top: -7px;
}

.thumb-item--drop-after::after {
  bottom: -7px;
}

/* OLD DESIGN - DISABLED */
/*
.viewer-pane {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  background: #eef2f8;
}
*/
/* END OLD DESIGN */

.pdf-editor.is-sidebar-resizing,
.pdf-editor.is-sidebar-resizing * {
  user-select: none;
}

.pdf-editor.is-sidebar-resizing {
  cursor: col-resize;
}

.error {
  margin: 0;
  text-align: center;
  font-size: 14px;
}

.error {
  color: #c24053;
}

.delete-confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(26, 35, 56, 0.28);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.delete-confirm-modal {
  width: min(340px, 100%);
  border-radius: 12px;
  border: 1px solid #d6deef;
  background: #ffffff;
  box-shadow: 0 18px 34px rgba(22, 34, 61, 0.26);
  padding: 16px 16px 14px;
}

.delete-confirm-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #1d2944;
}

.delete-confirm-subtitle {
  margin: 6px 0 0;
  font-size: 13px;
  color: #5a6b8e;
}

.delete-confirm-actions {
  margin-top: 14px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.delete-confirm-cancel,
.delete-confirm-submit {
  min-width: 96px;
  padding: 10px 18px;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  color: #334155;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.delete-confirm-cancel:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.delete-confirm-submit {
  border-color: #ef4444;
  background: #ef4444;
  color: #ffffff;
  font-weight: 700;
}

.delete-confirm-submit:hover:not(:disabled) {
  border-color: #dc2626;
  background: #dc2626;
}

.delete-confirm-hint {
  margin: 9px 0 0;
  font-size: 12px;
  color: #647598;
}

.signature-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 320;
  background: rgba(7, 14, 31, 0.44);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.signature-modal {
  width: min(920px, 100%);
  max-height: min(760px, 92vh);
  border-radius: 10px;
  border: 1px solid #1e2a46;
  background: #091122;
  color: #e9efff;
  box-shadow: 0 22px 44px rgba(7, 13, 28, 0.42);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.signature-modal-header {
  padding: 20px 24px 14px;
  border-bottom: 1px solid #24304f;
}

.signature-modal-header h3 {
  margin: 0;
  font-size: 30px;
  font-weight: 700;
  color: #f3f7ff;
}

.signature-tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 10px 24px 0;
  border-bottom: 1px solid #24304f;
  background: #08101f;
}

.signature-tab-btn {
  border: 0;
  border-radius: 0;
  padding: 10px 12px 12px;
  background: transparent;
  color: #bcc8ea;
  font-size: 15px;
  font-weight: 600;
}

.signature-tab-btn:hover:not(:disabled) {
  background: transparent;
  color: #f0f5ff;
}

.signature-tab-btn.active {
  color: #f4f8ff;
  box-shadow: inset 0 -2px 0 #97b5ff;
}

.signature-modal-body {
  padding: 16px 24px 18px;
  background: #2b3140;
  overflow: auto;
}

.signature-color-row {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.signature-color-label {
  font-size: 12px;
  font-weight: 700;
  color: #b8c5e7;
}

.signature-color-palette {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.signature-color-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid transparent;
  background: var(--signature-color);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  padding: 0;
}

.signature-color-dot.active {
  border-color: #a8c1ff;
  box-shadow: 0 0 0 2px rgba(168, 193, 255, 0.22);
}

.signature-pane {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.signature-surface {
  width: 100%;
  border: 1px dashed #c8d3eb;
  border-radius: 6px;
  background: #f8fbff;
  min-height: 210px;
  overflow: hidden;
}

.signature-draw-canvas {
  display: block;
  width: 100%;
  height: 290px;
  touch-action: none;
  cursor: crosshair;
}

.signature-pane-actions {
  display: flex;
  justify-content: flex-end;
}

.signature-upload-row {
  display: flex;
  justify-content: flex-start;
}

.signature-upload-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 170px;
  padding: 9px 14px;
  border: 1px solid #8ea5da;
  border-radius: 10px;
  color: #0f2246;
  background: #f3f7ff;
  font-weight: 700;
  cursor: pointer;
}

.signature-upload-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.signature-image-surface {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.signature-image-preview {
  max-width: 100%;
  max-height: 300px;
  object-fit: contain;
}

.signature-empty-hint {
  color: #5c6885;
  font-size: 14px;
  text-align: center;
}

.signature-type-input {
  width: 100%;
  border: 1px solid #9fb0d2;
  border-radius: 10px;
  background: #f8fbff;
  color: #172647;
  padding: 10px 12px;
  font-size: 16px;
}

.signature-type-surface {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 18px;
  min-height: 140px;
}

.signature-type-preview {
  font-size: clamp(44px, 7vw, 88px);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  user-select: none;
}

.signature-font-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid #24304f;
}

.signature-font-option {
  min-height: 86px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-right: 1px solid #24304f;
  border-bottom: 1px solid #24304f;
  background: #08101f;
  color: #e8efff;
}

.signature-font-option:nth-child(2n) {
  border-right: 0;
}

.signature-font-option.active {
  background: #101a31;
}

.signature-font-option input {
  margin: 0;
}

.signature-font-sample {
  font-size: clamp(31px, 3.6vw, 44px);
  line-height: 1;
  color: #f4f7ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.signature-modal-footer {
  background: #08101f;
  border-top: 1px solid #24304f;
  padding: 14px 22px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
}

.signature-cancel-btn {
  min-width: 114px;
  border-color: #4d5b78;
  background: #3f4b61;
  color: #e8eefc;
}

.signature-cancel-btn:hover:not(:disabled) {
  border-color: #5f6f91;
  background: #4d5a73;
}

.signature-done-btn {
  min-width: 114px;
  border-color: #3e5df7;
  background: #3e5df7;
  color: #ffffff;
  font-weight: 700;
}

.signature-done-btn:hover:not(:disabled) {
  border-color: #2f4ce1;
  background: #2f4ce1;
}

.signature-done-btn:disabled {
  opacity: 0.46;
}

.empty-state {
  margin: auto;
  max-width: 620px;
  text-align: center;
  border: 1px dashed #d6deef;
  border-radius: 14px;
  padding: 28px 20px;
  background: #ffffff;
}

.empty-state h1 {
  margin: 0 0 12px;
  font-size: 30px;
  color: #1f2a44;
}

.empty-state p {
  margin: 0;
  color: #576684;
  line-height: 1.55;
}

.empty-state.is-uploading {
  border-style: solid;
  border-color: rgba(102, 0, 188, 0.24);
  box-shadow: 0 14px 34px rgba(102, 0, 188, 0.14);
}

.empty-state-upload-spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border-radius: 999px;
  border: 3px solid rgba(102, 0, 188, 0.2);
  border-top-color: #6600bc;
  display: block;
  animation: html-layer-loader-spin 0.9s linear infinite;
}

.pdf-stage {
  flex: 1;
  width: 100%;
  overflow: auto;
  padding: 24px 18px 26px;
  display: flex;
  flex-direction: column;
  align-items: center;
  scrollbar-width: thin;
  scrollbar-color: #7f93c1 #dfe7f7;
}

.pdf-stage::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.pdf-stage::-webkit-scrollbar-track {
  background: #dfe7f7;
  border-radius: 10px;
}

.pdf-stage::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #8ca3d2 0%, #6f88be 100%);
  border-radius: 10px;
  border: 2px solid #dfe7f7;
}

.pdf-stage::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #7690c3 0%, #5f78ae 100%);
}

.pdf-stage::-webkit-scrollbar-corner {
  background: #dfe7f7;
}

.page-stack {
  position: relative;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 18px 30px rgba(38, 53, 88, 0.16);
  border-radius: 6px;
}

.html-layer-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  pointer-events: none;
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.72) 0%, rgba(255, 255, 255, 0.42) 38%, rgba(255, 255, 255, 0.2) 100%),
    linear-gradient(135deg, rgba(102, 0, 188, 0.06), rgba(93, 66, 206, 0.14));
}

.html-layer-loading-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  color: #163a86;
  font-size: 13px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 8px 24px rgba(102, 0, 188, 0.14);
}

.html-layer-loading-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(102, 0, 188, 0.2);
  border-top-color: #6600bc;
  border-radius: 999px;
  animation: html-layer-loader-spin 0.8s linear infinite;
}

.html-layer-loading-text {
  letter-spacing: 0.01em;
}

@keyframes html-layer-loader-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.page-stack.zoom-preview {
  will-change: transform;
}

.zoom-preview-canvas {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  pointer-events: none;
  border-radius: 6px;
  background: #ffffff;
}

.zoom-preview-canvas.active {
  display: block;
}

.page-stack.zoom-preview .pdf-canvas,
.page-stack.zoom-preview .text-layer,
.page-stack.zoom-preview .annotation-layer {
  visibility: hidden;
}

.pdf-stage.draw-mode,
.page-stack.draw-mode,
.annotation-layer.draw-active {
  cursor: crosshair;
}

.pdf-stage.text-add-mode,
.page-stack.text-add-mode {
  cursor: text;
}

.pdf-stage.inline-dragging {
  overflow-anchor: none;
  user-select: none;
}

.pdf-stage.inline-dragging .text-layer,
.pdf-stage.inline-dragging .text-layer *,
.pdf-stage.inline-dragging .annotation-layer,
.pdf-stage.inline-dragging .annotation-layer * {
  user-select: none;
}

.pdf-stage.hand-mode,
.page-stack.hand-mode {
  cursor: grab;
}

.pdf-stage.hand-mode.hand-panning,
.page-stack.hand-mode.hand-panning {
  cursor: grabbing;
}

.pdf-stage.hand-mode .text-layer,
.pdf-stage.hand-mode .text-layer *,
.page-stack.hand-mode .text-layer,
.page-stack.hand-mode .text-layer *,
.pdf-stage.hand-mode .annotation-layer,
.pdf-stage.hand-mode .annotation-layer *,
.page-stack.hand-mode .annotation-layer,
.page-stack.hand-mode .annotation-layer * {
  cursor: grab !important;
}

.pdf-stage.hand-mode.hand-panning .text-layer,
.pdf-stage.hand-mode.hand-panning .text-layer *,
.page-stack.hand-mode.hand-panning .text-layer,
.page-stack.hand-mode.hand-panning .text-layer *,
.pdf-stage.hand-mode.hand-panning .annotation-layer,
.pdf-stage.hand-mode.hand-panning .annotation-layer *,
.page-stack.hand-mode.hand-panning .annotation-layer,
.page-stack.hand-mode.hand-panning .annotation-layer * {
  cursor: grabbing !important;
}

.pdf-canvas {
  display: block;
  background: #ffffff;
  border-radius: 6px;
  position: relative;
  z-index: 2;
}

/* Hidden background mirror for MS Clarity replay.
   Clarity records DOM but cannot capture <canvas> pixels, so for
   scanned PDFs the replayed viewer used to see a blank white area.
   This <img> sits underneath the canvas (z-index:1) and contains the
   same parsed background, so Clarity replay shows the document
   correctly. Live editor users still see the canvas (z-index:2). */
.pdf-clarity-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 6px;
  pointer-events: none;
  user-select: none;
  z-index: 1;
  object-fit: fill;
}

.text-layer {
  position: absolute;
  inset: 0;
  z-index: 6;
  overflow: hidden;
  opacity: 1;
  line-height: 1;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
}

.text-layer .text-token,
.text-layer .text-break-token {
  position: absolute;
  color: transparent;
  white-space: pre;
  cursor: text;
  transform-origin: 0 0;
}

/* Parsed HTML content (tables/blocks) must keep normal flow layout. */
.text-layer .parsed-text-block span,
.text-layer .parsed-text-block br,
.text-layer .parsed-table-cell-inner span,
.text-layer .parsed-table-cell-inner br {
  position: static !important;
  color: inherit;
  white-space: inherit;
  cursor: inherit;
  transform: none;
  line-height: inherit;
}

.text-layer .text-token {
  pointer-events: auto;
}

.text-layer .text-token:hover {
  outline: none;
}

.stored-override-area {
  position: absolute;
  z-index: 5;
  pointer-events: auto;
  cursor: text;
  background: transparent;
  box-sizing: border-box;
}

.page-stack.inline-active .stored-override-area {
  pointer-events: none;
}

.text-edit-overlay {
  position: absolute;
  z-index: 6;
  pointer-events: auto;
  cursor: text;
  background: transparent;
  box-sizing: border-box;
  white-space: pre-wrap;
  overflow: hidden;
  user-select: none;
}

.page-stack.inline-active .text-edit-overlay {
  pointer-events: none;
}

.page-stack.draw-mode .text-layer {
  pointer-events: none;
}

.page-stack.hand-mode .text-layer {
  pointer-events: none;
}

.page-stack.inline-active .text-layer {
  pointer-events: none;
}

/* Enable full interaction on text layer with parsed blocks */
.text-layer.has-parsed-blocks {
  pointer-events: auto !important;
  user-select: text !important;
  -webkit-user-select: text !important;
  overflow: visible;
}
.page-stack.inline-active .text-layer .parsed-text-block {
  pointer-events: auto;
  user-select: text;
  -webkit-user-select: text;
}

.text-layer ::selection {
  background: rgba(62, 93, 247, 0.22);
}

/* ── Parsed text blocks (Sejda-like HTML editing) ── */
.parsed-text-block {
  position: absolute;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  background: transparent;
  cursor: text;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
  line-height: 1.15;
  z-index: 10;
  overflow: hidden;
  user-select: text;
  -webkit-user-select: text;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.parsed-text-block:hover {
  outline: 1px dashed rgba(62, 93, 247, 0.4);
  outline-offset: 1px;
}

.parsed-text-block.parsed-link-block {
  cursor: pointer;
}

.parsed-text-block.parsed-link-block:hover {
  outline: 1px solid rgba(47, 88, 255, 0.75);
  outline-offset: 1px;
  box-shadow: inset 0 0 0 1px rgba(47, 88, 255, 0.22);
}

.parsed-text-block:focus {
  outline: 2px solid rgba(62, 93, 247, 0.6);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.85);
}

.parsed-text-block.parsed-text-block-editing {
  overflow: visible !important;
  max-height: none !important;
  height: auto;
}

.parsed-text-block.parsed-text-block-locked {
  outline: 1px dashed rgba(217, 119, 6, 0.7);
  outline-offset: 1px;
}

.parsed-text-block.parsed-text-block-locked::after {
  content: "LOCK";
  position: absolute;
  top: -16px;
  right: 0;
  min-width: 28px;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(217, 119, 6, 0.92);
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  pointer-events: none;
}

.parsed-overflow-warning {
  outline: 2px solid rgba(239, 68, 68, 0.75) !important;
  outline-offset: 1px;
  box-shadow: 0 0 0 1px rgba(239, 68, 68, 0.2);
}

.parsed-overflow-warning-hint {
  position: fixed;
  z-index: 1450;
  max-width: min(420px, calc(100vw - 16px));
  padding: 10px 11px;
  border-radius: 10px;
  border: 1px solid #fca5a5;
  background: rgba(255, 244, 244, 0.98);
  color: #7f1d1d;
  box-shadow: 0 12px 28px rgba(127, 29, 29, 0.22);
  font-size: 12px;
  line-height: 1.35;
  pointer-events: auto;
}

.parsed-overflow-warning-hint__text {
  margin: 0 0 8px;
  font-weight: 600;
}

.parsed-overflow-warning-hint__hide {
  border: 1px solid #fca5a5;
  background: #fff;
  color: #991b1b;
  border-radius: 8px;
  padding: 4px 9px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.parsed-overflow-warning-hint__hide:hover {
  background: #fff7f7;
}

.reflow-gap-indicator {
  position: absolute;
  left: 4px;
  right: 4px;
  border: 1px dashed transparent;
  border-radius: 8px;
  background: transparent;
  pointer-events: auto;
  z-index: 95;
  min-height: 3px;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.reflow-gap-indicator:hover,
.reflow-gap-indicator.dragging {
  border-color: rgba(14, 165, 233, 0.55);
  background: rgba(14, 165, 233, 0.08);
}

.reflow-gap-indicator.dragging {
  background: rgba(59, 130, 246, 0.13);
  border-color: rgba(93, 66, 206, 0.7);
}

.reflow-gap-indicator__badge {
  position: absolute;
  left: 10px;
  top: 6px;
  padding: 2px 7px;
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.82);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.reflow-gap-indicator__actions {
  position: absolute;
  right: 9px;
  top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.reflow-gap-indicator__btn {
  border: 1px solid rgba(30, 64, 175, 0.34);
  background: #fff;
  color: #1f2a44;
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 11px;
  line-height: 1.2;
  font-weight: 600;
}

.reflow-gap-indicator__btn:hover {
  background: #eef4ff;
}

.reflow-gap-indicator__btn.danger {
  border-color: rgba(220, 38, 38, 0.34);
  color: #a31b1b;
}

.reflow-gap-indicator__btn.danger:hover {
  background: #fff0f0;
}

.reflow-gap-indicator__drag-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 9px;
  cursor: ns-resize;
  background: linear-gradient(
    to bottom,
    rgba(30, 64, 175, 0.2) 0%,
    rgba(30, 64, 175, 0.08) 35%,
    rgba(30, 64, 175, 0.2) 100%
  );
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.reflow-gap-indicator__drag-handle.left {
  left: -1px;
  border-radius: 8px 0 0 8px;
}

.reflow-gap-indicator__drag-handle.right {
  right: -1px;
  border-radius: 0 8px 8px 0;
}

.reflow-gap-indicator:hover .reflow-gap-indicator__badge,
.reflow-gap-indicator.dragging .reflow-gap-indicator__badge,
.reflow-gap-indicator:hover .reflow-gap-indicator__actions,
.reflow-gap-indicator.dragging .reflow-gap-indicator__actions {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.reflow-gap-indicator:hover .reflow-gap-indicator__drag-handle,
.reflow-gap-indicator.dragging .reflow-gap-indicator__drag-handle {
  opacity: 1;
  pointer-events: auto;
}

.reflow-gap-insert-target {
  position: absolute;
  left: 8px;
  right: 8px;
  border: 1px dashed rgba(93, 66, 206, 0.62);
  border-radius: 999px;
  background: rgba(191, 219, 254, 0.28);
  color: #1d4ed8;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 96;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.reflow-gap-insert-target:hover {
  background: rgba(147, 197, 253, 0.45);
  border-color: rgba(29, 78, 216, 0.86);
  transform: translateY(-1px);
}

.text-layer .reflow-gap-insert-target__plus {
  position: static;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 1px solid rgba(29, 78, 216, 0.75);
  background: #fff;
  color: #1d4ed8;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
  font-weight: 800;
  transform: none;
  box-shadow: 0 4px 10px rgba(29, 78, 216, 0.2);
}

.reflow-overflow-panel {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 140;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #fecaca;
  background: #fff4f4;
  box-shadow: 0 10px 22px rgba(239, 68, 68, 0.16);
}

.reflow-overflow-panel__title {
  color: #991b1b;
  font-size: 12px;
  line-height: 1.3;
  font-weight: 700;
}

.reflow-overflow-panel__actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.reflow-overflow-panel__btn {
  border: 1px solid #fca5a5;
  background: #fff;
  color: #7f1d1d;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
}

.reflow-overflow-panel__btn:hover {
  background: #fff7f7;
}

.reflow-overflow-panel__btn.pin-bottom {
  border-color: #f59e0b;
  color: #92400e;
}

.reflow-overflow-panel__btn.dismiss {
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.ai-ocr-auto-notice {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  z-index: 170;
  min-width: min(880px, calc(100% - 28px));
  max-width: min(980px, calc(100% - 28px));
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(5px);
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.ai-ocr-auto-notice[data-state="loading"] {
  border-color: rgba(93, 66, 206, 0.34);
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.98) 0%, rgba(224, 242, 254, 0.98) 100%);
}

.ai-ocr-auto-notice[data-state="success"] {
  border-color: rgba(16, 185, 129, 0.34);
  background: linear-gradient(135deg, rgba(236, 253, 245, 0.98) 0%, rgba(220, 252, 231, 0.98) 100%);
}

.ai-ocr-auto-notice[data-state="error"] {
  border-color: rgba(248, 113, 113, 0.42);
  background: linear-gradient(135deg, rgba(254, 242, 242, 0.98) 0%, rgba(255, 237, 213, 0.98) 100%);
}

.ai-ocr-auto-notice__content {
  flex: 1 1 auto;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.ai-ocr-auto-notice__spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(93, 66, 206, 0.25);
  border-top-color: #2563eb;
  animation: ai-ocr-assist-spinner 0.8s linear infinite;
  flex: 0 0 16px;
}

.ai-ocr-auto-notice__text {
  font-size: 13px;
  line-height: 1.35;
  color: #1e293b;
  font-weight: 600;
}

.ai-ocr-auto-notice__close {
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.48);
  background: #ffffff;
  color: #475569;
  cursor: pointer;
  padding: 0;
  font-size: 12px;
  font-weight: 700;
}

.ai-ocr-auto-notice__close:hover {
  background: #f8fafc;
  color: #0f172a;
}

.ai-ocr-assist-panel {
  position: absolute;
  right: -344px;
  width: 324px;
  z-index: 145;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: linear-gradient(172deg, rgba(236, 253, 245, 0.98) 0%, rgba(224, 242, 254, 0.98) 45%, rgba(238, 242, 255, 0.98) 100%);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  backdrop-filter: blur(6px);
  padding: 12px 12px 11px;
  color: #0f172a;
}

.ai-ocr-assist-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.ai-ocr-assist-panel__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb 0%, #0ea5e9 100%);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.ai-ocr-assist-panel__close {
  border: 1px solid rgba(148, 163, 184, 0.5);
  border-radius: 999px;
  background: #ffffff;
  color: #475569;
  width: 22px;
  height: 22px;
  padding: 0;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.ai-ocr-assist-panel__close:hover {
  background: #f8fafc;
  color: #0f172a;
}

.ai-ocr-assist-panel__title {
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  color: #0f172a;
  margin-bottom: 6px;
}

.ai-ocr-assist-panel__magic {
  position: relative;
  height: 18px;
  margin: -2px 0 6px;
  pointer-events: none;
  overflow: hidden;
}

.ai-ocr-assist-panel__spark {
  position: absolute;
  top: 0;
  font-size: 13px;
  font-weight: 700;
  color: #7c3aed;
  text-shadow: 0 0 10px rgba(59, 130, 246, 0.25);
  opacity: 0;
  animation: ai-ocr-sparkle 1.8s ease-in-out infinite;
}

.ai-ocr-assist-panel__spark.s1 { left: 14px; animation-delay: 0s; }
.ai-ocr-assist-panel__spark.s2 { left: 54px; animation-delay: 0.22s; color: #2563eb; }
.ai-ocr-assist-panel__spark.s3 { left: 104px; animation-delay: 0.45s; color: #0ea5e9; }
.ai-ocr-assist-panel__spark.s4 { left: 156px; animation-delay: 0.68s; color: #8b5cf6; }
.ai-ocr-assist-panel__spark.s5 { left: 214px; animation-delay: 0.9s; color: #2563eb; }

@keyframes ai-ocr-sparkle {
  0% {
    transform: translateY(6px) scale(0.6) rotate(-8deg);
    opacity: 0;
  }
  20% {
    opacity: 0.95;
  }
  55% {
    transform: translateY(-3px) scale(1) rotate(6deg);
    opacity: 0.85;
  }
  100% {
    transform: translateY(-12px) scale(0.75) rotate(11deg);
    opacity: 0;
  }
}

.ai-ocr-assist-panel__text {
  font-size: 12px;
  line-height: 1.35;
  color: #334155;
  margin-bottom: 8px;
}

.ai-ocr-assist-panel__meta {
  font-size: 11px;
  line-height: 1.3;
  color: #475569;
  margin-bottom: 4px;
}

.ai-ocr-assist-panel__error {
  margin-top: 8px;
  margin-bottom: 8px;
  border-radius: 8px;
  border: 1px solid rgba(248, 113, 113, 0.4);
  background: rgba(254, 226, 226, 0.85);
  color: #991b1b;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1.3;
}

.ai-ocr-assist-panel__actions {
  margin-top: 9px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-ocr-assist-panel__bbox,
.ai-ocr-assist-panel__run {
  border: 1px solid rgba(29, 78, 216, 0.36);
  background: #ffffff;
  color: #1d4ed8;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.ai-ocr-assist-panel__bbox {
  width: auto;
  min-width: 112px;
  color: #0f766e;
  border-color: rgba(13, 148, 136, 0.32);
}

.ai-ocr-assist-panel__bbox:hover {
  background: #ecfeff;
}

.ai-ocr-assist-panel__bbox.is-active {
  background: #0f766e;
  color: #ffffff;
  border-color: #0f766e;
}

.ai-ocr-assist-panel__run {
  flex: 1 1 auto;
  width: 100%;
}

.ai-ocr-assist-panel__run:hover {
  background: #eff6ff;
}

.ai-ocr-assist-panel__run:disabled {
  cursor: default;
  color: #64748b;
  border-color: rgba(148, 163, 184, 0.34);
  background: rgba(248, 250, 252, 0.9);
}

.ai-ocr-assist-panel__spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(59, 130, 246, 0.2);
  border-top-color: #2563eb;
  border-radius: 999px;
  animation: ai-ocr-assist-spinner 0.8s linear infinite;
}

@keyframes ai-ocr-assist-spinner {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.ai-ocr-quick-launch {
  position: absolute;
  right: -220px;
  width: 198px;
  min-height: 46px;
  z-index: 145;
  border: 1px solid rgba(59, 130, 246, 0.28);
  background: linear-gradient(135deg, rgba(239, 246, 255, 0.98) 0%, rgba(224, 242, 254, 0.98) 100%);
  color: #1e3a8a;
  border-radius: 12px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.15);
  padding: 10px 11px;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  text-align: left;
}

.ai-ocr-quick-launch:hover {
  background: linear-gradient(135deg, rgba(219, 234, 254, 0.98) 0%, rgba(224, 242, 254, 0.98) 100%);
}

.ai-ocr-quick-launch.is-processing {
  border-color: rgba(14, 116, 144, 0.34);
}

.ai-ocr-quick-launch__icon {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 100%);
  color: #ffffff;
  font-size: 14px;
  box-shadow: 0 6px 14px rgba(93, 66, 206, 0.3);
}

.ai-ocr-quick-launch__text {
  flex: 1 1 auto;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
}

.ai-ocr-quick-launch__spinner {
  flex: 0 0 13px;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(29, 78, 216, 0.22);
  border-top-color: #1d4ed8;
  border-radius: 999px;
  animation: ai-ocr-assist-spinner 0.8s linear infinite;
}

.ai-ocr-bbox-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 120;
}

.ai-ocr-hit-overlay {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 119;
}

.ai-ocr-hit-overlay__box {
  position: absolute;
  pointer-events: auto;
  border: 1px dashed transparent;
  background: transparent;
  cursor: pointer;
  padding: 0;
  margin: 0;
  outline: none;
  border-radius: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.ai-ocr-hit-overlay__box:hover,
.ai-ocr-hit-overlay__box:focus-visible {
  border-color: rgba(93, 66, 206, 0.55);
  background: rgba(93, 66, 206, 0.04);
}

.ai-ocr-bbox-overlay__box {
  position: absolute;
  border: 1px dashed rgba(20, 184, 166, 0.75);
  background: rgba(20, 184, 166, 0.06);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.16);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.ai-ocr-bbox-overlay__box.is-pending:hover {
  border-color: rgba(93, 66, 206, 0.95);
  background: rgba(93, 66, 206, 0.1);
  box-shadow: inset 0 0 0 1px rgba(93, 66, 206, 0.28);
}

.ai-ocr-bbox-overlay__box.is-applied {
  border-color: rgba(34, 197, 94, 0.7);
  background: rgba(34, 197, 94, 0.06);
  box-shadow: inset 0 0 0 1px rgba(21, 128, 61, 0.22);
}

.ai-ocr-bbox-overlay__label {
  position: absolute;
  left: 2px;
  top: -16px;
  padding: 1px 5px;
  border-radius: 6px;
  font-size: 9px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffffff;
  background: rgba(15, 118, 110, 0.9);
  white-space: nowrap;
}

/* Reset <mark> default styling inside parsed blocks */
.parsed-text-block mark {
  background: none;
  color: inherit;
}

.parsed-text-block-from-ocr {
  outline: 1px dashed transparent;
  outline-offset: 1px;
  transition: outline-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
}

.parsed-text-block-from-ocr:hover,
.parsed-text-block-from-ocr:focus {
  outline-color: rgba(14, 165, 233, 0.78);
  box-shadow: 0 0 0 1px rgba(14, 165, 233, 0.22);
  background: rgba(14, 165, 233, 0.04);
}

/* ── OCR bbox resize handles ───────────────────────────── */
.ocr-bbox-resize-handle {
  position: absolute;
  background: rgba(14, 165, 233, 0.18);
  border: 1px solid rgba(14, 165, 233, 0.55);
  box-sizing: border-box;
  z-index: 20;
  opacity: 0;
  transition: opacity 0.15s ease, background 0.1s ease;
  pointer-events: auto;
}
.parsed-text-block-from-ocr:hover .ocr-bbox-resize-handle,
.parsed-text-block-from-ocr:focus .ocr-bbox-resize-handle,
.parsed-text-block-from-ocr:focus-within .ocr-bbox-resize-handle,
.parsed-text-block-from-ocr.parsed-text-block-editing .ocr-bbox-resize-handle,
.ocr-bbox-resizing .ocr-bbox-resize-handle,
.ocr-bbox-dragging .ocr-bbox-resize-handle {
  opacity: 1;
}
.ocr-bbox-resize-handle:hover {
  background: rgba(14, 165, 233, 0.55);
}

/* ── OCR bbox move handle (drag tab) ───────────────────── */
.ocr-bbox-move-handle {
  position: absolute;
  top: -22px;
  left: -1px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0ea5e9;
  color: #ffffff;
  border-radius: 6px 6px 0 0;
  cursor: grab;
  z-index: 22;
  opacity: 0;
  pointer-events: auto;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 2px 6px rgba(14, 165, 233, 0.35);
  transition: opacity 0.15s ease, background 0.12s ease;
}
.ocr-bbox-move-handle:hover {
  background: #0284c7;
}
.ocr-bbox-move-handle:active,
.ocr-bbox-dragging .ocr-bbox-move-handle {
  cursor: grabbing;
  background: #0369a1;
}
.parsed-text-block-from-ocr:hover .ocr-bbox-move-handle,
.parsed-text-block-from-ocr:focus .ocr-bbox-move-handle,
.parsed-text-block-from-ocr:focus-within .ocr-bbox-move-handle,
.parsed-text-block-from-ocr.parsed-text-block-editing .ocr-bbox-move-handle,
.ocr-bbox-resizing .ocr-bbox-move-handle,
.ocr-bbox-dragging .ocr-bbox-move-handle {
  opacity: 1;
}
.parsed-text-block-from-ocr.ocr-bbox-dragging {
  outline-color: rgba(14, 165, 233, 0.95) !important;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.3) !important;
}
.ocr-bbox-resize-handle--top {
  top: -3px; left: 4px; right: 4px; height: 6px;
  cursor: n-resize;
}
.ocr-bbox-resize-handle--bottom {
  bottom: -3px; left: 4px; right: 4px; height: 6px;
  cursor: s-resize;
}
.ocr-bbox-resize-handle--left {
  left: -3px; top: 4px; bottom: 4px; width: 6px;
  cursor: w-resize;
}
.ocr-bbox-resize-handle--right {
  right: -3px; top: 4px; bottom: 4px; width: 6px;
  cursor: e-resize;
}
.ocr-bbox-resize-handle--top-left {
  top: -4px; left: -4px; width: 8px; height: 8px;
  cursor: nw-resize;
}
.ocr-bbox-resize-handle--top-right {
  top: -4px; right: -4px; width: 8px; height: 8px;
  cursor: ne-resize;
}
.ocr-bbox-resize-handle--bottom-left {
  bottom: -4px; left: -4px; width: 8px; height: 8px;
  cursor: sw-resize;
}
.ocr-bbox-resize-handle--bottom-right {
  bottom: -4px; right: -4px; width: 8px; height: 8px;
  cursor: se-resize;
}

.ocr-erase-mask {
  position: absolute;
  background: #ffffff;
  pointer-events: none;
  z-index: 6;
}

.parsed-image-object,
.parsed-vector-object {
  position: absolute;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  pointer-events: auto;
  overflow: visible;
  transform-origin: center center;
  touch-action: none;
}

/* Loader placeholder shown inside the OCR image bbox while the crop
   image is still fetching from the backend. The spinner is centred
   on top of the holder via a ::before pseudo-element. */
.parsed-image-object[data-img-loading="1"],
.parsed-vector-object[data-img-loading="1"] {
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
  border-radius: 6px;
}
.parsed-image-object[data-img-loading="1"]::before,
.parsed-vector-object[data-img-loading="1"]::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  border: 3px solid rgba(59, 130, 246, 0.22);
  border-top-color: #2563eb;
  animation: parsed-image-spin 0.75s linear infinite;
  z-index: 3;
  pointer-events: none;
}
.parsed-image-object[data-img-loading="1"] > img,
.parsed-vector-object[data-img-loading="1"] > img {
  opacity: 0;
}
@keyframes parsed-image-spin {
  to { transform: rotate(360deg); }
}

.parsed-image-object:hover,
.parsed-image-object.selected,
.parsed-image-object.dragging,
.parsed-image-object.resizing,
.parsed-image-object.rotating {
  outline: 1px dashed rgba(62, 93, 247, 0.72);
  outline-offset: 1px;
  box-shadow: 0 0 0 1px rgba(62, 93, 247, 0.22);
}

.parsed-vector-object:hover,
.parsed-vector-object.selected,
.parsed-vector-object.dragging,
.parsed-vector-object.resizing,
.parsed-vector-object.rotating {
  outline: 1px dashed rgba(9, 105, 218, 0.72);
  outline-offset: 1px;
  box-shadow: 0 0 0 1px rgba(9, 105, 218, 0.22);
}

.parsed-object-from-ocr:hover,
.parsed-object-from-ocr.selected {
  outline-color: rgba(16, 185, 129, 0.85) !important;
  box-shadow: 0 0 0 1px rgba(16, 185, 129, 0.24) !important;
}

.parsed-image-object.dragging,
.parsed-vector-object.dragging {
  cursor: grabbing !important;
}

.parsed-object-ocr-hint {
  display: none !important;
  position: absolute;
  left: 0;
  top: -20px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid rgba(16, 185, 129, 0.4);
  background: rgba(15, 23, 42, 0.88);
  color: #dcfce7;
  font-size: 10px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 0.14s ease, transform 0.14s ease;
  pointer-events: none;
  z-index: 3;
}

.parsed-object-from-ocr:hover .parsed-object-ocr-hint {
  opacity: 1;
  transform: translateY(0);
}

.parsed-object-from-ocr.dragging .parsed-object-ocr-hint,
.parsed-object-from-ocr.resizing .parsed-object-ocr-hint,
.parsed-object-from-ocr.rotating .parsed-object-ocr-hint {
  opacity: 0 !important;
}

.parsed-object-ocr-assist {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 14px);
  transform: translate(-50%, 6px);
  width: min(420px, calc(100vw - 36px));
  min-width: 220px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid rgba(59, 130, 246, 0.32);
  background: rgba(248, 250, 255, 0.98);
  box-shadow: 0 10px 24px rgba(27, 40, 92, 0.16);
  display: none;
  flex-direction: column;
  gap: 8px;
  pointer-events: auto;
  z-index: 5;
  opacity: 0;
  transition: opacity 0.14s ease, transform 0.14s ease;
}

.parsed-image-object.selected .parsed-object-ocr-assist {
  display: flex;
  opacity: 1;
  transform: translate(-50%, 0);
}

.parsed-object-ocr-assist__question {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  min-height: 30px;
  padding: 6px 8px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.75);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 600;
  color: #1f2a4f;
  text-align: left;
  cursor: default;
  opacity: 1;
}

.parsed-object-ocr-assist__run {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(93, 66, 206, 0.35);
  border-radius: 10px;
  background: linear-gradient(180deg, #eff6ff 0%, #e0ecff 100%);
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
}

.parsed-object-ocr-assist__run:hover {
  border-color: rgba(93, 66, 206, 0.52);
  background: linear-gradient(180deg, #e7f0ff 0%, #d7e7ff 100%);
}

.parsed-object-ocr-assist__run:disabled {
  cursor: default;
  opacity: 0.8;
}

.parsed-object-ocr-assist__spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(93, 66, 206, 0.22);
  border-top-color: #2563eb;
  animation: parsed-object-ocr-spin 0.8s linear infinite;
}

@keyframes parsed-object-ocr-spin {
  to {
    transform: rotate(360deg);
  }
}

.parsed-image-object__img,
.parsed-vector-object__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

.parsed-object-controls {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.parsed-object-resize-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #2f58ff;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(26, 45, 113, 0.28);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.parsed-object-resize-handle-nw {
  left: 0;
  top: 0;
  cursor: nwse-resize;
}

.parsed-object-resize-handle-ne {
  left: 100%;
  top: 0;
  cursor: nesw-resize;
}

.parsed-object-resize-handle-se {
  left: 100%;
  top: 100%;
  cursor: nwse-resize;
}

.parsed-object-resize-handle-sw {
  left: 0;
  top: 100%;
  cursor: nesw-resize;
}

.parsed-object-rotate-arm {
  position: absolute;
  left: 50%;
  top: 100%;
  width: 2px;
  height: 22px;
  border-radius: 2px;
  background: #2f58ff;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}

.parsed-object-rotate-handle {
  position: absolute;
  left: 50%;
  top: calc(100% + 22px);
  width: 14px;
  height: 14px;
  border: 2px solid #2f58ff;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(26, 45, 113, 0.28);
  transform: translate(-50%, -50%);
  cursor: grab;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.parsed-object-rotate-handle:active {
  cursor: grabbing;
}

.parsed-object-rotate-badge {
  position: absolute;
  left: 50%;
  top: calc(100% + 38px);
  transform: translate(-50%, 0);
  min-width: 46px;
  padding: 3px 8px;
  border-radius: 8px;
  background: rgba(24, 34, 58, 0.9);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  z-index: 3;
}

.parsed-image-object:hover .parsed-object-resize-handle,
.parsed-image-object.selected .parsed-object-resize-handle,
.parsed-image-object.resizing .parsed-object-resize-handle,
.parsed-image-object.rotating .parsed-object-resize-handle,
.parsed-vector-object:hover .parsed-object-resize-handle,
.parsed-vector-object.selected .parsed-object-resize-handle,
.parsed-vector-object.resizing .parsed-object-resize-handle,
.parsed-vector-object.rotating .parsed-object-resize-handle {
  opacity: 1;
  pointer-events: auto;
}

.parsed-image-object:hover .parsed-object-rotate-arm,
.parsed-image-object.selected .parsed-object-rotate-arm,
.parsed-image-object.rotating .parsed-object-rotate-arm,
.parsed-vector-object:hover .parsed-object-rotate-arm,
.parsed-vector-object.selected .parsed-object-rotate-arm,
.parsed-vector-object.rotating .parsed-object-rotate-arm {
  opacity: 1;
}

.parsed-image-object:hover .parsed-object-rotate-handle,
.parsed-image-object.selected .parsed-object-rotate-handle,
.parsed-image-object.rotating .parsed-object-rotate-handle,
.parsed-vector-object:hover .parsed-object-rotate-handle,
.parsed-vector-object.selected .parsed-object-rotate-handle,
.parsed-vector-object.rotating .parsed-object-rotate-handle {
  opacity: 1;
  pointer-events: auto;
}

.parsed-image-object.rotating .parsed-object-rotate-badge,
.parsed-vector-object.rotating .parsed-object-rotate-badge {
  opacity: 1;
}

.parsed-image-object.dragging .parsed-object-rotate-badge,
.parsed-image-object.resizing .parsed-object-rotate-badge,
.parsed-vector-object.dragging .parsed-object-rotate-badge,
.parsed-vector-object.resizing .parsed-object-rotate-badge {
  opacity: 0;
}

.parsed-link-hover-preview {
  position: fixed;
  z-index: 1400;
  max-width: min(640px, calc(100vw - 16px));
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(238, 242, 255, 0.98);
  border: 1px solid #c6d3ff;
  color: #223462;
  font-size: 13px;
  line-height: 1.35;
  box-shadow: 0 10px 24px rgba(24, 38, 71, 0.2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

.move-tool-switch-hint {
  position: fixed;
  z-index: 1460;
  max-width: min(460px, calc(100vw - 16px));
  padding: 7px 11px;
  border-radius: 9px;
  border: 1px solid #93c5fd;
  background: rgba(239, 246, 255, 0.98);
  color: #1e3a8a;
  font-size: 12px;
  line-height: 1.25;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(30, 64, 175, 0.2);
  pointer-events: none;
  white-space: nowrap;
  animation: move-tool-switch-hint-float 1.7s ease forwards;
}

@keyframes move-tool-switch-hint-float {
  0% {
    opacity: 0;
    transform: translateY(8px);
  }
  18% {
    opacity: 1;
    transform: translateY(0);
  }
  80% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-6px);
  }
}

.annotation-layer {
  position: absolute;
  inset: 0;
  z-index: 12;
  pointer-events: none;
}

.annotation-layer.active {
  pointer-events: auto;
  touch-action: none;
}

/* In MOVE mode keep annotation items interactive, but let empty SVG areas
   pass events to parsed image/vector layers below. */
.annotation-layer.active.move-pass-through {
  pointer-events: none;
}
.annotation-layer.active.move-pass-through .annotation-item,
.annotation-layer.active.move-pass-through .annotation-item *,
.annotation-layer.active.move-pass-through .annotation-selection,
.annotation-layer.active.move-pass-through .annotation-selection *,
.annotation-layer.active.move-pass-through .annotation-rotate-controls,
.annotation-layer.active.move-pass-through .annotation-rotate-controls *,
.annotation-layer.active.move-pass-through .annotation-note-icon {
  pointer-events: auto;
}

.annotation-note-icon {
  pointer-events: auto;
  cursor: pointer;
}

.annotation-shape {
  fill: none;
  stroke: #d5365d;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.annotation-item {
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
}

.annotation-item.inline-edit-hidden {
  visibility: hidden;
  pointer-events: none;
}

.annotation-hitbox {
  fill: transparent;
  stroke: none;
  pointer-events: all;
}

.annotation-item.selected .annotation-shape,
.annotation-item.selected .annotation-highlight,
.annotation-item.selected .annotation-box,
.annotation-item.selected .annotation-image {
  filter: drop-shadow(0 0 1px rgba(62, 93, 247, 0.42));
}

.annotation-shape.preview {
  stroke-dasharray: 6 4;
  opacity: 0.8;
}

.annotation-image {
  pointer-events: none;
}

.annotation-selection,
.annotation-selection * {
  pointer-events: auto;
}

.annotation-text-group,
.annotation-text-foreign,
.annotation-text-content {
  pointer-events: none;
}

.annotation-text-background {
  stroke: none;
}

.annotation-text-content {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  padding: 3px;
  white-space: pre-wrap;
  word-break: break-word;
  overflow: hidden;
  line-height: 1.3;
}

.annotation-pencil {
  fill: none;
}

.annotation-pencil.preview {
  stroke-dasharray: none;
  opacity: 0.95;
}

.annotation-highlight {
  fill: rgba(255, 219, 77, 0.45);
  stroke: rgba(176, 129, 0, 0.7);
  stroke-width: 1.2;
}

.annotation-highlight.preview {
  stroke-dasharray: 6 4;
}

.annotation-link-preview {
  fill: rgba(47, 88, 255, 0.08);
  stroke: #2f58ff;
  stroke-width: 1.4;
  stroke-dasharray: 5 4;
}

.annotation-box {
  fill: rgba(62, 93, 247, 0.12);
  stroke: #3e5df7;
  stroke-width: 1.6;
  stroke-dasharray: 5 4;
}

.annotation-box.preview {
  fill: rgba(62, 93, 247, 0.08);
}

.annotation-box-label {
  font-size: 12px;
  font-weight: 600;
  fill: #2543b8;
  user-select: none;
}

.annotation-selection-box {
  fill: rgba(62, 93, 247, 0.06);
  stroke: #2f58ff;
  stroke-width: 1.4;
  stroke-dasharray: 5 4;
  pointer-events: none;
}

.annotation-resize-handle {
  fill: #ffffff;
  stroke: #2f58ff;
  stroke-width: 1.7;
  filter: drop-shadow(0 1px 2px rgba(34, 55, 122, 0.3));
}

.link-selection-preview,
.link-selection-preview * {
  pointer-events: none;
}

.link-selection-box {
  fill: rgba(47, 88, 255, 0.08);
}

.annotation-rotate-arm {
  stroke: #3e5df7;
  stroke-width: 1.6;
  stroke-linecap: round;
  pointer-events: none;
}

.annotation-rotate-handle {
  fill: #ffffff;
  stroke: #3e5df7;
  stroke-width: 1.8;
  cursor: grab;
  filter: drop-shadow(0 1px 2px rgba(34, 55, 122, 0.3));
}

.annotation-rotate-handle:active {
  cursor: grabbing;
}

.annotation-rotate-badge {
  font-size: 11px;
  font-weight: 700;
  fill: #ffffff;
  paint-order: stroke;
  stroke: rgba(17, 24, 39, 0.82);
  stroke-width: 3;
  stroke-linejoin: round;
  pointer-events: none;
}

.text-edit-source-mask {
  position: absolute;
  z-index: 34;
  border-radius: 2px;
  pointer-events: none;
  overflow: hidden;
}

.text-edit-source-mask.is-text-mask {
  border-radius: 0;
}

.text-edit-source-mask-text {
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  padding: 0;
  background: transparent !important;
  background-image: none !important;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
}

.text-hover-highlight {
  position: absolute;
  z-index: 34;
  pointer-events: none;
  border: 1.5px solid rgba(38, 70, 220, 0.45);
  border-radius: 3px;
  background: rgba(38, 70, 220, 0.04);
  box-sizing: border-box;
}

.text-edit-box {
  position: absolute;
  z-index: 35;
  border: 0;
  outline: 2px dashed rgba(38, 70, 220, 0.92);
  outline-offset: 1px;
  border-radius: 6px;
  background: transparent !important;
  box-shadow: 0 0 0 1px rgba(38, 70, 220, 0.14), 0 6px 18px rgba(38, 70, 220, 0.08);
  isolation: isolate;
  box-sizing: border-box;
}

.text-edit-box.is-dragging {
  cursor: move;
}

.link-settings-popover {
  position: absolute;
  z-index: 36;
  border-radius: 16px;
  border: 1px solid #d7deef;
  background: #f8faff;
  box-shadow: 0 22px 34px rgba(21, 33, 59, 0.2);
  overflow: hidden;
}

.link-settings-header {
  padding: 18px 22px;
  border-bottom: 1px solid #dbe3f4;
  font-size: 17px;
  font-weight: 700;
  color: #20283b;
  background: #f3f6fc;
}

.link-settings-body {
  padding: 18px 22px 12px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.link-settings-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.link-settings-label {
  font-size: 14px;
  font-weight: 600;
  color: #31384c;
}

.link-settings-segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-radius: 12px;
  overflow: hidden;
  background: #e9edf7;
}

.link-settings-segment {
  min-height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #3c465f;
  font-size: 15px;
  font-weight: 700;
  box-shadow: none;
}

.link-settings-segment:hover:not(:disabled) {
  background: rgba(47, 88, 255, 0.08);
}

.link-settings-segment.active {
  background: #4b3ff2;
  color: #ffffff;
}

.link-settings-input {
  width: 100%;
  min-height: 50px;
  border-radius: 12px;
  border: 1px solid #b9c6e7;
  background: #ffffff;
  padding: 12px 14px;
  font-size: 16px;
  color: #20283b;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(10, 23, 52, 0.04);
}

.link-settings-input:focus {
  border-color: #4b3ff2;
  box-shadow: 0 0 0 3px rgba(75, 63, 242, 0.12);
}

.link-settings-hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: #68738f;
}

.link-settings-footer {
  padding: 0 22px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.link-settings-btn {
  min-width: 108px;
}

.link-settings-btn.cancel {
  background: #ffffff;
  color: #33405f;
}

.link-settings-btn.save {
  border-color: #4b3ff2;
  background: #4b3ff2;
  color: #ffffff;
  font-weight: 700;
}

.link-settings-btn.save:hover:not(:disabled) {
  border-color: #3c32d4;
  background: #3c32d4;
}

.pdf-editor.is-inline-rotating,
.pdf-editor.is-inline-rotating * {
  user-select: none;
}

.pdf-editor.is-annotation-rotating,
.pdf-editor.is-annotation-rotating * {
  user-select: none;
}

.image-annotation-input {
  display: none;
}

.text-edit-mask {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  pointer-events: none;
  z-index: 1;
}

.text-edit-canvas-preview {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}

.text-edit-render-canvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
  user-select: none;
}

.text-edit-input {
  position: relative;
  z-index: 3;
  display: block;
  width: 100%;
  min-height: 100%;
  box-sizing: border-box;
  resize: none;
  margin: 0;
  border: 0;
  outline: none;
  border-radius: 4px;
  padding: 3px;
  color: #101827;
  background: transparent !important;
  background-image: none !important;
  -webkit-appearance: none;
  appearance: none;
  caret-color: #1d2f86;
  font-kerning: normal;
  font-variant-ligatures: normal;
  font-synthesis: weight style;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: subpixel-antialiased;
  -moz-osx-font-smoothing: auto;
  transform-origin: 0 0;
  overflow: visible;
  cursor: text;
  user-select: text;
}

/* Normalize elements inside contenteditable to prevent extra spacing. */
.text-edit-input > span,
.text-edit-input > div {
  margin: 0;
  padding: 0;
}

.text-edit-box.show-canvas-preview .text-edit-input,
.text-edit-box.show-canvas-preview .text-edit-input *,
.text-edit-box.show-render-canvas .text-edit-input,
.text-edit-box.show-render-canvas .text-edit-input * {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  text-shadow: none !important;
}

.text-edit-box.is-wrap .text-edit-input {
  overflow: hidden;
}

.text-edit-input[contenteditable="false"] {
  pointer-events: none;
}

.inline-drag-zone {
  position: absolute;
  z-index: 2;
  pointer-events: auto;
  cursor: move;
}

.inline-drag-zone.top,
.inline-drag-zone.bottom {
  left: 16px;
  right: 16px;
  height: 8px;
}

.inline-drag-zone.left,
.inline-drag-zone.right {
  top: 16px;
  bottom: 16px;
  width: 8px;
}

.inline-drag-zone.top {
  top: -4px;
}

.inline-drag-zone.right {
  right: -4px;
}

.inline-drag-zone.bottom {
  bottom: -4px;
}

.inline-drag-zone.left {
  left: -4px;
}

.resize-handle {
  position: absolute;
  z-index: 3;
  top: 50%;
  width: 15px;
  height: 15px;
  border: 2.5px solid #3e5df7;
  border-radius: 50%;
  background: #ffffff;
  transform: translateY(-50%);
  cursor: ew-resize;
  box-shadow: 0 2px 6px rgba(26, 45, 113, 0.3);
  opacity: 1;
  pointer-events: auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.text-edit-box:hover .resize-handle,
.text-edit-box.is-resizing .resize-handle {
  transform: translateY(-50%) scale(1.06);
  box-shadow: 0 3px 10px rgba(26, 45, 113, 0.34);
}

.rotate-handle-arm {
  position: absolute;
  left: 50%;
  bottom: -38px;
  width: 34px;
  height: 34px;
  background: transparent;
  transform: translateX(-50%);
  opacity: 1;
  pointer-events: auto;
  transition: transform 0.15s ease;
}

.rotate-handle-arm::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 2px;
  width: 3px;
  height: 28px;
  border-radius: 2px;
  background: #3e5df7;
  transform: translateX(-50%);
}

.rotate-handle {
  position: absolute;
  left: 50%;
  bottom: -56px;
  width: 18px;
  height: 18px;
  border: 2.5px solid #3e5df7;
  border-radius: 50%;
  background: #ffffff;
  transform: translateX(-50%);
  cursor: grab;
  box-shadow: 0 2px 6px rgba(26, 45, 113, 0.3);
  opacity: 1;
  pointer-events: auto;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.rotate-handle::before {
  content: "";
  position: absolute;
  inset: -14px;
  border-radius: 50%;
  background: transparent;
}

.rotate-handle:active {
  cursor: grabbing;
}

.rotate-angle-badge {
  position: absolute;
  left: 50%;
  bottom: -82px;
  transform: translateX(-50%);
  min-width: 48px;
  padding: 4px 9px;
  border-radius: 10px;
  background: rgba(24, 34, 58, 0.9);
  color: #ffffff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  opacity: 1;
  pointer-events: none;
  transition: transform 0.15s ease;
}

.text-edit-box:hover .rotate-handle-arm,
.text-edit-box:hover .rotate-handle,
.text-edit-box:hover .rotate-angle-badge,
.text-edit-box.is-rotating .rotate-handle-arm,
.text-edit-box.is-rotating .rotate-handle,
.text-edit-box.is-rotating .rotate-angle-badge {
  pointer-events: auto;
}

.text-edit-box:hover .rotate-angle-badge,
.text-edit-box.is-rotating .rotate-angle-badge {
  pointer-events: none;
}

.resize-handle.left {
  left: -10px;
}

.resize-handle.right {
  right: -10px;
}

/* OLD DESIGN - DISABLED */
/*
/* ── Bottom Toolbar ── */
.bottom-toolbar {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 140;
  background: #2f3e5c;
  color: #e9eefc;
  border-radius: 12px;
  padding: 8px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 12px 26px rgba(20, 31, 56, 0.35);
}

.bt-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.bt-divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.24);
  margin: 0 3px;
}

.bt-page-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  height: 28px;
  box-sizing: border-box;
  overflow: hidden;
  color-scheme: dark;
}

.bt-page-input {
  width: 28px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff !important;
  background: transparent !important;
  border: none;
  outline: none;
  box-shadow: none !important;
  -moz-appearance: textfield;
  -webkit-appearance: none;
  appearance: none;
}
.bt-page-input::-webkit-outer-spin-button,
.bt-page-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.bt-page-input:focus {
  color: #a3bfff;
  background: transparent !important;
}
.bt-page-input::selection {
  color: #ffffff;
  background: rgba(127, 152, 255, 0.35);
}
.bt-page-input:-webkit-autofill,
.bt-page-input:-webkit-autofill:hover,
.bt-page-input:-webkit-autofill:focus,
.bt-page-input:-webkit-autofill:active {
  -webkit-text-fill-color: #ffffff !important;
  -webkit-box-shadow: 0 0 0 1000px transparent inset !important;
  box-shadow: 0 0 0 1000px transparent inset !important;
  background-color: transparent !important;
  caret-color: #ffffff;
  transition: background-color 9999s ease-out 0s;
}

.bt-page-sep {
  font-size: 11px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
}

.bt-page-total {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.55);
}

.bt-zoom-label {
  min-width: 44px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  color: #e9eefc;
}

.bottom-btn {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #f4f7ff;
  border-radius: 8px;
  min-width: 28px;
  height: 28px;
  padding: 0 7px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.bottom-btn .material-symbols-outlined {
  font-size: 18px;
}

.bottom-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.18);
  border-color: rgba(255, 255, 255, 0.36);
}

.bottom-btn:disabled {
  opacity: 0.44;
  cursor: default;
}

.bt-hand-toggle {
  min-width: 28px;
  width: 28px;
  height: 28px;
  padding: 0;
}

.bt-hand-toggle.active {
  background: #4a6cff;
  border-color: #7f98ff;
}
/* ── End Bottom Toolbar ── */

.save-format-backdrop {
  position: fixed;
  inset: 0;
  z-index: 540;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(20, 30, 55, 0.45);
  backdrop-filter: blur(4px);
}

.save-format-modal {
  width: 420px;
  max-width: calc(100vw - 32px);
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(20, 30, 55, 0.25);
  overflow: hidden;
}

.save-format-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 14px;
  border-bottom: 1px solid #edf1f7;
}

.save-format-header h3 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: #1e2a44;
}

.save-format-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #6b7a96;
  cursor: pointer;
}

.save-format-close:hover {
  background: #f3f5f9;
}

.save-format-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 18px;
}

.save-format-switcher {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.save-format-switch-btn {
  flex: 1;
  min-height: 36px;
  border: 1px solid #d8deea;
  border-radius: 10px;
  background: #f7f9fd;
  color: #4a5573;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.save-format-switch-btn:hover:not(:disabled) {
  background: #eef3fa;
}

.save-format-switch-btn.active {
  background: #e9eeff;
  border-color: #6f84ff;
  color: #314cbe;
}

.save-format-switch-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.save-format-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: min(58vh, 430px);
  overflow-y: auto;
  padding-right: 2px;
}

.save-format-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f8f9fc;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.save-format-option:hover {
  background: #eef1f8;
}

.save-format-option.selected {
  background: #f0e8f5;
  border-color: #7c4dff;
}

.save-format-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.save-format-icon svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: #4a5573;
}

.save-format-option.selected .save-format-icon svg {
  color: #7c4dff;
}

.save-format-label {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: #2a3550;
  text-align: left;
}

.save-format-ext {
  font-size: 13px;
  font-weight: 500;
  color: #8895ad;
}

.save-format-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid #edf1f7;
}

.save-format-cancel {
  padding: 9px 20px;
  border: 1px solid #d8deea;
  border-radius: 10px;
  background: #ffffff;
  color: #4a5573;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}

.save-format-cancel:hover {
  background: #f5f7fb;
}

.save-format-download {
  padding: 9px 24px;
  border: 0;
  border-radius: 10px;
  background: #d34f69;
  color: #ffffff;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}

.save-format-download:hover:not(:disabled) {
  background: #c91d41;
}

.save-format-download:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.save-format-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.save-format-spinner {
  display: inline-flex;
  align-items: center;
}
.save-format-spin-icon {
  font-size: 18px;
  line-height: 1;
  animation: save-format-spin 0.9s linear infinite;
}
@keyframes save-format-spin {
  to { transform: rotate(360deg); }
}
.save-format-close:disabled {
  opacity: 0.3;
  pointer-events: none;
}
.save-format-cancel:disabled {
  opacity: 0.5;
  pointer-events: none;
}

@media (max-width: 1180px) {
  .app-header {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-left {
    flex: 1 1 auto;
    min-width: 0;
  }

  .header-right {
    flex: 0 0 auto;
  }

  .app-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .thumbs-sidebar {
    width: 190px !important;
  }

  .signature-modal {
    width: min(860px, 100%);
  }

  .signature-modal-header h3 {
    font-size: 27px;
  }
}

@media (max-width: 760px) {
  .app-header {
    padding: 12px;
  }

  .brand-name {
    font-size: 22px;
  }

  .header-left,
  .header-right {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .document-meta {
    justify-content: space-between;
  }

  .document-name-shell {
    flex: 1 1 auto;
  }

  .document-name {
    max-width: 100%;
    font-size: 14px;
  }

  .document-name-input {
    width: 100%;
    max-width: none;
  }

  .header-utility-actions {
    flex-wrap: wrap;
  }

  .app-actions {
    width: 100%;
    padding-left: 0;
    border-left: 0;
    border-top: none;
    padding-top: 8px;
    justify-content: space-between;
  }

  .top-action {
    min-width: 56px;
    flex: 1 1 56px;
    border-left: 0;
  }

  .share-action,
  .done-action {
    min-width: 0;
    flex: 1 1 auto;
    margin-left: 0;
  }

  .tool-btn {
    min-width: 80px;
    padding: 10px 7px;
  }

  .tool-label {
    font-size: 12px;
  }

  .viewer-shell {
    padding: 12px;
    padding-bottom: 12px;
  }

  .thumbs-sidebar,
  .thumbs-resizer {
    display: none;
  }

  .bottom-toolbar {
    max-width: calc(100vw - 18px);
    gap: 6px;
    padding: 9px 10px;
  }

  .bottom-page-input {
    gap: 4px;
    font-size: 12px;
  }

  .bottom-page-input input {
    width: 46px;
    padding: 3px 5px;
  }

  .bottom-btn {
    min-width: 30px;
    padding: 5px 8px;
  }

  button,
  .upload-lite {
    padding: 8px 10px;
    border-radius: 9px;
  }

  .signature-modal-overlay {
    padding: 8px;
  }

  .signature-modal {
    max-height: 95vh;
  }

  .signature-modal-header {
    padding: 14px 14px 10px;
  }

  .signature-modal-header h3 {
    font-size: 22px;
  }

  .signature-tabs {
    padding: 8px 10px 0;
  }

  .signature-tab-btn {
    font-size: 14px;
    padding: 8px 9px 10px;
  }

  .signature-modal-body {
    padding: 10px 10px 12px;
  }

  .signature-draw-canvas {
    height: 214px;
  }

  .signature-font-grid {
    grid-template-columns: 1fr;
  }

  .signature-font-option {
    border-right: 0;
  }

.signature-modal-footer {
  padding: 10px;
}
}

.page-manager-backdrop {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.26);
  backdrop-filter: blur(4px);
}

.page-manager-modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(96vw, 1620px);
  height: min(90vh, 940px);
  z-index: 521;
  border-radius: 18px;
  overflow: hidden;
  background: #f8fafc;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
}

.page-manager-toolbar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid #dce3ef;
  background: #ffffff;
}

.page-manager-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  color: #16213c;
}

.page-manager-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.page-manager-toolbar-spacer {
  flex: 1 1 auto;
}

.page-manager-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid #d7deea;
  border-radius: 10px;
  background: #ffffff;
  color: #25324f;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.1;
  transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.page-manager-tool-icon,
.page-manager-footer-icon,
.page-manager-move-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.page-manager-tool:hover:not(:disabled) {
  border-color: #5a6cff;
  background: #eef2ff;
  color: #2034d8;
  box-shadow: 0 8px 20px rgba(90, 108, 255, 0.12);
}

.page-manager-tool:disabled {
  opacity: 0.44;
  cursor: not-allowed;
  box-shadow: none;
}

.page-manager-body {
  position: relative;
  flex: 1 1 auto;
  overflow: auto;
  padding: 24px;
  background: #eef2f7;
}

.page-manager-state {
  display: flex;
  min-height: 240px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: #5a6480;
  text-align: center;
}

.page-manager-state strong {
  font-size: 20px;
  color: #1f2a44;
}

.page-manager-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 28px 24px;
  align-content: start;
}

.page-manager-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 0;
  border: 0;
  border-radius: 16px;
  background: transparent;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

.page-manager-card:hover {
  background: rgba(255, 255, 255, 0.44);
}

.page-manager-card.selected {
  background: rgba(87, 92, 255, 0.08);
}

.page-manager-card.dragging {
  opacity: 0.58;
}

.page-manager-card-sheet {
  position: relative;
  width: 100%;
  max-width: 212px;
  padding: 12px;
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 14px 34px rgba(25, 36, 68, 0.08);
}

.page-manager-card-preview {
  position: relative;
  width: 100%;
  min-height: 132px;
  overflow: hidden;
  border: 1px solid #d9dfeb;
  border-radius: 10px;
  background: #f7f9fd;
}

.page-manager-card-preview.blank {
  background:
    linear-gradient(135deg, rgba(87, 92, 255, 0.08), rgba(87, 92, 255, 0.01)),
    #ffffff;
}

.page-manager-card-image {
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  transform-origin: center;
}

.page-manager-card-placeholder {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: #62708d;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
}

.page-manager-card-number {
  min-width: 44px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #8f96a5;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
}

.page-manager-card.selected .page-manager-card-number {
  background: #575cff;
}

.page-manager-card-check,
.page-manager-card-badge {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.page-manager-card-check {
  top: 12px;
  left: 18px;
  width: 28px;
  padding: 0;
  border: 2px solid #b9c5dd;
  background: #ffffff;
  color: transparent;
}

.page-manager-card.selected .page-manager-card-check {
  border-color: #575cff;
  background: #575cff;
  color: #ffffff;
}

.page-manager-card-badge {
  top: 14px;
  right: 18px;
  border: 1px solid #d8ddff;
  background: #eef2ff;
  color: #4652f5;
}

.page-manager-card.drop-before::before,
.page-manager-card.drop-after::after {
  content: "";
  position: absolute;
  top: 24px;
  bottom: 50px;
  width: 4px;
  border-radius: 999px;
  background: #575cff;
}

.page-manager-card.drop-before::before {
  left: -8px;
}

.page-manager-card.drop-after::after {
  right: -8px;
}

.page-manager-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-top: 1px solid #dce3ef;
  background: #ffffff;
}

.page-manager-footer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 112px;
  min-height: 40px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid #d4dae8;
  font-size: 14px;
  font-weight: 700;
}

.page-manager-footer-btn.cancel {
  background: #ffffff;
  color: #31405e;
}

.page-manager-footer-btn.save {
  margin-left: auto;
  border-color: #575cff;
  background: #575cff;
  color: #ffffff;
  box-shadow: 0 12px 28px rgba(87, 92, 255, 0.24);
}

.page-manager-footer-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

.page-manager-move-dialog {
  position: absolute;
  top: 92px;
  right: 22px;
  z-index: 530;
  width: min(100%, 420px);
  padding: 16px;
  border: 1px solid #d8deeb;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.18);
}

.page-manager-move-dialog-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-manager-move-label {
  flex: 1 1 auto;
  color: #31405e;
  font-size: 14px;
  font-weight: 600;
}

.page-manager-move-input {
  width: 90px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid #cfd7e6;
  border-radius: 10px;
  background: #f8fafc;
  color: #1f2a44;
  font-size: 14px;
  font-weight: 600;
}

.page-manager-move-confirm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid #575cff;
  border-radius: 10px;
  background: #575cff;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
}

.page-manager-move-confirm:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.page-manager-move-hint {
  margin: 12px 0 0;
  color: #6b7791;
  font-size: 13px;
  line-height: 1.45;
}

@media (max-width: 1100px) {
  .page-manager-modal {
    width: 98vw;
    height: 92vh;
  }

  .page-manager-body {
    padding: 18px;
  }

  .page-manager-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 22px 16px;
  }

  .page-manager-card-sheet {
    max-width: 184px;
  }

  .page-manager-card-preview {
    min-height: 116px;
  }
}

@media (max-width: 760px) {
  .page-manager-backdrop {
    padding: 10px;
  }

  .page-manager-toolbar {
    padding: 14px;
  }

  .page-manager-body {
    padding: 14px;
  }

  .page-manager-actions {
    gap: 6px;
  }

  .page-manager-tool {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .page-manager-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .page-manager-card-sheet {
    max-width: 160px;
    padding: 8px;
  }

  .page-manager-card-preview {
    min-height: 96px;
  }

  .page-manager-footer {
    padding: 12px 14px;
  }

  .page-manager-footer-btn {
    min-width: 96px;
  }

  .page-manager-move-dialog {
    top: auto;
    right: 14px;
    bottom: 76px;
    left: 14px;
    width: auto;
  }

  .page-manager-move-dialog-row {
    flex-wrap: wrap;
  }
}

/* ═══════════════════════════════════════════════════
   AI Chat Panel (inside editor)
   ═══════════════════════════════════════════════════ */

.ai-chat-resizer {
  width: 6px;
  cursor: col-resize;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
}
.ai-chat-resizer::after {
  content: '';
  width: 2px;
  height: 40px;
  background: #cbd5e1;
  border-radius: 999px;
  transition: all 0.15s;
}
.ai-chat-resizer:hover::after,
.ai-chat-resizer:active::after {
  background: #6600bc;
  width: 3px;
}

.ai-chat-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #fff;
  border-left: 1px solid #e2e8f0;
  min-width: 260px;
  max-width: 700px;
  flex-shrink: 0;
}

.ai-chat-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid #e2e8f0;
  flex-shrink: 0;
}

.ai-chat-panel-title {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.ai-chat-panel-clear {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #94a3b8;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.ai-chat-panel-clear:hover {
  background: #f1f5f9;
  color: #64748b;
}

.ai-chat-panel-status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #eff6ff;
  border-bottom: 1px solid #dbeafe;
  font-size: 13px;
  font-weight: 600;
  color: #6600bc;
  flex-shrink: 0;
}

.ai-chat-panel-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid #93c5fd;
  border-top-color: #6600bc;
  border-radius: 50%;
  animation: ai-spin 0.8s linear infinite;
}
@keyframes ai-spin { to { transform: rotate(360deg); } }

.ai-chat-panel-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ai-chat-panel-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #94a3b8;
  text-align: center;
  padding: 24px;
}
.ai-chat-panel-empty p {
  font-size: 13px;
  line-height: 1.5;
}

.ai-chat-msg {
  display: flex;
  gap: 8px;
}
.ai-chat-msg.is-user {
  justify-content: flex-end;
}

.ai-chat-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #6600bc;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ai-chat-msg-bubble {
  max-width: 85%;
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.6;
  border-radius: 14px;
  word-break: break-word;
}

.ai-chat-msg.is-user .ai-chat-msg-bubble {
  background: #eff6ff;
  color: #1e293b;
  border-bottom-right-radius: 4px;
}

.ai-chat-msg.is-ai .ai-chat-msg-bubble {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
  border-bottom-left-radius: 4px;
}

.ai-chat-msg-bubble strong { font-weight: 700; }
.ai-chat-msg-bubble code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
}
.ai-chat-msg-bubble li {
  margin-left: 16px;
  list-style-type: disc;
}

.ai-chat-typing {
  display: flex !important;
  align-items: center;
  gap: 4px;
  padding: 12px 18px !important;
}
.ai-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: ai-dot-pulse 1.2s ease-in-out infinite;
}
.ai-chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.ai-chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ai-dot-pulse {
  0%, 60%, 100% { opacity: 0.3; transform: scale(0.8); }
  30% { opacity: 1; transform: scale(1.1); }
}

.ai-chat-panel-quick {
  display: flex;
  gap: 6px;
  padding: 8px 14px;
  overflow-x: auto;
  flex-shrink: 0;
  border-top: 1px solid #f1f5f9;
}

.ai-chat-quick-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  padding: 5px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  cursor: pointer;
  transition: all 0.15s;
}
.ai-chat-quick-btn:hover {
  background: #eff6ff;
  color: #6600bc;
  border-color: #bfdbfe;
}

.ai-chat-panel-input-wrap {
  padding: 10px 14px;
  border-top: 1px solid #e2e8f0;
  flex-shrink: 0;
  position: relative;
}

.ai-chat-panel-input {
  width: 100%;
  resize: none;
  border: none;
  background: #f1f5f9;
  border-radius: 12px;
  padding: 10px 42px 10px 14px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.4;
  outline: none;
  transition: box-shadow 0.15s;
}
.ai-chat-panel-input:focus { box-shadow: 0 0 0 2px rgba(102, 0, 188,0.15); }
.ai-chat-panel-input::placeholder { color: #94a3b8; }

.ai-chat-panel-send {
  position: absolute;
  right: 22px;
  bottom: 18px;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: #6600bc;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s;
  box-shadow: 0 2px 8px rgba(102, 0, 188,0.2);
}
.ai-chat-panel-send:hover { background: #1d4ed8; }
.ai-chat-panel-send:disabled { opacity: 0.4; cursor: default; }

/* ═══════════════════════════════════════════════════
   Responsive header: hide labels, reduce gaps
   ═══════════════════════════════════════════════════ */

/* Class for text labels inside header nav buttons */
.header-action-label {
  transition: all 0.15s;
}

@media (max-width: 1400px) {
  .app-header nav {
    gap: 12px !important;
    padding-left: 16px !important;
  }
}

@media (max-width: 1280px) {
  .app-header nav .header-action-label {
    display: none;
  }
  .app-header nav {
    gap: 8px !important;
    padding-left: 12px !important;
  }
}

@media (max-width: 1180px) {
  .ai-chat-panel,
  .ai-chat-resizer {
    display: none;
  }
}

@media (max-width: 760px) {
  .ai-chat-panel,
  .ai-chat-resizer {
    display: none;
  }
}

/* ---- Crop overlay ---- */
.crop-overlay {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 50;
  cursor: crosshair;
}
.crop-mask-svg {
  display: block;
}
.crop-actions {
  display: flex;
  gap: 4px;
}
.crop-action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: transform 0.15s;
}
.crop-action-btn:hover {
  transform: scale(1.1);
}
.crop-confirm {
  background: #6600bc;
  color: #fff;
}
.crop-cancel {
  background: #fff;
  color: #64748b;
}
.crop-cancel:hover {
  background: #f1f5f9;
}

/* Note (sticky note) styles */
.annotation-note-icon:hover path {
  filter: brightness(1.08);
}
.note-popup {
  position: absolute;
  width: 220px;
  background: #fef3c7;
  border: 1px solid #f59e0b;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 100;
  font-family: "Inter", sans-serif;
}
.note-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 4px;
  border-bottom: 1px solid #fbbf24;
}
.note-popup-title {
  font-size: 13px;
  font-weight: 600;
  color: #92400e;
}
.note-popup-close {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 4px;
  color: #92400e;
  padding: 0;
}
.note-popup-close:hover {
  background: rgba(0,0,0,0.08);
}
.note-popup-close .material-symbols-outlined {
  font-size: 16px;
}
.note-popup-textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px;
  border: none;
  background: transparent;
  resize: vertical;
  font-size: 12px;
  font-family: "Inter", sans-serif;
  color: #451a03;
  outline: none;
}

/* ── Sign Up Modal ────────────────────────────────────── */
.signup-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.signup-modal {
  position: relative;
  width: 420px;
  max-width: 95vw;
  max-height: 90vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  padding: 32px;
}
.signup-modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: #94a3b8;
  border-radius: 8px;
  transition: all 0.15s;
}
.signup-modal-close:hover {
  background: #f1f5f9;
  color: #334155;
}
.signup-modal-title {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 8px;
}
.signup-modal-subtitle {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 20px;
  line-height: 1.5;
}
.signup-step-badge {
  display: inline-block;
  background: #dbeafe;
  color: #6600bc;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  margin-right: 4px;
}
.signup-google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: all 0.15s;
}
.signup-google-btn:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.signup-google-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.signup-google-icon {
  flex-shrink: 0;
}
.signup-divider {
  display: flex;
  align-items: center;
  margin: 20px 0;
  gap: 12px;
}
.signup-divider::before,
.signup-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}
.signup-divider span {
  font-size: 12px;
  color: #94a3b8;
  font-weight: 500;
}
.signup-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.signup-field {
  position: relative;
  display: block;
  width: 100%;
}
.signup-field-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 20px;
  height: 20px;
  margin-top: -10px;
  color: #94a3b8;
  pointer-events: none;
  z-index: 1;
  display: block;
  flex-shrink: 0;
}
.signup-input {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px 12px 46px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  font-size: 14px;
  color: #0f172a;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.3;
}
.signup-input::placeholder {
  color: #94a3b8;
}
.signup-input:hover {
  border-color: #cbd5e1;
}
.signup-input:focus {
  border-color: #6600bc;
  box-shadow: 0 0 0 3px rgba(102, 0, 188, 0.1);
}
.signup-input:disabled {
  background: #f8fafc;
  cursor: not-allowed;
}
.signup-password-strength {
  display: flex;
  align-items: center;
  gap: 8px;
}
.signup-strength-bar {
  display: flex;
  gap: 3px;
  flex: 1;
}
.signup-strength-segment {
  height: 4px;
  flex: 1;
  border-radius: 2px;
  background: #e2e8f0;
  transition: background 0.2s;
}
.signup-strength-segment.active:nth-child(1) { background: #ef4444; }
.signup-strength-segment.active:nth-child(2) { background: #f59e0b; }
.signup-strength-segment.active:nth-child(3) { background: #22c55e; }
.signup-strength-segment.active:nth-child(4) { background: #16a34a; }
.signup-strength-label {
  font-size: 11px;
  font-weight: 600;
  color: #94a3b8;
  min-width: 40px;
}
.signup-error {
  color: #ef4444;
  font-size: 13px;
  margin: 0;
  padding: 4px 0;
}
.signup-submit-btn {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: #6600bc;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.signup-submit-btn:hover {
  background: #1d4ed8;
}
.signup-submit-btn:disabled {
  background: #93c5fd;
  cursor: not-allowed;
}
.signup-switch {
  margin: 16px 0 0;
  font-size: 13px;
  color: #64748b;
  text-align: center;
}
.signup-switch a {
  color: #6600bc;
  font-weight: 600;
  text-decoration: none;
}
.signup-switch a:hover {
  text-decoration: underline;
}
.signup-terms {
  margin: 12px 0 0;
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  line-height: 1.5;
}
.signup-terms a {
  color: #64748b;
  text-decoration: underline;
}

/* ── Profile Avatar ───────────────────────────────────── */
.profile-avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #6600bc;
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.15s;
}
.profile-avatar-btn:hover {
  box-shadow: 0 0 0 3px rgba(102, 0, 188, 0.2);
}
.profile-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
  border: 1px solid #e2e8f0;
  min-width: 160px;
  padding: 4px;
  z-index: 100;
}
.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: #334155;
  cursor: pointer;
  border-radius: 6px;
  transition: background 0.1s;
}
.profile-dropdown-item:hover {
  background: #f1f5f9;
}

/* ===== MOBILE EDITOR ===== */

/* Hide mobile-only elements on desktop */
.mobile-editor-header,
.mobile-page-indicator,
.mobile-bottom-tabs,
.mobile-more-sheet-overlay {
  display: none;
}

@media (max-width: 760px) {
  /* ── Show mobile elements ── */
  .mobile-editor-header,
  .mobile-bottom-tabs {
    display: flex;
  }
  .mobile-page-indicator {
    display: flex;
  }
  /* overlay is toggled via .open class, default stays hidden */

  /* ── Hide desktop elements ── */
  .editor-ribbon {
    display: none !important;
  }
  .pencil-subheader,
  .tool-subheader {
    display: none !important;
  }
  .thumbs-sidebar,
  .thumbs-resizer {
    display: none !important;
  }
  .app-header {
    display: none !important;
  }
  .top-shell {
    position: static !important;
  }

  /* ── Viewer adjustments ── */
  .viewer-shell {
    padding: 0 !important;
    padding-bottom: 140px !important;
    padding-top: 0 !important;
  }
  .viewer-shell.has-bottom-toolbar .pdf-stage {
    padding-bottom: 0 !important;
  }

  /* ── Bottom toolbar repositioned above tab bar ── */
  .bottom-toolbar {
    bottom: 76px !important;
    border-radius: 999px !important;
    padding: 6px 12px !important;
    gap: 4px !important;
    max-width: calc(100vw - 32px) !important;
  }
  .bottom-toolbar .bt-hand-toggle {
    display: none !important;
  }
  .bottom-toolbar .bt-divider:last-of-type {
    display: none !important;
  }

  /* ─────────────────────────────────────────
     MOBILE HEADER
  ───────────────────────────────────────── */
  .mobile-editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    padding: 0 12px;
    padding-top: env(safe-area-inset-top, 0px);
    background: #ffffff;
    border-bottom: 1px solid #e2e8f0;
    z-index: 200;
    will-change: transform;
    transform: translateZ(0);
  }
  .mobile-header-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    color: #334155;
    border-radius: 10px;
    padding: 0;
  }
  .mobile-header-back:active {
    background: #f1f5f9;
  }
  .mobile-header-back .material-symbols-outlined {
    font-size: 24px;
  }
  .mobile-header-filename {
    flex: 1;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 12px;
  }
  .mobile-header-save {
    padding: 8px 20px;
    background: #6600bc;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
  }
  .mobile-header-save:active {
    opacity: 0.8;
  }
  .mobile-header-save:disabled {
    opacity: 0.5;
    cursor: default;
  }

  /* Push page content below fixed header */
  .pdf-editor {
    padding-top: calc(56px + env(safe-area-inset-top, 0px));
  }

  /* ─────────────────────────────────────────
     MOBILE PAGE INDICATOR
  ───────────────────────────────────────── */
  .mobile-page-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 148px;
    padding: 6px 18px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #475569;
    z-index: 140;
    white-space: nowrap;
    pointer-events: none;
    will-change: transform;
    transform: translateX(-50%) translateZ(0);
  }

  /* ─────────────────────────────────────────
     MOBILE BOTTOM TAB BAR
  ───────────────────────────────────────── */
  .mobile-bottom-tabs {
    display: flex;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: #ffffff;
    border-top: 1px solid #e2e8f0;
    z-index: 200;
    will-change: transform;
    transform: translateZ(0);
  }
  .mobile-tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 0;
    color: #94a3b8;
    transition: color 0.15s;
    -webkit-tap-highlight-color: transparent;
    border-radius: 0;
  }
  .mobile-tab-btn.active {
    color: #6600bc;
  }
  .mobile-tab-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: background 0.15s;
  }
  .mobile-tab-btn.active .mobile-tab-icon {
    background: rgba(102, 0, 188, 0.12);
  }
  .mobile-tab-icon .material-symbols-outlined {
    font-size: 22px;
  }
  .mobile-tab-label {
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    line-height: 1;
  }

  /* ─────────────────────────────────────────
     MOBILE "MORE" BOTTOM SHEET
  ───────────────────────────────────────── */
  .mobile-more-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    z-index: 300;
    pointer-events: none;
    transition: background 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    display: flex;
    align-items: flex-end;
  }
  .mobile-more-sheet-overlay.open {
    background: rgba(0, 0, 0, 0.4);
    pointer-events: auto;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
  }

  .mobile-more-sheet {
    position: relative;
    width: 100%;
    max-height: 85vh;
    background: #ffffff;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    will-change: transform;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mobile-more-sheet.open {
    transform: translateY(0);
  }

  .mobile-more-sheet-handle {
    display: flex;
    justify-content: center;
    padding: 12px 0 4px;
    cursor: grab;
    touch-action: none;
  }
  .mobile-more-sheet-handle::after {
    content: '';
    width: 40px;
    height: 5px;
    background: #cbd5e1;
    border-radius: 999px;
  }

  .mobile-more-sheet-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 8px 20px 12px;
  }
  .mobile-more-sheet-tag {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94a3b8;
    margin: 0 0 2px;
  }
  .mobile-more-sheet-header h3 {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin: 0;
  }
  .mobile-more-sheet-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    margin-top: 2px;
  }
  .mobile-more-sheet-close:active {
    background: #e2e8f0;
  }

  /* Sheet tool grid (4 columns) */
  .mobile-more-sheet-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px 8px;
    padding: 0 16px 16px;
  }
  .mobile-sheet-tool {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 4px;
    border-radius: 14px !important;
    transition: background 0.12s;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-sheet-tool:active {
    background: #f1f5f9;
  }
  .mobile-sheet-tool-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    background: #f1f5f9;
    border-radius: 16px;
    color: #334155;
  }
  .mobile-sheet-tool-icon .material-symbols-outlined {
    font-size: 24px;
  }
  .mobile-sheet-tool-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #475569;
    letter-spacing: 0.01em;
    text-align: center;
    line-height: 1.2;
  }

  /* Sheet list items */
  .mobile-more-sheet-list {
    border-top: 1px solid #e2e8f0;
    margin: 0 16px;
    padding: 8px 0 12px;
  }
  .mobile-sheet-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 4px;
    background: none;
    border: none;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: #334155;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
  }
  .mobile-sheet-list-item:last-child {
    border-bottom: none;
  }
  .mobile-sheet-list-item:active {
    background: #f8fafc;
  }
  .mobile-sheet-list-item .material-symbols-outlined {
    font-size: 22px;
    color: #64748b;
  }
  .mobile-sheet-list-item span:nth-child(2) {
    flex: 1;
  }
  .mobile-sheet-chevron {
    font-size: 20px !important;
    color: #cbd5e1 !important;
  }
}

/* ── PDF attachments / portfolio sidebar ──────────────────── */
.pdf-attachments-sidebar {
  position: fixed;
  top: 110px;
  right: 16px;
  width: 280px;
  max-height: calc(100vh - 160px);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
  z-index: 9990;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.18s ease;
}
.pdf-attachments-sidebar.collapsed {
  width: 48px;
}
.pdf-attachments-sidebar__toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: none;
  border-bottom: 1px solid #e2e8f0;
  color: #1e293b;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.pdf-attachments-sidebar.collapsed .pdf-attachments-sidebar__toggle {
  border-bottom: none;
  justify-content: center;
  padding: 12px 10px;
}
.pdf-attachments-sidebar__toggle svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: #2563eb;
}
.pdf-attachments-sidebar__toggle-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}
.pdf-attachments-sidebar__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}
.pdf-attachments-sidebar__list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pdf-attachments-sidebar__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.pdf-attachments-sidebar__item:hover {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.pdf-attachments-sidebar__icon {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: #dbeafe;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #1d4ed8;
  flex-shrink: 0;
}
.pdf-attachments-sidebar__icon svg {
  width: 16px;
  height: 16px;
}
.pdf-attachments-sidebar__meta {
  flex: 1;
  min-width: 0;
}
.pdf-attachments-sidebar__name {
  font-size: 12.5px;
  font-weight: 700;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pdf-attachments-sidebar__size {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 1px;
}
.pdf-attachments-sidebar__download {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: #fff;
  color: #2563eb;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.12s ease;
}
.pdf-attachments-sidebar__download:hover {
  background: #dbeafe;
}
.pdf-attachments-sidebar__download svg {
  width: 16px;
  height: 16px;
}
@media (max-width: 768px) {
  .pdf-attachments-sidebar {
    top: auto;
    bottom: 16px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 50vh;
  }
  .pdf-attachments-sidebar.collapsed {
    width: 48px;
    left: auto;
  }
}

/* ── Onboarding tutorial overlay + spotlight + popover ──── */
.onboarding-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
}
.onboarding-spotlight {
  position: fixed;
  border-radius: 12px;
  box-shadow: 0 0 0 9999px rgba(15, 23, 42, 0.55);
  pointer-events: none;
  transition: top 0.32s ease, left 0.32s ease, width 0.32s ease, height 0.32s ease;
  z-index: 10000;
}
.onboarding-popover {
  position: fixed;
  z-index: 10001;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 14px 44px rgba(15, 23, 42, 0.2), 0 2px 10px rgba(15, 23, 42, 0.08);
  padding: 20px 22px 16px;
  max-width: 90vw;
  animation: onboardingFadeIn 0.25s ease;
}
@keyframes onboardingFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.onboarding-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.onboarding-popover-step {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #2563eb;
  background: #eff6ff;
  padding: 3px 10px;
  border-radius: 999px;
}
.onboarding-popover-close {
  width: 28px;
  height: 28px;
  border: none;
  background: #f1f5f9;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #94a3b8;
  cursor: pointer;
}
.onboarding-popover-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.onboarding-popover-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
  line-height: 1.35;
}
.onboarding-popover-desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 16px;
}
.onboarding-popover-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}
.onboarding-btn {
  font-size: 13px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.onboarding-btn--next {
  background: #2563eb;
  color: #ffffff;
}
.onboarding-btn--next:hover {
  background: #1d4ed8;
}
.onboarding-btn--back {
  background: #f1f5f9;
  color: #334155;
}
.onboarding-btn--back:hover {
  background: #e2e8f0;
}
.onboarding-btn--skip {
  background: transparent;
  color: #94a3b8;
  margin-right: auto;
}
.onboarding-btn--skip:hover {
  color: #64748b;
}
@media (max-width: 760px) {
  .onboarding-popover {
    padding: 16px 16px 12px;
    border-radius: 14px;
  }
  .onboarding-popover-title {
    font-size: 15px;
  }
  .onboarding-popover-desc {
    font-size: 12px;
    margin-bottom: 12px;
  }
  .onboarding-btn {
    font-size: 12px;
    padding: 7px 14px;
  }
}
