[hidden] {
  display: none !important;
}
svg {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
header.app-header {
  height: 62px;
  padding: 0 28px;
}
.privacy {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.privacy svg {
  width: 16px;
  height: 16px;
}
.language-picker {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.language-picker > .brio-icon {
  width: 16px;
  height: 16px;
  color: #60718c;
}
.language-picker select {
  width: 118px;
  min-height: 34px;
  padding: 5px 25px 5px 7px;
  font-size: 12px;
  font-weight: 600;
}
.language-picker .language-submit {
  width: 31px;
  min-height: 31px;
}
.app-header .quiet {
  margin-left: 8px;
}
.home {
  max-width: 1130px;
  margin: 0 auto;
  padding: 33px 25px 10px;
}
.home-intro {
  text-align: center;
  margin-bottom: 25px;
}
.eyebrow {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #48617d;
  margin: 0 0 9px;
}
.home-intro h1 {
  font-size: 32px;
  line-height: 1.2;
  margin: 0 0 12px;
  letter-spacing: -1px;
}
.home-intro > p:last-child {
  font-size: 15px;
  color: #61728a;
  margin: 0;
}
.drop-zone {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 6px 17px;
  align-items: center;
  background: white;
  border: 1px dashed #9db6e6;
  border-radius: 13px;
  padding: 22px 25px;
  margin: 0 0 25px;
}
.drop-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: #edf3ff;
  border-radius: 12px;
  color: var(--blue);
}
.drop-mark svg {
  width: 27px;
  height: 27px;
}
.drop-zone strong {
  font-size: 17px;
}
.drop-zone p {
  margin: 5px 0 0;
  color: #667994;
  font-size: 13px;
}
.entry-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}
.entry-buttons button {
  min-height: 40px;
}
.drop-zone .drop-help {
  grid-column: 2/4;
  margin: 2px 0 0;
  font-size: 12px;
}
.tool-filter {
  display: flex;
  gap: 6px;
  margin-bottom: 17px;
  flex-wrap: wrap;
}
.tool-filter button {
  border: 0;
  background: transparent;
  border-radius: 22px;
  padding: 7px 16px;
  color: #61728a;
  font-size: 13px;
}
.tool-filter button.active {
  background: #1f58df;
  color: white;
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.tool-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  gap: 10px;
  padding: 19px;
  min-height: 169px;
  border-radius: 11px;
  background: white;
  font-weight: 400;
}
.tool-card > strong {
  font-size: 16px;
  letter-spacing: -0.2px;
}
.tool-card > span:last-child {
  font-size: 13px;
  color: #697a90;
  line-height: 1.5;
}
.tool-icon {
  color: #2860d7;
  background: #eef3ff;
  border-radius: 9px;
  padding: 9px;
  display: grid;
  place-items: center;
}
.tool-icon svg {
  width: 24px;
  height: 24px;
}
.tool-create {
  color: #897036;
  background: #faf5e9;
}
.tool-read {
  color: #167965;
  background: #eaf7f2;
}
.tool-card.chosen {
  border-color: #6e9af1;
}
.home-footer {
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 22px;
  padding: 27px 0 15px;
  font-size: 12px;
}
.home-footer > span {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-right: auto;
}
.home-footer a {
  color: #687991;
  text-decoration: none;
}
.home-footer svg {
  width: 15px;
  height: 15px;
}
.editor-tools,
.page-tools {
  min-height: 44px;
  padding: 6px 16px;
  gap: 12px;
  flex-wrap: nowrap;
}
.editor-tools button,
.page-tools button {
  padding: 6px 9px;
  min-height: 32px;
  font-size: 13px;
  white-space: nowrap;
}
.tool-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
.tool-group + .tool-group {
  padding-left: 10px;
  border-left: 1px solid var(--border);
}
.icon-only {
  padding: 6px;
  width: 33px;
  min-height: 32px;
}
.page-tools {
  background: #fff;
}
.page-tools #selected-count {
  font-size: 12px;
  color: #748297;
  min-width: 132px;
  margin: 0;
}
.workspace {
  grid-template-columns: 166px minmax(0, 1fr);
  height: calc(100dvh - 150px);
  min-height: 350px;
}
.document,
.pages {
  height: auto;
  min-height: 0;
}
.viewer-toolbar {
  min-height: 43px;
  padding: 6px 14px;
  gap: 5px;
  justify-content: center;
  flex-wrap: nowrap;
}
.viewer-toolbar button,
.viewer-toolbar select,
.viewer-toolbar input {
  padding: 5px 8px;
  font-size: 13px;
  min-height: 29px;
}
.viewer-toolbar #page-number {
  width: 49px;
}
.viewer-toolbar #search-form {
  margin-left: auto;
}
.viewer-toolbar #search {
  width: 180px;
}
.panel-title {
  padding: 12px;
}
.selection {
  padding-bottom: 3px;
  flex-wrap: wrap;
}
.selection button {
  padding: 4px 8px;
  flex: 1 1 0;
}
.selection #select-ranges {
  flex-basis: 100%;
}
.selection-summary {
  margin: 0 10px 5px;
  padding: 5px 7px;
  border: 1px solid #d8e2f3;
  border-radius: 7px;
  background: #f7f9fd;
  color: #60728d;
  font-size: 11px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.thumb {
  padding: 8px;
  margin: 8px 12px;
}
.thumb label {
  margin-top: 6px;
}
.tool-hint {
  margin: 0;
  background: #f1f5ff;
  color: #426298;
  border-bottom: 1px solid #dce6fb;
  padding: 7px 15px;
  font-size: 12px;
}
#viewport {
  padding: 20px;
}
.document footer {
  padding: 7px 12px;
}
.file-drag #drop-zone,
.file-drag #viewport {
  outline: 3px dashed var(--blue);
  outline-offset: -4px;
  background: #e8f0ff;
}
.source-option {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  margin: 8px 0;
  padding: 13px;
}
.source-option span {
  font-size: 13px;
  color: #6b7b90;
  font-weight: 400;
  line-height: 1.5;
}
.source-trigger {
  white-space: nowrap;
}
#source-modal {
  max-width: 460px;
}
.busy .home {
  pointer-events: none;
  opacity: 0.65;
}
#toast {
  pointer-events: none;
}
.editor-mode {
  overflow: hidden;
}
@media (max-width: 1000px) {
  .tool-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .drop-zone {
    grid-template-columns: 48px 1fr;
  }
  .entry-buttons {
    grid-column: 2;
    flex-wrap: wrap;
  }
  .drop-zone .drop-help {
    grid-column: 2;
  }
  .workspace {
    grid-template-columns: 146px minmax(0, 1fr);
    height: calc(100dvh - 150px);
    min-height: 350px;
  }
  .document,
  .pages {
    height: auto;
    min-height: 0;
  }
  .page-tools #selected-count {
    min-width: 110px;
  }
}
@media (max-width: 700px) {
  header.app-header {
    height: auto;
    min-height: 58px;
    padding: 10px 12px;
    gap: 8px;
  }
  .app-header .privacy {
    margin-left: auto;
    order: 0;
    width: auto;
    padding: 5px 7px;
    font-size: 11px;
  }
  .app-header .privacy svg {
    display: none;
  }
  .app-header .language-picker {
    gap: 3px;
  }
  .app-header .language-picker > .brio-icon {
    display: none;
  }
  .app-header .language-picker select {
    width: 104px;
    min-height: 31px;
    padding: 4px 20px 4px 6px;
    font-size: 11px;
  }
  .app-header .language-picker .language-submit {
    width: 29px;
    min-height: 29px;
  }
  .app-header .brand {
    font-size: 21px;
  }
  .app-header .brand-icon {
    font-size: 18px;
    padding: 4px 8px;
    margin-right: 7px;
  }
  .app-header #back-home {
    font-size: 12px;
    padding: 6px;
  }
  .app-header #download {
    font-size: 13px;
    padding: 7px;
  }
  .editor-mode .app-header .privacy {
    display: none;
  }
  .home {
    padding: 24px 15px 10px;
  }
  .home-intro h1 {
    font-size: 26px;
  }
  .home-intro > p:last-child {
    font-size: 14px;
  }
  .drop-zone {
    padding: 16px;
    gap: 10px;
    grid-template-columns: 1fr;
  }
  .drop-mark {
    display: none;
  }
  .entry-buttons {
    grid-column: 1;
    gap: 7px;
  }
  .entry-buttons button {
    font-size: 13px;
  }
  .entry-buttons .primary {
    margin-left: 0;
  }
  .drop-zone .drop-help {
    grid-column: 1;
  }
  .tool-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
  .tool-card {
    padding: 14px;
    min-height: 175px;
    gap: 8px;
  }
  .tool-card > strong {
    font-size: 14px;
  }
  .tool-card > span:last-child {
    font-size: 12px;
  }
  .tool-icon {
    padding: 7px;
  }
  .tool-icon svg {
    width: 21px;
    height: 21px;
  }
  .home-footer {
    gap: 15px;
    flex-wrap: wrap;
    padding-top: 20px;
  }
  .home-footer > span {
    width: 100%;
  }
  .editor-tools,
  .page-tools {
    padding: 5px 8px;
    gap: 5px;
    overflow-x: auto;
    min-height: 42px;
  }
  .editor-tools button,
  .page-tools button {
    font-size: 12px;
    padding: 5px 7px;
    gap: 5px;
  }
  .editor-tools #status {
    display: none;
  }
  .page-tools #selected-count {
    min-width: auto;
    white-space: nowrap;
    font-size: 11px;
  }
  .page-tools .tool-group + .tool-group {
    padding-left: 6px;
  }
  .tool-group {
    gap: 3px;
  }
  .workspace {
    grid-template-columns: 91px minmax(0, 1fr);
    height: calc(100dvh - 142px);
    min-height: 250px;
  }
  .document,
  .pages {
    height: auto;
    min-height: 0;
  }
  .viewer-toolbar {
    padding: 5px;
    gap: 3px;
    flex-wrap: wrap;
    justify-content: flex-start;
  }
  .viewer-toolbar #search-form {
    margin-left: 0;
    width: 100%;
    gap: 4px;
  }
  .viewer-toolbar #search {
    width: 100%;
    min-width: 0;
  }
  .viewer-toolbar #zoom {
    max-width: 125px;
  }
  .thumb {
    margin: 6px 5px;
    padding: 5px;
  }
  .panel-title {
    padding: 10px 7px;
  }
  .selection {
    gap: 3px;
    padding: 0 4px;
  }
  .selection button {
    font-size: 11px;
    padding: 4px;
  }
  .tool-hint {
    font-size: 11px;
    padding: 5px 8px;
  }
  #viewport {
    padding: 9px;
  }
  .document footer {
    font-size: 11px;
    padding: 5px 8px;
  }
  .document footer > span:last-child {
    display: none;
  }
  .icon-only {
    width: 30px;
  }
}

/* Available height follows actual header/toolbars, including wrapped mobile labels. */
body.editor-mode {
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
body.editor-mode .app-header {
  flex: 0 0 auto;
}
#editor {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#editor > .toolbar {
  flex: 0 0 auto;
}
#editor .workspace {
  height: auto;
  flex: 1;
  min-height: 0;
}
#back-home svg {
  display: none;
}
@media (max-width: 700px) {
  .editor-mode .app-header {
    flex-wrap: nowrap;
  }
  .editor-mode #back-home {
    width: 32px;
    min-width: 32px;
    padding: 5px;
    margin-left: auto;
  }
  .editor-mode #back-home svg {
    display: block;
  }
  .editor-mode #back-home-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .editor-mode .app-header #download {
    margin-left: 0;
  }
}

.tool-card {text-decoration:none;color:inherit;}
.tool-guide {margin:1.5rem auto;max-width:64rem;color:var(--muted,#526174);line-height:1.6;}

/* BrioPDF-created content: overlay text stays separate from PDF.js text. */
#content-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  overflow: hidden;
}
.brio-overlay {
  position: absolute;
  pointer-events: auto;
  min-width: 48px;
  min-height: 22px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: move;
  user-select: none;
  touch-action: none;
  box-sizing: border-box;
}
.brio-overlay-text {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  overflow: hidden;
  line-height: 1.2;
  outline: none;
  box-sizing: border-box;
}
/* dev.6.93: ordinary BrioPDF-added text may be a true one-line object.
   Keep resize handles usable without forcing the generic 22px overlay height. */
.brio-text-overlay.origin-brio.variant-text { min-height: 12px; }

.brio-overlay:hover,
.brio-overlay.selected {
  border-color: #79a0ef;
  box-shadow: 0 0 0 1px #ffffffaa, 0 0 0 2px #215be61f;
}
.brio-overlay.editing {
  cursor: text;
  user-select: text;
  border-color: var(--blue);
  box-shadow: 0 0 0 2px #215be625;
}
.brio-overlay.editing .brio-overlay-text {
  cursor: text;
  user-select: text;
}
.brio-resize-handle {
  display: none;
  position: absolute;
  z-index: 2;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--blue);
  border: 1px solid white;
  box-shadow: 0 0 0 1px #215be655;
  touch-action: none;
}
.brio-resize-nw { left: -5px; top: -5px; cursor: nwse-resize; }
.brio-resize-n {
  left: 50%;
  top: -5px;
  transform: translateX(-50%);
  cursor: ns-resize;
}
.brio-resize-ne { right: -5px; top: -5px; cursor: nesw-resize; }
.brio-resize-e {
  right: -5px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}
.brio-resize-se { right: -5px; bottom: -5px; cursor: nwse-resize; }
.brio-resize-s {
  left: 50%;
  bottom: -5px;
  transform: translateX(-50%);
  cursor: ns-resize;
}
.brio-resize-sw { left: -5px; bottom: -5px; cursor: nesw-resize; }
.brio-resize-w {
  left: -5px;
  top: 50%;
  transform: translateY(-50%);
  cursor: ew-resize;
}
.brio-overlay.selected:not(.editing) .brio-resize-handle {
  display: block;
}
.brio-overlay.dragging,
.brio-overlay.resizing {
  opacity: 0.88;
}
.brio-overlay.dragging {
  cursor: grabbing;
}
.brio-overlay.resizing {
  cursor: nwse-resize;
}
.text-floating-toolbar {
  position: fixed;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: 3px;
  max-width: calc(100vw - 16px);
  min-height: 42px;
  padding: 4px 5px;
  border: 1px solid #cbd7ea;
  border-radius: 9px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 7px 24px rgba(30, 50, 80, .18), 0 1px 3px rgba(30, 50, 80, .12);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  backdrop-filter: blur(8px);
}
.text-floating-toolbar[hidden] { display: none !important; }
.text-floating-toolbar select {
  width: 104px;
  height: 32px;
  padding: 4px 6px;
}
.text-floating-toolbar .font-size-combo { display: inline-flex; }
.text-floating-toolbar .font-size-combo input {
  width: 54px;
  height: 32px;
  padding: 4px 5px;
  text-align: center;
}
.text-floating-toolbar .format-toggle {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 5px;
}
.text-floating-toolbar .format-toggle .brio-icon { width: 17px; height: 17px; }
.format-toggle.active,
.format-toggle[aria-pressed="true"] {
  background: #dfe9ff;
  border-color: #8baaf0;
  color: #173e98;
}
.floating-separator {
  width: 1px;
  height: 24px;
  margin: 0 2px;
  background: #d8e0ec;
  flex: 0 0 auto;
}
.color-control {
  --picker-color: #243249;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: white;
  cursor: pointer;
  overflow: hidden;
}
.color-control::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 3px;
  height: 3px;
  border-radius: 999px;
  background: var(--picker-color);
  pointer-events: none;
}
.color-control:focus-within {
  border-color: #7f9fe1;
  box-shadow: 0 0 0 2px rgba(33, 91, 230, .14);
}
.color-control .brio-icon { width: 17px; height: 17px; pointer-events: none; }
.color-control input[type="color"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  opacity: .001;
  background: transparent;
  cursor: pointer;
}
.color-control input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-control input[type="color"]::-webkit-color-swatch { border: 0; border-radius: 2px; }
.color-control:has(input[type="color"]:disabled) { opacity: .45; cursor: default; }
.color-control input[type="color"]:disabled { cursor: default; }
.background-color-control:has(input:disabled) { opacity: .55; }
@media (max-width: 700px) {
  .text-floating-toolbar { max-width: calc(100vw - 10px); padding-inline: 4px; }
  .text-floating-toolbar select { width: 90px; }
  .image-floating-toolbar { min-width: 0; }
}


