/* esigit app, signer page and free tool. Builds on esigit.css tokens; adds nothing to the palette except
   signer colours 4 and 5 (esigit.css stops at 3). One accent (seal) for action. Hover = colour/opacity only. */

:root {
  --signer-4: #7A4E12; --signer-4-tint: #F3EADC;
  --signer-5: #5B3A6B; --signer-5-tint: #EEE6F1;
  --stage: #ECE9E1;
  --head: 64px;
}

/* ---------- small shared pieces ---------- */
[hidden] { display: none !important; }
#title:focus, [tabindex="-1"]:focus { outline: none; }
a.sr-only:focus { position: fixed; top: 8px; left: 8px; width: auto; height: auto; clip: auto; margin: 0; padding: 10px 16px; background: var(--paper); border: 2px solid var(--seal); border-radius: var(--field); z-index: 200; white-space: normal; }
.link-btn { background: none; border: 0; padding: 0; min-height: 0; font: inherit; color: var(--seal); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; cursor: pointer; transition: color var(--t-color) var(--ease); }
.link-btn:hover { color: var(--seal-hover); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: var(--module); height: var(--module); border: 0; border-radius: 50%; background: transparent; color: var(--ink-2); font: 400 24px/1 var(--text); cursor: pointer; transition: background-color var(--t-color) var(--ease); }
.icon-btn:hover { background: var(--band); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.error-text { color: var(--error); }
.loading::after { content: "\2026"; }
.badge.none { background: var(--band); color: var(--ink-2); }
.h4 { font: 600 17px/25px var(--text); letter-spacing: -0.2px; margin: 0; }
fieldset.plain { border: 0; padding: 0; margin-left: 0; margin-right: 0; min-width: 0; }
fieldset.plain legend { padding: 0; margin-bottom: 12px; }
.check.switch input { margin-top: 2px; }
.pass-wrap { position: relative; }
.pass-wrap input { padding-right: 64px; }
.pass-show { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; }
.notice { align-items: flex-start; }
.notice + * { margin-top: 0; }

.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 96px; z-index: 300; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 440px); pointer-events: none; }
.toast { background: var(--ink); color: var(--paper); padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 20px; box-shadow: 0 8px 24px rgba(29,28,26,.18); transition: opacity var(--t-opacity) var(--ease); }
.toast.ok { background: var(--signed); }
.toast.error { background: var(--error); }
.toast.out { opacity: 0; }

