/* =====================================================================
   Clippy — design tokens
   Warm neutrals and a periwinkle accent taken from the app icon.
   ===================================================================== */
:root {
  --bg: #ffffff;
  --canvas: #f4f2ef;
  --surface: #ffffff;
  --raised: #ffffff;
  --text: #1c1b22;
  --muted: #6b6878;
  --faint: #a7a3b0;
  --line: #e9e6e1;
  --line-strong: #dcd8d2;
  --hover: #f5f3f0;
  --press: #eeebe6;
  --accent: #6c63e6;
  --accent-hover: #5d54d9;
  --accent-soft: rgba(108, 99, 230, 0.10);
  --accent-ring: rgba(108, 99, 230, 0.28);
  --danger: #c4372d;
  --success: #12804a;
  --warn: #b25b0c;

  --shadow-xs: 0 1px 1px rgba(28, 27, 34, 0.04);
  --shadow-sm: 0 1px 2px rgba(28, 27, 34, 0.06), 0 0 0 1px rgba(28, 27, 34, 0.02);
  --shadow: 0 2px 6px rgba(28, 27, 34, 0.06), 0 1px 2px rgba(28, 27, 34, 0.05);
  --shadow-md: 0 6px 16px rgba(28, 27, 34, 0.08), 0 2px 4px rgba(28, 27, 34, 0.04);
  --shadow-lg: 0 24px 48px -12px rgba(28, 27, 34, 0.22), 0 8px 16px -8px rgba(28, 27, 34, 0.12);
  --page-shadow: 0 0 0 1px rgba(28, 27, 34, 0.06), 0 1px 2px rgba(28, 27, 34, 0.05), 0 6px 16px -6px rgba(28, 27, 34, 0.10);
  --page-shadow-hover: 0 0 0 1px rgba(28, 27, 34, 0.07), 0 2px 4px rgba(28, 27, 34, 0.06), 0 14px 28px -10px rgba(28, 27, 34, 0.20);

  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --fast: 120ms;
  --mid: 200ms;
  --slow: 280ms;

  --toast-bg: rgba(28, 27, 34, 0.94);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17161b;
    --canvas: #0f0f12;
    --surface: #1d1c22;
    --raised: #24232a;
    --text: #ecebf0;
    --muted: #9a97a6;
    --faint: #5f5c69;
    --line: #2a2930;
    --line-strong: #36343d;
    --hover: #222128;
    --press: #2a2930;
    --accent: #8a83ff;
    --accent-hover: #9d97ff;
    --accent-soft: rgba(138, 131, 255, 0.14);
    --accent-ring: rgba(138, 131, 255, 0.34);
    --danger: #ff7a6e;
    --success: #4cc38a;
    --warn: #f0a050;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.04);
    --page-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 6px 16px -6px rgba(0, 0, 0, 0.6);
    --page-shadow-hover: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 16px 32px -10px rgba(0, 0, 0, 0.75);
    --toast-bg: rgba(44, 43, 52, 0.96);
    color-scheme: dark;
  }
}

/* =====================================================================
   Base
   ===================================================================== */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  font-size: 13px;
  line-height: 1.45;
  letter-spacing: -0.003em;
  color: var(--text);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  font-feature-settings: 'cv11', 'ss01';
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
input { font: inherit; color: inherit; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.012em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
::selection { background: var(--accent-ring); }
img { -webkit-user-drag: none; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }

/* Thin scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(127, 124, 138, 0.28); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(127, 124, 138, 0.45); background-clip: padding-box; border: 3px solid transparent; }

/* Shared keyframes */
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes modal-out { to { opacity: 0; transform: translateY(6px) scale(0.99); } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(0.92); } 100% { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }

/* =====================================================================
   Titlebar
   ===================================================================== */
.titlebar {
  height: 52px;
  flex: none;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 14px 0 86px;
  border-bottom: 1px solid var(--line);
  -webkit-app-region: drag;
  background: var(--bg);
  position: relative;
  z-index: 5;
}
.titlebar button, .titlebar .segmented { -webkit-app-region: no-drag; }
.doc-title { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 600; }
.doc-title #docName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-title .muted { font-weight: 400; white-space: nowrap; font-variant-numeric: tabular-nums; }
.doc-title .back { margin: 0 0 0 -6px; color: var(--text); }
.app-logo { width: 22px; height: auto; display: block; margin-right: 2px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.08)); }
.title-actions { display: flex; justify-content: flex-end; gap: 6px; }
.title-actions .btn { animation: fade-in var(--mid) var(--ease) both; }

/* =====================================================================
   Buttons and controls
   ===================================================================== */
