/* =====================================================================
   Fill & Sign - PDF signer (sign-document.html)
   An Acrobat-style workspace: top bar, Fill & Sign toolbar, page sidebar,
   continuous-scroll document canvas and floating page/zoom controls.
   ===================================================================== */

:root {
  --ps-font: "Source Sans 3", "Segoe UI", system-ui, -apple-system, sans-serif;

  --ps-chrome: #f4f4f4;
  --ps-surface: #ffffff;
  --ps-surface-2: #f3f3f3;
  --ps-surface-3: #e9e9e9;
  --ps-canvas: #e3e3e3;
  --ps-border: #e1e1e1;
  --ps-border-strong: #c9c9c9;
  --ps-text: #1f1f1f;
  --ps-text-2: #505050;
  --ps-text-3: #8a8a8a;
  --ps-accent: #3b63fb;
  --ps-accent-hover: #2d50de;
  --ps-accent-soft: rgba(59, 99, 251, 0.12);
  --ps-accent-ring: rgba(59, 99, 251, 0.35);
  --ps-on-accent: #ffffff;
  --ps-brand: #ff2c3c;
  --ps-danger: #d7373f;
  --ps-success: #12805c;
  --ps-success-soft: rgba(18, 128, 92, 0.12);
  --ps-warning: #c26a00;
  --ps-warning-soft: rgba(230, 134, 25, 0.14);
  --ps-page-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 2px 6px rgba(0, 0, 0, 0.08),
    0 10px 24px rgba(0, 0, 0, 0.06);
  --ps-pop-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06), 0 8px 28px rgba(0, 0, 0, 0.16);
  --ps-radius: 8px;
  --ps-sidebar-w: 212px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ps-chrome: #1b1b1b;
    --ps-surface: #252525;
    --ps-surface-2: #2e2e2e;
    --ps-surface-3: #383838;
    --ps-canvas: #141414;
    --ps-border: #363636;
    --ps-border-strong: #4a4a4a;
    --ps-text: #ececec;
    --ps-text-2: #b8b8b8;
    --ps-text-3: #8c8c8c;
    --ps-accent: #6f8cff;
    --ps-accent-hover: #8aa1ff;
    --ps-accent-soft: rgba(111, 140, 255, 0.16);
    --ps-accent-ring: rgba(111, 140, 255, 0.45);
    --ps-on-accent: #0d1330;
    --ps-success: #3fc08d;
    --ps-success-soft: rgba(63, 192, 141, 0.14);
    --ps-warning: #f0a33c;
    --ps-page-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 4px 18px rgba(0, 0, 0, 0.55);
    --ps-pop-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 10px 32px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ps-chrome: #1b1b1b;
  --ps-surface: #252525;
  --ps-surface-2: #2e2e2e;
  --ps-surface-3: #383838;
  --ps-canvas: #141414;
  --ps-border: #363636;
  --ps-border-strong: #4a4a4a;
  --ps-text: #ececec;
  --ps-text-2: #b8b8b8;
  --ps-text-3: #8c8c8c;
  --ps-accent: #6f8cff;
  --ps-accent-hover: #8aa1ff;
  --ps-accent-soft: rgba(111, 140, 255, 0.16);
  --ps-accent-ring: rgba(111, 140, 255, 0.45);
  --ps-on-accent: #0d1330;
  --ps-success: #3fc08d;
  --ps-success-soft: rgba(63, 192, 141, 0.14);
  --ps-warning: #f0a33c;
  --ps-page-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 4px 18px rgba(0, 0, 0, 0.55);
  --ps-pop-shadow: 0 0 0 1px rgba(255, 255, 255, 0.07), 0 10px 32px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- base */

html,
body.ps-body-page {
  height: 100%;
}

body.ps-body-page {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--ps-chrome);
  color: var(--ps-text);
  font-family: var(--ps-font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

body.ps-body-page > nav {
  flex: none;
}

.ps-app *,
.ps-modal *,
.ps-toasts * {
  box-sizing: border-box;
}

.ps-app svg,
.ps-modal svg,
.ps-toasts svg,
.ps-menu svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.ps-app button,
.ps-modal button {
  font-family: inherit;
}

[hidden] {
  display: none !important;
}

.ps-app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.ps-spacer {
  flex: 1;
}

.ps-divider {
  width: 1px;
  height: 24px;
  background: var(--ps-border);
  margin: 0 6px;
  flex: none;
}

/* ------------------------------------------------------------- buttons */

.ps-icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--ps-radius);
  background: transparent;
  color: var(--ps-text-2);
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  flex: none;
}
.ps-icon-btn:hover:not(:disabled) {
  background: var(--ps-surface-2);
  color: var(--ps-text);
}
.ps-icon-btn:active:not(:disabled) {
  background: var(--ps-surface-3);
}
.ps-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
.ps-icon-btn.is-on {
  background: var(--ps-accent-soft);
  color: var(--ps-accent);
}
.ps-icon-btn--sm {
  width: 30px;
  height: 30px;
}
.ps-icon-btn--sm svg {
  width: 18px;
  height: 18px;
}