.seg { display: inline-flex; padding: 4px; gap: 4px; background: var(--band); border-radius: var(--pill); }
.seg button { min-height: 36px; padding: 6px 18px; border: 0; border-radius: var(--pill); background: transparent; color: var(--ink-2); font: 400 15px/1 var(--text); cursor: pointer; transition: background-color var(--t-color) var(--ease), color var(--t-color) var(--ease); }
.seg button[aria-selected="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px rgba(29,28,26,.12); }

/* ---------- sheet (native <dialog>): bottom sheet on phones, centred card on desktop ---------- */
dialog.sheet { border: 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); margin: auto auto 0; width: 100%; max-width: 100%; border-radius: 22px 22px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 -12px 40px rgba(29,28,26,.16); max-height: 92vh; overflow: auto; }
dialog.sheet::backdrop { background: rgba(29,28,26,.42); }
@media (min-width: 700px) { dialog.sheet { margin: auto; max-width: 520px; border-radius: 22px; padding: 24px; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: -6px -10px 12px 0; }
.sheet .seg { margin-bottom: 14px; }
.pad { position: relative; height: 170px; background: var(--band); border-radius: 14px; overflow: hidden; }
.pad-canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.pad-line { position: absolute; left: 24px; right: 24px; bottom: 40px; border-bottom: 1px solid var(--ink-3); pointer-events: none; }
.pad-hint { position: absolute; left: 24px; bottom: 14px; font-size: 12px; color: var(--ink-3); pointer-events: none; transition: opacity var(--t-opacity) var(--ease); }
.pad.has-ink .pad-hint { opacity: 0; }
.pad-type { display: flex; align-items: center; padding: 0 28px 28px; }
/* room for the script's swashes (J, S, Y swing past the start; V, W, P past the end; tails below) without moving the layout */
.typed-preview { font: 400 52px/1.3 var(--script); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 6px 44px 10px 20px; margin: -6px -44px -10px -20px; }
.typed-field { margin-top: 12px; }
.pad-tools { display: flex; gap: 20px; margin-top: 10px; min-height: 28px; align-items: center; }

/* ---------- app shell ---------- */
body.app { min-height: 100vh; display: flex; flex-direction: column; }
.app-head { position: sticky; top: 0; z-index: 60; display: flex; align-items: center; gap: 24px; height: var(--head); padding: 0 24px; background: rgba(251,250,247,.9); -webkit-backdrop-filter: saturate(1.8) blur(20px); backdrop-filter: saturate(1.8) blur(20px); border-bottom: 1px solid var(--rule); }
.app-head .logo img { height: 32px; width: auto; }
.steps ol { display: flex; gap: 20px; list-style: none; margin: 0; padding: 0; font-size: 15px; }
.steps li > * { display: inline-flex; gap: 6px; align-items: baseline; text-decoration: none; color: var(--ink-3); }
.steps li.done > * { color: var(--signed); }
.steps li.current > * { color: var(--seal); font-weight: 500; }
.steps a:hover { opacity: .8; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 18px; font-size: 14px; }
#account { display: flex; gap: 16px; align-items: center; }
#account a { color: var(--ink-2); text-decoration: none; }
#account a:hover { color: var(--ink); }
#saved { color: var(--ink-3); }
.actions { display: flex; gap: 10px; }
.actions[hidden] { display: none; }
.offline { margin: 0; padding: 10px 24px; background: #FBEDEB; color: var(--error); font-size: 14px; text-align: center; }
:is(body.app, body.sign-page) main#main { flex: 1; width: 100%; max-width: 1080px; margin: 0 auto; padding: 40px 24px 120px; }
:is(body.app, body.sign-page) main#main > h1 { font-size: clamp(30px, 4vw, 40px); margin-bottom: 24px; }
body.app[data-route="fields"] main#main { max-width: none; padding: 0; display: flex; flex-direction: column; }

@media (max-width: 900px) {
  /* backdrop-filter would make the header the containing block of the fixed bottom action bar */
  .app-head { gap: 12px; padding: 0 16px; height: 56px; --head: 56px; background: var(--paper); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .steps li:not(.current) .step-l { display: none; }
  .steps ol { gap: 12px; font-size: 14px; }
  .head-right { gap: 12px; }
  #saved { display: none; }
  .actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 70; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--rule); }
  .actions .btn { flex: 1; }
  .actions .btn-quiet { flex: 0 0 auto; }
  :is(body.app, body.sign-page) main#main { padding: 24px 16px 120px; }
}
@media (max-width: 420px) { .steps .step-l { display: none; } .steps li.current .step-l { display: inline; } }

/* ---------- upload ---------- */
.upload { display: grid; justify-items: center; gap: 16px; }
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; width: min(100%, 380px); aspect-ratio: 8.5 / 11; padding: 32px; background: var(--paper); border-radius: 6px; box-shadow: 0 1px 0 var(--rule), 0 18px 40px rgba(29,28,26,.08); cursor: pointer; text-align: center; transition: background-color var(--t-color) var(--ease); }
.dropzone::before { content: ""; position: absolute; inset: 14px; border: 1.5px dashed var(--rule); border-radius: 4px; transition: border-color var(--t-color) var(--ease); pointer-events: none; }
.dropzone:hover::before, .dropzone.over::before { border-color: var(--seal); }
.dropzone.over { background: var(--signer-1-tint); }
.dropzone.focus { outline: 2px solid var(--seal); outline-offset: 4px; }
.dropzone.busy { opacity: .6; pointer-events: none; }
.dz-sheet { position: relative; width: 44px; height: 56px; border: 1.5px solid var(--ink-3); border-radius: 3px; margin-bottom: 4px; }
.dz-fold { position: absolute; top: -1.5px; right: -1.5px; width: 14px; height: 14px; background: var(--paper); border-left: 1.5px solid var(--ink-3); border-bottom: 1.5px solid var(--ink-3); }
.dz-title { font: 500 24px/1.2 var(--display); }
.dz-cap { max-width: 240px; }
.upload-status { width: min(100%, 520px); min-height: 24px; }
.upload-notes { list-style: none; padding: 0; margin: 28px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px; text-align: center; }
.draft-card { max-width: 620px; margin: 0 auto 8px; }
body[data-route="new"] main#main > h1, body[data-route="new"] main#main > .muted { text-align: center; }
body[data-route="new"] .small.muted.mt-3 { text-align: center; }

