/* =========================================================
   Signatures: handwriting fonts (SIL OFL 1.1, see /fonts/signature/LICENSE-OFL.txt)
   and the signature dialog shared by /sign and the editor
   ========================================================= */
@font-face { font-family: 'lp-sig-dancing-script'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/dancing-script-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'lp-sig-dancing-script'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/dancing-script-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'lp-sig-great-vibes'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/great-vibes-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'lp-sig-great-vibes'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/great-vibes-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'lp-sig-allura'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/allura-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'lp-sig-allura'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/allura-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'lp-sig-caveat'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/caveat-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'lp-sig-caveat'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/caveat-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'lp-sig-sacramento'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/sacramento-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'lp-sig-sacramento'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/sacramento-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'lp-sig-mrs-saint-delafield'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/mrs-saint-delafield-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'lp-sig-mrs-saint-delafield'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/mrs-saint-delafield-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'lp-sig-herr-von-muellerhoff'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/herr-von-muellerhoff-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'lp-sig-herr-von-muellerhoff'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/herr-von-muellerhoff-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'lp-sig-alex-brush'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/alex-brush-latin-400-normal.woff2') format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'lp-sig-alex-brush'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/signature/alex-brush-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* ---------- dialog ---------- */
.sig-dialog { border: 0; padding: 0; border-radius: 16px; width: min(640px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); box-shadow: var(--shadow-lg); color: var(--text); background: #fff; overflow: auto; }
.sig-dialog::backdrop { background: rgba(11, 19, 36, 0.55); backdrop-filter: blur(2px); }
.sig-dialog-sm { width: min(440px, calc(100vw - 24px)); }
.sig-box { padding: 20px 22px 18px; display: flex; flex-direction: column; gap: 14px; margin: 0; }
.sig-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sig-head h2 { margin: 0; font-size: 1.15rem; letter-spacing: -0.01em; }
.sig-close { border: 0; background: transparent; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.sig-close:hover { background: var(--bg-soft); color: var(--ink); }
.sig-close svg { width: 18px; height: 18px; }
.sig-label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--muted); margin: 0 0 6px; }

.sig-saved { display: flex; flex-direction: column; gap: 6px; }
.sig-saved > span { font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.sig-saved-list { display: flex; flex-wrap: wrap; gap: 8px; }
.sig-saved-item { position: relative; }
.sig-saved-item > button:first-child { border: 1px solid var(--line-2); background: #fff; border-radius: 10px; height: 56px; padding: 6px 12px; cursor: pointer; }
.sig-saved-item > button:first-child:hover { border-color: var(--lime-600); box-shadow: 0 0 0 3px var(--lime-100); }
.sig-saved-item img { height: 100%; max-width: 150px; object-fit: contain; display: block; }
.sig-forget { position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; border-radius: 50%; border: 1px solid var(--line-2); background: #fff; display: grid; place-items: center; cursor: pointer; padding: 0; color: var(--muted); }
.sig-forget svg { width: 11px; height: 11px; }
.sig-forget:hover { color: var(--danger); border-color: var(--danger); }

.sig-tabs { display: flex; gap: 4px; background: var(--bg-soft); border: 1px solid var(--line); padding: 4px; border-radius: 10px; }
.sig-tabs button { flex: 1; border: 0; background: transparent; padding: 8px 10px; border-radius: 7px; font: inherit; font-size: 0.9rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.sig-tabs button[aria-selected="true"] { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }

.sig-text { width: 100%; font: inherit; font-size: 1rem; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 10px; }
.sig-text:focus { outline: none; border-color: var(--lime-600); box-shadow: 0 0 0 3px var(--lime-100); }
.sig-fonts { border: 0; padding: 0; margin: 12px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; max-height: 300px; overflow: auto; }
.sig-fonts legend { grid-column: 1 / -1; }
.sig-font { position: relative; display: flex; flex-direction: column; justify-content: center; min-height: 82px; padding: 8px 12px 6px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; overflow: hidden; background: #fff; }
.sig-font input { position: absolute; opacity: 0; pointer-events: none; }
.sig-font:hover { border-color: var(--line-2); }
.sig-font:has(input:checked) { border-color: var(--lime-600); box-shadow: 0 0 0 2px var(--lime-500) inset; background: var(--lime-50); }
.sig-font:has(input:focus-visible) { outline: 2px solid var(--lime-700); outline-offset: 2px; }
.sig-font-sample { line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sig-font-name { font-size: 0.7rem; color: var(--muted-2); margin-top: 2px; }

.sig-pad-wrap { position: relative; height: 190px; border: 1px solid var(--line-2); border-radius: 12px; background: #fff; overflow: hidden; }
.sig-pad { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; z-index: 1; }
.sig-pad-line { position: absolute; left: 22px; right: 22px; bottom: 46px; border-bottom: 1px solid var(--line-2); }
.sig-pad-line span { position: absolute; left: 0; bottom: 4px; font-size: 0.85rem; color: var(--muted-2); }
.sig-pad-hint { position: absolute; inset: 0; margin: 0; display: grid; place-items: center; color: var(--muted-2); font-size: 0.95rem; pointer-events: none; }
.sig-pad-hint[hidden] { display: none; }
.sig-pad-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 6px; }

.sig-upload { display: flex; align-items: center; gap: 14px; min-height: 120px; padding: 16px; border: 1.5px dashed var(--line-2); border-radius: 12px; cursor: pointer; background: var(--bg-soft); }
.sig-upload:hover { border-color: var(--lime-600); background: var(--lime-50); }
.sig-upload-text { display: flex; flex-direction: column; gap: 4px; }
.sig-upload-text small { color: var(--muted); }
.sig-upload-preview { flex: 0 0 auto; width: 180px; height: 90px; border-radius: 8px; background: #fff conic-gradient(#f1f5f9 25%, #fff 0 50%, #f1f5f9 0 75%, #fff 0) 0 0 / 14px 14px; border: 1px solid var(--line); display: grid; place-items: center; padding: 6px; }
.sig-upload-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sig-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; color: var(--text); cursor: pointer; }
.sig-panel .sig-check { margin-top: 10px; }

.sig-inks { display: flex; align-items: center; gap: 10px; }
.sig-inks .sig-label { margin: 0 4px 0 0; }
.sig-ink { position: relative; cursor: pointer; }
.sig-ink input { position: absolute; opacity: 0; }
.sig-ink span:not(.visually-hidden) { display: block; width: 24px; height: 24px; border-radius: 50%; box-shadow: 0 0 0 2px #fff, 0 0 0 3px var(--line-2); }
.sig-ink input:checked + span { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
.sig-ink input:focus-visible + span { outline: 2px solid var(--lime-700); outline-offset: 4px; }

.sig-error { margin: 0; color: var(--danger); font-size: 0.88rem; }
.sig-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 14px; }
.sig-foot-actions { display: flex; gap: 8px; margin-left: auto; }
.sig-remove { color: var(--danger); }

@media (max-width: 560px) {
  .sig-box { padding: 16px 14px 14px; }
  .sig-fonts { grid-template-columns: 1fr; max-height: 240px; }
  .sig-foot-actions { width: 100%; justify-content: flex-end; }
  .sig-upload-preview { width: 120px; }
}