.ps-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, color 0.12s, box-shadow 0.12s;
  text-decoration: none;
}
.ps-btn svg {
  width: 18px;
  height: 18px;
}
.ps-btn:focus-visible,
.ps-icon-btn:focus-visible,
.ps-tool:focus-visible,
.ps-sign-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ps-accent-ring);
}
.ps-btn--primary {
  background: var(--ps-accent);
  color: var(--ps-on-accent);
}
.ps-btn--primary:hover:not(:disabled) {
  background: var(--ps-accent-hover);
}
.ps-btn--ghost {
  background: transparent;
  color: var(--ps-text);
  border-color: var(--ps-border-strong);
}
.ps-btn--ghost:hover:not(:disabled) {
  background: var(--ps-surface-2);
}
.ps-btn--danger {
  background: var(--ps-danger);
  color: #fff;
}
.ps-btn--success {
  background: var(--ps-success);
  color: #fff;
}
.ps-btn--sm {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
}
.ps-btn--lg {
  height: 44px;
  padding: 0 22px;
  font-size: 15px;
}
.ps-btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.ps-btn.is-busy {
  position: relative;
  color: transparent !important;
}
.ps-btn.is-busy::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  border-top-color: #fff;
  animation: ps-spin 0.7s linear infinite;
}

/* ------------------------------------------------------------- top bar */

.ps-topbar {
  height: 52px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px 0 6px;
  background: var(--ps-surface);
  border-bottom: 1px solid var(--ps-border);
  position: relative;
  z-index: 20;
}
.ps-topbar__left,
.ps-topbar__right {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}
.ps-topbar__left {
  flex: 1;
  overflow: hidden;
}
.ps-topbar__right {
  flex: none;
}
.ps-topbar__right .ps-btn {
  margin-left: 4px;
}

.ps-docid {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin-left: 4px;
}
.ps-docid__icon {
  flex: none;
  width: 30px;
  height: 36px;
  border-radius: 4px 9px 4px 4px;
  background: var(--ps-brand);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: grid;
  place-items: end center;
  padding-bottom: 5px;
  position: relative;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.12);
}
.ps-docid__icon::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: linear-gradient(225deg, var(--ps-surface) 50%, rgba(0, 0, 0, 0.18) 50%);
  border-bottom-left-radius: 3px;
}
.ps-docid__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.ps-docid__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 42vw;
}
.ps-docid__meta {
  font-size: 12px;
  color: var(--ps-text-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ps-docid__meta:empty {
  display: none;
}

.ps-chip {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--ps-surface-2);
  color: var(--ps-text-2);
}
.ps-chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.ps-chip--warn {
  background: var(--ps-warning-soft);
  color: var(--ps-warning);
}
.ps-chip--ok {
  background: var(--ps-success-soft);
  color: var(--ps-success);
}
.ps-chip--info {
  background: var(--ps-accent-soft);
  color: var(--ps-accent);
}

/* ------------------------------------------------------------- toolbar */

.ps-toolbar {
  height: 48px;
  flex: none;
  display: flex;
  justify-content: center;
  background: var(--ps-surface);
  border-bottom: 1px solid var(--ps-border);
  position: relative;
  z-index: 19;
}
.ps-app[data-state="welcome"] .ps-toolbar,
.ps-app[data-state="loading"] .ps-toolbar,
.ps-app[data-state="error"] .ps-toolbar {
  pointer-events: none;
}
.ps-app[data-state="welcome"] .ps-toolbar__scroll,
.ps-app[data-state="loading"] .ps-toolbar__scroll,
.ps-app[data-state="error"] .ps-toolbar__scroll {
  opacity: 0.4;
}
.ps-toolbar__scroll {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 10px;
  overflow-x: auto;
  scrollbar-width: none;
  max-width: 100%;
}
.ps-toolbar__scroll::-webkit-scrollbar {
  display: none;
}
.ps-toolgroup {
  display: flex;
  align-items: center;
  gap: 2px;
}
.ps-tool {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--ps-radius);
  background: transparent;
  color: var(--ps-text-2);
  cursor: pointer;
  flex: none;
  transition: background 0.12s, color 0.12s;
}
.ps-tool:hover {
  background: var(--ps-surface-2);
  color: var(--ps-text);
}
.ps-tool.is-active {
  background: var(--ps-accent-soft);
  color: var(--ps-accent);
}
.ps-app.is-readonly [data-edit-only] {
  display: none !important;
}
.ps-app:not(.is-local) [data-local-only] {
  display: none !important;
}
.ps-app.is-local [data-workflow-only] {
  display: none !important;
}
.ps-app:not(.has-doc) [data-needs-doc] {
  display: none !important;
}

.ps-signmenu {
  position: relative;
  flex: none;
}
.ps-sign-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px 0 12px;
  margin-left: 2px;
  border-radius: 999px;
  border: 1px solid var(--ps-accent);
  background: var(--ps-accent-soft);
  color: var(--ps-accent);
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.12s;
}
.ps-sign-btn:hover,
.ps-sign-btn[aria-expanded="true"] {
  background: var(--ps-accent);
  color: var(--ps-on-accent);
}
.ps-sign-btn.is-active {
  background: var(--ps-accent);
  color: var(--ps-on-accent);
}
.ps-sign-btn .ps-caret {
  width: 16px;
  height: 16px;
}

/* --------------------------------------------------------------- menus */

