/* Annotation layer */
.annotation-layer { position: absolute; inset: 0; z-index: 3; }
.annotation-layer[data-mode="draw"] { cursor: crosshair; }
.annotation-layer[data-mode="text"] { cursor: text; }
.annotation-layer[data-mode="erase"] { cursor: not-allowed; }
.annotation-layer[data-mode="pan"] { pointer-events: none; }
.annot-item { position: absolute; pointer-events: none; }
.annotation-layer[data-selectable="true"] .annot-item { pointer-events: auto; cursor: move; }
.annot-hl { border-radius: 2px; mix-blend-mode: multiply; }
:root[data-theme="dark"] .annot-hl { mix-blend-mode: screen; }
.annot-underline { border-bottom-style: solid; }
.annot-strike { text-decoration: line-through; }
.annot-rect { border-style: solid; }
.annot-ellipse { border-radius: 50%; border-style: solid; }
.annot-svg { overflow: visible; }
.annot-text { white-space: pre-wrap; line-height: 1.35; }
.annot-note {
  width: 22px; height: 22px; border-radius: 4px 4px 4px 1px; display: grid; place-items: center;
  font-size: 11px; font-weight: 700; color: #fff; box-shadow: var(--shadow-sm); cursor: pointer;
}
.annot-note-pop {
  position: absolute; z-index: 6; min-width: 168px; max-width: 240px; padding: 8px 10px;
  background: var(--warning-soft); color: var(--text); border: 1px solid color-mix(in srgb, var(--amber-500) 45%, transparent);
  border-radius: var(--r-sm); font-size: var(--fs-xs); line-height: 1.5; box-shadow: var(--shadow-md);
}
.annot-item[data-selected="true"] { outline: 1.5px dashed var(--accent); outline-offset: 2px; }
.annot-handle {
  position: absolute; width: 9px; height: 9px; background: #fff; border: 1.5px solid var(--accent);
  border-radius: 2px; z-index: 4; display: none;
}
.annot-item[data-selected="true"] .annot-handle { display: block; }
.annot-handle[data-dir="se"] { right: -5px; bottom: -5px; cursor: nwse-resize; }
.annot-handle[data-dir="sw"] { left: -5px; bottom: -5px; cursor: nesw-resize; }
.annot-handle[data-dir="ne"] { right: -5px; top: -5px; cursor: nesw-resize; }
.annot-handle[data-dir="nw"] { left: -5px; top: -5px; cursor: nwse-resize; }
.annot-delete {
  position: absolute; top: -11px; right: -11px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--danger); color: #fff; display: none; place-items: center; z-index: 5; box-shadow: var(--shadow-sm);
}
.annot-item[data-selected="true"] .annot-delete { display: grid; }
.annot-draft { position: absolute; pointer-events: none; z-index: 5; }
.annot-color-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* Signature pad */
.sig-pad { position: relative; border: 1px solid var(--surface-border-strong); border-radius: var(--r-md); background: #fff; overflow: hidden; touch-action: none; }
.sig-pad canvas { display: block; width: 100%; height: 160px; cursor: crosshair; touch-action: none; }
.sig-baseline { position: absolute; left: 16px; right: 16px; bottom: 34px; border-bottom: 1px dashed #c9c9d3; pointer-events: none; }

/* Annotation panel (editor side) */
.annot-toolbar-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; }
.annot-tool {
  display: grid; place-items: center; gap: 3px; aspect-ratio: 1; padding: 5px 2px;
  border: 1px solid var(--surface-border); border-radius: var(--r-sm); color: var(--text-secondary);
  background: var(--bg-elevated); transition: background var(--dur-2), color var(--dur-2), border-color var(--dur-2);
}
.annot-tool:hover { background: var(--bg-hover); color: var(--text); }
.annot-tool[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.annot-tool span { font-size: 9px; letter-spacing: .01em; }