/* ---------- signers ---------- */
.signer-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 16px; }
.signer { padding: 16px; border-radius: var(--card); background: var(--band); }
.signer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.signer-dot { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: var(--c, var(--seal)); color: var(--paper); font: 600 12px/1 var(--text); }
.signer-tools { margin-left: auto; display: flex; gap: 16px; font-size: 14px; }
.signer-fields { display: grid; grid-template-columns: 1fr 1.3fr; gap: 12px; }
@media (max-width: 600px) { .signer-fields { grid-template-columns: 1fr; } }
.signer .field input { background: var(--paper); }
.order .check + .check { margin-top: 12px; }

/* ---------- field placement ---------- */
.fields-layout { display: grid; grid-template-columns: 1fr 340px; height: calc(100vh - var(--head)); height: calc(100dvh - var(--head)); }
.fields-layout > * { min-height: 0; }
.stage { position: relative; display: flex; flex-direction: column; min-width: 0; background: var(--stage); }
.page-info { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 5; background: rgba(251,250,247,.92); padding: 4px 12px; border-radius: var(--pill); }
.side { border-left: 1px solid var(--rule); padding: 24px; display: flex; flex-direction: column; gap: 12px; background: var(--paper); overflow: auto; }
.owners { display: grid; gap: 8px; }
.owner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--rule); border-radius: 12px; cursor: pointer; transition: border-color var(--t-color) var(--ease); }
.owner:hover { border-color: var(--c); }
.owner-ring { flex: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--c); }
.owner:has(input:checked) { border: 2px solid var(--c); padding: 11px 13px; background: var(--t); }
.owner:has(input:checked) .owner-ring { background: radial-gradient(circle, var(--c) 0 3px, transparent 4px); }
.owner:has(input:focus-visible) { outline: 2px solid var(--seal); outline-offset: 2px; }
.owner-text { display: flex; flex-direction: column; min-width: 0; }
.owner-name { font-weight: 500; }
.owner-text .caption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette { display: grid; gap: 8px; }
.pal { display: flex; align-items: center; gap: 12px; min-height: var(--module); padding: 10px 14px; border: 0; border-radius: 12px; background: var(--band); color: var(--ink); font: 400 17px/1 var(--text); text-align: left; cursor: grab; touch-action: manipulation; user-select: none; transition: opacity var(--t-opacity) var(--ease); }
.pal:hover { opacity: .8; }
.pal-icon { width: 22px; height: 16px; border: 1.5px dashed var(--ink-3); border-radius: 3px; flex: none; }
.pal[data-type="checkbox"] .pal-icon { width: 16px; border-style: solid; }
.side-foot { margin-top: auto; padding-top: 12px; }
.field-counts { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; color: var(--ink-2); }
.field-counts li::before { content: "\2713  "; color: var(--signed); }
.field-counts li.need { color: var(--error); }
.field-counts li.need::before { content: "!  "; color: var(--error); font-weight: 600; }
.price-card { padding: 16px; border-radius: 12px; background: var(--band); }
.price-card .caption { margin-top: 4px; }
.show-touch { display: none; }
@media (hover: none) { .show-touch { display: inline; } .hide-touch { display: none; } }