.ps-menu {
  position: fixed;
  z-index: 1200;
  min-width: 220px;
  max-width: min(320px, calc(100vw - 16px));
  padding: 6px;
  background: var(--ps-surface);
  color: var(--ps-text);
  border-radius: 12px;
  box-shadow: var(--ps-pop-shadow);
  animation: ps-pop 0.12s ease-out;
}
.ps-menu__label {
  padding: 8px 10px 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ps-text-3);
}
.ps-menu__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 6px 10px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.ps-menu__item:hover,
.ps-menu__item:focus-visible {
  background: var(--ps-surface-2);
  outline: none;
}
.ps-menu__item.is-checked {
  color: var(--ps-accent);
  font-weight: 600;
}
.ps-menu__item kbd {
  margin-left: auto;
}
.ps-menu__sep {
  height: 1px;
  margin: 6px 4px;
  background: var(--ps-border);
}
.ps-menu__sig {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  height: 58px;
  padding: 6px 34px 6px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  cursor: pointer;
}
.ps-menu__sig:hover {
  background: var(--ps-surface-2);
  border-color: var(--ps-border);
}
.ps-menu__sig img {
  max-height: 44px;
  max-width: 100%;
  object-fit: contain;
}
:root[data-theme="dark"] .ps-menu__sig img,
:root[data-theme="dark"] .ps-savedgrid img {
  filter: invert(1) hue-rotate(180deg);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ps-menu__sig img,
  :root:not([data-theme="light"]) .ps-savedgrid img {
    filter: invert(1) hue-rotate(180deg);
  }
}
.ps-menu__sig .ps-x {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0;
}
.ps-menu__sig:hover .ps-x {
  opacity: 1;
}
.ps-x {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: 0;
  background: transparent;
  color: var(--ps-text-3);
  cursor: pointer;
}
.ps-x:hover {
  background: var(--ps-surface-3);
  color: var(--ps-danger);
}
.ps-x svg {
  width: 15px !important;
  height: 15px !important;
}

kbd {
  display: inline-block;
  min-width: 20px;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--ps-border-strong);
  border-bottom-width: 2px;
  background: var(--ps-surface-2);
  font: 600 11.5px/1.5 var(--ps-font);
  color: var(--ps-text-2);
  text-align: center;
}

/* ---------------------------------------------------------------- main */

.ps-main {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
}

/* ------------------------------------------------------------- sidebar */

.ps-sidebar {
  width: var(--ps-sidebar-w);
  flex: none;
  display: flex;
  flex-direction: column;
  background: var(--ps-surface);
  border-right: 1px solid var(--ps-border);
  transition: margin-left 0.22s ease, transform 0.22s ease;
  z-index: 15;
  min-height: 0;
}
.ps-app.sidebar-closed .ps-sidebar {
  margin-left: calc(-1 * var(--ps-sidebar-w) - 1px);
}
.ps-sidebar__tabs {
  display: flex;
  gap: 2px;
  padding: 8px 8px 0;
  border-bottom: 1px solid var(--ps-border);
}
.ps-sidetab {
  position: relative;
  flex: 1;
  height: 36px;
  display: grid;
  place-items: center;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ps-text-3);
  cursor: pointer;
}
.ps-sidetab:hover {
  color: var(--ps-text);
}
.ps-sidetab.is-active {
  color: var(--ps-accent);
  border-bottom-color: var(--ps-accent);
}
.ps-sidetab svg {
  width: 19px !important;
  height: 19px !important;
}
.ps-badge {
  position: absolute;
  top: 2px;
  left: calc(50% + 6px);
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--ps-accent);
  color: var(--ps-on-accent);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 17px;
}
.ps-sidebar__panel {
  display: none;
  flex: 1;
  min-height: 0;
  flex-direction: column;
}
.ps-sidebar__panel.is-active {
  display: flex;
}
.ps-panel-title {
  padding: 12px 14px 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ps-text-3);
}

.ps-thumbs {
  flex: 1;
  overflow-y: auto;
  padding: 6px 0 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.ps-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 0;
  cursor: pointer;
  color: var(--ps-text-3);
  font-size: 12px;
  font-weight: 600;
}
.ps-thumb__frame {
  position: relative;
  width: 118px;
  background: #fff;
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--ps-border-strong);
  overflow: hidden;
  transition: box-shadow 0.12s;
}
.ps-thumb__frame canvas {
  display: block;
  width: 100%;
  height: 100%;
}
.ps-thumb:hover .ps-thumb__frame {
  box-shadow: 0 0 0 2px var(--ps-border-strong);
}
.ps-thumb.is-current {
  color: var(--ps-accent);
}
.ps-thumb.is-current .ps-thumb__frame {
  box-shadow: 0 0 0 3px var(--ps-accent);
}
.ps-thumb__dot {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ps-accent);
  box-shadow: 0 0 0 2px #fff;
}

.ps-items {
  flex: 1;
  overflow-y: auto;
  padding: 4px 8px 24px;
}
.ps-items__page {
  padding: 10px 6px 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ps-text-3);
}
.ps-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 38px;
  padding: 4px 4px 4px 8px;
  border-radius: 8px;
  border: 0;
  background: none;
  color: var(--ps-text);
  text-align: left;
  cursor: pointer;
  font-size: 13.5px;
}
.ps-item:hover {
  background: var(--ps-surface-2);
}
.ps-item.is-selected {
  background: var(--ps-accent-soft);
}
.ps-item__icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--ps-surface-2);
  color: var(--ps-text-2);
}
.ps-item__icon svg {
  width: 16px !important;
  height: 16px !important;
}
.ps-item__label {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ps-item .ps-x {
  opacity: 0;
}
.ps-item:hover .ps-x,
.ps-item.is-selected .ps-x {
  opacity: 1;
}
.ps-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--ps-text-3);
  font-size: 13px;
  line-height: 1.5;
}