/* dev.6.6 command bar: compact ribbon plus object-local floating format bars. */
.brio-icon-sprite {
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  overflow: hidden !important;
  pointer-events: none;
}
.brio-icon {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}
.commandbar {
  min-height: 64px;
  align-items: stretch;
  padding: 4px 12px 3px;
  gap: 0;
  overflow-x: auto;
  overflow-y: hidden;
  background: #fbfcfe;
}
.command-group {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 0 0 auto;
  min-width: max-content;
  padding: 0 10px 2px;
  border-right: 1px solid var(--border);
}
.command-group:first-child { padding-left: 0; }
.command-items {
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.command-items > button:not(.icon-only) {
  min-height: 38px;
  padding: 4px 8px;
}
.command-items > button .brio-icon {
  width: 20px;
  height: 20px;
}
.command-group-label {
  display: block;
  margin-top: 1px;
  color: #758399;
  font-size: 9px;
  line-height: 11px;
  text-align: center;
  letter-spacing: .02em;
  user-select: none;
}
.command-context {
  background: #f1f6ff;
  box-shadow: inset 0 2px 0 #5b88e5;
}
.command-context .command-group-label {
  color: #3261bd;
  font-weight: 700;
}
.commandbar #status {
  align-self: center;
  margin: 0 0 0 auto;
  padding: 0 8px 0 14px;
  white-space: nowrap;
}
.contextual-bar {
  min-height: 40px;
  padding: 4px 12px;
  background: #f4f7fd;
  border-bottom-color: #d5e0f4;
}
.contextual-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-right: 4px;
  padding-right: 12px;
  border-right: 1px solid var(--border);
  color: #315da9;
  white-space: nowrap;
}
.contextual-title .brio-icon { width: 17px; height: 17px; }
.contextual-title strong { font-size: 12px; }
.contextual-title #selected-count {
  min-width: 0;
  color: #748297;
  font-size: 11px;
}
.viewer-toolbar .icon-only .brio-icon { width: 16px; height: 16px; }
.icon-button-label { display: inline-flex; align-items: center; gap: 5px; }

@media (max-width: 900px) {
  .commandbar { min-height: 55px; padding-inline: 7px; }
  .command-group { padding-inline: 6px; }
  .command-group-label { display: none; }
  .command-items > button:not(.icon-only) span { display: none; }
  .command-items > button:not(.icon-only) { width: 34px; padding-inline: 5px; }
  .commandbar #status { display: none; }
  .contextual-bar { overflow-x: auto; flex-wrap: nowrap; }
}

/* Image overlays share the same selection/move model; resize keeps the visual aspect ratio. */
.brio-image-overlay {
  min-width: 28px;
  min-height: 28px;
  background: #fff;
}
.brio-overlay-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  pointer-events: none;
  user-select: none;
}
.brio-image-overlay .brio-resize-nw,
.brio-image-overlay .brio-resize-ne,
.brio-image-overlay .brio-resize-se,
.brio-image-overlay .brio-resize-sw {
  width: 11px;
  height: 11px;
  border-radius: 50%;
}
.image-floating-toolbar {
  min-width: 300px;
}
.image-floating-toolbar > button:not(.icon-only) {
  min-height: 32px;
  padding: 5px 8px;
}
.image-opacity-control {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 128px;
  height: 32px;
  padding: 0 3px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.image-opacity-control input[type="range"] {
  width: 72px;
  margin: 0;
}
.image-opacity-control output {
  min-width: 31px;
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* dev.6.8: PDF text targets advertise capability in-place.
   Blue = native-safe edit. Amber = visual replacement only. The animated
   dashed perimeter avoids modal interruptions and mirrors desktop editors. */
#text-layer span.pdf-text-native-editable,
#text-layer span.pdf-text-visual-fallback {
  cursor: text;
  border-radius: 2px;
  --pdf-target-color: #215be6;
  --pdf-target-fill: rgba(33, 91, 230, .08);
}
#text-layer span.pdf-text-visual-fallback {
  --pdf-target-color: #c98a16;
  --pdf-target-fill: rgba(201, 138, 22, .09);
}
#text-layer span.pdf-text-native-editable:hover,
#text-layer span.pdf-text-visual-fallback:hover,
#text-layer span.pdf-text-native-editable.pdf-text-group-hover,
#text-layer span.pdf-text-visual-fallback.pdf-text-group-hover {
  background: var(--pdf-target-fill);
}
#text-layer span.pdf-text-native-editable:hover::after,
#text-layer span.pdf-text-visual-fallback:hover::after,
#text-layer span.pdf-text-native-editable.pdf-text-group-hover::after,
#text-layer span.pdf-text-visual-fallback.pdf-text-group-hover::after {
  content: "";
  position: absolute;
  inset: -3px;
  z-index: 3;
  border-radius: 3px;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--pdf-target-color) 50%, transparent 50%) 0 0 / 8px 1px repeat-x,
    linear-gradient(90deg, var(--pdf-target-color) 50%, transparent 50%) 0 100% / 8px 1px repeat-x,
    linear-gradient(0deg, var(--pdf-target-color) 50%, transparent 50%) 0 0 / 1px 8px repeat-y,
    linear-gradient(0deg, var(--pdf-target-color) 50%, transparent 50%) 100% 0 / 1px 8px repeat-y;
  animation: brio-pdf-target-march .55s linear infinite;
}
@keyframes brio-pdf-target-march {
  to {
    background-position: 8px 0, -8px 100%, 0 -8px, 100% 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #text-layer span.pdf-text-native-editable:hover::after,
  #text-layer span.pdf-text-visual-fallback:hover::after,
  #text-layer span.pdf-text-native-editable.pdf-text-group-hover::after,
  #text-layer span.pdf-text-visual-fallback.pdf-text-group-hover::after { animation: none; }
}
.object-kind-label {
  flex: 0 0 auto;
  margin-right: 2px;
  padding: 3px 6px;
  border: 1px solid #b8c9ee;
  border-radius: 999px;
  background: #edf3ff;
  color: #28539e;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}
.image-opacity-control input[type="range"] {
  --range-progress: 100%;
  appearance: none;
  -webkit-appearance: none;
  height: 14px;
  border: 0;
  border-radius: 999px;
  outline: none;
  background: transparent;
}
.image-opacity-control input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(to right, #215be6 0, #215be6 var(--range-progress), #d7dfeb var(--range-progress), #d7dfeb 100%);
}
.image-opacity-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  margin-top: -5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #215be6;
  box-shadow: 0 0 0 1px #8da9de;
}
.image-opacity-control input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: #d7dfeb;
}
.image-opacity-control input[type="range"]::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: #215be6;
}
.image-opacity-control input[type="range"]::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #215be6;
  box-shadow: 0 0 0 1px #8da9de;
}
.brio-text-overlay.native-deleted {
  border-style: dashed;
  cursor: default;
}
.brio-pdf-text-source-mask {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  box-sizing: border-box;
}
#content-layer .brio-overlay { z-index: 1; }
.brio-text-overlay.pdf-source-pristine:not(.editing) .brio-overlay-text {
  visibility: hidden;
}
.brio-text-overlay.native-preview-rendered:not(.editing) .brio-overlay-text {
  color: transparent !important;
}
/* dev.6.77: while native PDF text is being moved/resized, the HTML copy is
   temporarily the visual authority. The structural PDF preview is rebuilt at
   commit/next frame, so the glyphs visibly follow the selection instead of
   leaving an empty moving box. */
.brio-text-overlay.origin-native.dragging .brio-overlay-text,
.brio-text-overlay.origin-native.resizing .brio-overlay-text {
  visibility: visible !important;
  color: inherit !important;
  -webkit-text-fill-color: currentColor !important;
}
#text-layer span.pdf-text-replaced {
  visibility: hidden !important;
  pointer-events: none !important;
}
.brio-text-overlay.origin-native .brio-overlay-text,
.brio-text-overlay.origin-replacement .brio-overlay-text {
  line-height: normal;
}
/* dev.6.45: native PDF inline editing uses a clipped structural source
   removal preview plus the correctly positioned HTML editor.  Keeping the
   editor visible avoids geometry-dependent replacement glyphs appearing at a
   remote page position while preserving the captured PDF.js family/colour/
   horizontal scale. */
.brio-text-overlay.origin-native.editing.native-live-edit .brio-overlay-text {
  /* Native PDF inline editing is interaction-only in the DOM. The page canvas
     remains the visual authority and live drafts are rendered back through the
     PDF engine, avoiding font/baseline/kerning jumps from browser metrics. */
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  caret-color: #215be6;
  text-shadow: none !important;
  background: transparent !important;
}
.brio-text-overlay.origin-native.editing.native-live-edit .brio-overlay-text::selection {
  color: transparent;
  -webkit-text-fill-color: transparent;
  background: rgba(33, 91, 230, .20);
}

/* dev.6.12: PDF-origin text keeps its true geometry and capability colour
   after selection. New BrioPDF text retains a larger minimum editing target. */
.brio-text-overlay.origin-native,
.brio-text-overlay.origin-replacement {
  min-width: 8px;
  min-height: 8px;
}
.brio-text-overlay.origin-native:hover,
.brio-text-overlay.origin-native.selected,
.brio-text-overlay.origin-replacement:hover,
.brio-text-overlay.origin-replacement.selected {
  border-color: transparent;
  box-shadow: none;
}
.brio-text-overlay.origin-native { --pdf-object-color: #215be6; --pdf-object-fill: rgba(33,91,230,.07); }
.brio-text-overlay.origin-replacement { --pdf-object-color: #c98a16; --pdf-object-fill: rgba(201,138,22,.09); }
/* Selecting PDF-origin text must not repaint/tint it. The canvas remains the
   visual source until an edit is committed; selection is perimeter-only. */
.brio-text-overlay.origin-native.selected,
.brio-text-overlay.origin-replacement.selected {
  background-image: none;
  background-color: transparent;
}
.brio-text-overlay.origin-native.selected::after,
.brio-text-overlay.origin-replacement.selected::after,
.brio-text-overlay.origin-native:hover::after,
.brio-text-overlay.origin-replacement:hover::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 4;
  border-radius: 3px;
  pointer-events: none;
  background:
    linear-gradient(90deg, var(--pdf-object-color) 50%, transparent 50%) 0 0 / 8px 1px repeat-x,
    linear-gradient(90deg, var(--pdf-object-color) 50%, transparent 50%) 0 100% / 8px 1px repeat-x,
    linear-gradient(0deg, var(--pdf-object-color) 50%, transparent 50%) 0 0 / 1px 8px repeat-y,
    linear-gradient(0deg, var(--pdf-object-color) 50%, transparent 50%) 100% 0 / 1px 8px repeat-y;
  animation: brio-pdf-target-march .55s linear infinite;
}
.brio-text-overlay.origin-replacement .brio-resize-handle {
  background: #c98a16;
  box-shadow: 0 0 0 1px rgba(201,138,22,.42);
}
.text-floating-toolbar[data-origin="pdf-native"] .object-kind-label {
  border-color: #9eb7f1;
  background: #edf3ff;
  color: #28539e;
}
.text-floating-toolbar[data-origin="pdf-replacement"] .object-kind-label {
  border-color: #e3c27f;
  background: #fff7e4;
  color: #8b5d07;
}
@media (prefers-reduced-motion: reduce) {
  .brio-text-overlay.origin-native.selected::after,
  .brio-text-overlay.origin-replacement.selected::after,
  .brio-text-overlay.origin-native:hover::after,
  .brio-text-overlay.origin-replacement:hover::after { animation: none; }
}


/* dev.6.15: exact drawn geometry; geometry-following selection and line endpoints. */
.shape-floating-toolbar { min-width: 430px; }
.shape-width-control { display:inline-flex; align-items:center; gap:3px; height:32px; font-size:11px; color:var(--muted); }
.shape-width-control input { width:48px; height:32px; padding:4px; text-align:center; }
.brio-shape-overlay { min-width:0; min-height:0; padding:0; border:0 !important; border-radius:0; box-shadow:none !important; background:transparent; pointer-events:none; overflow:visible; }
.brio-overlay-shape { display:block; width:100%; height:100%; overflow:visible; pointer-events:none; }
.brio-shape-visual { pointer-events:none; }
.brio-shape-hit { pointer-events:all; cursor:move; }
.brio-shape-selection { opacity:0; pointer-events:none; }
.brio-shape-overlay:hover .brio-shape-selection,
.brio-shape-overlay.selected .brio-shape-selection { opacity:1; animation:brio-shape-march .65s linear infinite; }
.brio-shape-overlay .brio-resize-handle { border-radius:50%; pointer-events:auto; }
.brio-resize-ellipse-nw { left:15%; top:15%; transform:translate(-50%,-50%); cursor:nwse-resize; }
.brio-resize-ellipse-ne { left:85%; top:15%; transform:translate(-50%,-50%); cursor:nesw-resize; }
.brio-resize-ellipse-se { left:85%; top:85%; transform:translate(-50%,-50%); cursor:nwse-resize; }
.brio-resize-ellipse-sw { left:15%; top:85%; transform:translate(-50%,-50%); cursor:nesw-resize; }
.brio-line-endpoint {
  display:none; position:absolute; z-index:3; width:10px; height:10px; margin:0;
  border-radius:50%; background:var(--blue); border:1px solid white;
  box-shadow:0 0 0 1px #215be655; transform:translate(-50%,-50%);
  pointer-events:auto; touch-action:none; cursor:crosshair;
}
.brio-shape-overlay.selected .brio-line-endpoint { display:block; }
.brio-line-endpoint.endpoint-left { left:0; top:0; }
.brio-line-endpoint.endpoint-right { left:100%; top:100%; }
.brio-line-endpoint.endpoint-left.endpoint-bottom { top:100%; }
.brio-line-endpoint.endpoint-right.endpoint-top { top:0; }
.shape-drawing #sheet { cursor:crosshair; }
.highlight-drawing #sheet {
  cursor:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2728%27 height=%2728%27 viewBox=%270 0 28 28%27%3E%3Cg transform=%27rotate(-42 14 14)%27%3E%3Crect x=%2710%27 y=%272%27 width=%278%27 height=%2718%27 rx=%272%27 fill=%27%23fff176%27 stroke=%27%23202a3a%27 stroke-width=%271.6%27/%3E%3Cpath d=%27M10 18h8v5l-4 3-4-3z%27 fill=%27%23215be6%27 stroke=%27%23202a3a%27 stroke-width=%271.6%27 stroke-linejoin=%27round%27/%3E%3C/g%3E%3C/svg%3E") 6 24, crosshair;
}
.shape-draw-preview { position:absolute; inset:0; width:100%; height:100%; z-index:8; pointer-events:none; overflow:visible; }
.shape-draw-preview-graphic { vector-effect:non-scaling-stroke; }
@keyframes brio-shape-march { to { stroke-dashoffset:-18; } }
@media (prefers-reduced-motion:reduce) {
  .brio-shape-overlay:hover .brio-shape-selection,
  .brio-shape-overlay.selected .brio-shape-selection { animation:none; }
}
@media (max-width:700px) { .shape-floating-toolbar { min-width:0; } }

