/* pdf-sign.css – Sign PDF page (loaded after /assets/css/site.css). */

/* text fields use Liberation Sans (metric-compatible with Helvetica, the PDF font they are written in) */
@font-face { font-family: "PE Sans"; src: url(/assets/fonts/editor/pe-sans-regular.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
/* handwriting styles for typed signatures (SIL Open Font License / Apache 2.0, see /assets/fonts/signature/LICENSES.txt) */
@font-face { font-family: "SG Dancing Script"; src: url(/assets/fonts/signature/dancing-script.woff) format("woff"); font-display: swap; }
@font-face { font-family: "SG Great Vibes"; src: url(/assets/fonts/signature/great-vibes.woff) format("woff"); font-display: swap; }
@font-face { font-family: "SG Allura"; src: url(/assets/fonts/signature/allura.woff) format("woff"); font-display: swap; }
@font-face { font-family: "SG Sacramento"; src: url(/assets/fonts/signature/sacramento.woff) format("woff"); font-display: swap; }
@font-face { font-family: "SG Satisfy"; src: url(/assets/fonts/signature/satisfy.woff) format("woff"); font-display: swap; }
@font-face { font-family: "SG Alex Brush"; src: url(/assets/fonts/signature/alex-brush.woff) format("woff"); font-display: swap; }
@font-face { font-family: "SG Mr Dafoe"; src: url(/assets/fonts/signature/mr-dafoe.woff) format("woff"); font-display: swap; }
@font-face { font-family: "SG Homemade Apple"; src: url(/assets/fonts/signature/homemade-apple.woff) format("woff"); font-display: swap; }
@font-face { font-family: "SG Cedarville Cursive"; src: url(/assets/fonts/signature/cedarville-cursive.woff) format("woff"); font-display: swap; }

.sg { --sg-line: #e2e8f0; --sg-ink: #1a202c; --sg-muted: #4a5568; --sg-soft: #718096; --sg-bg: #eef2f7; --sg-acc: var(--accent, #3666d1); --sg-acc-soft: var(--accent-soft, #eef3fc);
      position: relative; max-width: 1400px; margin: 0 auto 2.5rem; padding: 0 12px; }
.sg [hidden] { display: none !important; }

/* ---------- start ---------- */
.sg-start { max-width: 860px; margin: 0 auto; }
.sg.is-loaded .sg-start { display: none; }
.sg-start-points { display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.2rem; margin: .9rem 0 0; padding: 0; list-style: none; color: var(--sg-muted); font-size: .9rem; }
.sg-start-points li::before { content: "✓ "; color: #38a169; font-weight: 700; }
.sg-error { max-width: 860px; margin: .8rem auto 0; padding: .75rem 1rem; border: 1px solid #feb2b2; border-radius: 10px; background: #fff5f5; color: #9b2c2c; }

/* ---------- workspace ---------- */
.sg-work { display: none; flex-direction: column; height: calc(100vh - var(--header-h, 64px) - 24px); min-height: 560px; border: 1px solid var(--sg-line); border-radius: 14px; overflow: hidden; background: #fff; box-shadow: 0 8px 30px rgba(15, 23, 42, .08); scroll-margin-top: calc(var(--header-h, 64px) + 12px); }
.sg.is-loaded .sg-work { display: flex; }
.sg-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; row-gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--sg-line); background: #fff; flex: none; }
.sg-group { display: flex; align-items: center; gap: 2px; padding-right: 6px; margin-right: 2px; border-right: 1px solid var(--sg-line); flex: none; }
.sg-group:last-child { border-right: 0; margin-left: auto; padding-right: 0; }
.sg-tb { display: inline-flex; align-items: center; justify-content: center; min-width: 38px; height: 38px; padding: 0 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: #2d3748; cursor: pointer; }
.sg-tb svg { width: 20px; height: 20px; }
.sg-tb:hover:not(:disabled) { background: #f1f5f9; }
.sg-tb:disabled { opacity: .35; cursor: default; }
.sg-tb:focus-visible, .sg-download:focus-visible, .sg-field:focus-visible, .sg-slot:focus-visible { outline: 2px solid var(--sg-acc); outline-offset: 2px; }
.sg-zoom-val { min-width: 48px; text-align: center; font-size: .85rem; font-weight: 600; color: var(--sg-muted); font-variant-numeric: tabular-nums; }
.sg-pagebox { display: flex; align-items: center; gap: 5px; font-size: .85rem; color: var(--sg-muted); padding: 0 4px; }
.sg-pageinput { width: 50px; height: 32px; padding: 0 4px; border: 1px solid #cbd5e0; border-radius: 7px; text-align: center; font: inherit; }
.sg-download { height: 40px; padding: 0 16px; border: 0; border-radius: 10px; background: var(--brand, #3666d1); color: #fff; font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.sg-download:hover { background: var(--brand-dark, #2b4c94); }
.sg-download svg { width: 18px; height: 18px; }

.sg-body { display: flex; flex: 1; min-height: 0; }

/* left: signature, initials, fields */
.sg-side { width: 230px; flex: none; overflow-y: auto; padding: 14px 12px; border-right: 1px solid var(--sg-line); background: #f8fafc; display: flex; flex-direction: column; gap: 8px; }
.sg-side-h { margin: 4px 0 0; font-size: .78rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--sg-soft); }
.sg-slotwrap { display: flex; flex-direction: column; gap: 6px; }
.sg-slot { position: relative; height: 76px; padding: 8px 10px; border: 1.5px solid #cbd5e0; border-radius: 10px; background: #fff; cursor: grab; display: flex; align-items: center; justify-content: center; touch-action: none; }
.sg-slot svg, .sg-slot img { max-width: 100%; max-height: 100%; width: auto; height: 100%; display: block; pointer-events: none; }
.sg-slot svg { width: 100%; }
.sg-slot:hover { border-color: var(--sg-acc); box-shadow: 0 0 0 3px var(--sg-acc-soft); }
.sg-slotwrap.is-empty .sg-slot { border-style: dashed; cursor: pointer; }
.sg-slot-add { font-size: .9rem; font-weight: 700; color: var(--sg-acc); }
.sg-slot-tools { display: flex; gap: 6px; }
.sg-slotwrap.is-empty .sg-slot-tools { display: none; }
.sg-slot-btn { flex: 1; height: 28px; border: 1px solid #cbd5e0; border-radius: 7px; background: #fff; font: inherit; font-size: .78rem; font-weight: 600; color: var(--sg-muted); cursor: pointer; }
.sg-slot-btn:hover { background: #f1f5f9; }
.sg-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.sg-field { display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 10px; border: 1px solid #cbd5e0; border-radius: 9px; background: #fff; font: inherit; font-size: .86rem; font-weight: 600; color: #2d3748; cursor: grab; touch-action: none; }
.sg-field svg { width: 18px; height: 18px; flex: none; color: var(--sg-acc); }
.sg-field:hover { border-color: var(--sg-acc); }
.sg-side-note { margin: 4px 0 0; font-size: .78rem; line-height: 1.45; color: var(--sg-soft); }
.is-dragging { opacity: .5; }
.sg-ghost { position: fixed; z-index: 3050; transform: translate(-50%, -50%); pointer-events: none; opacity: .85; outline: 1.5px dashed var(--accent, #3666d1); outline-offset: 2px; }
.sg-ghost svg, .sg-ghost img { width: 100%; height: 100%; display: block; }
.sg-ghost .sg-tline { font-family: "PE Sans", "Liberation Sans", Arial, Helvetica, sans-serif; white-space: pre; color: #0f172a; }

/* pages */
.sg-view { flex: 1; min-width: 0; overflow: auto; background: var(--sg-bg); position: relative; overscroll-behavior: contain; }
.sg-pages { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 20px 20px 60px; min-width: min-content; }
.sg-page { position: relative; flex: none; background: #fff; box-shadow: 0 1px 4px rgba(15, 23, 42, .18), 0 6px 18px rgba(15, 23, 42, .08); }
.sg-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.sg-layer { position: absolute; inset: 0; }
.sg-pnum { position: absolute; bottom: -18px; right: 0; font-size: .72rem; color: var(--sg-soft); }

.sg-item { position: absolute; box-sizing: border-box; cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; }
.sg-item svg, .sg-item img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; overflow: visible; }
.sg-item:hover { outline: 1px dashed rgba(54, 102, 209, .6); outline-offset: 2px; }
.sg-item.is-sel { outline: 1.5px solid var(--sg-acc); outline-offset: 3px; }
.sg-tline { display: block; white-space: pre; font-family: "PE Sans", "Liberation Sans", Arial, Helvetica, sans-serif; font-kerning: none; font-variant-ligatures: none; font-synthesis: none; pointer-events: none; }
.sg-h { position: absolute; width: 12px; height: 12px; margin: -6px 0 0 -6px; border: 2px solid var(--sg-acc); border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); z-index: 2; touch-action: none; }
.sg-h::after { content: ""; position: absolute; inset: -10px; }
.sg-h-nw { left: -3px; top: -3px; cursor: nwse-resize; } .sg-h-ne { left: calc(100% + 3px); top: -3px; cursor: nesw-resize; }
.sg-h-se { left: calc(100% + 3px); top: calc(100% + 3px); cursor: nwse-resize; } .sg-h-sw { left: -3px; top: calc(100% + 3px); cursor: nesw-resize; }
.sg-x { position: absolute; top: -30px; right: -6px; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 50%; background: #2b4c94; color: #fff; font-size: 16px; line-height: 24px; cursor: pointer; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); z-index: 3; }

/* right: settings */
.sg-props { width: 260px; flex: none; overflow-y: auto; border-left: 1px solid var(--sg-line); background: #fff; padding: 14px 14px 18px; display: flex; flex-direction: column; gap: 10px; }
.sg-props-title { margin: 0; font-size: 1rem; font-weight: 700; color: var(--sg-ink); }
.sg-props-body { display: flex; flex-direction: column; gap: 12px; }
.sg-steps { margin: 0; padding-left: 1.2rem; font-size: .86rem; line-height: 1.5; color: var(--sg-muted); display: flex; flex-direction: column; gap: 6px; }
.sg-f { display: flex; flex-direction: column; gap: 5px; font-size: .82rem; color: var(--sg-muted); font-weight: 600; }
.sg-f input[type=text], .sg-f select { height: 36px; padding: 0 9px; border: 1px solid #cbd5e0; border-radius: 8px; background: #fff; font: inherit; font-weight: 500; color: var(--sg-ink); min-width: 0; }
.sg-f input[type=range] { width: 100%; accent-color: var(--sg-acc); }
.sg-f output { color: var(--sg-ink); }
.sg-inks { display: flex; flex-wrap: wrap; gap: 8px; }
.sg-ink { width: 28px; height: 28px; padding: 0; border: 2px solid #fff; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 1px #cbd5e0; cursor: pointer; }
.sg-ink.is-on { box-shadow: 0 0 0 2px var(--sg-acc); }
.sg-ink-auto { background: conic-gradient(#2b4c94, #0f172a, #3666d1, #2b4c94); position: relative; }
.sg-ink-auto::after { content: "A"; position: absolute; inset: 0; color: #fff; font-size: .72rem; font-weight: 700; line-height: 24px; text-align: center; }
.sg-ink-orig { background: conic-gradient(#3666d1, #d69e2e, #38a169, #3666d1, #5a82db, #3666d1); }
.sg-copy { display: flex; gap: 6px; }
.sg-copy input { flex: 1; }
.sg-act { height: 36px; padding: 0 12px; border: 1px solid #cbd5e0; border-radius: 8px; background: #fff; font: inherit; font-size: .84rem; font-weight: 600; color: #2d3748; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.sg-act svg { width: 16px; height: 16px; }
.sg-act:hover { background: #f7fafc; }
.sg-act.is-danger { color: #c53030; border-color: #feb2b2; }
.sg-props-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding-top: 8px; border-top: 1px solid var(--sg-line); }
.sg-geo { margin-top: auto; font-size: .74rem; color: var(--sg-soft); font-variant-numeric: tabular-nums; }
.sg-count { margin: 0; font-size: .78rem; color: var(--sg-soft); }
.sg-keys { font-size: .82rem; color: var(--sg-muted); }
.sg-keys summary { cursor: pointer; font-weight: 600; }
.sg-keys dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin: 8px 0 0; }
.sg-keys dt { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .76rem; background: #edf2f7; border-radius: 4px; padding: 1px 5px; justify-self: start; }
.sg-keys dd { margin: 0; }

/* ---------- create-signature dialog ---------- */
html.sg-modal-open { overflow: hidden; }
.sg-modal { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(15, 23, 42, .55); }
.sg-dialog { width: min(720px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: #fff; border-radius: 16px; box-shadow: 0 24px 60px rgba(0, 0, 0, .3); padding: 18px 20px 16px; display: flex; flex-direction: column; gap: 14px; }
.sg-m-head { display: flex; align-items: center; justify-content: space-between; }
.sg-m-title { margin: 0; font-size: 1.15rem; font-weight: 700; color: var(--sg-ink); }
.sg-m-close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f1f5f9; font-size: 22px; line-height: 1; color: #4a5568; cursor: pointer; }
.sg-tabs { display: flex; gap: 4px; padding: 4px; border-radius: 11px; background: #f1f5f9; }
.sg-tab { flex: 1; height: 38px; border: 0; border-radius: 8px; background: transparent; font: inherit; font-weight: 700; font-size: .92rem; color: var(--sg-muted); cursor: pointer; }
.sg-tab.is-on { background: #fff; color: var(--sg-ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.sg-pad-wrap { position: relative; border: 1.5px solid #cbd5e0; border-radius: 12px; background: #fff; overflow: hidden; }
.sg-pad { display: block; width: 100%; height: 240px; touch-action: none; cursor: crosshair; }
.sg-pad-line { position: absolute; left: 7%; right: 7%; bottom: 26%; border-bottom: 1.5px solid #cbd5e0; pointer-events: none; }
.sg-pad-line::before { content: "✕"; position: absolute; left: -2px; bottom: 4px; color: #a0aec0; font-size: 15px; }
.sg-pad-hint { position: absolute; left: 0; right: 0; top: 34%; text-align: center; color: #a0aec0; font-size: .95rem; pointer-events: none; }
.sg-pad-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sg-thick-l { display: flex; align-items: center; gap: 8px; margin-right: auto; font-size: .85rem; font-weight: 600; color: var(--sg-muted); }
.sg-thick { width: 140px; accent-color: var(--sg-acc); }
.sg-type-input { width: 100%; box-sizing: border-box; height: 46px; padding: 0 14px; border: 1.5px solid #cbd5e0; border-radius: 10px; font: inherit; font-size: 1.05rem; }
.sg-type-input:focus { outline: none; border-color: var(--sg-acc); box-shadow: 0 0 0 3px var(--sg-acc-soft); }
.sg-fonts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.sg-font { height: 74px; padding: 0 8px; border: 1.5px solid #e2e8f0; border-radius: 10px; background: #fff; cursor: pointer; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.sg-font span { font-size: 30px; white-space: nowrap; line-height: 1.6; }
.sg-font:hover { border-color: #a0aec0; }
.sg-font.is-on { border-color: var(--sg-acc); box-shadow: 0 0 0 3px var(--sg-acc-soft); }
.sg-up-drop { display: flex; align-items: center; justify-content: center; min-height: 220px; padding: 16px; border: 2px dashed #cbd5e0; border-radius: 12px; cursor: pointer; text-align: center; color: var(--sg-muted); font-size: .92rem; line-height: 1.5;
              background-color: #fff; }
.sg-up-drop.is-over { border-color: var(--sg-acc); background-color: var(--sg-acc-soft); }
.sg-up-empty strong { color: var(--sg-ink); }
.sg-up-preview { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 190px; border-radius: 8px;
                 background: repeating-conic-gradient(#f1f5f9 0% 25%, #fff 0% 50%) 50% / 18px 18px; }
.sg-up-canvas { max-width: 100%; max-height: 210px; width: auto; height: auto; display: block; }
.sg-up-controls { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; }
.sg-check { display: inline-flex; align-items: center; gap: 7px; font-size: .86rem; font-weight: 600; color: var(--sg-muted); cursor: pointer; }
.sg-check input { width: 17px; height: 17px; accent-color: var(--sg-acc); }
.sg-up-sl { display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--sg-muted); flex-wrap: wrap; }
.sg-up-sl input { width: 150px; accent-color: var(--sg-acc); }
.sg-up-scale { display: none; }
.sg-up-status { font-size: .8rem; color: var(--sg-soft); flex-basis: 100%; }
.sg-m-row { display: flex; align-items: center; gap: 12px; }
.sg-m-lbl { font-size: .85rem; font-weight: 700; color: var(--sg-muted); }
.sg-m-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--sg-line); }
.sg-m-btns { display: flex; gap: 8px; margin-left: auto; }
.sg-primary { height: 40px; padding: 0 20px; border: 0; border-radius: 10px; background: var(--accent, #3666d1); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
.sg-primary:hover:not(:disabled) { background: var(--accent-dark, #2b4c94); }
.sg-primary:disabled { opacity: .45; cursor: default; }

.sg-toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 3100; max-width: min(560px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 10px; background: #1a202c; color: #fff; font-size: .9rem; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
.sg-toast.is-warn { background: #9b2c2c; }
.sg-busy { position: fixed; inset: 0; z-index: 3200; display: flex; align-items: center; justify-content: center; background: rgba(255, 255, 255, .7); }
.sg-busy span { padding: 14px 20px; border-radius: 12px; background: #fff; box-shadow: 0 8px 30px rgba(0, 0, 0, .15); font-weight: 600; color: var(--sg-ink); display: flex; align-items: center; gap: 10px; }
.sg-busy span::before { content: ""; width: 18px; height: 18px; border: 3px solid #cbd5e0; border-top-color: var(--sg-acc); border-radius: 50%; animation: sg-spin .8s linear infinite; }
@keyframes sg-spin { to { transform: rotate(360deg); } }

/* ---------- smaller screens ---------- */
@media (max-width: 1100px) { .sg-props { width: 220px; } .sg-side { width: 200px; } }
@media (max-width: 860px) {
    .sg { padding: 0; }
    .sg-work { height: auto; min-height: 0; border-radius: 0; border-left: 0; border-right: 0; }
    .sg-bar { flex-wrap: nowrap; overflow-x: auto; }
    .sg-group:last-child { position: sticky; right: -10px; padding: 0 10px 0 8px; background: #fff; box-shadow: -10px 0 12px -6px rgba(15, 23, 42, .18); }
    .sg-dl-x { display: none; }
    .sg-body { flex-direction: column; }
    .sg-side { width: auto; order: -1; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 8px; padding: 10px; border-right: 0; border-bottom: 1px solid var(--sg-line); align-items: flex-start; }
    .sg-side-h, .sg-side-note { display: none; }
    .sg-slot-tools { gap: 4px; }
    .sg-slot-btn { height: 24px; font-size: .7rem; }
    .sg-slotwrap { flex: none; }
    .sg-slot { width: 128px; height: 54px; }
    .sg-fields { display: flex; gap: 6px; }
    .sg-field { height: 54px; flex-direction: column; justify-content: center; gap: 2px; padding: 0 10px; font-size: .74rem; }
    .sg-view { height: 62vh; min-height: 360px; flex: none; }
    .sg-pages { padding: 14px 10px 40px; gap: 16px; }
    .sg-props { width: auto; border-left: 0; border-top: 1px solid var(--sg-line); }
    .sg-modal { padding: 0; align-items: stretch; }
    .sg-dialog { width: 100%; max-height: none; height: 100%; border-radius: 0; padding: 14px 14px 12px; }
    .sg-pad { height: 46vw; min-height: 170px; max-height: 260px; }
    .sg-fonts { grid-template-columns: 1fr 1fr; }
    .sg-font span { font-size: 24px; }
}