.ps-info {
  flex: 1;
  overflow-y: auto;
  padding: 0 14px 24px;
  font-size: 13.5px;
}
.ps-info dl {
  margin: 0 0 14px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 10px;
}
.ps-info dt {
  color: var(--ps-text-3);
}
.ps-info dd {
  margin: 0;
  font-weight: 600;
  word-break: break-word;
}
.ps-info h3 {
  margin: 16px 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ps-text-3);
}
.ps-signer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--ps-border);
}
.ps-signer:first-of-type {
  border-top: 0;
}
.ps-avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ps-surface-3);
  color: var(--ps-text-2);
  font-size: 12px;
  font-weight: 700;
}
.ps-signer__name {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}
.ps-signer__name small {
  display: block;
  color: var(--ps-text-3);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ps-signer .ps-chip {
  height: 20px;
  font-size: 11px;
}

.ps-scrim {
  display: none;
}

/* --------------------------------------------------------------- stage */

.ps-stage {
  flex: 1;
  min-width: 0;
  position: relative;
  background: var(--ps-canvas);
  overflow: hidden;
}
.ps-scroller {
  position: absolute;
  inset: 0;
  overflow: auto;
  outline: none;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
}
.ps-pages {
  --zoom: 1;
  width: max-content;
  min-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 28px 72px 120px;
}
.ps-page {
  position: relative;
  flex: none;
  background: #fff;
  box-shadow: var(--ps-page-shadow);
  touch-action: pan-x pan-y;
  -webkit-user-select: none;
  user-select: none;
}
.ps-page > canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.ps-page__label {
  position: absolute;
  left: 50%;
  bottom: -16px;
  transform: translateX(-50%);
  font-size: 11px;
  color: var(--ps-text-3);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}
.ps-scroller.is-scrolling .ps-page__label {
  opacity: 1;
}
.ps-page__ph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
}
.ps-page__ph::after {
  content: "";
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #ddd;
  border-top-color: #999;
  animation: ps-spin 0.8s linear infinite;
}
.ps-search-layer,
.ps-annots {
  position: absolute;
  inset: 0;
}
.ps-search-layer {
  pointer-events: none;
}
.ps-hit {
  position: absolute;
  background: rgba(255, 200, 0, 0.38);
  mix-blend-mode: multiply;
  border-radius: 2px;
}
.ps-hit.is-current {
  background: rgba(255, 120, 0, 0.55);
  box-shadow: 0 0 0 2px rgba(255, 120, 0, 0.6);
}

/* Cursor per tool */
.ps-app[data-tool="hand"] .ps-scroller {
  cursor: grab;
}
.ps-app[data-tool="hand"] .ps-scroller.is-panning {
  cursor: grabbing;
}
.ps-app[data-tool="hand"] .ps-annots {
  pointer-events: none;
}
.ps-app.is-placing .ps-page {
  cursor: copy;
}
.ps-app[data-tool="text"] .ps-page,
.ps-app[data-tool="date"] .ps-page {
  cursor: text;
}
.ps-app[data-tool="ink"] .ps-page,
.ps-app[data-tool="line"] .ps-page,
.ps-app[data-tool="rect"] .ps-page,
.ps-app[data-tool="highlight"] .ps-page,
.ps-app[data-tool="whiteout"] .ps-page {
  cursor: crosshair;
  touch-action: none;
}
.ps-app.is-placing .ps-ann,
.ps-app[data-tool="ink"] .ps-ann,
.ps-app[data-tool="line"] .ps-ann,
.ps-app[data-tool="rect"] .ps-ann,
.ps-app[data-tool="highlight"] .ps-ann,
.ps-app[data-tool="whiteout"] .ps-ann {
  pointer-events: none;
}

/* ---------------------------------------------------------- annotations */

.ps-ann {
  position: absolute;
  touch-action: none;
  cursor: move;
}
.ps-app.is-readonly .ps-ann,
.ps-ann.is-locked {
  cursor: default;
  pointer-events: none;
}
.ps-ann::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 2px;
  pointer-events: none;
}
.ps-app[data-tool="select"] .ps-ann:not(.is-locked):hover::after {
  outline: 1px dashed var(--ps-accent);
  outline-offset: 0;
}
.ps-ann.is-selected::after {
  outline: 1.5px solid var(--ps-accent) !important;
  outline-offset: 0;
}
.ps-ann img,
.ps-ann svg {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
  overflow: visible;
}
.ps-ann--text {
  font-size: calc(var(--fs) * var(--zoom) * 1px);
  line-height: 1.2;
  white-space: pre;
  color: var(--c, #000);
  font-family: Helvetica, Arial, "Liberation Sans", sans-serif;
  min-width: 4px;
  min-height: 1.2em;
}
.ps-ann--text[data-font="serif"] {
  font-family: "Times New Roman", Times, "Liberation Serif", serif;
}
.ps-ann--text[data-font="mono"] {
  font-family: "Courier New", Courier, "Liberation Mono", monospace;
}
.ps-ann--text[data-bold="true"] {
  font-weight: 700;
}
.ps-ann--text.is-editing {
  cursor: text;
  outline: none;
  -webkit-user-select: text;
  user-select: text;
  caret-color: var(--ps-accent);
}
.ps-ann--text.is-editing::after {
  outline: 1.5px solid var(--ps-accent) !important;
  background: rgba(59, 99, 251, 0.05);
}
.ps-ann--text:empty::before {
  content: attr(data-placeholder);
  color: rgba(0, 0, 0, 0.35);
}
.ps-ann--highlight {
  mix-blend-mode: multiply;
}
.ps-ann--whiteout {
  background: #fff;
}
.ps-ann--whiteout:not(.is-selected) {
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.04);
}