.btn {
  height: 30px;
  padding: 0 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  border-radius: var(--r-sm);
  font-weight: 500;
  box-shadow: var(--shadow-xs);
  white-space: nowrap;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease), color var(--fast);
}
.btn:hover { background: var(--hover); border-color: var(--line-strong); }
.btn:active { transform: scale(0.98); background: var(--press); }
.btn svg { width: 14px; height: 14px; }
.btn:not(.primary) > svg:not(.spark) { color: var(--muted); transition: color var(--fast); }
.btn:not(.primary):hover > svg:not(.spark) { color: var(--text); }
.history-btns { display: flex; gap: 2px; margin-right: 4px; }
#btnThumbs.on { color: var(--accent); }
/* Page thumbnails beside the document (Sign & fill) */
.thumbs { width: 132px; flex: none; overflow-y: auto; border-right: 1px solid var(--line); background: var(--bg); padding: 14px 0 40px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.thumbs[hidden] { display: none; }
.tcard { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; }
.tthumb { position: relative; background: #fff; border-radius: 2px; box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(0, 0, 0, 0.06); overflow: hidden; transition: box-shadow var(--fast); }
.tthumb canvas { width: 100%; height: 100%; display: block; }
.tcard:hover .tthumb { box-shadow: 0 0 0 1px var(--line-strong), 0 2px 6px rgba(0, 0, 0, 0.1); }
.tcard.current .tthumb { box-shadow: 0 0 0 2px rgba(108, 99, 230, 0.45); }
.tcard.selected .tthumb { box-shadow: 0 0 0 2.5px var(--accent); }
.tcard span { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tcard.selected span { color: var(--accent); font-weight: 600; }
.tcard.sortable-ghost { opacity: 0.35; }
/* Compress choices with the size each one gives, and a close-up to judge quality */
.segmented.compress-seg { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 0; background: none; border: 0; box-shadow: none; height: auto; }
.segmented.compress-seg button {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; height: auto; min-height: 56px; padding: 10px 12px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); text-align: left; font-size: 13px; font-weight: 500; color: var(--text);
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast);
}
.segmented.compress-seg button:hover { border-color: var(--muted); background: var(--surface); }
.segmented.compress-seg button.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 99, 230, 0.15); background: var(--surface); color: var(--text); }
.compress-seg small { font-size: 12px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; min-height: 15px; white-space: nowrap; }
.compress-seg button.active small { color: var(--accent); }
.compress-seg ~ .compress-preview { margin-top: 12px; }
.cert-export { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.cert-export select { max-width: 260px; }
.split-ctl { display: flex; gap: 8px; align-items: center; }
.split-ctl input { width: 120px; }
.compress-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; }
.compress-preview[hidden] { display: none; }
.compress-preview figure { margin: 0; }
.compress-preview canvas { width: 100%; height: 120px; display: block; border: 1px solid var(--line); border-radius: 6px; background: #fff; object-fit: cover; }
.compress-preview figcaption { font-size: 11px; color: var(--muted); margin-top: 4px; }
.history-btns[hidden] { display: none; }
.btn.primary {
  background: var(--accent); border-color: transparent; color: #fff;
  box-shadow: 0 1px 2px rgba(60, 50, 180, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.primary:active { background: var(--accent-hover); }
.btn.lg { height: 38px; padding: 0 18px; font-size: 14px; border-radius: var(--r); }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.45; pointer-events: none; }

.icon-btn {
  width: 28px; height: 28px; border-radius: var(--r-sm); border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--muted);
  transition: background var(--fast) var(--ease), color var(--fast), transform var(--fast) var(--ease);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn:disabled { opacity: 0.35; pointer-events: none; }

.tool {
  height: 28px; padding: 0 9px; border: 0; border-radius: var(--r-sm); background: transparent;
  display: inline-flex; align-items: center; gap: 6px; color: var(--text); white-space: nowrap;
  transition: background var(--fast) var(--ease), color var(--fast), opacity var(--fast), transform var(--fast) var(--ease);
}
.tool svg { color: var(--muted); transition: color var(--fast); }
.tool svg .swatch.hl { stroke: var(--hl, #f5c400); stroke-width: 2.6; }
/* Highlighter colours: in the tool hint while highlighting, and on a selected highlight's toolbar */
.hl-swatches { gap: 6px; margin-left: auto; }
.hl-swatches button { width: 14px; height: 14px; }
.tool svg .swatch.wo { fill: #fff; stroke-width: 1.1; }
.tool svg .swatch.rd { fill: #111; stroke-width: 1.1; }
.tool:hover { background: var(--hover); }
.tool:active { transform: scale(0.98); }
.tool:disabled { opacity: 0.35; pointer-events: none; }
.tool.danger:hover, .tool.danger:hover svg { color: var(--danger); }
.tool.block {
  width: 100%; height: 36px; border: 1px solid var(--line); justify-content: flex-start; padding: 0 10px;
  background: var(--surface);
  transition: border-color var(--fast) var(--ease), background var(--fast), box-shadow var(--fast), transform var(--fast) var(--ease);
}
.tool.block:hover { border-color: var(--line-strong); box-shadow: var(--shadow-xs); }
.tool.block.armed { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.tool.block.armed svg { color: var(--accent); }
.tool.block[draggable=true] { cursor: pointer; }

.link-btn { border: 0; background: none; color: var(--accent); font-weight: 500; padding: 2px 4px; border-radius: 4px; transition: opacity var(--fast); }
.link-btn:hover { opacity: 0.8; }

/* Segmented control with a sliding pill */
.segmented {
  position: relative;
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--hover); border: 1px solid var(--line);
}
.segmented .seg-pill {
  position: absolute; top: 3px; bottom: 3px; left: 0; width: 0; border-radius: 6px;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform var(--slow) var(--ease-out), width var(--slow) var(--ease-out);
  pointer-events: none;
}
@media (prefers-color-scheme: dark) { .segmented .seg-pill { background: var(--raised); } }
.segmented button {
  position: relative; z-index: 1;
  height: 26px; padding: 0 14px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 500;
  transition: color var(--mid) var(--ease);
}
.segmented button:hover { color: var(--text); }
.segmented button.active { color: var(--text); }
.segmented:not(.has-pill) button.active { background: var(--surface); box-shadow: var(--shadow-sm); }
.segmented.small button { font-size: 12px; height: 26px; }

kbd {
  font-family: inherit; font-size: 10.5px; font-weight: 500; color: var(--muted);
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; line-height: 16px; min-width: 18px; text-align: center;
  background: var(--surface); white-space: nowrap;
}
.tool.block kbd { margin-left: auto; color: var(--faint); }

input[type=range] { -webkit-appearance: none; appearance: none; width: 96px; height: 3px; background: var(--line-strong); border-radius: 2px; outline: none; }
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  transition: transform var(--fast) var(--ease);
}
input[type=range]:active::-webkit-slider-thumb { transform: scale(1.15); }

.switch {
  -webkit-appearance: none; appearance: none; width: 34px; height: 20px; border-radius: 10px; background: var(--line-strong);
  position: relative; flex: none; margin: 0; transition: background var(--mid) var(--ease);
}
.switch::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); transition: transform var(--slow) var(--spring);
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(14px); }

.swatches { display: flex; gap: 8px; }
.swatches button {
  width: 20px; height: 20px; border-radius: 50%; border: 0; background: var(--c); padding: 0;
  box-shadow: 0 0 0 1px var(--line-strong); transition: box-shadow var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.swatches button:hover { transform: scale(1.08); }
.swatches button.active { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

.check { display: flex; align-items: center; gap: 8px; margin: 10px 0 0; }
.check input, .radio-row input[type=radio] { accent-color: var(--accent); margin: 0; }

.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; width: 100%; }
.field > span { font-size: 12px; color: var(--muted); }
.field input[type=text], .inline-input, .type-input {
  height: 32px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: 0 10px; background: var(--surface); outline: none;
  user-select: text; transition: border-color var(--fast), box-shadow var(--fast);
}
.field input:focus, .inline-input:focus, .type-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* =====================================================================
   Organize toolbar
   ===================================================================== */
.toolbar {
  height: 44px; flex: none; display: flex; align-items: center; gap: 6px; padding: 0 12px;
  border-bottom: 1px solid var(--line); background: var(--bg);
  animation: fade-in var(--mid) var(--ease);
}
.toolbar .group { display: flex; align-items: center; gap: 2px; }
.toolbar .spacer { flex: 1; }
#selInfo { font-variant-numeric: tabular-nums; animation: fade-in var(--fast) var(--ease); }
.divider { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.zoom { display: flex; align-items: center; gap: 6px; color: var(--faint); }
.zoom svg { width: 12px; height: 12px; }
.zoom svg.lg { width: 16px; height: 16px; }

/* =====================================================================
   Main area and views
   ===================================================================== */
main { flex: 1; min-height: 0; position: relative; background: var(--canvas); }
main > section { position: absolute; inset: 0; }
main > section:not([hidden]) { animation: fade-in var(--mid) var(--ease); }

/* ---------- Home */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; overflow-y: auto; }
.drop-card {
  width: 480px; max-width: 100%; text-align: center; padding: 44px 40px 40px;
  border: 1px dashed var(--line-strong); border-radius: 16px; background: var(--bg);
  animation: rise-in var(--slow) var(--ease-out);
  transition: border-color var(--mid) var(--ease), background var(--mid) var(--ease);
}
.drop-icon { width: 72px; height: 58px; margin: 0 auto 20px; display: flex; align-items: center; justify-content: center; }
.drop-icon img { width: 72px; height: auto; filter: drop-shadow(0 6px 10px rgba(80, 60, 120, 0.18)); transition: transform var(--slow) var(--spring); }
.drop-card:hover .drop-icon img { transform: translateY(-2px) rotate(-2deg); }
.drop-card h1 { font-size: 19px; margin-bottom: 6px; }
.drop-card p { margin: 0 0 22px; }

.empty.has-recent { justify-content: flex-start; padding: 32px 40px 56px; }
.empty.has-recent .drop-card {
  width: 100%; max-width: 1100px; padding: 18px 22px; display: grid; grid-template-columns: auto 1fr auto;
  align-items: center; gap: 2px 16px; text-align: left; border-radius: var(--r-lg);
}
.empty.has-recent .drop-icon { width: 44px; height: 36px; margin: 0; grid-row: span 2; }
.empty.has-recent .drop-icon img { width: 44px; }
.empty.has-recent .drop-card h1 { font-size: 14px; margin: 0; align-self: end; }
.empty.has-recent .drop-card p { margin: 0; grid-column: 2; font-size: 12.5px; align-self: start; }
.empty.has-recent .drop-actions { grid-column: 3; grid-row: 1 / span 2; }
.empty.has-recent .drop-card .btn { height: 32px; font-size: 13px; }
.empty.has-recent .drop-actions { gap: 8px; }

.recent-wrap { width: 100%; max-width: 1100px; margin-top: 36px; }
/* Tools: every feature, by category — centred, soft buttons that are easy to scan */
.tools-wrap { width: 100%; max-width: 1100px; margin: 14px auto 8px; padding: 0 8px; animation: rise-in var(--mid) var(--ease-out); }
.empty.has-recent .tools-wrap { margin: 14px auto 0; }
.tools-grid .tool-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
#btnMore { margin-right: 2px; }
.tools-wrap[hidden] { display: none; }
#btnTools[aria-expanded="true"] { border-color: var(--accent); color: var(--accent); }
#btnTools[aria-expanded="true"] svg { color: var(--accent); }
.tools-title { text-align: center; font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 22px; }
.tools-grid { display: flex; flex-direction: column; gap: 26px; }
.tool-cat h3 { text-align: center; font-size: 11px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.tool-cat .tool-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tool-link {
  display: inline-flex; align-items: center; gap: 10px; height: 44px; padding: 0 16px 0 8px; border: 1px solid transparent; border-radius: 12px;
  background: rgba(108, 99, 230, 0.05); color: var(--text); font: inherit; font-size: 13.5px; font-weight: 500; cursor: pointer;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.tool-link .tile { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: rgba(108, 99, 230, 0.12); flex: none; }
.tool-link svg { width: 15px; height: 15px; color: var(--accent); }
.tool-link:hover { background: rgba(108, 99, 230, 0.09); border-color: rgba(108, 99, 230, 0.22); }
.tool-link:active { transform: scale(0.98); }
@media (prefers-color-scheme: dark) {
  .tool-link { background: rgba(255, 255, 255, 0.035); }
  .tool-link:hover { background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.1); }
  .tool-link .tile { background: rgba(140, 132, 255, 0.16); }
  .tool-link svg { color: #a9a3ff; }
}
/* Crop and form fields */
.crop-shade { position: absolute; z-index: 2; pointer-events: none; background: rgba(18, 18, 26, 0.42); }
.crop-edge { position: absolute; z-index: 2; pointer-events: none; outline: 1.5px dashed rgba(108, 99, 230, 0.9); }
.crop-live { position: absolute; z-index: 4; pointer-events: none; outline: 1.5px dashed var(--accent); background: rgba(108, 99, 230, 0.06); }
.formfield-ov { outline: 1.5px dashed var(--accent) !important; background: rgba(108, 99, 230, 0.08); border-radius: 2px; }
.formfield-ov .ff-name { position: absolute; left: 0; top: -15px; font-size: 10px; line-height: 14px; padding: 0 4px; border-radius: 3px; background: var(--accent); color: #fff; white-space: nowrap; pointer-events: none; }
.formfield-ov.check { border-radius: 2px; }
/* Company stamp maker */
.seal-grid { display: grid; grid-template-columns: 240px 1fr; gap: 18px; align-items: stretch; }
.seal-form { display: flex; flex-direction: column; gap: 8px; }
.seal-form .inline-input { width: 100%; height: 32px; }
.seal-form .segmented { margin-top: 4px; }
.seal-preview { display: flex; align-items: center; justify-content: center; min-height: 230px; border-radius: 10px; background: #fbfaf7; border: 1px solid var(--line); padding: 18px; }
.seal-preview img { max-width: 100%; max-height: 210px; mix-blend-mode: multiply; }
.sig-item .tag.stamp { background: rgba(36, 57, 143, 0.1); color: #24398f; }
/* Compare two PDFs */
.cmp-sheet { position: fixed; inset: 0; z-index: 800; background: var(--canvas); display: flex; flex-direction: column; animation: fade-in var(--mid) var(--ease); }
.cmp-head { display: flex; align-items: center; gap: 16px; height: 52px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--line); background: var(--bg); }
.cmp-title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.cmp-title .muted { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-stats { margin-left: auto; display: flex; gap: 12px; font-size: 12.5px; }
.cmp-stats .st::before, .cmp-row .dot { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }
.st.add::before, .cmp-row.added .dot { background: #1f9d55; }
.st.del::before, .cmp-row.removed .dot { background: #d64545; }
.st.chg::before, .cmp-row.changed .dot { background: #e0a100; }
.cmp-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 1fr 280px; }
.cmp-col { overflow-y: auto; padding: 16px 20px 60px; display: flex; flex-direction: column; gap: 16px; align-items: center; border-right: 1px solid var(--line); }
.cmp-label { align-self: stretch; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cmp-page { position: relative; width: 100%; max-width: 640px; background: #fff; box-shadow: var(--page-shadow); border-radius: 2px; }
.cmp-page canvas { display: block; }
.cmp-mark { position: absolute; border-radius: 2px; mix-blend-mode: multiply; pointer-events: none; transition: box-shadow var(--fast); }
.cmp-mark.added { background: rgba(31, 157, 85, 0.22); }
.cmp-mark.removed { background: rgba(214, 69, 69, 0.22); }
.cmp-mark.changed { background: rgba(224, 161, 0, 0.28); }
.cmp-mark.on { box-shadow: 0 0 0 2px var(--accent); }
.cmp-list { overflow-y: auto; padding: 10px; background: var(--bg); }
.cmp-row { display: flex; align-items: baseline; gap: 4px; width: 100%; padding: 8px 8px; border: 0; border-radius: 6px; background: none; color: var(--text); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.cmp-row:hover { background: var(--hover); }
.cmp-row .txt { flex: 1; min-width: 0; line-height: 1.4; }
.cmp-row .pg { color: var(--muted); font-size: 11px; white-space: nowrap; }
.cmp-empty { padding: 16px 8px; color: var(--muted); font-size: 13px; }
.recent-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; padding: 0 8px; }
.recent-head h2 { font-size: 13px; color: var(--muted); font-weight: 500; }
.lib-status { font-size: 12px; color: var(--muted); }
.lib-search { margin-left: auto; display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--surface); width: 240px; transition: border-color var(--fast), box-shadow var(--fast); }
.lib-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 99, 230, 0.15); }
.lib-search svg { width: 13px; height: 13px; color: var(--muted); }
.lib-search input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; outline: none; }
.recent-snippet { font-size: 11.5px; color: var(--muted); line-height: 1.35; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.recent-snippet mark, .recent-name mark { background: rgba(255, 214, 10, 0.45); color: inherit; border-radius: 2px; padding: 0 1px; }
/* The best match while searching: Enter opens it. */
.recent.best { background: color-mix(in srgb, var(--accent) 8%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent); }
.recent-empty { grid-column: 1 / -1; color: var(--muted); font-size: 13px; padding: 24px 8px; }
.recent-grid.settled .recent { animation: none; }
.recent[hidden], .recent-empty[hidden], .recent-snippet[hidden] { display: none; }
.recent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(max(164px, calc((100% - 4 * 14px) / 5)), 1fr)); gap: 18px 14px; }
.recent {
  position: relative; display: flex; flex-direction: column; gap: 1px; padding: 8px; border-radius: var(--r-lg);
  animation: rise-in var(--slow) var(--ease-out) both; animation-delay: calc(var(--i, 0) * 28ms);
  transition: background var(--fast) var(--ease);
}
.recent:hover { background: rgba(127, 120, 110, 0.07); }
.recent-thumb {
  aspect-ratio: 3 / 4; background: #fff; border-radius: 4px; box-shadow: var(--page-shadow); overflow: hidden;
  display: flex; align-items: flex-start; justify-content: center; margin-bottom: 10px;
  transition: transform var(--mid) var(--ease-out), box-shadow var(--mid) var(--ease-out);
}
.recent:hover .recent-thumb { transform: translateY(-3px); box-shadow: var(--page-shadow-hover); }
.recent:active .recent-thumb { transform: translateY(-1px) scale(0.99); }
.recent-thumb img { width: 100%; height: 100%; object-fit: contain; object-position: top; }
.recent-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
.recent-meta { font-size: 12px; color: var(--muted); padding: 0 2px; font-variant-numeric: tabular-nums; }
.recent-del {
  position: absolute; top: 14px; right: 14px; width: 26px; height: 26px; border-radius: var(--r-sm); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; color: var(--muted); padding: 0;
  opacity: 0; transform: scale(0.9); transition: opacity var(--fast) var(--ease), transform var(--fast) var(--ease), color var(--fast);
}
.recent:hover .recent-del { opacity: 1; transform: none; }
.recent-del:hover { color: var(--danger); }
.recent-del svg { width: 14px; height: 14px; }

/* ---------- Organize grid */
.organize { overflow-y: auto; }
.grid {
  --thumb: 170px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(calc(var(--thumb) + 24px), 1fr));
  gap: 8px;
  padding: 24px;
  align-items: end;
}
.card {
  position: relative; padding: 12px 12px 8px; border-radius: var(--r-lg);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 1px solid transparent;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.card:hover { background: rgba(127, 120, 110, 0.06); }
.card.selected { background: var(--accent-soft); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card .thumb-box { width: var(--thumb); height: calc(var(--thumb) * 1.3); display: flex; align-items: center; justify-content: center; }
.card .thumb {
  position: relative; background: #fff; box-shadow: var(--page-shadow); border-radius: 3px; overflow: hidden;
  transition: transform var(--mid) var(--ease-out), box-shadow var(--mid) var(--ease-out), width var(--mid) var(--ease-out), height var(--mid) var(--ease-out);
}
.card:hover .thumb { transform: translateY(-2px); box-shadow: var(--page-shadow-hover); }
.card .thumb canvas, .card .thumb .ph { position: absolute; inset: 0; width: 100%; height: 100%; }
.card .thumb canvas { animation: fade-in 240ms var(--ease); }
.card .thumb .ph {
  background: linear-gradient(90deg, #f6f5f3 0%, #fbfaf9 50%, #f6f5f3 100%); background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.card .label { font-size: 12px; color: var(--muted); display: flex; gap: 6px; align-items: center; height: 18px; font-variant-numeric: tabular-nums; }
.card .label .num { min-width: 18px; text-align: center; border-radius: 9px; padding: 0 5px; transition: background var(--fast), color var(--fast); }
.card.selected .label .num { background: var(--accent); color: #fff; font-weight: 600; }
.card .src-tag { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); }
.card .actions {
  position: absolute; top: 6px; right: 6px; display: flex; gap: 1px;
  background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow-md); border: 1px solid var(--line); padding: 2px;
  opacity: 0; transform: translateY(-3px) scale(0.98); pointer-events: none;
  transition: opacity var(--fast) var(--ease), transform var(--mid) var(--ease-out);
}
.card:hover .actions { opacity: 1; transform: none; pointer-events: auto; }
.card .actions button {
  width: 26px; height: 26px; border: 0; background: none; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; color: var(--muted);
  transition: background var(--fast), color var(--fast);
}
.card .actions button:hover { background: var(--hover); color: var(--text); }
.card .actions button[data-act=delete]:hover { color: var(--danger); }
.card .actions button svg { width: 14px; height: 14px; }
.ov-mini { position: absolute; pointer-events: none; }
.ov-mini img { width: 100%; height: 100%; display: block; }
.sortable-ghost { opacity: 0.3; }
.sortable-ghost .thumb { box-shadow: 0 0 0 2px var(--accent); }
.sortable-drag { opacity: 1 !important; }
.sortable-drag .thumb { transform: rotate(-1.5deg) scale(1.03); box-shadow: var(--shadow-lg); }
.sortable-chosen .actions { opacity: 0 !important; }

/* =====================================================================
   Sign & fill
   ===================================================================== */
.sign { display: flex; }
.reader { flex: 1; overflow-y: auto; padding: 32px 32px 96px; display: flex; flex-direction: column; align-items: center; gap: 28px; scroll-behavior: smooth; }
.reader.placing .page { cursor: crosshair; }
.reader.reviewing .page { cursor: copy; }
.page-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.page-wrap .pnum { font-size: 11px; color: var(--faint); font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.page {
  position: relative; background: #fff; box-shadow: var(--page-shadow); border-radius: 2px;
  transition: box-shadow var(--mid) var(--ease);
}
.page canvas { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 2px; animation: fade-in 260ms var(--ease); }
.page.drop-target { box-shadow: 0 0 0 2px var(--accent), 0 0 0 6px var(--accent-soft), var(--page-shadow); }

/* Placed items */
.overlay { position: absolute; cursor: move; touch-action: none; border-radius: 2px; transition: outline-color var(--fast); outline: 1px dashed transparent; outline-offset: 1px; }
.overlay img { width: 100%; height: 100%; display: block; pointer-events: none; }
.overlay:hover { outline-color: rgba(108, 99, 230, 0.55); }
.overlay.active { outline: 1.5px solid var(--accent); }
.overlay.fresh { animation: pop-in 240ms var(--spring); }
.overlay.stamp-ov.active { outline: 1.5px solid var(--accent); }
.overlay .handle {
  position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--accent); cursor: nwse-resize; opacity: 0; transform: scale(0.6);
  transition: opacity var(--fast) var(--ease), transform var(--mid) var(--spring); pointer-events: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.overlay .x {
  position: absolute; right: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  display: flex; align-items: center; justify-content: center; color: var(--muted); padding: 0;
  opacity: 0; transform: scale(0.6); pointer-events: none;
  transition: opacity var(--fast) var(--ease), transform var(--mid) var(--spring), color var(--fast);
}
.overlay .x:hover { color: var(--danger); }
.overlay .x svg { width: 10px; height: 10px; stroke-width: 2; }
.overlay.active .handle, .overlay.active .x { opacity: 1; transform: none; pointer-events: auto; }

.inline-edit {
  position: absolute; z-index: 5; border: 0; outline: 1.5px solid var(--accent); outline-offset: 2px;
  background: rgba(255, 255, 255, 0.92); padding: 0 0.12em; margin: 0; font-family: 'Inter', sans-serif; color: #111;
  line-height: 1; field-sizing: content; min-width: 4em; border-radius: 2px; user-select: text;
  box-shadow: 0 0 0 5px var(--accent-soft); animation: fade-in var(--fast) var(--ease);
}
.inline-edit::placeholder { color: #a3a0ad; }

/* Floating toolbar for the selected item */
.ov-toolbar {
  position: absolute; z-index: 6; display: flex; align-items: center; gap: 1px; padding: 3px;
  background: var(--raised); border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg);
  white-space: nowrap; transform: translateY(-100%); margin-top: -10px;
  animation: tb-in var(--mid) var(--ease-out);
}
@keyframes tb-in { from { opacity: 0; transform: translateY(calc(-100% + 4px)); } to { opacity: 1; transform: translateY(-100%); } }
.ov-toolbar.below { transform: none; margin-top: 10px; animation-name: tb-in-below; }
@keyframes tb-in-below { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.tb-btn {
  height: 28px; padding: 0 8px; border: 0; background: none; border-radius: 7px; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text);
  transition: background var(--fast), color var(--fast);
}
.tb-btn svg { width: 14px; height: 14px; color: var(--muted); transition: color var(--fast); }
.tb-btn:hover { background: var(--hover); }
.tb-btn.danger:hover, .tb-btn.danger:hover svg { color: var(--danger); }
.tb-swatches { gap: 6px; padding: 0 6px; }
.tb-swatches button { width: 16px; height: 16px; }
.tb-div { width: 1px; height: 18px; background: var(--line); margin: 0 3px; }
.reader.dragging-item .ov-toolbar { display: none; }

/* Preview that follows the cursor while placing */
.place-ghost {
  position: fixed; z-index: 30; pointer-events: none; opacity: 0.8; transform: translate(-50%, -50%);
  outline: 1.5px dashed var(--accent); outline-offset: 3px; border-radius: 3px; background: rgba(108, 99, 230, 0.05);
  animation: fade-in var(--fast) var(--ease);
}
.place-ghost img { width: 100%; height: 100%; display: block; }

/* ---------- Sidebar */
.panel { width: 300px; flex: none; border-left: 1px solid var(--line); background: var(--bg); overflow-y: auto; display: flex; flex-direction: column; }
.panel-section { padding: 18px 16px; border-bottom: 1px solid var(--line); }
.panel-section h3 { font-size: 12px; color: var(--text); margin-bottom: 10px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel-head h3 { margin: 0; }
.panel-section p { margin: 0; }
.panel.reviewing .panel-section:not(.review):not(.summary) { display: none; }
.panel-section.summary { border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); background: var(--canvas); }

.sig-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.sig-list:empty { display: none; }
.sig-item {
  position: relative; height: 78px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff;
  display: flex; align-items: center; justify-content: center; padding: 10px 28px; cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: border-color var(--fast) var(--ease), box-shadow var(--mid) var(--ease-out), transform var(--mid) var(--ease-out);
  animation: rise-in var(--slow) var(--ease-out);
}
.sig-item:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.sig-item:active { cursor: grabbing; transform: scale(0.99); }
.sig-item.armed { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.sig-item img { max-width: 100%; max-height: 100%; transition: transform var(--mid) var(--ease-out); }
.sig-item:hover img { transform: scale(1.02); }
.sig-item .tag { position: absolute; left: 10px; top: 7px; font-size: 10px; color: #8a8696; font-weight: 500; }
.sig-item .grab {
  position: absolute; left: 10px; bottom: 7px; font-size: 10px; color: #8a8696; display: flex; align-items: center; gap: 3px;
  opacity: 0; transform: translateY(2px); transition: opacity var(--fast), transform var(--mid) var(--ease-out);
}
.sig-item:hover .grab { opacity: 1; transform: none; }
.sig-item .grab svg { width: 10px; height: 10px; }
.sig-item .del {
  position: absolute; right: 5px; top: 5px; width: 22px; height: 22px; border: 0; background: none; border-radius: 5px; color: #8a8696;
  display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity var(--fast), background var(--fast), color var(--fast);
}
.sig-item:hover .del { opacity: 1; }
.sig-item .del:hover { background: #f4f2ef; color: #c4372d; }
.sig-item .del svg { width: 12px; height: 12px; }
.sig-empty {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 18px 14px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-lg);
  background: transparent; text-align: left; color: var(--muted); margin-bottom: 10px; line-height: 1.4;
  transition: border-color var(--fast) var(--ease), background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.sig-empty:hover { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.sig-empty:active { transform: scale(0.99); }
.sig-empty svg { width: 22px; height: 22px; color: var(--accent); }
.sig-empty b { color: var(--text); font-weight: 600; }
.drag-hint { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--accent); font-weight: 500; margin: 0 0 12px; line-height: 1.4; animation: rise-in var(--mid) var(--ease-out); }
.drag-hint svg { width: 14px; height: 14px; color: var(--accent); }
#placeHintText:empty { display: none; }
.block-btn { width: 100%; justify-content: center; height: 34px; margin-bottom: 8px; }
.block-btn svg { width: 14px; height: 14px; }
.add-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* Firma digital */
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sw-text { display: flex; flex-direction: column; gap: 2px; }
.sw-text b { font-size: 12px; font-weight: 600; }
#firmaBody { margin-top: 14px; animation: rise-in var(--mid) var(--ease-out); }
#firmaBody .check { margin: 2px 0 12px; }
.cert-picker { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.cert-picker:empty { display: none; }
.cert-opt {
  display: flex; align-items: flex-start; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background var(--fast);
}
.cert-opt:hover { border-color: var(--line-strong); }
.cert-opt.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cert-opt input { accent-color: var(--accent); margin: 2px 0 0; }
.cert-opt .c-name { font-weight: 500; }
.cert-opt .c-meta { font-size: 11px; color: var(--muted); }
#certHint:empty { display: none; }

/* Summary */
.sum-body { font-size: 12.5px; line-height: 1.55; animation: fade-in var(--slow) var(--ease); }
.sum-what { font-weight: 600; margin-bottom: 6px; }
.sum-lead { font-size: 13px; line-height: 1.5; color: var(--text); margin: 0 0 10px !important; font-weight: 500; }
.sum-body ul { margin: 0; padding-left: 16px; }
.sum-body li { margin: 3px 0; color: var(--text); }
.sum-body li::marker { color: var(--faint); }
.sum-err { color: var(--muted); margin: 0 0 6px; }
.sum-foot { font-size: 11px; color: var(--faint); margin: 10px 0 0 !important; }
.sum-foot:empty { display: none; }
.sum-loading { display: flex; flex-direction: column; gap: 8px; }
.sum-loading span { height: 9px; border-radius: 5px; background: linear-gradient(90deg, var(--line) 0%, var(--hover) 50%, var(--line) 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.sum-loading span:nth-child(1) { width: 70%; } .sum-loading span:nth-child(2) { width: 95%; } .sum-loading span:nth-child(3) { width: 85%; } .sum-loading span:nth-child(4) { width: 60%; }

/* ---------- Sign for me review */
.review { animation: rise-in var(--mid) var(--ease-out); }
.review h3 { font-size: 14px; margin-bottom: 6px; }
#arSub:empty { display: none; }
.review p { margin-bottom: 12px !important; }
.ar-sides { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 14px; }
.ar-sides:empty { display: none; }
.ar-sides-label { font-size: 12px; color: var(--muted); margin-right: 2px; }
.chip {
  height: 28px; padding: 0 12px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); font-size: 12px; font-weight: 500;
  transition: background var(--mid) var(--ease), border-color var(--fast), color var(--fast), transform var(--fast) var(--ease);
}
.chip:hover { border-color: var(--accent); }
.chip:active { transform: scale(0.97); }
.chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.ar-sigs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.ar-sigs:empty { display: none; }
.ar-sigs button { height: 40px; width: 76px; border: 1px solid var(--line); border-radius: var(--r-sm); background: #fff; padding: 4px 6px; display: flex; align-items: center; justify-content: center; transition: border-color var(--fast), box-shadow var(--fast); }
.ar-sigs button img { max-width: 100%; max-height: 100%; }
.ar-sigs button.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ar-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 14px; overflow: hidden; background: var(--surface); }
.ar-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-bottom: 1px solid var(--line); transition: background var(--fast), opacity var(--mid); animation: fade-in var(--mid) var(--ease) both; }
.ar-row:hover { background: var(--hover); }
.ar-row:last-child { border-bottom: 0; }
.ar-row.off { opacity: 0.6; }
.ar-row input { accent-color: var(--accent); margin: 0; }
.ar-row .ar-num { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: none; transition: background var(--mid); }
.ar-row.off .ar-num { background: var(--faint); }
.ar-row .ar-text { flex: 1; min-width: 0; display: flex; flex-direction: column; cursor: pointer; }
.ar-row .ar-text span:last-child { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-tag { font-size: 10px; font-weight: 600; color: var(--warn); background: rgba(178, 91, 12, 0.1); padding: 2px 7px; border-radius: 8px; flex: none; }
.ar-tag.done { color: var(--muted); background: var(--hover); }
.ar-actions { justify-content: flex-end; }
.preview {
  position: absolute; outline: 1.5px dashed var(--accent); outline-offset: 3px; background: rgba(108, 99, 230, 0.07); cursor: pointer; z-index: 3; border-radius: 2px;
  animation: pop-in var(--slow) var(--ease-out) both;
  transition: outline-color var(--mid), background var(--mid), opacity var(--mid);
}
.preview img { width: 100%; height: 100%; display: block; pointer-events: none; transition: opacity var(--mid); }
.preview:hover { background: rgba(108, 99, 230, 0.12); }
.preview.off { outline-color: #b4b0bd; background: transparent; }
.preview.off img { opacity: 0.28; }
.preview .pv-num {
  position: absolute; left: -11px; top: -11px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 600; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px #fff; transition: background var(--mid);
}
.preview.off .pv-num { background: #b4b0bd; }

/* =====================================================================
   Overlays: drop zone, modals, busy, toast
   ===================================================================== */
.drop-overlay {
  position: fixed; inset: 10px; border: 2px dashed var(--accent); border-radius: 16px; background: rgba(108, 99, 230, 0.08);
  display: flex; align-items: center; justify-content: center; z-index: 50; pointer-events: none;
  backdrop-filter: blur(2px); animation: fade-in var(--fast) var(--ease);
}
.drop-overlay div { background: var(--accent); color: #fff; padding: 9px 16px; border-radius: 20px; font-weight: 600; box-shadow: var(--shadow-md); animation: pop-in var(--mid) var(--spring); }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(20, 18, 28, 0.30); display: flex; align-items: center; justify-content: center; z-index: 40; padding: 24px;
  backdrop-filter: blur(3px); animation: fade-in var(--mid) var(--ease);
}
.modal-backdrop.closing { animation: fade-out 140ms var(--ease-in) forwards; }
.modal {
  width: 460px; max-width: 100%; max-height: 100%; overflow: auto; background: var(--bg); border-radius: 14px; box-shadow: var(--shadow-lg);
  border: 1px solid var(--line); animation: modal-in var(--slow) var(--ease-out);
}
.modal-backdrop.closing .modal { animation: modal-out 140ms var(--ease-in) forwards; }
.modal.wide { width: 620px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 16px 12px 22px; }
.modal-head h2 { font-size: 15px; }
.modal-body { padding: 4px 22px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--canvas); border-radius: 0 0 14px 14px; }

.tabs { position: relative; display: flex; gap: 20px; padding: 0 22px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs button { border: 0; background: none; padding: 8px 0 11px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color var(--fast), border-color var(--mid) var(--ease); }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel:not([hidden]) { animation: fade-in var(--mid) var(--ease); }

.pad-wrap { position: relative; height: 220px; border: 1px solid var(--line-strong); border-radius: var(--r-lg); background: #fff; overflow: hidden; box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03); }
#sigPad { position: absolute; inset: 0; width: 100%; height: 100%; cursor: crosshair; touch-action: none; }
.pad-line { position: absolute; left: 32px; right: 32px; bottom: 56px; border-bottom: 1px solid #e6e2dc; pointer-events: none; }
.pad-actions { position: absolute; right: 8px; top: 6px; display: flex; gap: 2px; z-index: 1; }
.pad-actions .link-btn { display: inline-flex; align-items: center; gap: 4px; padding: 4px 8px; border-radius: 6px; transition: background var(--fast), opacity var(--fast); }
.pad-actions .link-btn:hover { background: rgba(108, 99, 230, 0.08); opacity: 1; }
.pad-actions .link-btn:disabled { opacity: 0; pointer-events: none; }
.pad-actions svg { width: 13px; height: 13px; }
.type-input { width: 100%; height: 38px; font-size: 14px; margin-bottom: 12px; }
.font-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.font-options button {
  height: 78px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff; color: #111;
  font-size: 30px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 12px;
  transition: border-color var(--fast), box-shadow var(--fast), transform var(--fast) var(--ease);
}
.font-options button:hover { border-color: var(--line-strong); }
.font-options button:active { transform: scale(0.99); }
.font-options button.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.upload-box { height: 180px; border: 1px dashed var(--line-strong); border-radius: var(--r-lg); display: flex; align-items: center; justify-content: center; text-align: center; background: #fff; color: #6b6878; margin-bottom: 12px; }
.upload-box img { max-width: 90%; max-height: 90%; animation: fade-in var(--mid) var(--ease); }
.sig-options { display: flex; align-items: center; gap: 20px; margin-top: 16px; }
.thickness { display: flex; align-items: center; gap: 8px; }

.field-label { font-size: 12px; font-weight: 500; color: var(--muted); margin: 10px 0 8px; }
.format-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; }
.format-grid button, .level-list button {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--r); padding: 11px 6px; text-align: center;
  display: flex; flex-direction: column; gap: 2px;
  transition: border-color var(--fast), box-shadow var(--fast), background var(--fast), transform var(--fast) var(--ease);
}
.format-grid button b { font-size: 13px; font-weight: 600; }
.format-grid button:hover, .level-list button:hover { border-color: var(--line-strong); }
.format-grid button:active, .level-list button:active { transform: scale(0.98); }
.format-grid button.active, .level-list button.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--accent-soft); }
.radio-row { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.radio-row label { display: flex; align-items: center; gap: 8px; }
.inline-input { height: 28px; width: 140px; margin-left: 4px; }
#imgOptions { margin-bottom: 12px; animation: fade-in var(--mid) var(--ease); }
#exportNote, #compressNote { margin: 12px 0 0; }
#exportNote:empty, #compressNote:empty { display: none; }
.level-list { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 6px; }
.level-list button { text-align: left; padding: 11px 14px; flex-direction: row; justify-content: flex-start; align-items: center; }
.size-compare { display: flex; align-items: center; gap: 16px; margin-top: 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); animation: rise-in var(--mid) var(--ease-out); }
.size-compare > div { display: flex; flex-direction: column; }
.size-compare b { font-size: 15px; font-variant-numeric: tabular-nums; }
.size-compare svg { color: var(--faint); }
.badge { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--success); background: rgba(18, 128, 74, 0.1); padding: 3px 9px; border-radius: 10px; }
.badge.neutral { color: var(--muted); background: var(--hover); }

.keys-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 28px; padding-bottom: 20px; }
.keys-col:first-child { grid-row: span 2; }
.key-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.key-row:last-child { border-bottom: 0; }

/* Busy appears only if the work takes a moment, so quick actions don't flash. */
.busy { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(20, 18, 28, 0.12); animation: fade-in var(--mid) var(--ease) 180ms both; }
.busy-card {
  display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: var(--raised); border-radius: var(--r-lg); box-shadow: var(--shadow-lg);
  border: 1px solid var(--line); font-weight: 500; animation: modal-in var(--slow) var(--ease-out) 180ms both;
}
.spinner { width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; }

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 70;
  background: var(--toast-bg); color: #fff; padding: 10px 14px 10px 16px; border-radius: 12px; box-shadow: var(--shadow-lg);
  display: flex; gap: 14px; align-items: center; font-weight: 500; backdrop-filter: blur(12px);
  animation: toast-in var(--slow) var(--ease-out);
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 14px) scale(0.97); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toast-out { to { opacity: 0; transform: translate(-50%, 8px) scale(0.98); } }
.toast.leaving { animation: toast-out 160ms var(--ease-in) forwards; }
.toast .link-btn { color: #b9b4ff; padding: 4px 8px; border-radius: 6px; }
.toast .link-btn:hover { background: rgba(255, 255, 255, 0.08); opacity: 1; }
.toast.error { background: rgba(140, 30, 24, 0.95); }

/* =====================================================================
   Reduced motion
   ===================================================================== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}

/* =====================================================================
   Sign for me — the AI feature, in the colours of the app icon
   ===================================================================== */
.spark { fill: currentColor; stroke: none; }
.btn.ai .spark { width: 14px; height: 14px; fill: var(--muted); transition: fill var(--fast); }
.btn.ai:hover .spark { fill: var(--accent); }
.btn.ai:hover .spark { animation: twinkle 900ms var(--ease) infinite alternate; }
@keyframes twinkle { from { transform: scale(1) rotate(0deg); } to { transform: scale(1.15) rotate(12deg); } }

.ai-section { padding-bottom: 14px; }
.ai-card {
  position: relative; width: 100%; display: flex; align-items: center; gap: 12px; padding: 11px 12px; text-align: left;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--fast) var(--ease), box-shadow var(--mid) var(--ease), transform var(--fast) var(--ease);
}
.ai-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.ai-card:active { transform: scale(0.99); }
.ai-card .ai-text { flex: 1; display: flex; flex-direction: column; gap: 1px; position: relative; }
.ai-card .ai-text b { font-size: 13px; font-weight: 600; }
.ai-card .ai-text small { font-size: 11.5px; color: var(--muted); }
.ai-icon {
  position: relative; width: 34px; height: 34px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; color: #fff;
  background: linear-gradient(135deg, #f2a9c4 0%, #b49ce6 50%, #7d74e0 100%);
  box-shadow: 0 2px 6px rgba(125, 116, 224, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}
.ai-icon .spark { width: 18px; height: 18px; filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.55)); }
.ai-card:hover .ai-icon .spark { animation: twinkle 900ms var(--ease) infinite alternate; }
.ai-icon.sm { width: 22px; height: 22px; border-radius: 7px; }
.ai-icon.sm .spark { width: 13px; height: 13px; }
.ar-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.ar-head h3 { margin: 0 !important; }

/* Everything clickable shows the pointer hand */
a, [role=button], .link-btn, .recent, .card, .chip, .cert-opt, .ar-row, .ar-text,
label.check, .radio-row label, .switch-row, .switch, input[type=checkbox], input[type=radio], input[type=range],
.sig-item, .sig-empty, .preview, .tabs button, .segmented button, .swatches button, .format-grid button, .level-list button,
.font-options button, .recent-del, .overlay .x, .tb-btn { cursor: pointer; }
button:disabled, .btn:disabled, .icon-btn:disabled, .tool:disabled { cursor: default; }
.sig-item:active, .sortable-chosen, .sortable-drag { cursor: grabbing; }

/* ---------- Polish pass */
.ar-spark { display: inline-flex; color: var(--accent); }
.ar-spark .spark { width: 15px; height: 15px; }
.save-state { font-size: 12px; font-weight: 400; color: var(--faint); margin-left: 2px; animation: fade-in var(--mid) var(--ease); }
.save-state::before { content: '·'; margin-right: 6px; }
.icon-btn.sm { width: 24px; height: 24px; }
.icon-btn.sm svg { width: 13px; height: 13px; }
.recent-name { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.35; margin-bottom: 2px; }
.preview .pv-num { left: -9px; top: -20px; width: 18px; height: 18px; font-size: 10px; }
.overlay .x { display: none !important; }

.hand-tile {
  grid-column: 1 / -1; position: relative; height: 104px; border: 1px solid var(--line); border-radius: var(--r-lg); background: #fff;
  display: flex; align-items: center; justify-content: center; padding: 18px 90px 12px; cursor: pointer;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.hand-tile:hover { border-color: var(--line-strong); }
.hand-tile.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.hand-tile img { max-width: 100%; max-height: 100%; }
.hand-label { position: absolute; left: 12px; top: 9px; font-size: 10.5px; font-weight: 600; color: #8a8696; }
.hand-again { position: absolute; right: 8px; top: 6px; font-size: 11.5px; }
/* One divider above the summary, not two */
.panel-section:has(+ .panel-section.summary) { border-bottom: 0; }

.font-options .hand-again { height: auto; width: auto; border: 0; background: none; box-shadow: none; font-size: 11.5px; padding: 3px 7px; border-radius: 6px; color: var(--accent); font-family: inherit; }
.font-options .hand-again:hover { background: rgba(108, 99, 230, 0.08); }

/* ---------- Edit tools */
.reader.drawing .page { cursor: crosshair; }
/* The pointer is the tool: highlighter, marker, correction pen, pen. Text tools get the I-beam. */
.reader[data-tool=highlight] .page, .reader[data-tool=highlight] .overlay { cursor: var(--cur-highlight, crosshair); }
.reader[data-tool=redact] .page, .reader[data-tool=redact] .overlay { cursor: var(--cur-redact, crosshair); }
.reader[data-tool=whiteout] .page, .reader[data-tool=whiteout] .overlay { cursor: var(--cur-whiteout, crosshair); }
.reader[data-tool=ink] .page, .reader[data-tool=ink] .overlay { cursor: var(--cur-ink, crosshair); }
.reader[data-tool=text] .page { cursor: text; }
.reader .page.on-text { cursor: text; }
/* Selected text and Find matches */
.text-sel, .find-marks { position: absolute; inset: 0; z-index: 3; pointer-events: none; }
.text-sel > i { position: absolute; background: rgba(108, 99, 230, 0.24); border-radius: 1.5px; }
.find-marks > i { position: absolute; background: rgba(255, 196, 0, 0.32); mix-blend-mode: multiply; border-radius: 2px; }
.find-marks > i.cur { background: rgba(255, 140, 0, 0.55); box-shadow: 0 0 0 1.5px rgba(255, 140, 0, 0.9); }
/* Find bar */
.find-bar {
  position: absolute; top: 12px; right: 16px; z-index: 20; display: flex; align-items: center; gap: 2px;
  height: 36px; padding: 0 4px 0 10px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r); box-shadow: var(--shadow-md, 0 6px 24px rgba(0, 0, 0, 0.12)); animation: rise-in var(--mid) var(--ease-out);
}
.find-bar[hidden] { display: none; }
.find-bar > svg { color: var(--muted); width: 14px; height: 14px; margin-right: 4px; }
.find-bar input { width: 200px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 13px; outline: none; }
.find-count { font-size: 12px; color: var(--muted); min-width: 58px; text-align: right; margin-right: 4px; font-variant-numeric: tabular-nums; }
.find-bar.none .find-count { color: var(--danger); }
.find-bar .icon-btn { width: 26px; height: 26px; }
/* Right-click menu */
.ctx-menu {
  position: fixed; z-index: 1000; min-width: 210px; padding: 4px; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16), 0 1px 3px rgba(0, 0, 0, 0.08); animation: rise-in 120ms var(--ease-out);
}
.ctx-menu[hidden] { display: none; }
.ctx-item {
  display: flex; align-items: center; justify-content: space-between; gap: 24px; width: 100%; height: 28px; padding: 0 10px;
  border: 0; border-radius: 5px; background: transparent; color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer;
}
.ctx-item:hover:not(:disabled) { background: var(--accent); color: #fff; }
.ctx-item:hover:not(:disabled) kbd { color: rgba(255, 255, 255, 0.8); }
.ctx-item:disabled { opacity: 0.4; cursor: default; }
.ctx-item.danger { color: var(--danger); }
.ctx-item.danger:hover { background: var(--danger); color: #fff; }
.ctx-item kbd { font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; padding: 0; }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--line); }
/* Command bar (⌘K) */
.cmd-backdrop { position: fixed; inset: 0; z-index: 900; background: rgba(15, 14, 20, 0.18); display: flex; justify-content: center; align-items: flex-start; padding-top: 14vh; animation: fade-in var(--fast) var(--ease); }
.cmd-backdrop[hidden] { display: none; }
.cmd { width: 520px; max-width: calc(100vw - 32px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22), 0 2px 6px rgba(0, 0, 0, 0.08); overflow: hidden; animation: rise-in var(--mid) var(--ease-out); }
.cmd-input { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 50px; border-bottom: 1px solid var(--line); }
.cmd-input svg { color: var(--muted); }
.cmd-input input { flex: 1; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 15px; outline: none; }
.cmd-list { max-height: 340px; overflow-y: auto; padding: 6px; }
.cmd-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 34px; padding: 0 10px; border-radius: 7px; font-size: 13.5px; cursor: pointer; color: var(--text); }
.cmd-item.on { background: var(--accent); color: #fff; }
.cmd-item kbd { font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; padding: 0; }
.cmd-item.on kbd { color: rgba(255, 255, 255, 0.8); }
.cmd-empty { padding: 14px 10px; color: var(--muted); font-size: 13px; }
.overlay.rect-ov { outline-offset: 0; }
/* Marks: highlighter ink multiplies with the page like the real thing; whiteout takes the paper colour. */
.rect-ov.highlight, .mark-live.highlight { --mark: var(--hl-mark, rgba(255, 224, 0, 0.55)); mix-blend-mode: multiply; }
.rect-ov.whiteout, .mark-live.whiteout { --mark: var(--paper, #fff); }
.rect-ov.redact, .mark-live.redact { --mark: #000; }
.rect-ov { background: var(--mark); }
.rect-ov:has(> i) { background: transparent; cursor: text; outline-color: transparent !important; }
.rect-ov:has(> i) .handle { display: none; }
.rect-ov.active > i { box-shadow: 0 0 0 1.5px var(--accent); }
.rect-ov > i, .mark-live > i { position: absolute; background: var(--mark); border-radius: 1.5px; pointer-events: none; }
.rect-ov.highlight > i, .mark-live.highlight > i { border-radius: 2.5px; }
.mark-live { position: absolute; inset: 0; z-index: 4; pointer-events: none; }
.tool-box { position: absolute; z-index: 4; pointer-events: none; border-radius: 1px; }
.tool-box.highlight { background: rgba(255, 212, 0, 0.42); mix-blend-mode: multiply; }
.tool-box.whiteout { background: #fff; outline: 1px dashed var(--accent); }
.tool-box.redact { background: rgba(0, 0, 0, 0.85); }
.ink-live { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 4; pointer-events: none; }

/* ---------- Export options */
.opt-rows { display: flex; flex-direction: column; gap: 8px; margin: 14px 0 4px; }
.opt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.opt-row > span { color: var(--text); }
.opt-row .inline-input { width: 210px; margin: 0; height: 30px; }
.select {
  -webkit-appearance: none; appearance: none; width: 210px; height: 30px; padding: 0 28px 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23888' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 10px center;
  font: inherit; color: var(--text); cursor: pointer;
}
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.inline-input:disabled { opacity: 0.55; }

.modal.narrow { width: 380px; }
.pw-error { color: var(--danger); font-size: 12px; margin: 8px 0 0; }

/* ---------- Fillable form fields */
.field-hint { position: absolute; z-index: 2; background: rgba(108, 99, 230, 0.10); border-bottom: 1.5px solid rgba(108, 99, 230, 0.55); border-radius: 2px; cursor: text; transition: background var(--fast); }
.field-hint.check { cursor: pointer; border: 1.5px solid rgba(108, 99, 230, 0.55); }
.field-hint:hover { background: rgba(108, 99, 230, 0.2); }
.reader.placing .field-hint, .reader.reviewing .field-hint { pointer-events: none; opacity: 0.5; }

/* ---------- Edit text in place */
.reader.editing-text .page { cursor: text; }
.edit-hover { position: absolute; z-index: 2; pointer-events: none; outline: 1.5px solid rgba(108, 99, 230, 0.6); background: rgba(108, 99, 230, 0.07); border-radius: 2px; }
.overlay.edit-ov { outline-offset: 0; }
.edit-ov .edit-text { position: absolute; white-space: pre; line-height: 1; pointer-events: none; }
.edit-input { position: absolute; z-index: 6; border: 0; padding: 0; margin: 0; line-height: 1.2; outline: 1.5px solid var(--accent); outline-offset: 2px; border-radius: 1px; field-sizing: content; user-select: text; box-shadow: 0 0 0 5px var(--accent-soft); }
.edit-ov .handle { display: none; }
.overlay.edit-ov { cursor: text; }
/* Edited paragraphs: covers over the changed lines, words placed where they'll be in the PDF */
.overlay.para-ov { cursor: text; outline-color: transparent; }
.overlay.para-ov.active { outline: 1.5px dashed var(--accent); outline-offset: 2px; }
.para-ov .para-cover { position: absolute; pointer-events: none; }
.para-ov .para-word { position: absolute; white-space: pre; transform-origin: 0 0; pointer-events: none; }
.para-edit-cover { position: absolute; z-index: 5; pointer-events: none; }
.audit-preview .page { outline: 1.5px dashed var(--line-strong); outline-offset: 4px; opacity: 0.92; }
.audit-preview .pnum { color: var(--accent); }
.para-editor {
  position: absolute; z-index: 6; outline: none; white-space: normal; word-break: normal; text-align-last: left; caret-color: var(--accent);
  box-shadow: 0 0 0 1.5px rgba(108, 99, 230, 0.55), 0 0 0 5px rgba(108, 99, 230, 0.12); border-radius: 2px; cursor: text;
}
.add-grid .tool.wide { grid-column: 1 / -1; }

/* ---------- Batch */
.drop-actions { display: flex; gap: 8px; justify-content: center; }
.modal.batch { width: 520px; }
.batch-drop { border: 1px dashed var(--line-strong, var(--line)); border-radius: var(--r); padding: 22px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; transition: padding .18s ease; }
.batch-drop.compact { flex-direction: row; justify-content: space-between; padding: 10px 12px; }
.batch-pick { display: flex; gap: 6px; }
.batch-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r); }
.b-row { display: grid; grid-template-columns: 1fr auto 20px; align-items: center; gap: 10px; padding: 7px 10px; font-size: 12.5px; border-top: 1px solid var(--line); }
.b-row:first-child { border-top: 0; }
.b-row.done { cursor: pointer; }
.b-row.done:hover { background: var(--hover, rgba(127,127,127,.06)); }
.b-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-note { color: var(--muted); font-size: 12px; white-space: nowrap; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.b-row.fail .b-note { color: var(--danger, #d92d20); }
.b-state svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.b-row.done .b-state { color: var(--accent); }
.b-row.fail .b-state { color: var(--danger, #d92d20); }
.b-spin { display: block; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.b-del { border: 0; background: none; padding: 2px; color: var(--muted); cursor: pointer; border-radius: 4px; }
.b-del:hover { color: var(--text); background: var(--hover, rgba(127,127,127,.08)); }
.b-del svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; display: block; }
.batch-count { margin: 6px 0 2px; min-height: 16px; }
.select.block { width: 100%; }
.batch-out { display: flex; align-items: center; gap: 10px; min-width: 0; }
.batch-out #batchOut { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font: inherit; font-size: 13px; }
.link-btn:hover { text-decoration: underline; }
.batch-status { margin-right: auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.check.disabled { opacity: .45; }
/* Dragging a document card to a new place on the home screen */
.recent-ghost { opacity: 0.35; }
.recent.sortable-chosen .recent-thumb { box-shadow: var(--page-shadow-hover); }

/* Share link created: it's already copied */
.link-copied { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r); background: rgba(18, 128, 74, 0.08); margin-bottom: 12px; animation: rise-in var(--mid) var(--ease-out); }
.link-copied b { font-size: 13px; font-weight: 600; }
.link-check { width: 26px; height: 26px; flex: none; border-radius: 50%; background: var(--success); color: #fff; display: flex; align-items: center; justify-content: center; animation: pop-in var(--slow) var(--spring); }
.link-check svg { width: 14px; height: 14px; stroke-width: 2.2; }
.link-row { position: relative; }
.link-field { width: 100%; font-size: 12px; cursor: copy; color: var(--muted); }
.link-again { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 600; color: var(--success); background: var(--surface); padding: 0 4px; animation: fade-in var(--fast) var(--ease); }

/* "Check before signing" under the summary */
.sum-check { margin-top: 12px; padding: 10px 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--warn) 9%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 22%, transparent); }
.sum-check h4 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--text); }
.sum-check ul { margin: 0; padding-left: 16px; }
.sum-check li { font-size: 12.5px; line-height: 1.5; color: var(--text); }
.sum-check li + li { margin-top: 4px; }
