/* Topsign design system — hand-written, no framework.
   Light and flat: white ground, no shadows, heavy Archivo headings, Instrument Sans text,
   round icon lists and one bright action colour (peach) on deep indigo. */
@font-face { font-family: "Archivo"; src: url("/static/fonts/Archivo.ttf") format("truetype"); font-weight: 100 900; font-stretch: 62% 125%; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("/static/fonts/InstrumentSans.ttf") format("truetype"); font-weight: 400 700; font-stretch: 75% 100%; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("/static/fonts/Caveat.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Dancing Script"; src: url("/static/fonts/DancingScript.ttf") format("truetype"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Pacifico"; src: url("/static/fonts/Pacifico.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Great Vibes"; src: url("/static/fonts/GreatVibes.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Homemade Apple"; src: url("/static/fonts/HomemadeApple.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Mrs Saint Delafield"; src: url("/static/fonts/MrsSaintDelafield.ttf") format("truetype"); font-display: swap; }
@font-face { font-family: "Sacramento"; src: url("/static/fonts/Sacramento.ttf") format("truetype"); font-display: swap; }

:root {
  --ink: #1C1642; --ink-2: #4A4470; --muted: #5E5A78; --faint: #8C88A6;
  --navy: var(--ink); /* older name, still used in a few places */
  --bg: #FFFFFF; --surface: #FFFFFF; --mist: #F4F2F9; --mist-2: #ECE8F5;
  --line: #EEECF4; --line-strong: #C9C4DA;
  --accent: #FF9F6E; --accent-hover: #FFB48D; --accent-ink: #1C1642;
  --blue: #2F49D1; --blue-soft: #E8EBFD; --green: #1F7A4D; --green-soft: #E2F4EA;
  --red: #B42318; --red-soft: #FDE7E5; --amber-soft: #FFEBD9; --amber-ink: #8A4B00;
  --purple: #5B3CC4; --purple-soft: #EEE9FB;
  --radius: 24px; --radius-md: 16px; --radius-sm: 10px;
  --font: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Archivo", "Instrument Sans", system-ui, sans-serif;
  --c0:#2F49D1; --c1:#1F7A4D; --c2:#C2410C; --c3:#6C4DD6; --c4:#E07B1A; --c5:#0E8C9A; --c6:#C2286C; --c7:#5E5A78;
  --sig-frame: #283478;
}
* { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; font-weight: 600; }
a:hover { color: var(--ink-2); }
h1, h2, h3, h4 { margin: 0 0 .5rem; font-family: var(--display); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; }
h1 { font-size: 2.75rem; } h2 { font-size: 1.5rem; letter-spacing: -.02em; } h3 { font-size: 1.15rem; letter-spacing: -.01em; }
p { margin: 0 0 1rem; }
.muted { color: var(--muted); } .small { font-size: .9rem; } .tiny { font-size: .8rem; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; word-break: break-all; }
.right { text-align: right; } .center { text-align: center; } .nowrap { white-space: nowrap; }
.mt { margin-top: 1rem; } .mb { margin-bottom: 1rem; } .mt2 { margin-top: 2rem; } .mb0 { margin-bottom: 0; }
.flex { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; } .between { justify-content: space-between; }
.grow { flex: 1; } .stack { display: grid; gap: .75rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }

/* Logo: a peach disc with a signature stroke, wordmark in lower case */
.brand { display: flex; align-items: center; gap: .6rem; font-family: var(--display); font-weight: 800; font-size: 1.5rem; letter-spacing: -.04em; color: var(--ink); text-decoration: none; padding: .25rem .75rem 1.5rem; }
.brand:hover { color: var(--ink); }
.brand .logo { width: 32px; height: 32px; flex: none; }
.brand img { max-height: 36px; max-width: 160px; }

/* App shell */
.app { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 1.75rem 1rem; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a, .nav .nav-btn { display: flex; align-items: center; gap: .85rem; color: var(--ink-2); padding: 0 .9rem; min-height: 46px; border-radius: 999px; font-weight: 600; font-size: 1rem; text-decoration: none; background: none; border: 0; font-family: inherit; cursor: pointer; width: 100%; text-align: left; }
.nav a:hover, .nav .nav-btn:hover { background: var(--mist); color: var(--ink); }
.nav a.active { background: var(--mist); color: var(--ink); font-weight: 700; }
.nav .section { margin: 1.25rem .9rem .35rem; font-size: .85rem; font-weight: 600; color: var(--muted); }
.nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-foot { margin-top: 1.25rem; display: grid; gap: 2px; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 3rem; background: var(--surface); }
.topbar .title { font-weight: 700; color: var(--muted); }
.topbar .user { display: flex; align-items: center; gap: .75rem; font-size: .95rem; }
.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; font-weight: 700; font-size: .95rem; flex: none; }
.content { padding: .5rem 3rem 3rem; max-width: 1180px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 2rem; }
.page-head h1 { margin: 0; }
.page-head p { margin: .5rem 0 0; }
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 280px; transform: translateX(-100%); transition: transform .2s; z-index: 50; }
  #nav-toggle:checked ~ .app .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(28,22,66,.35); }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 999px; background: var(--mist); cursor: pointer; }
  .topbar { padding: .75rem 1rem; } .content { padding: .5rem 1rem 2rem; }
  h1 { font-size: 2.1rem; }
  .topbar .user .small { display: none; }
}

/* Public shell */
.public { min-height: 100vh; display: flex; flex-direction: column; background: var(--surface); }
.public-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.1rem 2rem; background: var(--surface); flex-wrap: wrap; }
.public-top .brand { padding: 0; font-size: 1.45rem; }
.public-main { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 3rem 1.25rem 4rem; }
.auth-card { width: 100%; max-width: 440px; }
.auth-card > .card { background: none; border: 0; padding: 0; }
.auth-card h1 { font-size: 3.25rem; line-height: .98; letter-spacing: -.045em; margin-bottom: 1.5rem; }
.auth-card .lead { font-size: 1.1rem; color: var(--muted); margin: -.75rem 0 2rem; }
.auth-card .big, .state-icon { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 1.5rem; background: var(--mist); color: var(--ink); }
.state-icon svg { width: 32px; height: 32px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.state-icon.ok { background: var(--green-soft); color: var(--green); }
.public-footer { padding: 1.5rem; text-align: center; color: var(--muted); font-size: .85rem; }
@media (max-width: 600px) { .public-top { padding: .9rem 1rem; } .auth-card h1 { font-size: 2.5rem; } }

/* Cards & tables */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.75rem; margin-bottom: 1.25rem; }
.card.tight { padding: 1rem 1.25rem; border-radius: var(--radius-md); }
.card.soft { background: var(--mist); border-color: transparent; }
.card h2, .card h3 { margin-top: 0; } .card h2 { margin-bottom: 1rem; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.stat { background: var(--mist); border-radius: var(--radius); padding: 1.4rem 1.5rem; display: flex; flex-direction: column; gap: .35rem; }
.stat .n { font-family: var(--display); font-size: 2.5rem; font-weight: 800; letter-spacing: -.04em; line-height: 1; }
.stat .l { color: var(--muted); font-size: .95rem; }
.stat a { color: inherit; text-decoration: none; display: flex; flex-direction: column; gap: .35rem; font-weight: 400; }
.stat:hover { background: var(--mist-2); }
table.tbl { width: 100%; border-collapse: collapse; font-size: .95rem; }
.tbl th { text-align: left; font-size: .85rem; color: var(--muted); padding: .6rem .75rem; border-bottom: 1px solid var(--line); font-weight: 600; }
.tbl td { padding: .85rem .75rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.row-link { cursor: pointer; } .tbl tr.row-link:hover td { background: var(--mist); }
.tbl-wrap { overflow-x: auto; }
.empty { text-align: center; color: var(--muted); padding: 2.5rem 1rem; }
.empty .big { width: 64px; height: 64px; border-radius: 50%; background: var(--mist); display: grid; place-items: center; margin: 0 auto 1rem; color: var(--ink); }
.empty .big svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Lists with round icons */
.list { display: flex; flex-direction: column; }
.list-group { font-size: .9rem; font-weight: 600; color: var(--muted); padding: 1rem 0 .25rem; }
.list-row { display: flex; align-items: center; gap: 1rem; padding: .75rem .5rem; margin: 0 -.5rem; border-radius: var(--radius-md); color: var(--ink); text-decoration: none; font-weight: 400; }
a.list-row:hover { background: var(--mist); color: var(--ink); }
.list-row .ic { position: relative; flex: none; width: 48px; height: 48px; border-radius: 50%; background: var(--mist); display: grid; place-items: center; color: var(--ink); }
.list-row .ic svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.list-row .ic.ok { background: var(--green-soft); color: var(--green); }
.list-row .ic.bad { background: var(--red-soft); color: var(--red); }
.list-row .ic .pip { position: absolute; right: -2px; bottom: -2px; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 2px solid #fff; }
.list-row .body { flex: 1; min-width: 0; }
.list-row .t { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .s { display: block; font-size: .9rem; color: var(--muted); }
.list-row .end { text-align: right; flex: none; }
.list-row .end .t { font-weight: 700; } .list-row .end .s { white-space: nowrap; }

/* Status: coloured text, no pill */
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .9rem; font-weight: 600; white-space: nowrap; color: var(--muted); }
.badge.draft { color: var(--muted); }
.badge.sent, .badge.delivered, .badge.processing, .badge.queued { color: var(--blue); }
.badge.completed, .badge.auto_signed, .badge.sent-ok, .badge.delivered-ok, .badge.done, .badge.active { color: var(--green); }
.badge.declined, .badge.voided, .badge.expired, .badge.failed, .badge.suspended { color: var(--red); }
.badge.created, .badge.reassigned, .badge.waiting { color: var(--amber-ink); }
.badge.aes { color: var(--purple); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

/* Tiles (dashboard) */
.tiles { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 1rem; margin-bottom: 2.5rem; }
.tile-dark { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 1.5rem; display: flex; flex-direction: column; gap: .75rem; }
.tile-dark .k { color: #CFCBE6; font-size: .95rem; }
.tile-dark .v { font-family: var(--display); font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
.tile-dark .foot { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-top: auto; flex-wrap: wrap; color: #CFCBE6; font-size: .9rem; }
.quick { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.25rem 0 2rem; }
.minor-links { display: flex; flex-wrap: wrap; gap: 1.25rem; font-size: .95rem; color: var(--muted); margin: -1.5rem 0 2rem; }
@media (max-width: 900px) { .tiles { grid-template-columns: 1fr; } }

/* Buttons: pills. Default = indigo, .accent = the one main action, .ghost = soft secondary */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; padding: .7rem 1.5rem; border-radius: 999px; border: 0; font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer; background: var(--ink); color: #fff; line-height: 1.2; text-decoration: none !important; transition: background .15s, transform .05s; white-space: nowrap; }
.btn:hover { background: #2C2560; color: #fff; } .btn:active { transform: translateY(1px); }
.btn.accent { background: var(--accent); color: var(--accent-ink); } .btn.accent:hover { background: var(--accent-hover); color: var(--accent-ink); }
.btn.ghost { background: var(--mist); color: var(--ink); } .btn.ghost:hover { background: var(--mist-2); color: var(--ink); }
.btn.danger { background: var(--red-soft); color: var(--red); } .btn.danger:hover { background: #F9D3CF; color: var(--red); }
.btn.link { background: none; color: var(--ink); padding: .4rem .5rem; min-height: 0; text-decoration: underline !important; text-underline-offset: 4px; font-weight: 600; }
.btn.link:hover { color: var(--ink-2); background: none; }
.btn.sm { min-height: 38px; padding: .45rem 1rem; font-size: .9rem; } .btn.lg { min-height: 56px; padding: .9rem 2rem; font-size: 1.05rem; } .btn.block { width: 100%; }
.btn[disabled], .btn.disabled { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* Forms */
label.lbl, .lbl { display: block; font-size: .95rem; font-weight: 600; margin-bottom: .45rem; color: var(--ink); }
.input, select.input, textarea.input { width: 100%; min-height: 52px; padding: .8rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit; font-size: 1rem; background: #fff; color: var(--ink); }
.input:hover { border-color: var(--ink-2); }
.input:focus { outline: none; border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.input[disabled] { background: var(--mist); color: var(--muted); border-color: transparent; }
textarea.input { min-height: 110px; resize: vertical; }
.field { margin-bottom: 1.15rem; } .field .help, .help { font-size: .88rem; color: var(--muted); margin-top: .35rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .75rem 1rem; }
.check { display: flex; align-items: flex-start; gap: .7rem; font-size: .98rem; cursor: pointer; font-weight: 400; } .check input { margin-top: .15rem; width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.inline-form { display: inline; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; margin-top: 1.25rem; }
.code-input { font-size: 1.6rem; letter-spacing: .5em; text-align: center; font-family: ui-monospace, monospace; }
.dropzone { border: 2px dashed var(--line-strong); border-radius: var(--radius); padding: 2.5rem; text-align: center; color: var(--muted); background: var(--mist); cursor: pointer; }
.dropzone.drag { border-color: var(--ink); background: var(--mist-2); }
.dropzone input { display: none; }

/* Segmented control */
.seg { display: flex; gap: 4px; background: var(--mist); border-radius: 999px; padding: 4px; }
.seg button { flex: 1; min-height: 42px; border: 0; border-radius: 999px; background: transparent; color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; padding: 0 .9rem; }
.seg button.active { background: var(--ink); color: #fff; font-weight: 700; }

/* Flash */
.flash { padding: 1rem 1.25rem; border-radius: var(--radius-md); margin-bottom: 1rem; font-size: .98rem; display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.flash.success { background: var(--green-soft); color: #14553A; } .flash.error { background: var(--red-soft); color: #8E1C13; }
.flash.warning { background: var(--amber-soft); color: #6E3C00; } .flash.info { background: var(--blue-soft); color: #1F308F; }
.flash button { background: none; border: 0; font-size: 1.2rem; cursor: pointer; color: inherit; }

/* Tabs / steps */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.5rem; overflow-x: auto; }
.tabs a { padding: .8rem 1rem; color: var(--muted); font-weight: 600; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a.active, .tabs a:hover { color: var(--ink); border-color: var(--ink); }
.steps { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: .5rem; margin-bottom: 2rem; max-width: 44rem; }
.steps .step { display: flex; flex-direction: column; gap: .5rem; font-size: .9rem; font-weight: 600; color: var(--muted); }
.steps .step::before { content: ""; height: 4px; border-radius: 999px; background: var(--line); }
.steps .step.done, .steps .step.active { color: var(--ink); }
.steps .step.done::before, .steps .step.active::before { background: var(--ink); }
.steps .step.active { font-weight: 700; }
.steps .num { display: none; }
@media (max-width: 600px) { .steps { grid-auto-flow: row; } }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 160px 1fr; gap: 1rem; padding: .65rem 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.timeline li:last-child { border: 0; } .timeline .t { color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 600px) { .timeline li { grid-template-columns: 1fr; gap: .1rem; } }

/* Recipient color chips */
.rc { display: inline-flex; align-items: center; gap: .5rem; }
.rc .dot { background: var(--c0); } .rc[data-c="1"] .dot { background: var(--c1); } .rc[data-c="2"] .dot { background: var(--c2); }
.rc[data-c="3"] .dot { background: var(--c3); } .rc[data-c="4"] .dot { background: var(--c4); } .rc[data-c="5"] .dot { background: var(--c5); }
.rc[data-c="6"] .dot { background: var(--c6); } .rc[data-c="7"] .dot { background: var(--c7); }

/* Modal */
dialog.modal { border: 0; border-radius: var(--radius); padding: 0; max-width: 600px; width: calc(100% - 2rem); color: var(--ink); }
dialog.modal::backdrop { background: rgba(28,22,66,.45); }
.modal-body { padding: .5rem 1.75rem 1.75rem; } .modal-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.5rem 1.75rem .75rem; }
.modal-head h3 { margin: 0; font-size: 1.6rem; letter-spacing: -.03em; }
.modal-close { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--mist); border: 0; font-size: 1.4rem; cursor: pointer; color: var(--ink); }

/* Pagination */
.pagination { display: flex; gap: .4rem; align-items: center; justify-content: flex-end; margin-top: 1rem; font-size: .95rem; }
.pagination a, .pagination span { padding: .45rem .8rem; border-radius: 999px; text-decoration: none; }
.pagination a:hover { background: var(--mist); }

/* Signature capture */
.sig-names { display: grid; grid-template-columns: 1fr 9rem; gap: 0 1rem; }
@media (max-width: 480px) { .sig-names { grid-template-columns: 1fr; } }
.sigpad { position: relative; border-radius: var(--radius-md); background: var(--mist); touch-action: none; }
.sigpad canvas { width: 100%; height: 190px; display: block; border-radius: var(--radius-md); cursor: crosshair; }
.sigpad .baseline { position: absolute; left: 24px; right: 24px; bottom: 44px; border-top: 1px solid var(--line-strong); pointer-events: none; }
.sig-styles { display: grid; gap: .5rem; max-height: 340px; overflow-y: auto; padding: 2px; }
.sig-style { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; border: 1px solid var(--line-strong); border-radius: var(--radius-md); cursor: pointer; font-weight: 400; }
.sig-style:hover { border-color: var(--ink-2); }
.sig-style:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); background: var(--mist); }
.sig-style input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; margin: 0; }
.sig-style .sigframe { flex: 1; min-height: 76px; }
.sig-ini { flex: none; min-width: 64px; min-height: 64px; padding: 0 .5rem; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 8px; font-size: 1.6rem; color: #102048; }
.sig-ini:empty { visibility: hidden; }
/* The stamp frame, mirrored from the PDF (services/sigstamp.py) */
.sigframe { position: relative; display: grid; grid-template-rows: auto 1fr auto; align-items: center; padding: .2rem .6rem .2rem .55rem; color: var(--sig-frame); min-width: 0; }
.sigframe::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: min(30%, 64px); border: 1.5px solid var(--sig-frame); border-right: 0; border-radius: 6px 0 0 6px; pointer-events: none; }
.sigframe-l, .sigframe-id { font-family: var(--font); font-size: .72rem; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sigframe-id { color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.sigframe-sig { font-size: 2.1rem; line-height: 1.3; color: #102048; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: .1rem 0; }
.sigframe.on-doc { position: absolute; inset: 0; padding: 1px 4px 1px 6px; }
.sigframe.on-doc .sigframe-l, .sigframe.on-doc .sigframe-id { font-size: 9px; color: var(--sig-frame); }
.sigframe.on-doc .sigframe-sig { min-height: 0; height: 100%; display: flex; align-items: center; }
.sigframe.on-doc .sigframe-sig img { max-height: 100%; max-width: 100%; object-fit: contain; object-position: left center; }
.f-caveat { font-family: "Caveat", cursive; } .f-dancing { font-family: "Dancing Script", cursive; } .f-pacifico { font-family: "Pacifico", cursive; }
.f-greatvibes { font-family: "Great Vibes", cursive; } .f-homemade { font-family: "Homemade Apple", cursive; font-size-adjust: .42; }
.f-delafield { font-family: "Mrs Saint Delafield", cursive; font-size-adjust: .5; } .f-sacramento { font-family: "Sacramento", cursive; }
.sigframe.f-delafield .sigframe-sig, .sigframe.f-sacramento .sigframe-sig, .sigframe.f-greatvibes .sigframe-sig { font-size: 2.5rem; }
.sigframe.f-homemade .sigframe-sig { font-size: 1.6rem; }
.sigframe .sigframe-l, .sigframe .sigframe-id { font-family: var(--font); font-size-adjust: none; }
.sig-preview { max-height: 80px; max-width: 100%; }

/* Editor */
.editor { display: grid; grid-template-columns: 280px 1fr 320px; height: calc(100vh - 77px); }
.editor .tools, .editor .props { background: var(--surface); padding: 1.5rem 1.25rem; overflow-y: auto; }
.editor .props { border-left: 1px solid var(--line); }
.editor .tools { border-right: 1px solid var(--line); }
.editor .pages { overflow: auto; padding: 2rem; background: var(--mist); }
.tool { display: flex; align-items: center; gap: .85rem; padding: .45rem .5rem; border-radius: 999px; margin-bottom: 2px; cursor: grab; font-size: .98rem; font-weight: 600; user-select: none; }
.tool:hover { background: var(--mist); } .tool.active { background: var(--ink); color: #fff; }
.tool .ic { width: 38px; height: 38px; border-radius: 50%; background: var(--mist); color: var(--ink); display: grid; place-items: center; font-size: .75rem; font-weight: 700; flex: none; }
.tool.active .ic { background: var(--accent); color: var(--ink); }
.tool .ic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pdf-page { position: relative; margin: 0 auto 1.75rem; background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.pdf-page canvas { display: block; width: 100%; height: 100%; border-radius: 4px; }
.pdf-page .overlay { position: absolute; inset: 0; }
.pdf-page .pnum { position: absolute; top: -1.5rem; left: 0; font-size: .8rem; font-weight: 600; color: var(--muted); }
.fld { position: absolute; border: 2px solid var(--c0); background: rgba(47,73,209,.10); border-radius: 6px; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--ink); cursor: move; user-select: none; }
.fld[data-c="1"] { border-color: var(--c1); background: rgba(31,122,77,.12); } .fld[data-c="2"] { border-color: var(--c2); background: rgba(194,65,12,.12); }
.fld[data-c="3"] { border-color: var(--c3); background: rgba(108,77,214,.12); } .fld[data-c="4"] { border-color: var(--c4); background: rgba(224,123,26,.13); }
.fld[data-c="5"] { border-color: var(--c5); background: rgba(14,140,154,.12); } .fld[data-c="6"] { border-color: var(--c6); background: rgba(194,40,108,.12); }
.fld[data-c="7"] { border-color: var(--c7); background: rgba(94,90,120,.12); }
.fld.selected { outline: 3px solid rgba(28,22,66,.35); outline-offset: 2px; z-index: 5; }
.fld .lbl-in { pointer-events: none; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fld .rz { position: absolute; right: -6px; bottom: -6px; width: 12px; height: 12px; background: #fff; border: 2px solid var(--ink); border-radius: 50%; cursor: nwse-resize; }
.fld .del { position: absolute; top: -10px; right: -10px; width: 20px; height: 20px; border-radius: 50%; background: var(--red); color: #fff; border: 0; font-size: 12px; cursor: pointer; display: none; line-height: 20px; padding: 0; }
.fld.selected .del { display: block; }
.editor-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .75rem 1.5rem; background: var(--surface); border-bottom: 1px solid var(--line); }
.zoom { display: flex; gap: 4px; align-items: center; background: var(--mist); border-radius: 999px; padding: 4px; }
.zoom button { width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; font: 700 1.1rem var(--font); color: var(--ink); }
.zoom button:hover { background: #fff; }
@media (max-width: 1000px) { .editor { grid-template-columns: 1fr; height: auto; } .editor .tools { display: flex; flex-wrap: wrap; gap: .4rem; border-right: 0; } .editor .tools .tool { margin: 0; } .editor .props { border: 0; } }

/* Signing page */
.sign-shell { display: grid; grid-template-columns: 1fr 440px; min-height: calc(100vh - 77px); border-top: 1px solid var(--line); }
.sign-docs { background: var(--mist); padding: 2rem; overflow: auto; }
.sign-side { background: var(--surface); padding: 2rem 2rem 2.5rem; position: sticky; top: 0; height: calc(100vh - 77px); overflow-y: auto; }
.sign-side h2 { font-size: 2.1rem; letter-spacing: -.035em; line-height: 1.02; margin-bottom: .75rem; }
.sign-side h3 { font-size: 1.3rem; }
.progress { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; margin: .6rem 0 1.25rem; }
.progress i { display: block; height: 100%; background: var(--ink); width: 0; transition: width .2s; border-radius: 999px; }
.sf { position: absolute; border: 2px dashed var(--ink); background: rgba(255,159,110,.35); border-radius: 6px; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 11px; font-weight: 700; overflow: hidden; color: var(--ink); }
.sf.required::after { pointer-events: none; content: "*"; position: absolute; top: -2px; right: 3px; color: var(--red); font-weight: 800; font-size: 13px; }
.sf.done { background: rgba(31,122,77,.08); border: 2px solid var(--green); } .sf.done::after { content: ""; }
.sf.done:has(.sigframe), .sf.done:has(img) { background: transparent; border-color: transparent; }
.sf.done:has(.sigframe):hover, .sf.done:has(img):hover { border-color: var(--green); }
.sf.theirs { border: 1px dashed var(--line-strong); background: transparent; cursor: default; font-weight: 400; }
.sf.current { outline: 4px solid rgba(255,159,110,.55); outline-offset: 2px; z-index: 4; }
.sf input, .sf select, .sf textarea { width: 100%; height: 100%; border: 0; background: transparent; font: inherit; font-size: inherit; font-weight: 400; padding: 0 3px; outline: none; color: var(--ink); }
.sf textarea { resize: none; padding: 2px 3px; }
.sf img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sf.chk input { width: 100%; height: 100%; margin: 0; accent-color: var(--ink); cursor: pointer; }
.sf .ph { pointer-events: none; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.sf.theirs .ph { color: var(--muted); }
.sign-bottom { display: none; }
@media (max-width: 900px) {
  .sign-shell { grid-template-columns: 1fr; } .sign-side { position: static; height: auto; padding: 1.5rem 1rem 6rem; }
  .sign-docs { padding: 1rem .5rem; }
  .sign-bottom { display: flex; gap: .5rem; position: sticky; bottom: 0; background: #fff; padding: .75rem 1rem; border-top: 1px solid var(--line); z-index: 20; }
}
.consent-box { background: var(--mist); border-radius: var(--radius-md); padding: 1rem 1.1rem; font-size: .95rem; }
.att-list { list-style: none; padding: 0; margin: .5rem 0 0; } .att-list li { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--line); font-size: .93rem; }
.kv { display: grid; grid-template-columns: 170px 1fr; gap: .5rem 1rem; font-size: .97rem; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; gap: 0 } .kv dt { margin-top: .5rem; } }
.hero { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 2.25rem; margin-bottom: 1.75rem; }
.hero h1 { color: #fff; } .hero p { color: #CFCBE6; max-width: 60ch; }
.hero a { color: #fff; }
.qr { width: 180px; height: 180px; background: #fff; padding: 8px; border-radius: 12px; border: 1px solid var(--line); }
.codes { columns: 2; font-family: ui-monospace, monospace; font-size: 1rem; }
.swagger-ui .topbar { display: none; }
.banner { background: var(--amber-soft); color: #6E3C00; padding: .75rem 3rem; font-size: .95rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.lang-switch { display: inline-flex; gap: 2px; background: var(--mist); border-radius: 999px; padding: 3px; }
.lang-switch a { color: var(--muted); font-size: .85rem; font-weight: 600; padding: .3rem .65rem; border-radius: 999px; text-decoration: none; }
.lang-switch a.active { color: #fff; background: var(--ink); }
.thumb { width: 60px; height: 80px; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
details.acc { border: 1px solid var(--line); border-radius: var(--radius-md); padding: .8rem 1rem; margin-bottom: .5rem; background: #fff; }
details.acc summary { cursor: pointer; font-weight: 700; }
.print-only { display: none; }
.badge svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.public-main:has(> .sign-shell), .public-main:has(> .editor) { padding: 0; }

/* Draw on a phone (signing dialog on computers without a touchscreen) */
.phone-offer { display: flex; align-items: center; gap: 1rem; background: var(--mist); border-radius: var(--radius-md); padding: .9rem 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.phone-offer .ic { width: 44px; height: 44px; border-radius: 50%; background: #fff; display: grid; place-items: center; flex: none; }
.phone-offer .ic svg, .phone-panel svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.phone-panel { display: flex; gap: 1.5rem; align-items: flex-start; flex-wrap: wrap; padding-bottom: .5rem; }
.phone-panel .qr { width: 196px; height: 196px; flex: none; }
.phone-panel h4 { font-size: 1.25rem; margin-bottom: .5rem; }
.phone-panel ol { margin: 0 0 1rem; padding-left: 1.2rem; display: grid; gap: .25rem; }
.phone-status { font-weight: 600; min-height: 1.5em; }
/* Phone page */
.handoff { width: 100%; max-width: 40rem; }
.handoff h1 { font-size: 2.4rem; margin: .25rem 0 .5rem; }
.handoff .lead { color: var(--muted); font-size: 1.05rem; }
.handoff .sigpad canvas { height: min(52vh, 380px); }
.ho-actions { display: flex; gap: .6rem; margin-top: 1rem; }
.anchor-mask { position: absolute; background: #fff; box-shadow: 0 0 0 2px #fff; pointer-events: none; }
.sig-current { display: grid; grid-template-columns: 2fr 1fr; gap: 1rem; }
.sig-current > div { background: var(--mist); border-radius: var(--radius-md); padding: .9rem 1rem; min-height: 96px; }
.sig-current .sig-preview { max-height: 56px; display: block; margin-top: .25rem; }
.sigpad-ini { max-width: 320px; } .sigpad-ini canvas { height: 120px; }