/* Fields assigned to other signers (workflow) */
.ps-ann.is-locked {
  opacity: 0.95;
}

.ps-handle {
  position: absolute;
  width: 10px;
  height: 10px;
  margin: -5px 0 0 -5px;
  background: #fff;
  border: 1.5px solid var(--ps-accent);
  border-radius: 50%;
  z-index: 3;
  touch-action: none;
}
.ps-handle::before {
  content: "";
  position: absolute;
  inset: -10px;
}
.ps-handle[data-h="nw"],
.ps-handle[data-h="se"] {
  cursor: nwse-resize;
}
.ps-handle[data-h="ne"],
.ps-handle[data-h="sw"] {
  cursor: nesw-resize;
}
.ps-handle[data-h="n"],
.ps-handle[data-h="s"] {
  cursor: ns-resize;
}
.ps-handle[data-h="e"],
.ps-handle[data-h="w"] {
  cursor: ew-resize;
}
.ps-handle[data-h="p0"],
.ps-handle[data-h="p1"] {
  cursor: move;
}

.ps-ghost {
  position: absolute;
  pointer-events: none;
  opacity: 0.6;
  z-index: 4;
  outline: 1px dashed var(--ps-accent);
  outline-offset: 2px;
}
.ps-ghost img,
.ps-ghost svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.ps-draft {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: visible;
  width: 100%;
  height: 100%;
}

/* ------------------------------------------------- contextual mini bar */

.ps-ctx {
  position: absolute;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--ps-surface);
  color: var(--ps-text);
  border-radius: 12px;
  box-shadow: var(--ps-pop-shadow);
  animation: ps-pop 0.1s ease-out;
  white-space: nowrap;
}
.ps-ctx .ps-divider {
  height: 20px;
  margin: 0 3px;
}
.ps-ctx select {
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ps-text);
  font: 600 13px var(--ps-font);
  padding: 0 4px;
  cursor: pointer;
}
.ps-ctx select:hover {
  background: var(--ps-surface-2);
}
.ps-ctx__size {
  display: flex;
  align-items: center;
}
.ps-ctx__size span {
  min-width: 26px;
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.ps-swatch-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}
.ps-swatch-btn:hover {
  background: var(--ps-surface-2);
}
.ps-swatch-btn i,
.ps-swatches button {
  display: block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
}
.ps-swatches {
  display: grid;
  grid-template-columns: repeat(5, 28px);
  gap: 4px;
  padding: 4px;
}
.ps-swatches button {
  width: 28px;
  height: 28px;
  border: 0;
  cursor: pointer;
  transition: transform 0.1s;
}
.ps-swatches button:hover {
  transform: scale(1.12);
}
.ps-swatches button.is-on {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 0 2px var(--ps-surface),
    0 0 0 4px var(--ps-accent);
}

/* --------------------------------------------------------- banner/float */

.ps-banner {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: calc(100% - 24px);
  padding: 8px 8px 8px 14px;
  border-radius: 999px;
  background: var(--ps-surface);
  box-shadow: var(--ps-pop-shadow);
  font-size: 14px;
  animation: ps-drop 0.25s ease-out;
}
.ps-banner svg {
  color: var(--ps-accent);
}
.ps-banner__text {
  min-width: 0;
}
.ps-banner__text strong {
  font-weight: 700;
}
.ps-banner--edit svg {
  color: var(--ps-warning);
}

.ps-float {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ps-float__group {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px;
  border-radius: 14px;
  background: var(--ps-surface);
  box-shadow: var(--ps-pop-shadow);
}
.ps-pagebox {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 0;
}
.ps-pagebox input {
  width: 38px;
  height: 26px;
  border: 1px solid var(--ps-border-strong);
  border-radius: 6px;
  background: var(--ps-surface);
  color: var(--ps-text);
  text-align: center;
  font: 600 13px var(--ps-font);
  font-variant-numeric: tabular-nums;
}
.ps-pagebox input:focus {
  outline: none;
  border-color: var(--ps-accent);
  box-shadow: 0 0 0 3px var(--ps-accent-ring);
}
.ps-pagebox__total {
  white-space: nowrap;
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--ps-text-3);
  font-variant-numeric: tabular-nums;
}
.ps-zoomval {
  width: 46px;
  height: 26px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--ps-text);
  font: 600 12.5px var(--ps-font);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.ps-zoomval:hover {
  background: var(--ps-surface-2);
}
.ps-zoommenu {
  min-width: 170px;
}

