:root { --fg:#1b1d21; --muted:#5b616b; --line:#d7dbe0; --bg:#f6f7f9; --card:#fff; --accent:#1f4fd1; --accent-fg:#fff; --danger:#b42318; --ok:#067647; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--fg); background: var(--bg); }
* { box-sizing: border-box; }
body { margin: 0; }
.bar { background: #11203d; padding: .75rem 1rem; }
.brand { color: #fff; font-weight: 600; text-decoration: none; }
main { max-width: 860px; margin: 0 auto; padding: 1rem; }
h1 { font-size: 1.5rem; margin: .5rem 0 1rem; overflow-wrap: anywhere; }
h2 { font-size: 1.15rem; margin: 1.5rem 0 .5rem; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin: .75rem 0; }
.list a.item { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: .75rem 1rem; margin: .5rem 0; color: inherit; text-decoration: none; }
.list a.item:focus-visible, .list a.item:hover { border-color: var(--accent); }
.badge { display: inline-block; font-size: .8rem; padding: .1rem .5rem; border-radius: 999px; background: #e8ecf3; margin-left: .25rem; }
.badge.action { background: #fff1c2; }
.badge.completed, .badge.signed { background: #dcfae6; }
.badge.declined, .badge.voided, .badge.expired { background: #fee4e2; }
button, .button { display: inline-block; font: inherit; border: 0; border-radius: 6px; padding: .7rem 1.1rem; background: var(--accent); color: var(--accent-fg); cursor: pointer; text-decoration: none; min-height: 44px; }
button.secondary, .button.secondary { background: #e8ecf3; color: var(--fg); }
button.danger { background: var(--danger); }
button:disabled { opacity: .5; cursor: not-allowed; }
button:focus-visible, .button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #8fb0ff; outline-offset: 2px; }
.doc iframe { width: 100%; height: 70vh; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.field { margin: 1rem 0; }
.field label { display: block; font-weight: 600; margin-bottom: .35rem; }
.field input[type=text], textarea { width: 100%; font: inherit; padding: .6rem; border: 1px solid var(--line); border-radius: 6px; }
.pad { width: 100%; height: 150px; border: 1px dashed #8a94a6; border-radius: 6px; background: #fff; touch-action: none; display: block; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .5rem 0; }
.check { display: flex; gap: .6rem; align-items: flex-start; }
.check input { width: 1.4rem; height: 1.4rem; margin-top: .1rem; flex: none; }
.error { color: var(--danger); font-weight: 600; }
.okmsg { color: var(--ok); font-weight: 600; }
@media (max-width: 480px) { main { padding: .75rem; } .doc iframe { height: 55vh; } .row > button { flex: 1 1 100%; } }
.title-input { width: 100%; font-family: inherit; font-size: 1.5rem; font-weight: 600; line-height: 1.3; padding: .4rem .5rem; border: 1px solid var(--line); border-radius: 6px; margin: .5rem 0; }
.recipients { padding-left: 1.25rem; }
.recipients li { margin: .4rem 0; }
.swatch { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; margin-right: .4rem; vertical-align: middle; }
button.link { background: none; color: var(--danger); padding: 0 .5rem; min-height: 0; text-decoration: underline; }
input[type=search], select, input.step { font: inherit; padding: .55rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
input[type=search] { width: 100%; }
input.step { width: 5rem; }
.results { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.toolbar select { width: 100%; margin-bottom: .5rem; }
.pages { overflow-x: auto; }
.page { position: relative; margin: .5rem auto 0; box-shadow: 0 1px 4px rgba(0,0,0,.18); background: #fff; touch-action: pan-y; }
.page canvas { display: block; cursor: crosshair; }
.pageno { text-align: center; margin: .25rem 0 1rem; font-size: .85rem; }
.fieldbox { position: absolute; border: 2px solid; border-radius: 3px; background: rgba(255,255,255,.75); font-size: 11px; line-height: 1.1; overflow: hidden; cursor: move; touch-action: none; padding: 1px 16px 1px 3px; white-space: nowrap; text-overflow: ellipsis; user-select: none; }
.fieldbox.filled { background: rgba(220,250,230,.8); }
.fieldbox .x { position: absolute; top: 0; right: 0; min-height: 0; padding: 0 3px; line-height: 1; background: transparent; color: inherit; font-size: 14px; }
.audit { font-size: .9rem; padding-left: 1.25rem; }
.audit code { font-size: .8rem; color: var(--muted); }
input[type=text] { font: inherit; padding: .55rem; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
form.row input[type=text] { flex: 1 1 14rem; min-width: 0; }
input[type=file] { display: block; margin-top: .5rem; font: inherit; max-width: 100%; }
.error:empty { display: none; }
.fieldbox .x { background: rgba(255,255,255,.9); }
.reassign input { width: 100%; margin-top: .5rem; }
.vault-item h2 { margin-top: 0; }
.vault-img { display: block; max-width: 100%; max-height: 160px; margin: .5rem 0; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: .5rem; }
.capture { margin-top: .5rem; }
details summary { cursor: pointer; margin-top: .75rem; }
details h3 { font-size: 1rem; margin: .75rem 0 .25rem; }

/* QUILL-37 photo capture */
.photo { margin-top: 1rem; display: grid; gap: .5rem; }
.photo-canvas { width: 100%; max-height: 60vh; object-fit: contain; touch-action: none; border: 1px solid var(--line, #d0d5dd); border-radius: 8px; background: #111827; cursor: crosshair; }
.photo-result { display: grid; gap: .5rem; }

/* QUILL-42 phone-first ceremony */
.doc .pages { max-height: 75vh; overflow: auto; background: #eef0f4; border-radius: 6px; padding: .25rem; }
.doc .page { touch-action: pan-x pan-y pinch-zoom; }
button.fieldbox { cursor: pointer; min-height: 0; padding: 1px 3px; color: #7a2e0e; border-color: #f79009; background: rgba(255, 236, 179, .7); font-size: 11px; border-radius: 3px; }
button.fieldbox.filled { color: var(--ok); border-color: var(--ok); background: rgba(220, 250, 230, .75); }
.actionbar { position: sticky; bottom: 0; z-index: 5; display: flex; gap: .75rem; align-items: center; justify-content: space-between; margin: 1rem -1rem -1rem; padding: .6rem 1rem calc(.6rem + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -2px 8px rgba(0, 0, 0, .06); }
.actionbar .progress { font-weight: 600; }
@media (max-width: 480px) { .pad { height: 190px; } .actionbar { margin: 1rem -.75rem -.75rem; } .actionbar button { flex: 0 0 auto; } }
/* QUILL-42 contact settings and sender notices */
.settings .field input[type=tel] { width: 100%; font: inherit; padding: .6rem; border: 1px solid var(--line); border-radius: 6px; }
.notice-log { font-size: .9rem; padding-left: 1.25rem; }
.warn { background: #fffaeb; border-color: #fec84b; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .5rem; }
.grid2 label { font-weight: 600; display: block; }
.grid2 > * { min-width: 0; }
.grid2 input, .grid2 select { width: 100%; max-width: 100%; box-sizing: border-box; }
/* QUILL-49 templates */
.templates details summary { cursor: pointer; font-weight: 600; }
.templates label.pick { display: block; margin: .5rem 0; }
.templates label.pick span { display: block; font-weight: 600; margin-bottom: .2rem; }
.templates select, .templates input { width: 100%; font: inherit; padding: .5rem; }

/* QUILL-89 · 0.5.0 signing redesign. Handwriting fonts: self-hosted, SIL OFL 1.1 (licences in /static/fonts/). */
@font-face { font-family: "Quill Great Vibes"; src: url("/static/fonts/GreatVibes-Regular.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "Quill Sacramento"; src: url("/static/fonts/Sacramento-Regular.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "Quill Allura"; src: url("/static/fonts/Allura-Regular.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "Quill Alex Brush"; src: url("/static/fonts/AlexBrush-Regular.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "Quill Parisienne"; src: url("/static/fonts/Parisienne-Regular.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "Quill Mr Dafoe"; src: url("/static/fonts/MrDafoe-Regular.ttf") format("truetype"); font-display: block; }
@font-face { font-family: "Quill Herr Von Muellerhoff"; src: url("/static/fonts/HerrVonMuellerhoff-Regular.ttf") format("truetype"); font-display: block; }
.bar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.nav { display: flex; gap: 1rem; margin-left: auto; }
.nav a { color: #dbe4ff; text-decoration: none; }
.nav a:hover, .nav a:focus-visible { color: #fff; text-decoration: underline; }
.small { font-size: .875rem; }
.label { font-weight: 600; margin: .75rem 0 .35rem; }
.adopt h2 { margin-top: 0; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: .75rem 0 0; overflow-x: auto; }
.tab { background: none; color: var(--fg); border-radius: 6px 6px 0 0; border: 1px solid transparent; border-bottom: 0; padding: .6rem 1rem; flex: 1 1 0; min-width: 4.5rem; }
.tab[aria-selected="true"] { background: var(--card); border-color: var(--line); color: var(--accent); font-weight: 600; box-shadow: inset 0 -3px 0 var(--accent); }
.tabpanel { padding: 1rem 0 .25rem; }
.tabpanel .field input[type=text] { width: 100%; }
.tabpanel .field input.short { max-width: 8rem; }
.styles { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .5rem; }
.style { display: flex; align-items: baseline; justify-content: space-between; gap: .75rem; background: #fff; color: #111827; border: 2px solid var(--line); border-radius: 8px; padding: .4rem .9rem; min-height: 4.5rem; text-align: left; overflow: hidden; }
.style[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 3px #c7d6ff; }
.preview-sig { font-size: 2.1rem; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.preview-ini { font-size: 1.6rem; line-height: 1.3; color: #374151; flex: none; }
.pad-lg { height: 240px; }
.beforeafter { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: .75rem; margin-top: .75rem; }
.beforeafter figure { margin: 0; }
.beforeafter img { display: block; width: 100%; max-height: 180px; object-fit: contain; background: repeating-conic-gradient(#f1f3f6 0% 25%, #fff 0% 50%) 50% / 16px 16px; border: 1px solid var(--line); border-radius: 6px; padding: .4rem; }
.beforeafter img.after { background: #fff; }
.beforeafter figcaption { font-size: .85rem; color: var(--muted); margin-top: .25rem; }
.beforeafter .row { grid-column: 1 / -1; }
.signbtn { display: flex; flex-direction: column; align-items: flex-start; gap: .15rem; width: 100%; text-align: left; padding: .75rem 1rem; }
.signbtn strong { font-size: 1.05rem; }
.signbtn span { font-size: .875rem; opacity: .92; }
.statement { font-size: .85rem; color: var(--muted); padding-left: 1.1rem; margin: .5rem 0 0; }
p.statement { padding-left: 0; }
.signbtn .statement { display: block; color: #fff; opacity: 1; font-weight: 400; padding-left: 0; margin: .35rem 0 0; }
.adopt-prompt { border-color: #b2c7ff; background: #f3f6ff; }
@media (max-width: 480px) {
  .nav { gap: .75rem; margin-left: 0; width: 100%; }
  .styles { grid-template-columns: 1fr; }
  .pad-lg { height: 200px; }
  .tab { padding: .6rem .4rem; }
}