@media (max-width: 900px) {
  .fields-layout { display: flex; flex-direction: column; min-height: 0; }
  .stage { height: calc(100vh - var(--head) - 210px); height: calc(100dvh - var(--head) - 210px); }
  .side { position: fixed; left: 0; right: 0; bottom: calc(69px + env(safe-area-inset-bottom)); top: auto; height: auto; z-index: 65; padding: 10px 16px; gap: 8px; border-left: 0; border-top: 1px solid var(--rule); overflow: visible; }
  .side h2, .side > .caption, .side-foot .price-card { display: none; }
  .owners { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; padding-bottom: 2px; }
  .owner { flex: none; padding: 6px 12px; min-height: var(--module); }
  .owner:has(input:checked) { padding: 5px 11px; }
  .owner-text .caption { display: none; }
  .palette { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .pal { flex: none; font-size: 15px; padding: 8px 14px; }
  .side-foot { margin: 0; padding: 0; }
  .field-counts { display: none; }
}

/* editor */
.ed { flex: 1; display: grid; grid-template-columns: 132px 1fr; min-height: 0; height: 100%; }
.ed-ro, .ed:not(:has(.ed-rail)) { grid-template-columns: 1fr; }
.ed-rail { overflow-y: auto; padding: 20px 16px; border-right: 1px solid var(--rule); background: var(--paper); display: flex; flex-direction: column; gap: 14px; }
.thumb { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; color: var(--ink-3); }
.thumb-page { display: block; width: 96px; border: 1px solid var(--rule); border-radius: 3px; background: #fff; overflow: hidden; transition: border-color var(--t-color) var(--ease); }
.thumb-page canvas { width: 100%; height: auto; display: block; }
.thumb:hover .thumb-page { border-color: var(--ink-3); }
.thumb[aria-current] .thumb-page { border: 2px solid var(--seal); }
.thumb[aria-current] .caption { color: var(--seal); }
.ed-main { position: relative; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.ed-zoom { position: absolute; right: 16px; bottom: 16px; z-index: 6; display: flex; gap: 2px; align-items: center; padding: 4px; border-radius: var(--pill); background: var(--paper); box-shadow: 0 4px 16px rgba(29,28,26,.12); }
.ed-zoom .icon-btn { width: 36px; height: 36px; font-size: 20px; }
.ed-zoom .btn-sm { min-width: 64px; }
.ed-scroll { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.ed-pages { display: flex; flex-direction: column; align-items: center; gap: 20px; padding: 32px 32px 96px; width: max-content; min-width: 100%; }
@media (max-width: 600px) { .ed-pages { padding: 44px 12px 80px; gap: 12px; } .ed { grid-template-columns: 1fr; } .ed-rail { display: none; } }
@media (max-width: 1023px) { .ed-rail { display: none; } .ed { grid-template-columns: 1fr; } }
.pg { position: relative; flex: none; background: #fff; box-shadow: 0 1px 2px rgba(29,28,26,.12), 0 12px 32px rgba(29,28,26,.08); }
.pg canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.pg-loading { position: absolute; inset: 0; background: linear-gradient(var(--paper), var(--paper)); }
.pg.ready .pg-loading { display: none; }
.pg-layer { position: absolute; inset: 0; }

.fld { position: absolute; box-sizing: border-box; display: flex; align-items: stretch; border: 1.5px dashed var(--c, var(--seal)); background: color-mix(in srgb, var(--t, var(--signer-1-tint)) 88%, transparent); border-radius: 4px; cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; outline: none; }
.fld::before { content: ""; position: absolute; inset: -8px; } /* bigger touch target than the box */
.fld.selected { border-style: solid; border-width: 2px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c, var(--seal)) 22%, transparent); z-index: 3; }
.fld:focus-visible { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--seal); }
.fld.dragging { z-index: 10; opacity: .9; }
.fld-body { position: relative; display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 2px 8px; overflow: hidden; pointer-events: none; }
.fld-t { font: 500 14px/16px var(--text); color: var(--c, var(--seal)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fld-s { font: 400 12px/15px var(--text); color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fld.tiny .fld-s { display: none; }
.fld.tiny .fld-t { font-size: 12px; line-height: 14px; }
.fld.narrow .fld-body { padding: 1px 3px; }
.fld[data-type="checkbox"] .fld-body { display: none; }
.fld-resize { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 2px solid var(--c, var(--seal)); cursor: nwse-resize; display: none; z-index: 2; }
.fld-resize::before { content: ""; position: absolute; inset: -12px; }
.fld.selected .fld-resize { display: block; }
.fld-bar { position: absolute; z-index: 8; display: flex; gap: 6px; }
.fld-bar .btn { background: var(--ink); color: var(--paper); min-height: 36px; box-shadow: 0 4px 12px rgba(29,28,26,.18); }
.fld-bar .btn:hover { color: var(--paper); opacity: .85; }
.bar-owner { min-height: 36px; padding: 0 30px 0 12px; border: 0; border-radius: var(--pill); background: var(--ink) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23FBFAF7' fill='none' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--paper); font: 400 14px/1 var(--text); appearance: none; -webkit-appearance: none; box-shadow: 0 4px 12px rgba(29,28,26,.18); cursor: pointer; }
.fld.ghost { position: fixed; z-index: 400; pointer-events: none; border-style: solid; opacity: .85; }

/* read-only (signer) and filled values */
.ed-ro .fld { cursor: pointer; touch-action: manipulation; }
/* on the line like the stamp: left, its bottom on the box bottom, then down a quarter of its own height (the img is
   sized to the picture, so the % is of the picture, not the box) */
.fld .fld-img { position: absolute; left: 2px; bottom: 0; width: auto; height: auto; max-width: calc(100% - 4px); max-height: 100%; transform: translateY(25%); }
.fld .fld-val { font: 400 13px/1.2 var(--text); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fld.filled { border-color: transparent; background: transparent; }
.fld.filled.selected, .fld.filled:focus-visible { border: 1.5px dashed var(--c, var(--seal)); }
/* signature / initials while placing: the signer's name in the signature script, baseline on the line (the font's
   tall descent would float it .4em up, so it drops .33em and tails cross the line like a pen), sized to the box (--n = letters) */
.fld.sig-preview { container-type: size; border-color: transparent; background: transparent; }
.fld.sig-preview.selected, .fld.sig-preview:focus-visible { border-color: var(--c, var(--seal)); background: color-mix(in srgb, var(--t, var(--signer-1-tint)) 55%, transparent); }
@media (hover: hover) { .fld.sig-preview:hover { border-color: var(--c, var(--seal)); background: color-mix(in srgb, var(--t, var(--signer-1-tint)) 55%, transparent); } }
.fld.sig-preview .fld-body { justify-content: flex-end; padding-bottom: 0; overflow: visible; }
.fld-sig { font-family: var(--script); font-weight: 400; line-height: 1.25; font-size: 20px; color: var(--ink); white-space: nowrap; transform: translateY(.33em); }
@supports (font-size: 1cqh) { .fld-sig { font-size: min(80cqh, calc(96cqw / (var(--n, 8) * .31))); } }
.fld-num { position: absolute; left: -10px; top: -10px; width: 20px; height: 20px; border-radius: 50%; background: var(--c, var(--seal)); color: var(--paper); font: 600 11px/20px var(--text); text-align: center; z-index: 2; }
.fld.filled .fld-num { background: var(--signed); }
.fld-check { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font: 600 14px/1 var(--text); color: var(--ink); }

/* ---------- review ---------- */
.review { max-width: 680px; }
.sum-row { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.sum-row + .sum-row { border-top: 1px solid var(--rule); padding-top: 16px; margin-top: 16px; }
.sum-signers { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 12px; }
.sum-signers li { display: grid; grid-template-columns: 24px 1fr auto; gap: 12px; align-items: start; }
.sum-signers .signer-dot { margin-top: 1px; }
.sum-fields { text-align: right; }
@media (max-width: 600px) { .sum-signers li { grid-template-columns: 24px 1fr; } .sum-fields { grid-column: 2; text-align: left; } }
.price-band { display: flex; gap: 20px; align-items: center; padding: 20px 24px; background: var(--band); border-radius: var(--card); }
.price-big { font: 500 44px/1 var(--display); color: var(--ink); }
.progress { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 15px; color: var(--ink-2); }
.progress:empty { display: none; }
.progress li::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 10px; border-radius: 50%; background: var(--seal); vertical-align: middle; }
.progress li.done::before { background: var(--signed); }

/* ---------- document status + list ---------- */
.people { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.person { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; padding: 16px; border-radius: var(--card); background: var(--band); }
.person .badge { margin-left: 10px; vertical-align: 2px; }
.person .badge.none, .person .btn-quiet { background: var(--paper); }
.people { margin-top: 16px; }
.person-acts { flex: none; }
@media (max-width: 600px) { .person { flex-direction: column; } .person-acts .btn { width: auto; } }
.timeline { list-style: none; padding: 0; margin: 0; border-left: 2px solid var(--rule); }
.timeline li { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 8px 0 8px 18px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--paper); border: 2px solid var(--ink-3); }
.timeline li:first-child::before { border-color: var(--seal); background: var(--seal); }
.doc-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--rule); }
.doc-link { flex: 1; display: flex; flex-direction: column; gap: 2px; padding: 16px 0; color: var(--ink); text-decoration: none; min-width: 0; }
.doc-link:hover strong { color: var(--seal); }
.doc-link strong { font-weight: 500; transition: color var(--t-color) var(--ease); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-side { display: flex; gap: 12px; align-items: center; flex: none; }
.empty { max-width: 460px; padding: 32px 0; }
.auth-form { max-width: 420px; }

/* ---------- signer page ---------- */
body.sign-page { min-height: 100vh; display: flex; flex-direction: column; background: var(--stage); }
.s-head { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; background: var(--paper); border-bottom: 1px solid var(--rule); }
.s-head .s-from { font: 500 17px/22px var(--text); }
.s-head h1 { font: 400 14px/20px var(--text); color: var(--ink-2); letter-spacing: -0.1px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.s-head > div { min-width: 0; }
.s-page { flex: none; color: var(--ink-2); }
.s-main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.s-main .stage { flex: 1; height: auto; background: transparent; }
.s-main .ed-scroll { overflow: visible; }
.s-main .ed-pages { padding: 20px 16px 40px; }
.s-bar { position: sticky; bottom: 0; z-index: 30; padding: 14px 20px calc(14px + env(safe-area-inset-bottom)); background: var(--paper); border-top: 1px solid var(--rule); }
.s-bar-inner { max-width: 560px; margin: 0 auto; display: grid; gap: 10px; }
.s-left { font: 500 15px/20px var(--text); }
.s-msg { max-width: 560px; margin: 48px auto; padding: 0 24px; text-align: center; }
.s-msg .h1 { margin-bottom: 16px; }
.seal-e { width: 72px; height: 72px; margin: 0 auto 16px; border-radius: 50%; background: var(--seal); color: var(--paper); font: italic 500 52px/68px var(--display); text-align: center; }
.otp-input { font: 500 30px/1 var(--text) !important; letter-spacing: 0.4em; text-align: center; padding-left: calc(14px + 0.4em) !important; font-variant-numeric: tabular-nums; }
.disclosure { max-height: 160px; overflow: auto; padding: 12px 14px; background: var(--band); border-radius: var(--field); font-size: 14px; line-height: 20px; color: var(--ink-2); }
.s-foot { padding: 20px; text-align: center; }

/* ---------- free tool ---------- */
.tool { background: var(--stage); border-radius: var(--card); overflow: hidden; }
.tool-empty { display: grid; justify-items: center; gap: 16px; padding: 40px 20px; }
.tool-work { display: grid; grid-template-columns: 1fr 300px; height: min(82vh, 900px); }
.tool-work .stage { min-height: 0; }
.tool-side { display: flex; flex-direction: column; gap: 12px; padding: 20px; background: var(--paper); border-left: 1px solid var(--rule); overflow: auto; }
.tool-side .palette { grid-template-columns: 1fr 1fr; }
@media (max-width: 900px) {
  .tool-work { grid-template-columns: 1fr; height: auto; }
  .tool-work .stage { height: 70vh; }
  .tool-side { border-left: 0; border-top: 1px solid var(--rule); }
  .tool-side .palette { display: grid; grid-template-columns: 1fr 1fr; overflow: visible; }
}
.private-note { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--signed); }
.private-note::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--signed); flex: none; }

@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }
.tool .fld { container-type: size; }
.fld-val.cq { font-size: 72cqh; line-height: 1.1; padding-left: 2px; }
.fld-t.faint { color: var(--ink-3); font-weight: 400; font-size: 12px; }