/* -------------------------------------------------------------- find bar */

.ps-find {
  position: absolute;
  top: 12px;
  right: 18px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px 4px 4px 10px;
  border-radius: 12px;
  background: var(--ps-surface);
  box-shadow: var(--ps-pop-shadow);
  animation: ps-drop 0.15s ease-out;
}
.ps-find__icon {
  color: var(--ps-text-3);
  width: 17px !important;
  height: 17px !important;
}
.ps-find input {
  width: 200px;
  height: 30px;
  border: 0;
  background: none;
  color: var(--ps-text);
  font: 14px var(--ps-font);
  padding: 0 6px;
}
.ps-find input:focus {
  outline: none;
}
.ps-find__count {
  min-width: 52px;
  text-align: right;
  font-size: 12.5px;
  color: var(--ps-text-3);
  font-variant-numeric: tabular-nums;
  padding-right: 4px;
}

/* --------------------------------------------------------------- welcome */

.ps-welcome {
  position: absolute;
  inset: 0;
  z-index: 26;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow-y: auto;
  background: radial-gradient(1200px 500px at 50% -10%, var(--ps-accent-soft), transparent 70%),
    var(--ps-canvas);
}
.ps-welcome__card {
  width: min(560px, 100%);
  padding: 36px 32px 24px;
  border-radius: 20px;
  background: var(--ps-surface);
  box-shadow: var(--ps-pop-shadow);
  text-align: center;
  border: 2px dashed transparent;
  transition: border-color 0.15s;
}
.ps-app.is-dragging .ps-welcome__card {
  border-color: var(--ps-accent);
}
.ps-welcome__art {
  display: grid;
  place-items: center;
  margin-bottom: 18px;
}
.ps-welcome__sheet {
  position: relative;
  width: 112px;
  height: 140px;
  padding: 18px 16px;
  border-radius: 6px 22px 6px 6px;
  background: var(--ps-surface-2);
  box-shadow: inset 0 0 0 1px var(--ps-border), 0 10px 26px rgba(59, 99, 251, 0.18);
  display: flex;
  flex-direction: column;
  gap: 9px;
  transform: rotate(-4deg);
}
.ps-welcome__sheet span {
  height: 7px;
  border-radius: 4px;
  background: var(--ps-surface-3);
}
.ps-welcome__sheet span.short {
  width: 60%;
}
.ps-welcome__sig {
  position: absolute !important;
  left: 12px;
  bottom: 12px;
  width: 92px !important;
  height: 34px !important;
  stroke: var(--ps-accent) !important;
  stroke-width: 3 !important;
  stroke-dasharray: 260;
  stroke-dashoffset: 260;
  animation: ps-write 2.2s 0.3s ease-in-out forwards;
}
.ps-welcome h2 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.ps-welcome p {
  margin: 0 auto;
  max-width: 400px;
  color: var(--ps-text-2);
  font-size: 15px;
  line-height: 1.5;
}
.ps-welcome__actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 10px;
}
.ps-welcome__drop {
  font-size: 13px !important;
  color: var(--ps-text-3) !important;
}
.ps-welcome__foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 1px solid var(--ps-border);
  font-size: 13px;
  color: var(--ps-text-3);
}
.ps-welcome__foot span,
.ps-welcome__foot a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.ps-welcome__foot svg {
  width: 15px !important;
  height: 15px !important;
}
.ps-welcome__foot a {
  color: var(--ps-accent);
  text-decoration: none;
  font-weight: 600;
}
.ps-welcome__foot a:hover {
  text-decoration: underline;
}

.ps-loading {
  position: absolute;
  inset: 0;
  z-index: 27;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  background: var(--ps-canvas);
  color: var(--ps-text-2);
}
.ps-app[data-state="loading"] .ps-loading {
  display: flex;
}
.ps-spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid var(--ps-surface-3);
  border-top-color: var(--ps-accent);
  animation: ps-spin 0.8s linear infinite;
}

.ps-dropveil {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  background: rgba(59, 99, 251, 0.12);
  backdrop-filter: blur(2px);
  pointer-events: none;
}
.ps-dropveil > div {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 40px;
  border-radius: 18px;
  border: 2px dashed var(--ps-accent);
  background: var(--ps-surface);
  color: var(--ps-accent);
  font-weight: 700;
  font-size: 16px;
}
.ps-dropveil svg {
  width: 34px !important;
  height: 34px !important;
}
.ps-dropveil p {
  margin: 0;
}

/* ----------------------------------------------------------------- modal */

.ps-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(10, 12, 20, 0.45);
  backdrop-filter: blur(3px);
  animation: ps-fade 0.15s ease-out;
  font-family: var(--ps-font);
  color: var(--ps-text);
}
.ps-modal__dialog {
  width: min(480px, 100%);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--ps-surface);
  border-radius: 16px;
  box-shadow: var(--ps-pop-shadow);
  animation: ps-rise 0.18s ease-out;
  overflow: hidden;
}
.ps-modal__dialog--wide {
  width: min(620px, 100%);
}
.ps-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 14px 8px 22px;
}
.ps-modal__head h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
}
.ps-modal__body {
  padding: 8px 22px 16px;
  overflow-y: auto;
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ps-text-2);
}
.ps-modal__body p {
  margin: 0 0 12px;
}
.ps-modal__foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid var(--ps-border);
}
.ps-modal__foot--end {
  justify-content: flex-end;
}