/* dev.6.18: arrow + freehand drawing. Selection follows the vector path, never a bounding box. */
.brio-shape-overlay.kind-line .brio-shape-hit,
.brio-shape-overlay.kind-arrow .brio-shape-hit,
.brio-shape-overlay.kind-freehand .brio-shape-hit { pointer-events:stroke; }
.brio-shape-overlay.kind-freehand .brio-shape-visual,
.brio-shape-overlay.kind-freehand .brio-shape-selection,
.brio-shape-overlay.kind-freehand .brio-shape-hit { stroke-linecap:round; stroke-linejoin:round; }
.freehand-drawing #sheet {
  cursor:url("data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2728%27 height=%2728%27 viewBox=%270 0 28 28%27%3E%3Cg transform=%27rotate(-42 14 14)%27%3E%3Cpath d=%27M12 2h5v17l-2.5 6-2.5-6z%27 fill=%27%23f7f8fb%27 stroke=%27%23202a3a%27 stroke-width=%271.5%27 stroke-linejoin=%27round%27/%3E%3Cpath d=%27M12 5h5%27 stroke=%27%23215be6%27 stroke-width=%272%27/%3E%3C/g%3E%3C/svg%3E") 7 24, crosshair;
}
.brio-arrow-head {
  position:absolute; z-index:2; width:11px; height:11px; box-sizing:border-box;
  border-top:var(--arrow-width, 2px) solid var(--arrow-color, #215be6);
  border-right:var(--arrow-width, 2px) solid var(--arrow-color, #215be6);
  transform:translate(-50%,-50%) rotate(calc(var(--arrow-angle, 0deg) + 45deg));
  transform-origin:center; pointer-events:auto; cursor:move;
}

/* Document Properties: read-only inspection modal, prepared for editable security in the next block. */
.document-properties-modal {
  width: min(920px, calc(100vw - 30px));
  max-width: 920px;
  padding: 0;
  overflow: hidden;
}
.document-properties-form {
  display: grid;
  grid-template-rows: auto auto minmax(0, auto) auto;
  max-height: min(82dvh, 760px);
}
.properties-heading {
  padding: 20px 22px 15px;
  border-bottom: 1px solid var(--border);
}
.properties-heading h2 { font-size: 21px; }
.properties-source-context {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  max-width: 720px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.properties-tabs {
  display: flex;
  gap: 2px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  background: #fbfcfe;
  overflow-x: auto;
  scrollbar-width: thin;
}
.properties-tabs button {
  appearance: none;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  padding: 12px 14px 10px;
  color: #5c6c83;
  font-weight: 600;
  white-space: nowrap;
}
.properties-tabs button:hover { background: #f2f6fc; color: #26364d; }
.properties-tabs button[aria-selected="true"] {
  color: var(--blue);
  border-bottom-color: var(--blue);
  background: #f7faff;
}
.properties-tabs button:focus-visible { outline-offset: -3px; }
.properties-panels {
  min-height: 0;
  max-height: min(58dvh, 520px);
  overflow: auto;
  background: #fff;
}
.properties-panel {
  padding: 22px;
  min-height: 0;
}
.properties-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 26px;
  margin: 0;
}
.properties-list > div {
  display: grid;
  grid-template-columns: minmax(115px, 0.44fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 10px 0;
  border-bottom: 1px solid #eef1f5;
  min-width: 0;
}
.properties-list > .properties-wide { grid-column: 1 / -1; }
.properties-list dt {
  color: #61718a;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.45;
}
.properties-list dd {
  margin: 0;
  color: #1f3047;
  font-size: 13px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  min-width: 0;
}
.properties-section-heading {
  margin: 22px 0 4px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: #2a3c56;
}
.properties-security-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.properties-security-summary > div {
  border: 1px solid #e0e6ef;
  border-radius: 9px;
  padding: 12px 14px;
  background: #fbfcfe;
  min-width: 0;
}
.properties-security-summary span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  margin-bottom: 5px;
}
.properties-security-summary strong {
  display: block;
  color: #22344c;
  font-size: 13px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.properties-permissions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 22px;
}
.properties-permission {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 9px 0;
  border-bottom: 1px solid #eef1f5;
  font-size: 13px;
}
.properties-permission > span:first-child { overflow-wrap: anywhere; }
.properties-permission-state {
  flex: 0 0 auto;
  border: 1px solid #cad6e6;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  color: #365576;
  background: #f5f8fc;
}
.properties-permission-state.restricted {
  border-color: #e6c6ca;
  color: #8a3040;
  background: #fff5f6;
}
.properties-note,
.properties-intro,
.properties-empty {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.properties-note {
  border: 1px solid #d9e3f3;
  background: #f7faff;
  border-radius: 8px;
  padding: 11px 13px;
}
.properties-table-wrap {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: auto;
  max-height: 390px;
}
.properties-font-table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
  font-size: 12px;
}
.properties-font-table th,
.properties-font-table td {
  padding: 9px 10px;
  text-align: left;
  border-bottom: 1px solid #edf1f5;
  vertical-align: top;
}
.properties-font-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7f9fc;
  color: #4d6079;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .025em;
}
.properties-font-table td:first-child { font-weight: 650; color: #21344d; }
.properties-font-table tbody tr:last-child td { border-bottom: 0; }
.properties-font-detail {
  display: block;
  margin-top: 2px;
  color: #77869a;
  font-size: 10px;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.properties-actions {
  margin: 0;
  padding: 13px 18px;
  border-top: 1px solid var(--border);
  background: #fbfcfe;
  align-items: center;
}
.properties-actions #properties-copy {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.properties-actions .primary { margin-left: 0; }
@media (max-width: 720px) {
 .document-properties-form { max-height: calc(100dvh - 20px); }
  .properties-heading { padding: 16px 15px 12px; }
  .properties-panel { padding: 15px; }
  .properties-tabs { padding: 0 8px; }
  .properties-list,
  .properties-security-summary,
  .properties-permissions { grid-template-columns: 1fr; }
  .properties-list > .properties-wide { grid-column: auto; }
  .properties-list > div { grid-template-columns: 120px minmax(0, 1fr); }
  .properties-actions { padding: 11px 12px; }
}
@media (max-width: 480px) {
  .properties-list > div { grid-template-columns: 1fr; gap: 3px; }
  .properties-actions { flex-wrap: wrap; }
  .properties-actions #properties-copy { margin-right: 0; }
}

/* dev.6.20 — document security manager */
.properties-security-actions { display:flex; justify-content:flex-end; margin-top:14px; }
.properties-security-actions button { display:inline-flex; align-items:center; gap:7px; }
.properties-security-pending { border-color:#bfd0f6; background:#f2f6ff; color:#234f9f; }
.security-config-modal { width:min(760px, calc(100vw - 24px)); max-width:760px; padding:0; border:0; border-radius:16px; overflow:hidden; box-shadow:0 26px 90px rgba(20,38,64,.28); }
.security-config-modal::backdrop { background:rgba(23,33,49,.42); backdrop-filter:blur(1px); }
.security-config-form { display:flex; flex-direction:column; max-height:min(780px, calc(100dvh - 28px)); background:#fff; }
.security-config-heading { padding:18px 20px 14px; border-bottom:1px solid #e2e8f0; }
.security-config-heading h2 { font-size:21px; }
.security-config-scroll { overflow:auto; padding:16px 18px 4px; display:grid; gap:13px; }
.security-config-section { border:1px solid #dfe6ef; border-radius:12px; padding:14px; background:#fff; display:grid; gap:12px; }
.security-protection-card { grid-template-columns:minmax(0,1fr) auto; align-items:center; background:#f8fafc; }
.security-protection-card p, .security-section-title span { margin:4px 0 0; color:#66758a; font-size:13px; line-height:1.4; }
.security-section-title { display:grid; gap:1px; }
.security-config-section > label:not(.security-switch), .security-password-grid label { display:grid; gap:6px; color:#3d4d62; font-size:13px; font-weight:650; }
.security-config-section input[type="password"], .security-config-section select { width:100%; min-height:38px; border:1px solid #cbd5e1; border-radius:9px; background:#fff; padding:7px 10px; color:#1f2d40; font:inherit; }
.security-config-section input[type="password"]:focus, .security-config-section select:focus { border-color:#6c91e8; outline:3px solid rgba(65,105,225,.12); }
.security-password-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.security-switch { display:inline-flex; align-items:center; gap:9px; cursor:pointer; user-select:none; }
.security-switch input { position:absolute; opacity:0; pointer-events:none; }
.security-switch > span { width:40px; height:23px; border-radius:999px; background:#c9d2df; position:relative; transition:.16s ease; box-shadow:inset 0 0 0 1px rgba(45,61,82,.08); }
.security-switch > span::after { content:""; position:absolute; width:19px; height:19px; border-radius:50%; background:#fff; top:2px; left:2px; box-shadow:0 1px 4px rgba(20,35,55,.28); transition:.16s ease; }
.security-switch input:checked + span { background:#2e65d4; }
.security-switch input:checked + span::after { transform:translateX(17px); }
.security-switch input:focus-visible + span { outline:3px solid rgba(46,101,212,.22); outline-offset:2px; }
.security-switch b { font-size:13px; color:#26384f; }
.security-inline-switch { justify-self:start; }
.security-permission-grid { display:grid; grid-template-columns:1fr 1fr; border:1px solid #e4e9f0; border-radius:10px; overflow:hidden; }
.security-permission-row { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:42px; padding:8px 10px; border-bottom:1px solid #edf1f5; color:#35465d; font-size:13px; }
.security-permission-row:nth-child(odd) { border-right:1px solid #edf1f5; }
.security-permission-row:nth-last-child(-n+2) { border-bottom:0; }
.security-permission-row input[type="checkbox"] { appearance:none; width:35px; height:20px; flex:0 0 auto; border-radius:999px; background:#c9d2df; position:relative; cursor:pointer; transition:.16s ease; }
.security-permission-row input[type="checkbox"]::after { content:""; position:absolute; width:16px; height:16px; border-radius:50%; background:#fff; top:2px; left:2px; box-shadow:0 1px 3px rgba(20,35,55,.25); transition:.16s ease; }
.security-permission-row input[type="checkbox"]:checked { background:#2e65d4; }
.security-permission-row input[type="checkbox"]:checked::after { transform:translateX(15px); }
.security-permission-row input[type="checkbox"]:focus-visible { outline:3px solid rgba(46,101,212,.22); outline-offset:2px; }
.security-config-section[aria-disabled="true"] { opacity:.52; }
.security-config-section[aria-disabled="true"] :is(input,select) { pointer-events:none; }
.security-config-error { margin:0; border:1px solid #efb8b8; border-radius:9px; background:#fff3f3; color:#9c2424; padding:10px 12px; font-size:13px; }
.security-local-note { margin:0 2px 10px; }
.security-config-actions { flex:0 0 auto; padding:12px 18px 14px; border-top:1px solid #e2e8f0; background:#fff; }
#document-security .brio-icon:last-child { width:12px; height:12px; margin-left:-2px; }
@media (max-width:650px) {
  .security-config-modal { width:calc(100vw - 14px); }
  .security-config-form { max-height:calc(100dvh - 14px); }
  .security-config-scroll { padding:12px 12px 3px; }
  .security-password-grid, .security-permission-grid { grid-template-columns:1fr; }
  .security-permission-row:nth-child(odd) { border-right:0; }
  .security-permission-row:nth-last-child(2) { border-bottom:1px solid #edf1f5; }
  .security-protection-card { grid-template-columns:1fr; }
}

/* dev.6.21: native PDF image targets. The PDF.js text layer stays above the
   image hit layer so normal text selection/editing keeps priority where text
   is printed over a picture. Brio-created overlays remain above both. */
#native-image-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  overflow: hidden;
}
#text-layer {
  z-index: 2;
  /* The full-page PDF.js text-layer box must not swallow clicks intended for
     native image targets underneath. Individual text spans remain interactive. */
  pointer-events: none;
}
#text-layer :is(span, br) { pointer-events: auto; }
.pdf-native-image-target,
.pdf-native-graphic-target {
  position: absolute;
  pointer-events: auto;
  box-sizing: border-box;
  cursor: pointer;
  touch-action: manipulation;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: transparent;
  box-shadow: none;
  color: inherit;
  font: inherit;
  overflow: visible;
}
/* app.css has a generic button:hover rule with greater specificity than
   .pdf-native-image-target. Keep native PDF image hit targets visually neutral
   in every interaction state; only the SVG perimeter below is allowed to show. */
button.pdf-native-image-target:hover:not(:disabled),
button.pdf-native-image-target:focus-visible,
button.pdf-native-image-target.selected,
button.pdf-native-graphic-target:hover:not(:disabled),
button.pdf-native-graphic-target:focus-visible,
button.pdf-native-graphic-target.selected {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  outline: none;
}
.pdf-native-image-target > svg,
.pdf-native-graphic-target > svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.pdf-native-image-target polygon,
.pdf-native-graphic-target polygon {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
}
.pdf-native-graphic-target .pdf-native-graphic-path {
  fill: transparent;
  stroke: transparent;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.pdf-native-image-target.safe:hover polygon,
.pdf-native-image-target.safe:focus-visible polygon,
.pdf-native-graphic-target.safe:hover polygon,
.pdf-native-graphic-target.safe:focus-visible polygon {
  fill: transparent;
  stroke: #6a8ce8;
  stroke-dasharray: 2 3;
  animation: none;
}
.pdf-native-graphic-target.safe:hover .pdf-native-graphic-path,
.pdf-native-graphic-target.safe:focus-visible .pdf-native-graphic-path {
  fill: transparent;
  stroke: #6a8ce8;
  stroke-dasharray: 3 3;
  animation: none;
}
.pdf-native-image-target.safe.selected polygon,
.pdf-native-graphic-target.safe.selected polygon {
  fill: transparent;
  stroke: #215be6;
  stroke-dasharray: 5 4;
  animation: none;
}
.pdf-native-graphic-target.safe.selected .pdf-native-graphic-path {
  fill: transparent;
  stroke: #215be6;
  stroke-dasharray: 5 4;
  animation: none;
}
/* A true PDF line should read as a selected line, not as a tiny editing box. */
.pdf-native-graphic-target.primitive-line.safe.selected .pdf-native-graphic-path {
  stroke-width: 2.2;
  stroke-dasharray: none;
}
/* After deleting a native object, the pointer is often still over an object
   underneath. Suppress that first stationary hover so it does not look as if
   BrioPDF silently selected another object. */
#sheet.native-target-hover-suspended .pdf-native-image-target:hover polygon,
#sheet.native-target-hover-suspended .pdf-native-graphic-target:hover polygon,
#sheet.native-target-hover-suspended .pdf-native-graphic-target:hover .pdf-native-graphic-path {
  stroke: transparent !important;
  fill: transparent !important;
}
.pdf-native-image-target.selected,
.pdf-native-graphic-target.selected { z-index: 4; }
.pdf-native-image-target.unsafe, .pdf-native-graphic-target.unsafe { cursor: not-allowed; }
.pdf-native-image-target.unsafe:hover polygon,
.pdf-native-image-target.unsafe:focus-visible polygon,
.pdf-native-graphic-target.unsafe:hover polygon,
.pdf-native-graphic-target.unsafe:focus-visible polygon {
  fill: transparent;
  stroke: #c98a16;
  stroke-dasharray: 4 4;
}
.pdf-native-graphic-target.unsafe:hover .pdf-native-graphic-path,
.pdf-native-graphic-target.unsafe:focus-visible .pdf-native-graphic-path {
  fill: transparent;
  stroke: #c98a16;
  stroke-dasharray: 4 4;
}
@keyframes brio-native-image-target-march { to { stroke-dashoffset: -9; } }
/* dev.6.39: vector/composite PDF figures share the native hit layer. They are
   exposed only when the raw q/Q group can be delimited and removed fail-closed. */
.pdf-native-graphic-target.safe:hover polygon,
.pdf-native-graphic-target.safe:focus-visible polygon { stroke-dasharray: 3 3; }
.pdf-native-graphic-target.primitive { cursor: pointer; }
.pdf-native-graphic-target.movable { cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; }
.pdf-native-graphic-target.movable.transforming { cursor: grabbing; }

/* dev.6.41: safe direct-page vector groups can be transformed in place. The
   hit target remains transparent; selected objects expose the same compact
   resize affordances used by Brio overlays without introducing a second box. */
.pdf-native-graphic-target.transformable { cursor: move; touch-action: none; }
.pdf-native-graphic-target.transformable.transforming { cursor: grabbing; }
.pdf-native-graphic-target.selected .pdf-native-graphic-resize-handle {
  display: block;
  z-index: 3;
  pointer-events: auto;
}
.pdf-native-graphic-target.transforming polygon { animation: none; }

/* dev.6.95: native objects use the single contextual toolbar for destructive
   actions. Inline X badges were removed because they duplicated Delete and could
   look like resize handles on one-dimensional PDF primitives. */

@media (prefers-reduced-motion: reduce) {
  .pdf-native-image-target.safe:hover polygon,
  .pdf-native-image-target.safe.selected polygon,
  .pdf-native-image-target.safe:focus-visible polygon,
  .pdf-native-graphic-target.safe:hover polygon,
  .pdf-native-graphic-target.safe.selected polygon,
  .pdf-native-graphic-target.safe:focus-visible polygon { animation: none; }
}
.native-image-floating-toolbar { min-width: 0; gap: 4px; }
.native-image-floating-toolbar .object-kind-label {
  padding: 3px 7px;
  border-radius: 999px;
  background: #eef4ff;
  color: #315a9e;
  font-weight: 600;
}
.native-image-floating-toolbar .native-graphic-style-controls { gap: 4px; }
.native-image-floating-toolbar .shape-width-control input { width: 42px; min-width: 42px; text-align: right; }
.native-image-floating-toolbar #native-image-delete { padding-inline: 7px; }
.native-image-floating-toolbar .object-kind-label {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Native PDF image deletions are rendered structurally in the preview.
   No tombstone overlay occupies the freed area. */

/* dev.6.23 note/stamp overlay editing base; dev.6.25 serializes them as native PDF annotations. */
.brio-text-overlay.variant-note {
  --note-border: #d6bd4c;
  min-width: 24px;
  min-height: 16px;
  box-shadow: inset 0 0 0 1px var(--note-border), 0 2px 7px rgba(80,68,20,.12);
}
.brio-text-overlay.variant-note .brio-overlay-text { padding: 4px 5px; }
.brio-text-overlay.variant-note.origin-pdf-annotation.annotation-has-rd .brio-overlay-text {
  padding: var(--annotation-rd-top, 4px) var(--annotation-rd-right, 5px) var(--annotation-rd-bottom, 4px) var(--annotation-rd-left, 5px);
}
.note-font-size-control { width: 54px; }
.note-font-size-control input { width: 50px; min-width: 50px; }
.brio-text-overlay.variant-stamp {
  text-transform: uppercase;
  letter-spacing: .045em;
  box-shadow: inset 0 0 0 2px currentColor;
}
.brio-text-overlay.variant-stamp .brio-overlay-text {
  display:flex; align-items:center; justify-content:center; padding:4px 8px; font-weight:700; line-height:1;
}
.brio-overlay.variant-note.selected, .brio-overlay.variant-stamp.selected { box-shadow: 0 0 0 1px #fff, 0 0 0 3px #215be640; }
.brio-overlay.origin-pdf-annotation { min-width: 4px; min-height: 4px; }
.brio-overlay.origin-pdf-annotation.annotation-pristine { background: transparent !important; }
.brio-overlay.origin-pdf-annotation.annotation-pristine .brio-overlay-text { visibility: hidden; }
.brio-shape-overlay.origin-pdf-annotation.annotation-pristine .brio-shape-visual { visibility: hidden; }
.brio-overlay.origin-pdf-annotation.annotation-pristine:not(:hover):not(.selected):not(.editing) {
  border-color: transparent;
  box-shadow: none;
}
.brio-overlay.origin-pdf-annotation.annotation-pristine:hover,
.brio-overlay.origin-pdf-annotation.annotation-pristine.selected {
  box-shadow: 0 0 0 1px #ffffffaa, 0 0 0 2px #215be61f;
}
.brio-overlay.origin-pdf-annotation.annotation-pristine.editing .brio-overlay-text { visibility: visible; }
.brio-text-overlay.variant-note.origin-pdf-annotation.annotation-pristine.editing {
  box-shadow: inset 0 0 0 1px var(--note-border), 0 2px 7px rgba(80,68,20,.12);
}
.brio-text-overlay.variant-stamp.origin-pdf-annotation.annotation-pristine.editing {
  box-shadow: inset 0 0 0 2px currentColor;
}
.annotation-floating-toolbar { min-width: 360px; }
.annotation-floating-toolbar select { width: 126px; }
@media (max-width:700px) { .annotation-floating-toolbar { min-width:0; } }

/* dev.6.25 — native PDF annotations and local comment-author profile. */
#annotation-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  overflow: visible;
}
.brio-native-annotation-layer:empty { pointer-events: none; }
.annotation-author-button {
  max-width: 180px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted, #526174);
  font-weight: 500;
}
.annotation-author-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.annotation-author-modal {
  width: min(500px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  border: 0;
  border-radius: 12px;
  padding: 0;
  overflow: hidden;
  box-shadow: 0 22px 70px #17243b45;
}
.annotation-author-modal::backdrop { background: rgba(20, 31, 49, .34); }
.annotation-author-form { width: 100%; max-width: 100%; min-width: 0; overflow: hidden; box-sizing: border-box; }
.annotation-author-form .dialog-heading { padding: 16px 18px 12px; align-items: flex-start; gap: 12px; }
.annotation-author-form .dialog-heading > div { min-width: 0; }
.annotation-author-form .dialog-heading h2 { margin: 0 0 3px; font-size: 18px; }
.annotation-author-form .dialog-heading p { margin: 0; color: var(--muted, #526174); font-size: 13px; line-height: 1.42; }
.annotation-author-fields {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 112px;
  gap: 10px 12px;
  padding: 5px 18px 14px;
  box-sizing: border-box;
  min-width: 0;
}
.annotation-author-fields > label:not(.security-switch) {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
  font-size: 12px;
  font-weight: 600;
  color: #3e4b5d;
}
.annotation-author-fields input[type="text"],
.annotation-author-fields input[type="email"] {
  width: 100%;
  min-width: 0;
  height: 36px;
  box-sizing: border-box;
  font-weight: 400;
  color: var(--text, #17243b);
}
.annotation-author-name-field { grid-column: 1; }
.annotation-author-initials-field { grid-column: 2; }
.annotation-author-email-field,
.annotation-author-remember,
.annotation-author-privacy,
.annotation-author-error { grid-column: 1 / -1; }
.annotation-author-remember { justify-self: start; margin-top: 2px; }
.annotation-author-privacy { margin: 0; line-height: 1.4; }
.annotation-author-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 11px 18px 16px; box-sizing: border-box; }
.annotation-author-actions button { white-space: nowrap; }
@media (max-width: 560px) {
  .annotation-author-fields { grid-template-columns: 1fr; }
  .annotation-author-name-field,
  .annotation-author-initials-field,
  .annotation-author-email-field,
  .annotation-author-remember,
  .annotation-author-privacy,
  .annotation-author-error { grid-column: 1; }
  .annotation-author-button { max-width: 120px; }
}

/* dev.6.32: explicit download scope when a partial page selection is active. */
.download-dialog-body { display: grid; gap: 20px; }
.download-scope { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 8px; }
.download-scope legend { font-weight: 650; padding: 0; margin: 0 0 4px; }
dialog .download-scope-option { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--border); border-radius: 9px; cursor: pointer; background: #fff; }
dialog .download-scope-option:has(input:checked) { border-color: #8caef4; background: #f4f7ff; }
dialog .download-scope-option input[type="radio"] { width: auto; min-width: 16px; margin: 2px 0 0; accent-color: #215be6; }
.download-scope-option > span { display: grid; gap: 2px; min-width: 0; }
.download-scope-option strong { font-size: 14px; }
.download-scope-option small { color: var(--muted); font-size: 12px; }
.download-filename { display: block; }

/* dev.6.34 — existing /Text comments, reply threads and review state. */
.brio-text-overlay.variant-comment {
  min-width: 12px;
  min-height: 12px;
  background: transparent !important;
  color: inherit;
}
.brio-text-overlay.variant-comment .brio-overlay-text { display: none !important; }
.brio-text-overlay.variant-comment .brio-comment-marker {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--comment-color, #f4b400), #5d4b00 38%);
  border-radius: 2px;
  background: var(--comment-color, #f4b400);
  color: #473900;
  box-shadow: 0 1px 3px rgba(26,34,48,.18);
  overflow: hidden;
  pointer-events: none;
}
.brio-text-overlay.variant-comment .brio-comment-marker::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 26%;
  height: 26%;
  background: rgba(255,255,255,.5);
  clip-path: polygon(0 0,100% 0,100% 100%);
}
.brio-text-overlay.variant-comment .brio-comment-marker .brio-icon {
  width: 68%;
  height: 68%;
  stroke-width: 1.6;
}
.brio-text-overlay.variant-comment.annotation-pristine .brio-comment-marker { visibility: hidden; }
.brio-text-overlay.variant-comment.selected {
  outline: 1px dashed #215be6;
  outline-offset: 2px;
  box-shadow: none;
}
.brio-text-overlay.variant-comment.annotation-pristine:hover,
.brio-text-overlay.variant-comment.annotation-pristine.selected {
  background: transparent !important;
  box-shadow: none;
}
.comment-floating-toolbar { min-width: 0; }
.comment-floating-toolbar .comment-status-control {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted, #526174);
  font-size: 12px;
  white-space: nowrap;
}
.comment-floating-toolbar .comment-status-control select { width: 118px; }
.comment-new-body {
  display: grid;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.comment-new-body label {
  display: grid;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted,#526174);
}
.comment-new-body textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 120px;
  resize: vertical;
  line-height: 1.45;
}
.comment-thread-body {
  display: grid;
  gap: 14px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.comment-thread-section { display: grid; gap: 7px; }
.comment-thread-section > label,
.comment-reply-card > label { font-size: 12px; font-weight: 700; color: var(--muted, #526174); }
.comment-thread-body textarea {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 86px;
  resize: vertical;
  line-height: 1.4;
}
.comment-thread-heading { display:flex; align-items:center; justify-content:space-between; gap:10px; }
.comment-thread-heading h3 { margin:0; font-size:14px; }
.comment-replies { display:grid; gap:9px; }
.comment-reply-card {
  display:grid;
  gap:7px;
  padding:10px;
  border:1px solid var(--border);
  border-radius:9px;
  background:#f8fafc;
}
.comment-reply-meta { display:flex; align-items:center; justify-content:space-between; gap:10px; font-size:12px; color:var(--muted,#526174); }
.comment-reply-meta select { width: 132px; }
.comment-thread-add { justify-self:start; }
.comment-thread-note { margin:0; font-size:12px; color:var(--muted,#526174); }
@media (max-width:700px) {
  .comment-thread-body { width: 100%; }
  .comment-reply-meta { align-items:flex-start; flex-direction:column; }
}

/* dev.6.40 — shell/UI: narrow navigation rail + contextual tool panel.
   PDF engines, object toolbars and rendering layers remain unchanged. */
.shell-topbar {
  min-height: 44px;
  padding: 5px 12px;
  gap: 8px;
  flex-wrap: nowrap;
  background: #fbfcfe;
}
.shell-topbar-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}
.shell-topbar button {
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
}
.shell-topbar .icon-only {
  width: 32px;
  padding-inline: 5px;
}
.shell-topbar-separator {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex: 0 0 auto;
}
.shell-topbar #status {
  margin-left: auto;
  max-width: min(42vw, 520px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#editor .shell-workspace {
  --workspace-panel-width: 188px;
  --workspace-panel-resizer-width: 6px;
  grid-template-columns: 58px clamp(150px, var(--workspace-panel-width), 360px) var(--workspace-panel-resizer-width) minmax(0, 1fr);
  height: auto;
  flex: 1;
  min-height: 0;
  background: #edf1f6;
  transition: grid-template-columns .16s ease;
}
#editor .shell-workspace.panel-collapsed {
  grid-template-columns: 58px 0 0 minmax(0, 1fr);
}
.workspace-rail {
  position: relative;
  z-index: 8;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: #f8fafc;
  border-right: 1px solid var(--border);
}
.workspace-rail-tabs {
  display: flex;
  min-height: 0;
  flex: 1 1 auto;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
}
.workspace-rail-button {
  position: relative;
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 57px;
  padding: 7px 3px 6px;
  border: 0;
  border-radius: 0;
  flex-direction: column;
  gap: 3px;
  background: transparent;
  color: #5f6f84;
  font-size: 9.5px;
  font-weight: 650;
  line-height: 1.05;
  text-align: center;
  white-space: normal;
}
.workspace-rail-button .brio-icon {
  width: 20px;
  height: 20px;
}
.workspace-rail-button:hover:not(:disabled) {
  border-color: transparent;
  background: #edf3ff;
  color: #214fbd;
}
.workspace-rail-button.active {
  background: #eaf1ff;
  color: #174aa9;
}
.workspace-rail-button.active::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--blue);
}
.workspace-rail-button > span:not(.sr-only) {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workspace-rail .shell-panel-toggle {
  min-height: 42px;
  border-top: 1px solid var(--border);
  color: #718097;
}
.workspace-rail .shell-panel-toggle .brio-icon {
  width: 17px;
  height: 17px;
}

.workspace-panel {
  position: relative;
  z-index: 7;
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #fbfcfe;
  border-right: 1px solid var(--border);
  opacity: 1;
  transition: opacity .12s ease;
}
.panel-collapsed .workspace-panel {
  pointer-events: none;
  border-right: 0;
  opacity: 0;
}
.workspace-panel-header {
  display: flex;
  min-height: 39px;
  padding: 0 10px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--border);
  background: #fff;
}
.workspace-panel-header strong {
  min-width: 0;
  overflow: hidden;
  font-size: 12.5px;
  letter-spacing: -.1px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.workspace-panel-page-count {
  min-width: 22px;
  padding: 2px 6px;
  border-radius: 999px;
  background: #eef3fb;
  color: #5d6f88;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.workspace-panel-section {
  min-width: 0;
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  scrollbar-width: thin;
}
.workspace-panel-section[data-shell-panel="pages"] {
  padding: 0;
  overflow: hidden;
}
.workspace-panel-section[hidden] {
  display: none !important;
}
.workspace-panel-intro {
  margin: 0 0 12px;
  color: #66768c;
  font-size: 12px;
  line-height: 1.45;
}
.shell-pages-panel {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  border: 0;
  background: transparent;
}
.shell-pages-panel .selection,
.shell-pages-panel .selection-summary {
  flex: 0 0 auto;
}
.shell-pages-panel .selection {
  gap: 3px;
  padding: 6px 7px 4px;
}
.shell-pages-panel .selection button {
  min-height: 25px;
  padding: 3px 5px;
  font-size: 10.5px;
}
.shell-pages-panel .selection-summary {
  margin: 0 7px 4px;
  padding: 4px 6px;
  font-size: 10.5px;
}
.shell-pages-panel #thumbnails {
  min-height: 0;
  flex: 1 1 auto;
  overflow-y: auto;
  padding-bottom: 5px;
  scrollbar-width: thin;
}
.shell-pages-panel .thumb {
  margin: 5px 8px 6px;
  padding: 5px 6px;
  border-radius: 7px;
}
.shell-pages-panel .thumb label {
  gap: 5px;
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.1;
}
.shell-pages-panel .thumb input[type="checkbox"] {
  width: 13px;
  height: 13px;
  margin: 0;
}
.shell-pages-panel .thumb canvas {
  box-shadow: 0 1px 4px #26344c1c;
}

.workspace-panel-resizer {
  position: relative;
  z-index: 9;
  grid-column: 3;
  min-width: 0;
  min-height: 0;
  cursor: col-resize;
  touch-action: none;
  background: transparent;
  outline: none;
}
.workspace-panel-resizer::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 50%;
  width: 1px;
  transform: translateX(-50%);
  background: #d8e0ec;
  transition: width .12s ease, background .12s ease;
}
.workspace-panel-resizer:hover::before,
.workspace-panel-resizer:focus-visible::before,
body.shell-panel-resizing .workspace-panel-resizer::before {
  width: 3px;
  background: #7fa2e8;
}
.panel-collapsed .workspace-panel-resizer {
  display: none;
}
body.shell-panel-resizing,
body.shell-panel-resizing * {
  cursor: col-resize !important;
  user-select: none !important;
}

.shell-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 7px;
}
.shell-action-grid-single {
  grid-template-columns: 1fr;
}
.shell-action-grid > button,
.workspace-panel-section > button {
  min-width: 0;
  min-height: 46px;
  padding: 7px 8px;
  justify-content: flex-start;
  align-items: center;
  background: #fff;
  font-size: 11.5px;
  line-height: 1.2;
  text-align: left;
}
.shell-action-grid > button .brio-icon {
  width: 19px;
  height: 19px;
  color: #315fae;
}
.shell-action-grid > button.danger .brio-icon {
  color: currentColor;
}
.shell-action-grid > button span {
  min-width: 0;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: auto;
}
.shell-command-section {
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.shell-panel-subheading {
  display: flex;
  margin-bottom: 8px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: #5e6f86;
  font-size: 11px;
}
.shell-panel-subheading > span:first-child {
  display: inline-flex;
  min-width: 0;
  align-items: center;
  gap: 5px;
}
.shell-panel-subheading .brio-icon {
  width: 15px;
  height: 15px;
}
.shell-panel-subheading #selected-count {
  color: #7b889b;
  text-align: right;
}
.shell-tip {
  display: flex;
  margin-top: 13px;
  padding: 9px 10px;
  align-items: flex-start;
  gap: 7px;
  border: 1px solid #dbe4f4;
  border-radius: 8px;
  background: #f5f8fd;
  color: #60718a;
  font-size: 11px;
  line-height: 1.4;
}
.shell-tip .brio-icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: #5576b6;
}

.shell-workspace .document {
  grid-column: 4;
  min-width: 0;
  min-height: 0;
  height: auto;
}
.shell-workspace .viewer-toolbar {
  min-height: 42px;
  padding: 5px 10px;
  background: #fbfcfe;
}
.shell-workspace #viewport {
  padding: 18px;
}

@media (max-width: 900px) {
  #editor .shell-workspace {
    grid-template-columns: 52px clamp(150px, var(--workspace-panel-width), 360px) var(--workspace-panel-resizer-width) minmax(0, 1fr);
  }
  #editor .shell-workspace.panel-collapsed {
    grid-template-columns: 52px 0 0 minmax(0, 1fr);
  }
  .workspace-rail-button {
    min-height: 52px;
    padding-inline: 2px;
    font-size: 9px;
  }
  .workspace-panel-section { padding: 10px; }
  .shell-action-grid > button { min-height: 44px; }
  .shell-topbar #status { display: none; }
}

@media (max-width: 700px) {
  .shell-topbar {
    min-height: 40px;
    padding: 4px 7px;
  }
  .shell-topbar button {
    min-height: 30px;
    padding: 4px 7px;
  }
  .shell-topbar #open span { display: none; }
  #editor .shell-workspace,
  #editor .shell-workspace.panel-collapsed {
    grid-template-columns: 48px minmax(0, 1fr);
    position: relative;
  }
  .workspace-rail { grid-column: 1; }
  .workspace-panel-resizer { display: none; }
  .workspace-rail-button {
    min-height: 48px;
    font-size: 0;
  }
  .workspace-rail-button .brio-icon {
    width: 19px;
    height: 19px;
  }
  .workspace-rail .shell-panel-toggle { min-height: 39px; }
  .workspace-panel {
    position: absolute;
    inset: 0 auto 0 48px;
    width: min(262px, calc(100vw - 78px));
    z-index: 30;
    box-shadow: 8px 0 24px rgba(31, 48, 76, .13);
    transform: translateX(0);
    transition: transform .16s ease, opacity .12s ease;
  }
  .panel-collapsed .workspace-panel {
    transform: translateX(calc(-100% - 8px));
  }
  .shell-workspace .document {
    grid-column: 2;
  }
  .shell-workspace .viewer-toolbar {
    min-height: 39px;
    padding: 4px 5px;
  }
  .shell-workspace .viewer-toolbar #search-form {
    width: auto;
    margin-left: auto;
  }
  .shell-workspace .viewer-toolbar #search {
    width: min(128px, 30vw);
  }
  .shell-workspace #viewport { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  #editor .shell-workspace,
  .workspace-panel { transition: none; }
}
/* Header reset: app.css styles every <header>; contextual shell header is intentionally compact. */
.workspace-panel-header {
  height: 39px;
  flex: 0 0 39px;
}

/* dev.6.44: safe direct-page Image XObjects can be moved/resized structurally.
   The image remains rendered by PDF.js; BrioPDF only exposes transparent hit
   geometry and resize handles while selected. */
.pdf-native-image-target.transformable { cursor: move; touch-action: none; }
.pdf-native-image-target.transformable.transforming { cursor: grabbing; }
.pdf-native-image-target.selected .pdf-native-image-resize-handle {
  display: block;
  z-index: 3;
  pointer-events: auto;
}
.pdf-native-image-target.transforming polygon { animation: none; }

/* dev.6.50 — lifecycle controls for native PDF comment threads. */
.comment-reply-card { margin-inline-start: calc(var(--reply-depth, 0) * 14px); }
.comment-reply-actions { display:inline-flex; align-items:center; gap:6px; }
.comment-reply-delete { width:30px; min-width:30px; height:30px; padding:0; }
.comment-reply-delete:disabled { opacity:.45; cursor:not-allowed; }
@media (max-width:700px) {
  .comment-reply-card { margin-inline-start: calc(var(--reply-depth, 0) * 8px); }
  .comment-reply-meta { align-items:flex-start; }
  .comment-reply-actions { flex-wrap:wrap; justify-content:flex-end; }
}

/* dev.6.52 — orthogonally rotated imported FreeText annotations. */
.brio-text-overlay.origin-pdf-annotation.annotation-rotated .brio-overlay-text {
  margin: 0;
}

/* Rich-text selection with heterogeneous values (dev.6.63). */
.text-floating-toolbar .format-toggle.mixed,
.text-floating-toolbar .format-toggle[aria-pressed="mixed"] {
  position: relative;
  background: #f2f5fa;
  border-color: #aab8cc;
  color: #52657f;
}
.text-floating-toolbar .format-toggle.mixed::after,
.text-floating-toolbar .format-toggle[aria-pressed="mixed"]::after {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 4px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.text-floating-toolbar select[data-mixed="true"],
.text-floating-toolbar input[data-mixed="true"] {
  border-color: #aab8cc;
  background-color: #f6f8fb;
}
.text-floating-toolbar .color-control[data-mixed="true"]::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 4px;
  background: linear-gradient(135deg, transparent 43%, #687a92 44%, #687a92 56%, transparent 57%);
  pointer-events: none;
}

/* dev.6.70 — stable single-side workspace shell.
   The main rail and its contextual panel stay together on the left.
   Switching tools never changes the document viewport width; only an explicit
   collapse or resize may do so. Grid transitions are disabled to prevent
   fit-width/page measurements during an intermediate layout state. */
.document-toolbar {
  min-height: 38px; padding: 3px 8px; gap: 5px;
  border-bottom: 1px solid var(--border); background: #fbfcfe;
}
.document-toolbar .shell-topbar-group { gap: 2px; }
.document-toolbar button, .document-toolbar select, .document-toolbar input { min-height: 28px; font-size: 11.5px; }
.document-toolbar button { padding: 3px 7px; }
.document-toolbar .icon-only { width: 28px; min-width: 28px; padding: 3px; }
.document-toolbar .shell-file-group #open { padding-inline: 8px; }
.shell-topbar-separator { height: 20px; opacity: .72; }
.shell-page-navigation { display:inline-flex; align-items:center; gap:1px; padding:0 1px; }
.shell-page-number { display:inline-flex; align-items:center; }
.shell-page-number input { width:40px; padding:3px 4px; text-align:center; font-variant-numeric:tabular-nums; }
.shell-page-total { min-width:26px; color:#728096; font-size:11px; font-variant-numeric:tabular-nums; white-space:nowrap; }
.document-toolbar .shell-zoom { width:auto; max-width:126px; padding:3px 23px 3px 7px; }
.document-toolbar .shell-document-status { margin-left:1px; max-width:min(25vw,320px); padding:2px 7px; overflow:hidden; border:1px solid #e2e8f1; border-radius:999px; background:#f6f8fb; color:#6a788d; font-size:10px; line-height:1.35; text-overflow:ellipsis; white-space:nowrap; }
.shell-search-form {
  display:inline-flex; margin-left:auto; align-items:center; gap:0;
  min-height:30px; padding:0; overflow:visible;
  border:1px solid #d7e0ec; border-radius:7px; background:#fff;
}
.shell-search-form:focus-within { border-color:#8baaf0; box-shadow:0 0 0 2px rgba(33,91,230,.10); }
.shell-search-form #search {
  width:clamp(132px,16vw,210px); min-height:28px; padding:3px 7px;
  border:0; border-radius:6px 0 0 6px; background:transparent; box-shadow:none;
}
.shell-search-form #search:focus,
.shell-search-form #search:focus-visible { outline:none; border-color:transparent; box-shadow:none; }
.shell-search-form #search-submit {
  min-width:30px; min-height:28px; padding:3px 7px;
  border:0; border-left:1px solid #e1e7f0; border-radius:0 6px 6px 0; background:#fff;
}
.shell-search-form #search-submit:hover:not(:disabled) { background:#f4f7fb; }

#editor .shell-workspace {
  --workspace-rail-width: 54px;
  --workspace-panel-width: 176px;
  grid-template-columns: var(--workspace-rail-width) clamp(144px,var(--workspace-panel-width),320px) var(--workspace-panel-resizer-width) minmax(0,1fr);
  transition: none;
}
#editor .shell-workspace.panel-collapsed { grid-template-columns:var(--workspace-rail-width) 0 0 minmax(0,1fr); }
.workspace-rail { grid-column:1; grid-row:1; }
.workspace-panel { grid-column:2; grid-row:1; border-left:0; border-right:1px solid var(--border); background:#f8fafc; }
.workspace-panel-resizer { grid-column:3; grid-row:1; }
.shell-workspace .document { grid-column:4; grid-row:1; }

.workspace-rail-button { min-height:52px; padding:6px 2px 5px; gap:2px; font-size:9px; }
.workspace-rail-button .brio-icon { width:19px; height:19px; }
.workspace-rail-button.active::before { inset-block:7px; }
.workspace-panel-header { min-height:38px; height:38px; flex-basis:38px; padding-inline:10px 5px; background:#fbfcfe; }
.workspace-panel-header-actions { display:inline-flex; align-items:center; gap:4px; }
.workspace-panel-close { width:28px; min-width:28px; min-height:28px; padding:4px; border-color:transparent; background:transparent; color:#6c7a8d; }
.workspace-panel-close:hover { background:#eef2f7; color:#34445b; }
.workspace-panel-close .brio-icon { width:15px; height:15px; }

.shell-pages-panel .selection { padding:5px 6px 3px; }
.shell-pages-panel .selection button { min-height:24px; font-size:10px; }
.shell-pages-panel .thumb { margin:4px 6px 5px; padding:4px 5px; }
.shell-pages-panel .thumb canvas { max-width:100%; }

/* Contextual tools use the same compact left palette as Pages. */
.workspace-panel-section:not([data-shell-panel="pages"]) { padding:10px 9px; }
.workspace-panel-intro { margin:1px 4px 9px; color:#738197; font-size:11px; line-height:1.4; }
.workspace-panel-section:not([data-shell-panel="pages"]) .shell-action-grid,
.workspace-panel-section:not([data-shell-panel="pages"]) .shell-action-grid-single { grid-template-columns:1fr; gap:3px; }
.workspace-panel-section:not([data-shell-panel="pages"]) .shell-action-grid > button,
.workspace-panel-section:not([data-shell-panel="pages"]) > button { min-height:38px; padding:6px 8px; border-color:transparent; border-radius:7px; background:transparent; font-size:11.5px; }
.workspace-panel-section:not([data-shell-panel="pages"]) .shell-action-grid > button:hover:not(:disabled),
.workspace-panel-section:not([data-shell-panel="pages"]) > button:hover:not(:disabled) { border-color:#dbe5f5; background:#edf3ff; }
.workspace-panel-section:not([data-shell-panel="pages"]) .shell-action-grid > button .brio-icon { width:18px; height:18px; }
.workspace-panel-section:not([data-shell-panel="pages"]) .shell-command-section { margin-top:10px; padding-top:9px; }
.workspace-panel-section:not([data-shell-panel="pages"]) .shell-tip { margin-top:10px; padding:7px 8px; font-size:10.5px; }

.shell-workspace #viewport { padding:14px; }
.document footer { min-height:28px; }

@media (max-width:1180px) { .document-toolbar .shell-document-status{display:none}.shell-search-form #search{width:145px} }
@media (max-width:920px) {
  #editor .shell-workspace { --workspace-rail-width:50px; }
  .document-toolbar{gap:4px;padding-inline:6px}
  .document-toolbar .shell-file-group #open span,.shell-search-form #search-submit span{display:none}
  .document-toolbar .shell-zoom{max-width:108px}
}
@media (max-width:700px) {
  .document-toolbar{min-height:38px;overflow-x:auto;scrollbar-width:none}
  .document-toolbar::-webkit-scrollbar{display:none}
  .document-toolbar .shell-topbar-separator{height:22px}
  .shell-search-form{margin-left:0}.shell-search-form #search{width:118px}
  #editor .shell-workspace,#editor .shell-workspace.panel-collapsed{grid-template-columns:48px minmax(0,1fr);position:relative}
  .workspace-rail{grid-column:1}
  .workspace-panel{position:absolute;inset:0 auto 0 48px;grid-column:auto;width:min(270px,calc(100vw - 78px));border-left:0;border-right:1px solid var(--border);box-shadow:8px 0 24px rgba(31,48,76,.13);transform:translateX(0)}
  .panel-collapsed .workspace-panel{transform:translateX(calc(-100% - 8px))}
  .workspace-panel-resizer{display:none}
  .shell-workspace .document{grid-column:2}
  .shell-workspace #viewport{padding:8px}
}
.document-toolbar #status { margin-left:2px; max-width:min(27vw,360px); }

/* dev.6.86: while inline text editing owns the interaction, native image/path
   hit targets are temporarily inert. This prevents a surrounding table/frame
   from lighting up under the pointer while the user is typing or reaching for
   the floating text toolbar. The PDF artwork itself remains fully visible. */
#sheet.inline-text-editing #native-image-layer .pdf-native-image-target,
#sheet.inline-text-editing #native-image-layer .pdf-native-graphic-target {
  pointer-events: none !important;
}
#sheet.inline-text-editing #native-image-layer .pdf-native-image-target polygon,
#sheet.inline-text-editing #native-image-layer .pdf-native-graphic-target polygon,
#sheet.inline-text-editing #native-image-layer .pdf-native-graphic-target .pdf-native-graphic-path {
  stroke: transparent !important;
  animation: none !important;
}

/* dev.6.88: compact PDF-editor zoom palette. It stays anchored above the
   document footer while the page itself scrolls, matching desktop editor
   ergonomics without stealing space from the top document bar. */
.shell-workspace .document { position: relative; }
.floating-zoom-toolbar {
  position: absolute;
  z-index: 80;
  left: 50%;
  bottom: 38px;
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  gap: 2px;
  min-height: 36px;
  padding: 4px 6px;
  border: 1px solid #d6dfec;
  border-radius: 12px;
  background: rgba(255,255,255,.96);
  box-shadow: 0 7px 24px rgba(31,48,76,.14), 0 1px 2px rgba(31,48,76,.08);
  backdrop-filter: blur(8px);
}
.floating-zoom-toolbar[hidden] { display: none !important; }
.floating-zoom-toolbar .zoom-command {
  width: 30px;
  min-width: 30px;
  min-height: 28px;
  padding: 4px;
  border-color: transparent;
  background: transparent;
  color: #526379;
}
.floating-zoom-toolbar .zoom-command:hover:not(:disabled),
.floating-zoom-toolbar .zoom-command:focus-visible {
  border-color: #d8e3f5;
  background: #edf3ff;
  color: #1f58c7;
}
.floating-zoom-toolbar .zoom-command .brio-icon { width: 17px; height: 17px; }
.floating-zoom-toolbar .zoom-value {
  min-width: 58px;
  min-height: 28px;
  padding: 3px 7px;
  border-color: transparent;
  background: transparent;
  color: #34445b;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.floating-zoom-toolbar .zoom-value:hover,
.floating-zoom-toolbar .zoom-value:focus-visible { background: #f1f4f8; }
.floating-zoom-toolbar .floating-separator { height: 20px; margin-inline: 2px; }

/* Explicit PDF-text mode inspired by professional editors: all text targets
   become discoverable at once, while image/path hit targets stand down so the
   user can select text without fighting overlapping PDF graphics. */
.shell-mode-button[aria-pressed="true"] {
  border-color: #bfd0f3 !important;
  background: #e9f1ff !important;
  color: #1e56be;
  font-weight: 700;
}
#sheet.text-target-mode #native-image-layer .pdf-native-image-target,
#sheet.text-target-mode #native-image-layer .pdf-native-graphic-target {
  pointer-events: none !important;
}
#sheet.text-target-mode #native-image-layer .pdf-native-image-target polygon,
#sheet.text-target-mode #native-image-layer .pdf-native-graphic-target polygon,
#sheet.text-target-mode #native-image-layer .pdf-native-graphic-target .pdf-native-graphic-path {
  stroke: transparent !important;
  animation: none !important;
}
#sheet.text-target-mode #text-layer span.pdf-text-native-editable,
#sheet.text-target-mode #text-layer span.pdf-text-visual-fallback {
  background: rgba(33,91,230,.025);
}
#sheet.text-target-mode #text-layer span.pdf-text-native-editable::after,
#sheet.text-target-mode #text-layer span.pdf-text-visual-fallback::after {
  content: "";
  position: absolute;
  inset: -2px;
  z-index: 3;
  border: 1px dashed color-mix(in srgb, var(--pdf-target-color) 58%, transparent);
  border-radius: 2px;
  pointer-events: none;
  animation: none;
}
#sheet.text-target-mode #text-layer span.pdf-text-native-editable:hover::after,
#sheet.text-target-mode #text-layer span.pdf-text-native-editable.pdf-text-group-hover::after,
#sheet.text-target-mode #text-layer span.pdf-text-visual-fallback:hover::after,
#sheet.text-target-mode #text-layer span.pdf-text-visual-fallback.pdf-text-group-hover::after {
  border-style: solid;
  border-color: var(--pdf-target-color);
  background: color-mix(in srgb, var(--pdf-target-fill) 70%, transparent);
}

@media (max-width:700px) {
  .floating-zoom-toolbar { bottom: 34px; min-height: 34px; padding: 3px 4px; }
  .floating-zoom-toolbar .zoom-command { width: 28px; min-width: 28px; }
  .floating-zoom-toolbar .zoom-value { min-width: 52px; padding-inline: 4px; }
}
.floating-zoom-toolbar .zoom-command.active {
  border-color: #c6d6f3;
  background: #e9f1ff;
  color: #1f58c7;
}

/* dev.6.89 — clearer text sizing and navigable PDF search. */
.text-floating-toolbar .font-size-combo {
  display: inline-flex;
  align-items: stretch;
  height: 32px;
  border: 1px solid #cbd7ea;
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}
.text-floating-toolbar .font-size-combo label {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 58px;
  min-width: 58px;
  border-left: 1px solid #e2e8f2;
  border-right: 1px solid #e2e8f2;
}
.text-floating-toolbar .font-size-combo input {
  width: 100%;
  height: 30px;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 4px 21px 4px 5px;
  text-align: right;
  box-shadow: none;
  appearance: textfield;
}
.text-floating-toolbar .font-size-combo input:focus { outline: 2px solid #8baaf0; outline-offset: -2px; }
.text-floating-toolbar .font-size-unit {
  position: absolute;
  right: 5px;
  color: #7a8799;
  font-size: 9px;
  pointer-events: none;
}
.text-floating-toolbar .font-size-step {
  width: 25px;
  min-width: 25px;
  height: 30px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #42526a;
  font-size: 15px;
  line-height: 1;
}
.text-floating-toolbar .font-size-step:hover { background: #f2f6fd; color: #174bba; }
.text-floating-toolbar .font-size-step:focus-visible { outline: 2px solid #8baaf0; outline-offset: -2px; }

.shell-search-form { position: relative; display:flex; align-items:center; gap:0; }
.search-navigation {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  min-height: 28px;
  padding-left: 3px;
  border-left: 1px solid #e1e7f0;
  background:#fff;
  border-radius:0 6px 6px 0;
}
.search-navigation[hidden] { display:none !important; }
.search-navigation button { width:26px; min-width:26px; min-height:26px; padding:3px; border-color:transparent; background:transparent; }
.search-navigation .search-clear { margin-left:2px; border-left-color:#dbe3ef; color:#6b7789; }
.search-navigation .search-clear:hover:not(:disabled),
.search-navigation .search-clear:focus-visible { color:#253750; background:#f1f4f8; }
.shell-search-form:focus-within { z-index:2; }
.shell-search-form #search:focus-visible { outline:none; }
.search-navigation output {
  min-width: 44px;
  text-align: center;
  color: #4a5c74;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
#search-highlight-layer {
  position:absolute;
  inset:0;
  z-index:2;
  pointer-events:none;
  overflow:hidden;
}
.search-match-highlight {
  position:absolute;
  background: rgba(255, 211, 61, .32);
  border-radius: 2px;
  box-shadow: inset 0 0 0 1px rgba(202, 151, 0, .25);
}
.search-match-highlight.active {
  background: rgba(255, 179, 0, .50);
  box-shadow: inset 0 0 0 1.5px rgba(177, 112, 0, .72), 0 0 0 1px rgba(255,255,255,.7);
}
@media (max-width: 900px) {
  .search-navigation output { min-width:36px; }
  .shell-search-form #search { width: 128px; }
}

/* dev.6.90 — primary editing command strip and graphical signature workflow. */
#editor > .editor-primary-toolbar { flex: 0 0 auto; }
.editor-primary-toolbar {
  min-height: 50px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 1px;
  padding: 3px 9px 2px;
  border-bottom: 1px solid #dce4ef;
  background: #fff;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
.editor-primary-command {
  min-width: 56px;
  min-height: 44px;
  padding: 3px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #4b5c72;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 10px;
  line-height: 1.12;
  white-space: nowrap;
}
.editor-primary-command .brio-icon { width: 17px; height: 17px; }
.editor-primary-command:hover:not(:disabled) { background: #f2f6fc; color: #243b61; border-color: #e0e8f3; }
.editor-primary-command.active,
.editor-primary-command[aria-pressed="true"] { background: #173a67; border-color: #173a67; color: #fff; }
.editor-primary-command:focus-visible { outline: 2px solid #6f9cf4; outline-offset: 1px; }
.editor-primary-command:disabled { opacity: .42; cursor: default; }
.editor-primary-separator { width: 1px; margin: 5px 5px; background: #dfe6ef; flex: 0 0 auto; }
.image-floating-toolbar #image-kind-label { margin-right: 2px; }

.signature-modal { width: min(600px, calc(100vw - 24px)); max-width: 600px; }
.signature-form { display: grid; gap: 12px; }
.signature-form .dialog-heading { margin-bottom: 0; }
.signature-form .dialog-heading p { margin: 3px 0 0; color: #66778d; font-size: 12px; line-height: 1.45; max-width: 480px; }
.signature-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.signature-mode-tabs button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid #cfd9e8;
  background: #f8fafd;
  color: #40536f;
}
.signature-mode-tabs button.active,
.signature-mode-tabs button[aria-selected="true"] { background: #e8f0ff; color: #17469d; border-color: #87a9ee; }
.signature-mode-tabs .brio-icon { width: 18px; height: 18px; }
.signature-panel { min-height: 178px; }
.signature-canvas-wrap {
  height: 154px;
  border: 1px solid #cbd7e7;
  border-radius: 9px;
  overflow: hidden;
  background:
    linear-gradient(#ffffffed, #ffffffed),
    repeating-linear-gradient(0deg, #edf2f8 0, #edf2f8 1px, transparent 1px, transparent 24px);
}
#signature-canvas { width: 100%; height: 100%; display: block; cursor: crosshair; touch-action: none; }
.signature-inline-actions { min-height: 34px; display: flex; align-items: center; gap: 10px; margin-top: 7px; color: #748298; font-size: 11px; flex-wrap: wrap; }
.signature-inline-actions button { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; }
.signature-inline-actions .brio-icon { width: 15px; height: 15px; }
.signature-stroke-setting { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; color: #596a82; white-space: nowrap; }
.signature-stroke-color-control { width: 34px; min-width: 34px; height: 30px; }
#signature-draw-hint { margin-left: auto; text-align: right; min-width: 180px; }
.signature-upload-button {
  width: 100%;
  min-height: 128px;
  padding: 8px;
  border: 1.5px dashed #aebdd3;
  border-radius: 9px;
  background: #f8fafd;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #426294;
  overflow: hidden;
}
.signature-upload-button:hover { background: #f1f6ff; border-color: #779de4; }
.signature-upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.signature-upload-placeholder[hidden],
.signature-upload-preview[hidden] { display: none !important; }
.signature-upload-placeholder .brio-icon { width: 27px; height: 27px; }
.signature-upload-preview {
  position: relative;
  width: 100%;
  min-width: 0;
  height: 116px;
  padding: 6px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-color: #fff;
  background-image:
    linear-gradient(45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(-45deg, #eef2f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef2f7 75%),
    linear-gradient(-45deg, transparent 75%, #eef2f7 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.signature-upload-preview img {
  display: block;
  max-width: 100%;
  max-height: 104px;
  width: auto;
  height: auto;
  object-fit: contain;
}
.signature-upload-preview-change {
  position: absolute;
  right: 6px;
  bottom: 6px;
  max-width: calc(100% - 12px);
  padding: 4px 7px;
  border-radius: 5px;
  background: rgba(17, 24, 39, .78);
  color: #fff;
  font-size: 10px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.signature-upload-name { margin: 7px 2px 0; color: #60718a; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.signature-legal-note { margin: 0; padding: 8px 10px; border-radius: 7px; background: #f5f7fa; color: #69788c; font-size: 11px; line-height: 1.4; }
.brio-image-overlay[data-image-role="signature"] { min-width: 72px; min-height: 28px; }
.brio-image-overlay[data-image-role="signature"] .brio-overlay-image { object-fit: contain; }

@media (max-width: 760px) {
  .editor-primary-toolbar { justify-content: flex-start; padding-inline: 6px; }
  .editor-primary-command { min-width: 53px; padding-inline: 5px; }
  .editor-primary-command span { font-size: 9.5px; }
  .editor-primary-separator { margin-inline: 2px; }
  .signature-modal { width: calc(100vw - 12px); }
  #signature-draw-hint { flex: 1 0 100%; min-width: 0; margin-left: 0; text-align: left; }
}

/* dev.6.95 — native PDF primitive style controls. */
.native-graphic-style-controls {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex: 0 0 auto;
}
.native-graphic-style-controls[hidden] { display: none !important; }

/* dev.6.98: independent annotation-author dialogs, compact and overflow-safe. */
@media (max-width: 480px) {
  .annotation-author-modal { width: calc(100vw - 16px); }
  .annotation-author-form .dialog-heading { padding: 14px 14px 10px; }
  .annotation-author-fields { padding: 4px 14px 13px; gap: 9px; }
  .annotation-author-actions { padding: 10px 14px 14px; }
  .annotation-author-actions button { flex: 1 1 auto; }
  .annotation-author-actions button.primary { flex-basis: 100%; order: -1; }
}

/* dev.6.102 — command-driven, user-customizable primary editor toolbar. */
#editor > .document-toolbar { order: 0; }
#editor > .editor-primary-toolbar { order: 1; }
#editor > .contextual-toolbar-dock { order: 2; }
#editor > .shell-workspace { order: 3; }
#editor[data-primary-toolbar-position="bottom"] > .shell-workspace { order: 1; }
#editor[data-primary-toolbar-position="bottom"] > .contextual-toolbar-dock { order: 2; }
#editor[data-primary-toolbar-position="bottom"] > .editor-primary-toolbar {
  order: 3;
  border-top: 1px solid #dce4ef;
  border-bottom: 0;
}
.editor-primary-command[hidden] { display: none !important; }
.editor-primary-customize {
  min-width: 54px;
  color: #61728a;
}
.editor-primary-customize .brio-icon { width: 17px; height: 17px; }
.toolbar-customize-dialog {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 12px;
}
.toolbar-customize-intro,
.toolbar-customize-note {
  margin: 0;
  color: #61728a;
  font-size: 12px;
  line-height: 1.45;
}
.toolbar-customize-position {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 220px);
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 600;
  color: #34445a;
}
.toolbar-customize-position select { width: 100%; min-width: 0; }
.toolbar-customize-subheading {
  padding-top: 3px;
  color: #34445a;
  font-size: 12px;
  font-weight: 700;
}
.toolbar-customize-drag-help {
  margin: -5px 0 0;
  color: #7c8999;
  font-size: 11px;
  line-height: 1.4;
}
.toolbar-customize-list {
  max-height: min(46vh, 420px);
  min-width: 0;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border: 1px solid #d7e0ec;
  border-radius: 8px;
  background: #fff;
  list-style: none;
}
.toolbar-customize-row {
  min-width: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  border-bottom: 1px solid #edf1f6;
}
.toolbar-customize-row:last-child { border-bottom: 0; }
.toolbar-customize-drag-handle {
  width: 30px;
  min-width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: #8190a4;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.toolbar-customize-drag-handle:hover { background: #f1f5fa; color: #40536b; }
.toolbar-customize-drag-handle:focus-visible {
  outline: 2px solid #2f6feb;
  outline-offset: 1px;
  background: #f4f8ff;
}
.toolbar-customize-drag-handle > span {
  display: block;
  font-size: 21px;
  line-height: 1;
  transform: translateY(-1px);
}
.toolbar-customize-list.is-sorting {
  user-select: none;
  cursor: grabbing;
}
.toolbar-customize-row.is-dragging {
  border: 1px solid #b9c9df;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(38, 54, 77, .2);
  cursor: grabbing;
}
.toolbar-customize-row.is-dragging .toolbar-customize-drag-handle { cursor: grabbing; }
.toolbar-customize-drop-placeholder {
  min-height: 42px;
  margin: 0;
  border: 2px solid #5b8def;
  border-width: 2px 0 0;
  background: #f6f9ff;
  list-style: none;
}
.toolbar-customize-visibility {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  color: #34445a;
  font-size: 12px;
}
.toolbar-customize-visibility > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toolbar-customize-visibility small {
  color: #7c8999;
  font-size: 10px;
  font-weight: 500;
}
.toolbar-customize-moves { display: inline-flex; gap: 4px; }
.toolbar-customize-moves .icon-only { width: 30px; min-width: 30px; height: 30px; padding: 5px; }
.toolbar-customize-reset {
  justify-self: start;
  min-height: 32px;
}
@media (max-width: 520px) {
  .toolbar-customize-position { grid-template-columns: 1fr; gap: 6px; }
  .toolbar-customize-visibility { grid-template-columns: auto minmax(0, 1fr); }
  .toolbar-customize-visibility small { grid-column: 2; }
  .toolbar-customize-row { grid-template-columns: 30px minmax(0, 1fr) auto; padding-inline: 5px; gap: 5px; }
  .editor-primary-customize { min-width: 48px; }
}

/* dev.6.132 — lateral annotation conversation panel. */
.workspace-comments-panel { min-height:0; }
.workspace-comments-panel .workspace-panel-intro { margin-bottom:7px; }
.conversation-list { display:grid; gap:6px; min-height:0; overflow:auto; padding:0 4px 10px; }
.conversation-empty { margin:14px 8px; color:#728096; font-size:11.5px; line-height:1.45; text-align:center; }
.conversation-card { position:relative; display:grid; grid-template-columns:minmax(0,1fr) 30px; align-items:stretch; border:1px solid #dfe6ef; border-radius:8px; background:#fff; overflow:hidden; }
.conversation-card:hover { border-color:#c9d7ea; box-shadow:0 1px 3px rgba(31,50,76,.06); }
.conversation-card.selected { border-color:#8eb3ef; box-shadow:0 0 0 1px #8eb3ef inset; background:#f5f9ff; }
.conversation-card-main { display:grid; gap:4px; min-width:0; padding:8px 7px 8px 9px; border:0; border-radius:0; background:transparent; color:inherit; text-align:left; }
.conversation-card-main:hover { background:transparent; }
.conversation-card-heading { display:flex; align-items:center; justify-content:space-between; gap:8px; min-width:0; }
.conversation-card-heading strong { overflow:hidden; color:#27384e; font-size:11.5px; text-overflow:ellipsis; white-space:nowrap; }
.conversation-card-heading > span { flex:0 0 auto; color:#7a8798; font-size:10px; }
.conversation-card-text { display:-webkit-box; overflow:hidden; color:#36475d; font-size:11.5px; line-height:1.35; -webkit-box-orient:vertical; -webkit-line-clamp:3; }
.conversation-card-meta { overflow:hidden; color:#8390a1; font-size:10px; text-overflow:ellipsis; white-space:nowrap; }
.conversation-card-open { align-self:stretch; width:30px; min-width:30px; border:0; border-left:1px solid #edf1f6; border-radius:0; background:transparent; color:#64748b; }
.conversation-card-open:hover { background:#edf4ff; color:#245fbb; }
.conversation-card-open .brio-icon { width:15px; height:15px; }

/* dev.6.134 — image quick transforms */
#image-rotate-right .brio-icon { transform: scaleX(-1); }

/* dev.6.135 — visual image crop */
.image-crop-modal { width:min(820px, calc(100vw - 24px)); max-width:820px; padding:0; border:0; border-radius:16px; overflow:hidden; box-shadow:0 26px 90px rgba(20,38,64,.28); }
.image-crop-modal::backdrop { background:rgba(23,33,49,.44); backdrop-filter:blur(1px); }
.image-crop-form { display:flex; flex-direction:column; max-height:min(88vh, 860px); }
.image-crop-form > .dialog-heading { padding:18px 20px 10px; }
.image-crop-form > .dialog-heading p { margin:.25rem 0 0; color:var(--muted, #667085); font-size:.92rem; }
.image-crop-stage { position:relative; min-height:240px; max-height:60vh; margin:0 20px; background:#151b26; border-radius:12px; overflow:hidden; display:grid; place-items:center; touch-action:none; user-select:none; }
.image-crop-stage > img { display:block; max-width:100%; max-height:60vh; width:auto; height:auto; user-select:none; pointer-events:none; }
.image-crop-shade { position:absolute; background:rgba(7,12,21,.58); pointer-events:none; }
.image-crop-selection { position:absolute; box-sizing:border-box; border:2px solid #fff; box-shadow:0 0 0 1px rgba(18,84,224,.95), 0 0 0 9999px rgba(0,0,0,0); cursor:move; touch-action:none; }
.image-crop-grid { position:absolute; pointer-events:none; background:rgba(255,255,255,.55); }
.image-crop-grid-v { top:0; bottom:0; width:1px; }
.image-crop-grid-v.one { left:33.333%; }.image-crop-grid-v.two { left:66.666%; }
.image-crop-grid-h { left:0; right:0; height:1px; }
.image-crop-grid-h.one { top:33.333%; }.image-crop-grid-h.two { top:66.666%; }
.image-crop-handle { position:absolute; width:14px; height:14px; border:2px solid #fff; background:#215be6; border-radius:50%; box-sizing:border-box; }
.image-crop-handle.nw { left:-8px; top:-8px; cursor:nwse-resize; }
.image-crop-handle.ne { right:-8px; top:-8px; cursor:nesw-resize; }
.image-crop-handle.sw { left:-8px; bottom:-8px; cursor:nesw-resize; }
.image-crop-handle.se { right:-8px; bottom:-8px; cursor:nwse-resize; }
.image-crop-tools { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:10px 20px 2px; }
.image-crop-tools button { display:inline-flex; align-items:center; gap:7px; }
.image-crop-tools .brio-icon { width:18px; height:18px; }
.image-crop-modal .modal-actions { padding:12px 20px 18px; }
@media (max-width:640px) {
  .image-crop-modal { width:calc(100vw - 12px); }
  .image-crop-stage { margin:0 10px; min-height:200px; }
  .image-crop-form > .dialog-heading { padding:14px 12px 8px; }
  .image-crop-tools { padding:10px 12px 2px; }
  .image-crop-modal .modal-actions { padding:12px; }
}

/* dev.6.140 — while a native text overlay is being edited, the single Brio
   selection box is the visual authority. Hide the per-run PDF.js target
   rectangles so multirun editing reads as one text object instead of a row of
   independent fragments. */
#sheet.inline-text-editing #text-layer span.pdf-text-native-editable::after,
#sheet.inline-text-editing #text-layer span.pdf-text-visual-fallback::after {
  opacity: 0 !important;
}
#sheet.inline-text-editing #text-layer span.pdf-text-native-editable,
#sheet.inline-text-editing #text-layer span.pdf-text-visual-fallback {
  background: transparent !important;
}


/* dev.6.142 — contextual tools float over the top of the visible viewer instead
   of participating in the editor flex layout. Showing/hiding the strip therefore
   never changes viewer height or shifts the open document. Its horizontal span is
   recalculated from the visible viewer column, so it follows panel/window width. */
.contextual-toolbar-dock {
  position: fixed;
  z-index: 34;
  min-width: 0;
  min-height: 38px;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 5px;
  border: 1px solid #d4deeb;
  border-radius: 8px;
  background: #fbfcfe;
  box-shadow: 0 4px 14px rgba(31, 50, 76, .11);
  overflow: hidden;
  pointer-events: auto;
}
.contextual-toolbar-dock[hidden] { display: none !important; }
.contextual-toolbar-dock > .text-floating-toolbar {
  position: static;
  inset: auto;
  z-index: auto;
  flex: 0 1 auto;
  min-width: 0;
  min-height: 34px;
  max-width: 100%;
  padding: 2px 3px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
}
#editor[data-primary-toolbar-position="bottom"] > .contextual-toolbar-dock {
  border: 1px solid rgba(199, 211, 227, .92);
}
@media (max-width: 760px) {
  .contextual-toolbar-dock { justify-content: flex-start; padding-inline: 4px; border-radius: 8px; }
  .contextual-toolbar-dock > .text-floating-toolbar { width: 100%; max-width: 100%; }
}


/* dev.6.144 — direct edit action for the active search match. */
.search-navigation .search-edit-result {
  margin-left: 3px;
  border-left: 1px solid #dbe3ef;
  border-radius: 0 6px 6px 0;
}
/* dev.6.145 — safe replace workflow for the active search match. */
.search-replace-dialog { display:grid; gap:10px; }
.search-replace-dialog label { display:grid; gap:6px; font-weight:600; }
.search-replace-dialog textarea { width:100%; min-height:72px; resize:vertical; font:inherit; }
.search-replace-help { margin:0; color:var(--muted, #667085); font-size:.9rem; line-height:1.4; }

/* dev.6.146 — page numbering dialog. */
.page-numbering-dialog{display:grid;gap:12px}.page-numbering-field{display:grid;gap:6px;font-size:13px}.page-numbering-field select,.page-numbering-field input[type=color]{width:100%;min-height:36px}.page-numbering-field input[type=color]{padding:3px}

/* dev.6.148 — AcroForm fill mode. PDF.js owns the live widget controls and
   AnnotationStorage; BrioPDF adds a stable navigation/selection affordance. */
.form-fill-toolbar { min-width: 0; gap: 5px; }
.form-fill-toolbar .object-kind-label { display:inline-flex; align-items:center; gap:5px; flex:0 0 auto; }
.form-fill-toolbar .object-kind-label .brio-icon { width:16px; height:16px; }
.form-fill-field-label {
  min-width: 80px;
  max-width: min(38vw, 360px);
  overflow: hidden;
  color: #34445a;
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.form-fill-count { min-width: 48px; color:#66768b; font-size:11px; text-align:center; }
#annotation-layer.form-fill-active .brio-form-widget {
  outline: 1px solid rgba(33, 91, 230, .72);
  outline-offset: 1px;
  border-radius: 2px;
  transition: outline-color .12s ease, box-shadow .12s ease;
}
#annotation-layer.form-fill-active .brio-form-widget:focus-within {
  outline: 2px solid #215be6;
  box-shadow: 0 0 0 3px rgba(33, 91, 230, .14);
}
#annotation-layer.form-fill-active .brio-form-widget :is(input,textarea,select) {
  cursor: text;
}
#annotation-layer.form-fill-active .brio-form-widget.buttonWidgetAnnotation :is(input,button) {
  cursor: pointer;
}
@media (max-width: 760px) {
  .form-fill-field-label { max-width: 42vw; }
}

/* dev.6.151 — dedicated Merge PDF studio, alignment + deploy-safe UX */
.merge-studio{
  width:min(100%,1500px);margin:0 auto;padding:26px clamp(20px,3.2vw,48px) 112px;
  min-height:calc(100vh - 70px)
}
/* Override the generic `header` shell rule: this is content, not the app header. */
.merge-studio .merge-studio-header{
  height:auto;min-height:0;padding:0;background:transparent;border:0;
  display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:end;gap:28px;
  margin:0 0 22px
}
.merge-studio-header>div:first-child{min-width:0}
.merge-studio-header .eyebrow{margin:0 0 5px;color:var(--muted,#64748b);font-size:12px;font-weight:650;letter-spacing:.035em}
.merge-studio-header h1{font-size:clamp(30px,3vw,42px);line-height:1.08;margin:0 0 8px;letter-spacing:-.025em}
.merge-studio-header p:last-child{max-width:820px;color:var(--muted,#64748b);margin:0;line-height:1.5}
.merge-studio-actions,.merge-view-toggle{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.merge-studio-actions{justify-content:flex-end;padding-bottom:1px}
.merge-studio-actions button,.merge-view-toggle button{display:inline-flex;align-items:center;justify-content:center;gap:7px;min-height:40px}
.merge-studio-toolbar{
  display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:24px;
  border-top:1px solid var(--border,#dbe3ee);border-bottom:1px solid var(--border,#dbe3ee);
  padding:12px 0;margin-bottom:20px;min-height:64px
}
.merge-view-toggle button.active{background:var(--accent-bg,#eaf1ff);color:var(--accent,#175cd3);border-color:color-mix(in srgb,var(--accent,#175cd3) 35%,transparent)}
.merge-studio-meta{display:flex;align-items:center;justify-content:flex-end;gap:14px;color:var(--muted,#64748b);font-size:13px;min-width:0;text-align:right}
.merge-studio-meta strong{color:var(--text,#172033);white-space:nowrap;font-variant-numeric:tabular-nums}
.merge-studio-meta span{min-width:0;line-height:1.35}
.merge-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(190px,1fr));gap:16px;align-items:start}
.merge-card{position:relative;min-width:0;border:1px solid var(--border,#dbe3ee);background:var(--card,#fff);border-radius:14px;padding:12px;box-shadow:0 1px 2px rgba(15,23,42,.04);transition:border-color .15s ease,box-shadow .15s ease,transform .15s ease}
.merge-card[draggable="true"]{cursor:grab}.merge-card.dragging{opacity:.45}.merge-card.drop-before{box-shadow:-4px 0 0 var(--accent,#175cd3)}.merge-card.drop-after{box-shadow:4px 0 0 var(--accent,#175cd3)}
.merge-card-preview{height:190px;border-radius:9px;background:#f4f6f9;display:flex;align-items:center;justify-content:center;overflow:hidden;border:1px solid #e6ebf1;position:relative}
.merge-card-preview canvas{max-width:100%;max-height:100%;width:auto;height:auto;box-shadow:0 2px 10px rgba(15,23,42,.14);background:white}
.merge-card-index{position:absolute;top:8px;left:8px;display:inline-flex;min-width:26px;height:26px;padding:0 7px;align-items:center;justify-content:center;border-radius:999px;background:rgba(15,23,42,.82);color:#fff;font-size:12px;font-weight:700}
.merge-card-body{padding:10px 2px 2px;min-width:0}.merge-card-title{display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:13px}.merge-card-subtitle{display:block;color:var(--muted,#64748b);font-size:12px;margin-top:4px}
.merge-card-controls{display:flex;gap:5px;margin-top:10px}.merge-card-controls button{flex:1;min-width:38px;padding:6px 8px}.merge-card-controls button.danger{color:#b42318}
.merge-add-card{appearance:none;display:block;width:100%;text-align:left;color:inherit;font:inherit;cursor:pointer;box-shadow:0 1px 2px rgba(15,23,42,.04);background:var(--card,#fff)}
.merge-add-card:hover{border-color:color-mix(in srgb,var(--accent,#175cd3) 52%,var(--border,#dbe3ee));box-shadow:0 3px 12px rgba(15,23,42,.07)}
.merge-add-card:hover .merge-add-preview{border-color:color-mix(in srgb,var(--accent,#175cd3) 46%,var(--border,#dbe3ee));background:color-mix(in srgb,var(--accent-bg,#eaf1ff) 42%,#f7f9fc)}
.merge-add-card:focus-visible{outline:3px solid color-mix(in srgb,var(--accent,#175cd3) 28%,transparent);outline-offset:2px}
.merge-add-preview{background:#f7f9fc;border-style:dashed;transition:border-color .15s ease,background .15s ease}
.merge-add-document{position:relative;display:block;width:92px;height:126px;border:1px solid #d9e1eb;border-radius:7px;background:#fff;box-shadow:0 3px 12px rgba(15,23,42,.08)}
.merge-add-document::after{content:"";position:absolute;right:-1px;top:-1px;width:24px;height:24px;background:linear-gradient(225deg,#f7f9fc 49%,#d9e1eb 50%,#fff 53%);border-top-right-radius:7px}
.merge-add-plus{position:absolute;z-index:1;left:50%;top:50%;transform:translate(-50%,-50%);display:flex;align-items:center;justify-content:center;width:38px;height:38px;border-radius:999px;background:var(--accent,#175cd3);color:#fff;box-shadow:0 3px 10px rgba(23,92,211,.2)}.merge-add-plus svg{width:19px;height:19px;stroke-width:2.2}
.merge-add-body{display:block;min-height:80px;padding:10px 2px 2px;text-align:left}
.merge-add-body .merge-card-title{color:var(--accent,#175cd3);font-weight:650}
.merge-add-body .merge-card-subtitle{white-space:normal;line-height:1.35;max-width:100%}
.merge-empty{
  display:flex;min-height:360px;align-items:center;justify-content:center;flex-direction:column;text-align:center;
  gap:10px;color:var(--muted,#64748b);border:2px dashed var(--border,#dbe3ee);border-radius:16px;
  background:color-mix(in srgb,var(--card,#fff) 35%,transparent);padding:28px
}
.merge-empty>svg{width:36px;height:36px}.merge-empty strong{font-size:18px;color:var(--text,#172033)}.merge-empty>span{max-width:520px;line-height:1.45}
.merge-studio-footer{
  position:fixed;z-index:30;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:flex-end;gap:18px;
  padding-block:14px;padding-left:max(20px,calc((100vw - 1500px)/2 + 48px));padding-right:max(20px,calc((100vw - 1500px)/2 + 48px));
  background:color-mix(in srgb,var(--card,#fff) 94%,transparent);border-top:1px solid var(--border,#dbe3ee);backdrop-filter:blur(12px)
}
.merge-studio-footer>span{color:var(--muted,#64748b);font-size:13px;font-variant-numeric:tabular-nums}.merge-studio-footer .primary{min-width:190px;justify-content:center;min-height:42px}
body.merge-mode{background:#f7f8fb}.merge-mode .app-header #download{display:none!important}.merge-mode #back-home{display:inline-flex!important}
body.merge-mode #toast{bottom:82px}
body.editor-mode #toast{bottom:92px}
@media(max-width:920px){
  .merge-studio .merge-studio-header{grid-template-columns:1fr;align-items:start;gap:16px}
  .merge-studio-actions{justify-content:flex-start}
  .merge-studio-toolbar{grid-template-columns:1fr;gap:10px;align-items:start}
  .merge-studio-meta{justify-content:flex-start;text-align:left;flex-wrap:wrap}
}
@media(max-width:760px){
  .merge-studio{padding:20px 14px 112px}.merge-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}.merge-card{padding:8px}.merge-card-preview{height:150px}
  .merge-studio-footer{justify-content:space-between;padding:12px 14px}.merge-studio-footer .primary{min-width:150px}
}
@media(max-width:430px){
  .merge-studio-header h1{font-size:30px}.merge-studio-actions{width:100%}.merge-studio-actions button{flex:1}
  .merge-view-toggle{width:100%}.merge-view-toggle button{flex:1}.merge-grid{grid-template-columns:1fr}.merge-card-preview{height:220px}
  .merge-studio-footer>span{display:none}.merge-studio-footer .primary{width:100%}
}


/* dev.6.160 — contextual tools are a compact dockable palette. The palette can
   float freely or snap to a fixed vertical lane at either edge of the visible
   viewer. Positioning never participates in document layout, so moving/docking
   it cannot reflow the PDF canvas. */
.contextual-toolbar-dock {
  width: max-content;
  max-width: min(920px, calc(100vw - 16px));
  min-height: 0;
  gap: 4px;
  justify-content: flex-start;
  padding: 3px 4px;
  overflow: visible;
  touch-action: none;
  user-select: none;
}
.contextual-palette-chrome {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  padding-right: 4px;
  border-right: 1px solid #dbe3ee;
}
.contextual-palette-chrome button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  padding: 5px;
  border-radius: 6px;
}
.contextual-palette-chrome button[aria-pressed="true"] {
  border-color: #a9c2f5;
  background: #eaf1ff;
  color: #174bba;
}
.contextual-palette-position-actions { display: inline-flex; align-items: center; gap: 2px; }
.contextual-palette-handle { cursor: grab; color: #5c6c82; touch-action: none; }
.contextual-palette-handle:active,
.contextual-palette-dragging .contextual-palette-handle { cursor: grabbing; }
.contextual-palette-dragging { box-shadow: 0 10px 28px rgba(31,50,76,.22); }

.contextual-toolbar-dock > .text-floating-toolbar {
  width: auto;
  max-width: min(820px, calc(100vw - 170px));
}

.contextual-toolbar-dock[data-palette-mode="dock-left"],
.contextual-toolbar-dock[data-palette-mode="dock-right"] {
  width: 214px;
  max-width: min(236px, calc(100vw - 16px));
  flex-direction: column;
  align-items: stretch;
  padding: 5px;
  border-radius: 10px;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] .contextual-palette-chrome,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .contextual-palette-chrome {
  width: 100%;
  justify-content: space-between;
  padding: 0 0 4px;
  border-right: 0;
  border-bottom: 1px solid #dbe3ee;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] .contextual-palette-position-actions,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .contextual-palette-position-actions {
  margin-left: auto;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] > .text-floating-toolbar,
.contextual-toolbar-dock[data-palette-mode="dock-right"] > .text-floating-toolbar {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 3px 1px 1px;
  overflow: visible;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] > .text-floating-toolbar > *,
.contextual-toolbar-dock[data-palette-mode="dock-right"] > .text-floating-toolbar > * {
  max-width: 100%;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] > .text-floating-toolbar > button:not(.icon-only),
.contextual-toolbar-dock[data-palette-mode="dock-right"] > .text-floating-toolbar > button:not(.icon-only),
.contextual-toolbar-dock[data-palette-mode="dock-left"] > .text-floating-toolbar > select,
.contextual-toolbar-dock[data-palette-mode="dock-right"] > .text-floating-toolbar > select,
.contextual-toolbar-dock[data-palette-mode="dock-left"] > .text-floating-toolbar > label:not(.color-control),
.contextual-toolbar-dock[data-palette-mode="dock-right"] > .text-floating-toolbar > label:not(.color-control) {
  width: 100%;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] .floating-separator,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .floating-separator {
  width: 100%;
  height: 1px;
  margin: 2px 0;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] .font-size-combo,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .font-size-combo,
.contextual-toolbar-dock[data-palette-mode="dock-left"] .native-graphic-style-controls,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .native-graphic-style-controls {
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] .image-opacity-control,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .image-opacity-control,
.contextual-toolbar-dock[data-palette-mode="dock-left"] .comment-status-control,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .comment-status-control {
  width: 100%;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] .object-kind-label,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .object-kind-label,
.contextual-toolbar-dock[data-palette-mode="dock-left"] .form-fill-field-label,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .object-kind-label,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .form-fill-field-label {
  white-space: normal;
  text-align: center;
}
@media (max-width: 760px) {
  .contextual-toolbar-dock {
    max-width: calc(100vw - 10px);
  }
  .contextual-palette-position-actions { display: none; }
  .contextual-toolbar-dock[data-palette-mode="dock-left"],
  .contextual-toolbar-dock[data-palette-mode="dock-right"] {
    width: min(190px, calc(100vw - 12px));
  }
}

/* dev.6.161 — handle and automatic contextual-palette placement.
   Docking is gesture-only: dragging close to the visible viewer edges previews
   and commits a left/right vertical dock. Floating auto mode follows the active
   object and deliberately avoids covering its selection box. */
.contextual-palette-chrome {
  padding-right: 5px;
  border-right: 1px solid #dbe3ee;
}
.contextual-palette-handle {
  position: relative;
  width: 26px;
  min-width: 26px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: transparent;
  cursor: grab;
  touch-action: none;
}
.contextual-palette-handle svg { display: none; }
.contextual-palette-handle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12px;
  height: 18px;
  transform: translate(-50%, -50%);
  background-image: radial-gradient(circle, #718096 1.4px, transparent 1.6px);
  background-size: 6px 6px;
  background-position: 0 0;
  opacity: .9;
}
.contextual-palette-handle:hover { background: #eef3f9; }
.contextual-palette-handle:focus-visible { outline: 2px solid #2468d8; outline-offset: 1px; }
.contextual-palette-handle:active,
.contextual-palette-dragging .contextual-palette-handle { cursor: grabbing; background: #e7eef9; }
.contextual-palette-dragging { transition: none !important; box-shadow: 0 12px 30px rgba(31,50,76,.22); }

.contextual-toolbar-dock[data-palette-mode="dock-left"] .contextual-palette-chrome,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .contextual-palette-chrome {
  justify-content: center;
  padding: 0 0 4px;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] .contextual-palette-handle,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .contextual-palette-handle {
  width: 44px;
  min-width: 44px;
  height: 24px;
}
.contextual-toolbar-dock[data-palette-mode="dock-left"] .contextual-palette-handle::before,
.contextual-toolbar-dock[data-palette-mode="dock-right"] .contextual-palette-handle::before {
  width: 20px;
  height: 12px;
  background-size: 6px 6px;
}

/* Subtle snap preview on the palette itself: enough feedback without painting
   permanent docking controls over the document. */
.contextual-toolbar-dock[data-palette-snap="dock-left"] {
  box-shadow: -4px 0 0 #2d6cdf, 0 12px 30px rgba(31,50,76,.22);
}
.contextual-toolbar-dock[data-palette-snap="dock-right"] {
  box-shadow: 4px 0 0 #2d6cdf, 0 12px 30px rgba(31,50,76,.22);
}
.contextual-toolbar-dock[data-palette-auto="true"] {
  transition: left 110ms ease-out, top 110ms ease-out;
}
@media (prefers-reduced-motion: reduce) {
  .contextual-toolbar-dock[data-palette-auto="true"] { transition: none; }
}
