/* SignatureOwl. Colors and type from the brand package (docs/brand.md). */

@font-face { font-family: "Outfit"; src: url("/fonts/Outfit-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Outfit"; src: url("/fonts/Outfit-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/Manrope-400.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/Manrope-500.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/Manrope-600.ttf") format("truetype"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Manrope"; src: url("/fonts/Manrope-700.ttf") format("truetype"); font-weight: 700; font-display: swap; }
/* Typed-signature font (Google Fonts, SIL Open Font License). */
@font-face { font-family: "Dancing Script"; src: url("/fonts/dancing-script-latin.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --ink: #15123B;
  --violet: #5B4BDB;
  --violet-dark: #4637C0;
  --gold: #F2A541;
  --paper: #F7F5F0;
  --violet-light: #ECE9FC;
  --slate: #55536E;
  --line: #E4E1EA;
  --green: #1F9D6B;
  --red: #C92A2A;
  --white: #FFFFFF;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(21, 18, 59, .06), 0 6px 24px rgba(21, 18, 59, .06);
  --font-head: "Outfit", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }
a { color: var(--violet); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 700; line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 30px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
.h-sm { font-size: 17px; margin-bottom: 14px; }
.h-md { font-size: 22px; }
p { margin: 0 0 1em; }
code { font-size: 12px; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
img { max-width: 100%; height: auto; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 16px; top: 16px; z-index: 100; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.container { width: 100%; max-width: 1100px; margin: 0 auto; padding: 0 16px; }
.container.narrow, .narrow { max-width: 560px; }
.main { padding: 36px 0 64px; }
.main-wide { padding: 0; }
.muted { color: var(--slate); }
.small { font-size: 14px; }
.lead { font-size: 18px; color: var(--slate); }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--violet); margin: 0 0 6px; }
.row { display: flex; align-items: center; flex-wrap: wrap; }
.gap-2 { gap: 10px; }
.grow { flex: 1; min-width: 0; }
.center { justify-content: center; }
.row-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.danger { color: var(--red) !important; }
.breadcrumb { font-size: 14px; color: var(--slate); margin-bottom: 14px; }
.page-head { margin-bottom: 24px; }
.page-head h1 { margin: 0; }

/* Header and footer */
.site-header { background: var(--white); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.brand { display: flex; }
.brand img { display: block; height: 32px; width: auto; }
.nav { display: flex; align-items: center; gap: 18px; font-size: 15px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { color: var(--slate); font-weight: 600; }
.nav a.is-active, .nav a:hover { color: var(--ink); text-decoration: none; }
.nav a.btn { color: #fff; }
.nav form { margin: 0; }
.who { color: var(--slate); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 640px) { .who { display: none; } .brand img { height: 28px; } }
.site-footer { border-top: 1px solid var(--line); padding: 20px 0; font-size: 13px; color: var(--slate); }
.site-footer .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* Buttons and form controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 10px; border: 1px solid var(--violet); background: var(--violet); color: #fff; font: 700 15px/1.2 var(--font-body); cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--violet-dark); border-color: var(--violet-dark); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: var(--violet-light); border-color: var(--violet-light); }
.btn-sm { padding: 7px 14px; font-size: 14px; }
.btn-lg { padding: 14px 26px; font-size: 17px; }
.btn-block { width: 100%; }
.danger-btn { background: var(--red); border-color: var(--red); }
.danger-btn:hover { background: #a61e1e; border-color: #a61e1e; }
.link { background: none; border: 0; padding: 0; color: var(--violet); font: inherit; font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; }
.field em { font-style: normal; font-weight: 500; }
.field-inline { flex-direction: row; align-items: center; gap: 10px; }
input, select, textarea { font: 500 15px/1.4 var(--font-body); color: var(--ink); background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--violet); outline-offset: 0; border-color: var(--violet); }
input[type=checkbox], input[type=radio] { width: 18px; height: 18px; padding: 0; accent-color: var(--violet); flex-shrink: 0; margin: 2px 0 0; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; font-weight: 500; cursor: pointer; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { padding: 0; margin-bottom: 8px; }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.center-card { text-align: center; }
.auth-card { margin-top: 24px; }
.flash { border-radius: 10px; padding: 12px 16px; margin: 0 0 18px; font-weight: 600; font-size: 15px; }
.flash-ok { background: #E3F5EC; color: #11613f; }
.flash-error { background: #FDECEC; color: #8f1d1d; }
.dev-note { background: var(--violet-light); border-radius: 8px; padding: 10px; font-size: 14px; }

/* Status chips */
.chip { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--line); color: var(--ink); }
.chip-draft { background: #EEEDF2; color: var(--slate); }
.chip-sent, .chip-r-sent { background: #FFF1DC; color: #8a5305; }
.chip-r-viewed { background: var(--violet-light); color: var(--violet-dark); }
.chip-completed, .chip-r-signed { background: #E3F5EC; color: #11613f; }
.chip-declined, .chip-r-declined { background: #FDECEC; color: #8f1d1d; }
.chip-voided { background: #EEEDF2; color: var(--slate); }
.chip-r-pending { background: #EEEDF2; color: var(--slate); }

/* Landing */
.hero { padding: 40px 0 24px; }
.hero-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 32px; align-items: center; }
.display { font-size: clamp(36px, 6vw, 58px); }
.hero-cta { display: flex; gap: 12px; flex-wrap: wrap; }
.hero-mark { justify-self: center; width: min(320px, 70%); }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 24px; }
.feature { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.feature p { color: var(--slate); margin: 0; }
@media (max-width: 760px) { .hero-grid, .features { grid-template-columns: 1fr; } .hero-mark { order: -1; width: 160px; } }
.prose { line-height: 1.7; }

/* Documents list */
.usage { margin-top: -10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--slate); font-weight: 600; font-size: 15px; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.is-active { color: var(--ink); border-bottom-color: var(--violet); }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.doc-list { list-style: none; margin: 0; padding: 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.doc-row { display: grid; grid-template-columns: 1fr auto auto 100px; gap: 16px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.doc-row:first-child { border-top: 0; }
.doc-link { display: flex; flex-direction: column; min-width: 0; color: var(--ink); }
.doc-link:hover { text-decoration: none; }
.doc-link:hover .doc-title { color: var(--violet); }
.doc-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-link .muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-date { text-align: right; }
@media (max-width: 700px) { .doc-row { grid-template-columns: 1fr auto; } .doc-progress, .doc-date { display: none; } }
.empty { text-align: center; padding: 48px 24px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px; text-align: center; cursor: pointer; background: var(--paper); }
.dropzone:hover { border-color: var(--violet); }
.dropzone input { max-width: 100%; border: 0; background: none; text-align: center; }
.dz-title { font-weight: 700; }

/* Document detail */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }
.signer-status { list-style: none; padding: 0; margin: 0 0 18px; }
.signer-status li { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.signer-status li:first-child { border-top: 0; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.turn { color: var(--violet); font-weight: 700; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.actions form { margin: 0; }
.fingerprint { margin: 16px 0 0; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; flex-direction: column; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.timeline li:first-child { border-top: 0; }

/* Admin */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; }
.stat-n { font-family: var(--font-head); font-size: 28px; font-weight: 700; }
@media (max-width: 700px) { .stats { grid-template-columns: repeat(2, 1fr); } }
.add-org summary { cursor: pointer; margin: 0; }
.add-org[open] summary { margin-bottom: 16px; }
.grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: end; }
.span-2 { grid-column: span 2; }
@media (max-width: 600px) { .grid-form { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }
.search { display: flex; gap: 10px; margin-bottom: 14px; max-width: 420px; }
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; }
.card .table-wrap { border: 0; margin: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--slate); padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.plain-list { list-style: none; padding: 0; margin: 0 0 16px; }
.plain-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.plain-list li:first-child { border-top: 0; }
.add-user .row input { flex: 1; min-width: 140px; }

/* ---------- Field editor ---------- */
.editor-body .site-footer { display: none; }
.editor { display: grid; grid-template-columns: 340px 1fr; height: calc(100vh - 65px); }
.ed-side { background: var(--white); border-right: 1px solid var(--line); overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.ed-section { border-top: 1px solid var(--line); padding-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.ed-section .h-sm { margin: 0; }
.signers { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.signer { border: 1px solid var(--line); border-left: 4px solid var(--c, var(--violet)); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: auto 1fr auto; gap: 6px 8px; align-items: center; }
.signer .num { font-weight: 700; color: var(--c); font-size: 14px; width: 18px; text-align: center; }
.signer input { padding: 7px 9px; font-size: 14px; }
.signer .inputs { display: flex; flex-direction: column; gap: 6px; }
.signer .tools { display: flex; flex-direction: column; gap: 2px; }
.signer .tools button { background: none; border: 0; cursor: pointer; color: var(--slate); font-size: 15px; padding: 2px 6px; border-radius: 6px; line-height: 1; }
.signer .tools button:hover { background: var(--violet-light); color: var(--ink); }
.signer .count { grid-column: 2 / 4; font-size: 12.5px; color: var(--slate); }
.order .check { font-size: 14px; margin-bottom: 4px; }
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pal { border: 1px dashed var(--c, var(--violet)); background: color-mix(in srgb, var(--c, var(--violet)) 8%, white); color: var(--ink); border-radius: 8px; padding: 10px 8px; font: 600 14px var(--font-body); cursor: grab; touch-action: none; user-select: none; }
.pal:hover, .pal.is-armed { background: color-mix(in srgb, var(--c, var(--violet)) 20%, white); border-style: solid; }
.props { background: var(--paper); border-radius: 10px; padding: 12px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.props .row { justify-content: space-between; }
.problems { background: #FFF1DC; color: #6b4004; border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.problems ul { margin: 0; padding-left: 18px; }
.save-state { margin: 0; text-align: center; }
.delete-draft { text-align: center; }
.ed-pages { overflow: auto; padding: 24px; background: #E9E7EF; }
.ed-pages .page, .sign-pages .page { margin: 0 auto 24px; }
.loading { text-align: center; padding: 40px; }
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; height: auto; }
  .ed-side { border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .ed-pages { padding: 12px; overflow: visible; }
}

/* Pages and fields, shared by the editor and the signing page */
.page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(21, 18, 59, .15); width: 100%; max-width: 900px; }
.page canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.page-layer { position: absolute; inset: 0; }
.page-num { position: absolute; right: 8px; bottom: -20px; font-size: 12px; color: var(--slate); }
.fld { position: absolute; border: 1.5px solid var(--c, var(--violet)); background: color-mix(in srgb, var(--c, var(--violet)) 16%, transparent); border-radius: 4px; font-size: 12px; font-weight: 700; color: var(--ink); display: flex; align-items: center; justify-content: center; overflow: hidden; user-select: none; touch-action: none; cursor: move; text-align: center; line-height: 1.1; container-type: size; }
.fld span { padding: 0 3px; font-size: clamp(8px, 40cqh, 13px); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fld.is-selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c, var(--violet)); z-index: 2; }
.fld .handle { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; background: var(--c, var(--violet)); border-radius: 3px 0 3px 0; cursor: nwse-resize; }
.fld .del { position: absolute; top: -1px; right: -1px; width: 18px; height: 18px; border: 0; border-radius: 0 3px 0 4px; background: var(--c, var(--violet)); color: #fff; font-size: 13px; line-height: 18px; padding: 0; cursor: pointer; display: none; }
.fld.is-selected .del { display: block; }
.fld.opt { border-style: dashed; }
.drop-ghost { position: fixed; pointer-events: none; z-index: 50; opacity: .85; }

/* ---------- Signing ---------- */
.sign-body { background: #E9E7EF; }
.sign-header { background: var(--ink); color: var(--paper); }
.sign-header img { display: block; height: 30px; width: auto; }
.sign-secure { color: #cfcbe8; }
.sign-bar { position: sticky; top: 0; z-index: 20; background: var(--white); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.sign-bar-row { display: flex; align-items: center; gap: 12px; padding-top: 10px; padding-bottom: 10px; }
.sign-bar-row strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 600px) { .sign-bar-row [data-progress] { display: none; } }
.sign-pages { padding: 20px 12px 60px; max-width: 924px; margin: 0 auto; }
.consent-wrap { padding: 20px 0 0; }
.consent-card { margin: 0 auto; }
.consent-card .check { margin: 14px 0; background: var(--violet-light); padding: 12px; border-radius: 10px; }
.sign-pages.is-locked { filter: blur(2px); pointer-events: none; opacity: .6; }
.sf { cursor: pointer; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 14%, rgba(255,255,255,.6)); animation: none; }
.sf.is-current { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--gold); }
.sf.is-done { background: transparent; border: 1px dashed color-mix(in srgb, var(--c) 60%, transparent); }
.sf img { max-width: 100%; max-height: 100%; object-fit: contain; object-position: left bottom; position: absolute; inset: 0; width: 100%; height: 100%; }
.sf input[type=text] { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; padding: 0 4px; font-size: clamp(8px, 55cqh, 15px); font-weight: 500; border-radius: 0; }
.sf input[type=checkbox] { width: 70%; height: 70%; margin: 0; }
.sf .val { font-weight: 500; font-size: clamp(8px, 55cqh, 15px); position: absolute; left: 4px; right: 4px; text-align: left; white-space: nowrap; overflow: hidden; }
.sf .req { position: absolute; top: -1px; left: 2px; color: var(--red); font-size: 13px; }
.other { position: absolute; display: flex; align-items: center; pointer-events: none; container-type: size; }
.other img { width: 100%; height: 100%; object-fit: contain; object-position: left bottom; }
.other .val { font-size: clamp(8px, 55cqh, 15px); padding-left: 2px; white-space: nowrap; }
.sign-footer { padding: 0 16px 30px; text-align: center; }
.sign-message { margin-top: 40px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 60; max-width: calc(100% - 32px); font-weight: 600; }

.modal { border: 0; border-radius: 16px; padding: 0; width: min(560px, calc(100% - 24px)); box-shadow: 0 20px 60px rgba(21, 18, 59, .35); }
.modal::backdrop { background: rgba(21, 18, 59, .55); }
.modal-body { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.sig-tabs { display: flex; gap: 6px; }
.sig-tab { border: 1px solid var(--line); background: var(--white); border-radius: 8px; padding: 7px 16px; font: 600 14px var(--font-body); cursor: pointer; }
.sig-tab.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.sig-pad { width: 100%; height: auto; aspect-ratio: 16 / 5; border: 1px solid var(--line); border-radius: 10px; background: #fff; touch-action: none; }
.sig-pad.is-drawing { cursor: crosshair; }
.sig-tools { display: flex; justify-content: space-between; gap: 10px; margin-top: -6px; }
.sf .req { pointer-events: none; }
.sign-body { scroll-padding-top: 90px; }
html:has(.sign-body) { scroll-padding-top: 90px; }
@media (max-width: 600px) {
  .sign-bar-row .grow .small { display: none; }
  .sign-bar-row strong { font-size: 15px; }
}