.ps-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--ps-surface-2);
  border: 1px solid var(--ps-border);
  color: var(--ps-text);
  font-size: 13.5px;
  cursor: pointer;
}
.ps-consent input {
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--ps-accent);
  flex: none;
}
.ps-consent a {
  color: var(--ps-accent);
  font-weight: 600;
}
.ps-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
.ps-summary .ps-chip::before {
  display: none;
}

.ps-done {
  text-align: center;
  padding: 30px 26px 8px;
}
.ps-done__badge {
  width: 64px;
  height: 64px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--ps-success-soft);
  color: var(--ps-success);
}
.ps-done__badge svg {
  width: 34px !important;
  height: 34px !important;
  stroke-width: 2.2 !important;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: ps-write 0.5s 0.15s ease-out forwards;
}
.ps-done h2 {
  margin: 0 0 6px;
  font-size: 22px;
}
.ps-done p {
  margin: 0;
  color: var(--ps-text-2);
}

.ps-shortcuts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 24px;
}
.ps-shortcuts div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--ps-border);
  color: var(--ps-text);
  font-size: 13.5px;
}
.ps-shortcuts kbd + kbd {
  margin-left: 3px;
}

/* Inputs */
.ps-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--ps-border-strong);
  background: var(--ps-surface);
  color: var(--ps-text);
  font: 15px var(--ps-font);
}
.ps-input:focus {
  outline: none;
  border-color: var(--ps-accent);
  box-shadow: 0 0 0 3px var(--ps-accent-ring);
}
.ps-input--lg {
  height: 46px;
  font-size: 17px;
}
.ps-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--ps-text-2);
  cursor: pointer;
  user-select: none;
}
.ps-check input {
  width: 16px;
  height: 16px;
  accent-color: var(--ps-accent);
  margin: 0;
}

/* --------------------------------------------------------- signature dlg */

.ps-sigdlg {
  width: min(600px, 100%);
}
.ps-tabs {
  display: flex;
  gap: 4px;
  padding: 0 22px;
  border-bottom: 1px solid var(--ps-border);
}
.ps-tab {
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--ps-text-2);
  font: 600 14px var(--ps-font);
  cursor: pointer;
}
.ps-tab:hover {
  color: var(--ps-text);
}
.ps-tab.is-active {
  color: var(--ps-accent);
  border-bottom-color: var(--ps-accent);
}
.ps-tab__count {
  font-weight: 500;
  color: var(--ps-text-3);
}
.ps-sigdlg .ps-modal__body {
  padding-top: 16px;
  min-height: 300px;
}
.ps-sigpane {
  display: none;
}
.ps-sigpane.is-active {
  display: block;
}
.ps-fontgrid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}
.ps-fontopt {
  position: relative;
  height: 76px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid var(--ps-border);
  background: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 34px;
  line-height: 1;
  white-space: nowrap;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.ps-fontopt:hover {
  border-color: var(--ps-border-strong);
}
.ps-fontopt.is-on {
  border-color: var(--ps-accent);
  box-shadow: 0 0 0 3px var(--ps-accent-ring);
}
.ps-fontopt small {
  position: absolute;
  left: 10px;
  bottom: 6px;
  font: 600 10.5px var(--ps-font);
  color: #9a9a9a;
}
.ps-pad {
  position: relative;
  height: 220px;
  border-radius: 12px;
  border: 1px solid var(--ps-border-strong);
  background: #fff;
  overflow: hidden;
}
.ps-pad canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
  z-index: 2;
}
.ps-pad__guide {
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 52px;
  border-bottom: 1.5px solid #d4d4d4;
  pointer-events: none;
}
.ps-pad__guide span {
  position: absolute;
  left: -2px;
  bottom: 2px;
  font-size: 20px;
  color: #b6b6b6;
}
.ps-pad__hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 46%;
  margin: 0;
  text-align: center;
  color: #b0b0b0;
  font-size: 15px;
  pointer-events: none;
  transition: opacity 0.15s;
}
.ps-pad.has-ink .ps-pad__hint {
  opacity: 0;
}
.ps-pad__tools {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.ps-imgdrop {
  display: grid;
  place-items: center;
  height: 220px;
  margin-bottom: 12px;
  border-radius: 12px;
  border: 2px dashed var(--ps-border-strong);
  background: var(--ps-surface-2);
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.12s;
  background-image: linear-gradient(45deg, rgba(0, 0, 0, 0.04) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0, 0, 0, 0.04) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0, 0, 0, 0.04) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0, 0, 0, 0.04) 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
