:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", Arial, sans-serif;
  color: #183c34;
  background: #f8f9f5;
  --ink: #183c34;
  --green: #205c4e;
  --muted: #52685f;
  --line: #d9e2da;
  --paper: #f8f9f5;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
button, a, summary, input { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid #127c70; outline-offset: 3px; }
a { color: var(--green); }
button { color: var(--ink); }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: absolute; left: 12px; top: 12px; z-index: 5; padding: 12px; background: white; }
.masthead { border-bottom: 1px solid var(--line); background: #fff; }
.mast-inner, main { width: min(1280px, 100%); margin: 0 auto; padding-inline: clamp(16px, 4.7vw, 68px); }
.mast-inner { height: 67px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 24px; font-weight: 720; letter-spacing: -1.4px; }
.brand-mark { width: 32px; height: 32px; color: var(--green); }
.private { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 550; }
.private svg { width: 16px; height: 16px; }
main { padding-bottom: 54px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin: 34px 0 24px; }
.eyebrow { color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: 1.4px; text-transform: uppercase; margin: 0 0 9px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(29px, 4vw, 46px); letter-spacing: -.05em; font-weight: 640; line-height: 1.09; overflow-wrap: anywhere; }
.state-badge { flex: none; display: inline-flex; align-items: center; gap: 7px; background: #e5efdf; color: #365d39; border-radius: 22px; padding: 6px 10px; font-size: 12px; font-weight: 650; }
.state-badge i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #477a4f; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, .45fr); align-items: start; gap: 22px; }
.reader, .sign-panel { border: 1px solid var(--line); border-radius: 15px; overflow: hidden; background: white; }
.reader-tools, .reader-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reader-tools { min-height: 55px; padding: 8px 15px 8px 18px; border-bottom: 1px solid var(--line); }
.file-info { display: flex; align-items: center; gap: 9px; min-width: 0; }
.file-info svg { width: 19px; height: 20px; flex: none; color: var(--green); }
.file-info h2 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 13px; font-weight: 650; }
.pages { display: flex; align-items: center; gap: 6px; flex: none; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pages b { color: var(--ink); }
.icon-button { display: grid; place-items: center; padding: 0 0 3px; width: 33px; height: 33px; background: white; border: 1px solid var(--line); border-radius: 7px; color: var(--green); font-size: 22px; line-height: 1; }
.icon-button:hover:not(:disabled) { background: #eef3ed; }
.icon-button:disabled { color: #8a9a92; background: #f8f9f7; }
.reader-surface { padding: clamp(11px, 2vw, 30px); background: #e9eeea; min-height: 165px; }
.reader-message { padding: 18px; text-align: center; color: var(--muted); font-size: 14px; }
.pdf-page { width: 100%; position: relative; background: white; box-shadow: 0 2px 9px #203c3022; }
#canvas-host canvas { display: block; width: 100% !important; height: auto !important; }
.field-layer { position: absolute; inset: 0; pointer-events: none; }
.pdf-field { position: absolute; display: flex; align-items: center; padding: 0 3px; line-height: 1; border: 1px solid #9e7e22; border-radius: 2px; color: #61460c; background: #fff1c1d9; pointer-events: auto; overflow: hidden; }
.pdf-field span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.pdf-field[data-filled="true"] { background: #e0f1dfdf; border-color: #628165; color: #254e39; }
@font-face { font-family: 'Dancing Script'; src: url('/fonts/dancing-script-latin.woff2') format('woff2'); font-display: swap; }
.pdf-field[data-kind="signature"][data-filled="true"] { font-family: 'Dancing Script', Georgia, serif; font-style: normal; }
.reader-footer { min-height: 43px; padding: 8px 17px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); }
.reader-footer > span { display: flex; align-items: center; gap: 7px; }
.field-key { height: 10px; width: 10px; border: 1px solid #ae9248; border-radius: 2px; background: #fff1c1; }
.reader-footer a { font-weight: 600; text-underline-offset: 3px; }
.text-version { border-top: 1px solid var(--line); padding: 10px 17px; color: var(--muted); font-size: 12px; }
.text-version summary { cursor: pointer; width: fit-content; font-weight: 600; }
.text-version p { padding-top: 12px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.65; }
.sign-panel { position: sticky; top: 16px; }
.sign-panel-inner { padding: clamp(19px, 2vw, 30px); }
.sign-panel h2 { font-weight: 650; letter-spacing: -.04em; font-size: 28px; line-height: 1.18; }
.identity { display: flex; align-items: center; gap: 9px; padding-block: 19px; margin-bottom: 19px; border-bottom: 1px solid var(--line); }
.avatar { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: #e5eddf; color: #315741; font-size: 12px; font-weight: 740; }
.identity-label { display: block; color: var(--muted); font-size: 11px; margin-bottom: 2px; }
.identity strong { font-weight: 650; font-size: 14px; overflow-wrap: anywhere; }
.entry { margin-bottom: 15px; }
.entry label { display: block; font-size: 13px; font-weight: 650; margin-bottom: 7px; }
.entry input { width: 100%; padding: 10px 12px; height: 43px; border: 1px solid #aebdb2; border-radius: 7px; color: var(--ink); background: #fff; }
.entry input::placeholder { color: #65756a; font-size: 14px; }
.signature-input:not(:placeholder-shown) { font-family: 'Dancing Script', Georgia, serif; font-size: 23px; font-style: normal; }
#signature-method { display: flex; padding: 3px; gap: 3px; border: 1px solid var(--line); background: #eff4ef; border-radius: 9px; margin-bottom: 13px; }
#signature-method button { flex: 1; min-height: 44px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); font-weight: 650; }
#signature-method button[aria-pressed="true"] { background: white; color: var(--green); border-color: #a7bbae; }
#pad-hint { margin: 0 0 8px; font-size: 13px; line-height: 1.45; color: var(--muted); }
#signature-pad { display: block; width: 100%; height: auto; aspect-ratio: 3 / 1; border-radius: 7px; box-shadow: inset 0 0 0 1px #8caa9a; background: linear-gradient(transparent 77%, #d8e2db 77%, #d8e2db calc(77% + 1px), transparent calc(77% + 1px)) white; cursor: crosshair; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ink-actions { display: flex; align-items: center; justify-content: space-between; }
.ink-actions button { background: none; border: none; min-height: 44px; padding: 5px 8px; color: var(--green); font-size: 13px; font-weight: 600; }
.ink-actions button:disabled { color: #748079; }
.pdf-field.has-ink { padding: 0; justify-content: center; }
.pdf-field .ink-preview { display: block; width: 96%; height: 96%; object-fit: contain; }
.date-note { margin: 0 0 13px; color: var(--muted); font-size: 12px; line-height: 1.55; }
.locations { color: var(--green); font-size: 13px; }
.locations summary { cursor: pointer; width: fit-content; padding: 5px 0; font-weight: 600; }
#location-list { margin-top: 5px; max-height: 160px; overflow: auto; }
.location { display: flex; justify-content: space-between; text-align: left; width: 100%; padding: 8px; gap: 10px; background: #f8faf7; border: 0; border-bottom: 1px solid #e0e6df; }
.location:hover { background: #edf4e9; }
.location small { color: var(--muted); font-size: 12px; }
.finalize { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.consent { display: flex; gap: 9px; align-items: start; color: var(--muted); font-size: 13px; line-height: 1.55; }
.consent input { flex: none; width: 17px; height: 17px; accent-color: var(--green); margin: 2px 0 0; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: center; gap: 12px; border-radius: 8px; min-height: 42px; padding: 10px 16px; text-decoration: none; font-size: 14px; font-weight: 650; }
.primary { border: 1px solid var(--green); background: var(--green); color: white; }
.primary:hover:not(:disabled) { background: #174c3f; }
.primary:disabled { opacity: .7; }
.secondary { background: white; color: var(--green); border: 1px solid var(--line); }
#finish-signing { width: 100%; margin-top: 16px; }
.form-error { margin-top: 12px; font-size: 13px; line-height: 1.5; color: #9a2e26; }
.status-screen { margin: clamp(42px, 12vh, 120px) auto; max-width: 525px; text-align: center; border: 1px solid var(--line); background: white; border-radius: 17px; padding: clamp(26px, 5vw, 49px); }
.status-mark { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; margin: 0 auto 22px; background: #e8efdf; color: var(--green); font-size: 29px; }
.status-screen h1 { font-size: clamp(27px, 4vw, 33px); }
.status-screen p { font-size: 15px; color: var(--muted); margin-top: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.status-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; }
.status-actions:not(:empty) { margin-top: 24px; }
@media (max-width: 790px) {
  .mast-inner, main { padding-inline: 16px; }
  .workspace { grid-template-columns: 1fr; gap: 16px; }
  .sign-panel { position: static; }
  .page-heading { margin-top: 24px; }
  .sign-panel-inner { padding: 22px; }
}
@media (max-width: 470px) {
  .mast-inner { height: 59px; }
  .brand { font-size: 21px; }
  .private { font-size: 11px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 10px; margin-bottom: 16px; }
  .reader-tools { min-height: 49px; padding: 6px 9px; }
  .reader-surface { padding: 7px; }
  .pages { gap: 4px; }
  .icon-button { width: 30px; height: 32px; }
  .reader-footer { padding-inline: 10px; }
}