.ps-imgdrop:hover,
.ps-imgdrop.is-over {
  border-color: var(--ps-accent);
}
.ps-imgdrop img {
  max-width: 90%;
  max-height: 180px;
  object-fit: contain;
}
.ps-imgdrop__empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--ps-text-3);
  font-weight: 600;
}
.ps-imgdrop__empty svg {
  width: 30px !important;
  height: 30px !important;
}
.ps-savedgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.ps-saved {
  position: relative;
  height: 90px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--ps-border);
  background: var(--ps-surface);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.ps-saved:hover {
  border-color: var(--ps-border-strong);
}
.ps-saved.is-on {
  border-color: var(--ps-accent);
  box-shadow: 0 0 0 3px var(--ps-accent-ring);
}
.ps-saved img {
  max-width: 100%;
  max-height: 60px;
  object-fit: contain;
}
.ps-saved .ps-x {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0;
}
.ps-saved:hover .ps-x {
  opacity: 1;
}
.ps-saved small {
  position: absolute;
  left: 10px;
  bottom: 6px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ps-text-3);
}
.ps-colors {
  display: flex;
  gap: 6px;
}
.ps-colors button {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
}
.ps-colors button.is-on {
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2), 0 0 0 2px var(--ps-surface),
    0 0 0 4px var(--ps-accent);
}

/* ---------------------------------------------------------------- toasts */

.ps-toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 1300;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  width: max-content;
  max-width: calc(100vw - 24px);
  font-family: var(--ps-font);
}
.ps-toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 12px;
  border-radius: 12px;
  background: #222;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.25);
  animation: ps-rise 0.2s ease-out;
  pointer-events: auto;
}
:root[data-theme="dark"] .ps-toast {
  background: #f0f0f0;
  color: #1b1b1b;
}
.ps-toast svg {
  width: 19px !important;
  height: 19px !important;
}
.ps-toast--success svg {
  color: #3fc08d;
}
.ps-toast--error svg {
  color: #ff6b6b;
}
.ps-toast--info svg {
  color: #8aa1ff;
}
.ps-toast.is-leaving {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
}

.ps-tooltip {
  position: fixed;
  z-index: 1400;
  padding: 5px 9px;
  border-radius: 7px;
  background: #1f1f1f;
  color: #fff;
  font: 500 12.5px var(--ps-font);
  pointer-events: none;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}
:root[data-theme="dark"] .ps-tooltip {
  background: #f2f2f2;
  color: #1b1b1b;
}

/* ------------------------------------------------------------ animations */

@keyframes ps-spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes ps-pop {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}
@keyframes ps-fade {
  from {
    opacity: 0;
  }
}
@keyframes ps-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes ps-drop {
  from {
    opacity: 0;
    transform: translate(-50%, -6px);
  }
}
.ps-find {
  animation-name: ps-fade;
}
@keyframes ps-write {
  to {
    stroke-dashoffset: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ps-app *,
  .ps-modal * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .ps-welcome__sig,
  .ps-done__badge svg {
    stroke-dashoffset: 0;
  }
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 960px) {
  .ps-sidebar {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    box-shadow: var(--ps-pop-shadow);
  }
  .ps-app.sidebar-closed .ps-sidebar {
    margin-left: 0;
    transform: translateX(calc(-100% - 12px));
  }
  .ps-app:not(.sidebar-closed) .ps-scrim {
    display: block;
    position: absolute;
    inset: 0;
    z-index: 14;
    background: rgba(0, 0, 0, 0.25);
  }
  .ps-pages {
    padding: 20px 16px 120px;
  }
}

@media (max-width: 640px) {
  .ps-hide-sm,
  .ps-topbar .ps-divider,
  #shortcutsBtn,
  #themeBtn,
  .ps-docid__meta {
    display: none !important;
  }
  .ps-topbar {
    padding: 0 6px 0 2px;
    gap: 6px;
  }
  .ps-docid__icon {
    display: none;
  }
  .ps-docid__title {
    max-width: 38vw;
    font-size: 14px;
  }
  .ps-topbar__right .ps-btn {
    padding: 0 10px;
    margin-left: 2px;
  }
  #openBtn span {
    display: none;
  }
  .ps-toolbar {
    justify-content: flex-start;
  }
  .ps-pages {
    padding: 14px 12px 110px;
    gap: 12px;
  }
  .ps-float {
    left: 50%;
    right: auto;
    bottom: 14px;
    transform: translateX(-50%);
    flex-direction: row;
  }
  .ps-float__group {
    flex-direction: row;
    border-radius: 999px;
  }
  .ps-pagebox {
    flex-direction: row;
    gap: 4px;
  }
  .ps-pagebox__total {
    margin: 0;
  }
  .ps-find {
    left: 8px;
    right: 8px;
  }
  .ps-find input {
    width: 100%;
    flex: 1;
  }
  .ps-banner {
    top: auto;
    bottom: 72px;
    left: 10px;
    right: 10px;
    max-width: none;
    transform: none;
    border-radius: 14px;
    font-size: 13px;
    animation-name: ps-rise;
  }
  .ps-banner__text {
    flex: 1;
  }
  .ps-banner .ps-btn {
    flex: none;
  }
  .ps-chip#docStatus {
    display: none !important;
  }
  .ps-fontgrid {
    grid-template-columns: 1fr;
  }
  .ps-fontopt {
    height: 64px;
  }
  .ps-shortcuts {
    grid-template-columns: 1fr;
  }
  .ps-tabs {
    padding: 0 12px;
  }
  .ps-modal__body,
  .ps-modal__foot {
    padding-left: 16px;
    padding-right: 16px;
  }
  .ps-welcome__card {
    padding: 28px 20px 20px;
  }
}

@media print {
  body.ps-body-page > nav,
  .ps-topbar,
  .ps-toolbar,
  .ps-sidebar,
  .ps-float {
    display: none !important;
  }
}
