:root {
  --brand: #13235e;
  --accent: #c9a227;
  --bg: #f4f5f7;
  --line: #e4e6eb;
  --ink: #1a1d24;
  --muted: #8a8f98;
}
* { box-sizing: border-box; }
body {
  margin: 0; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink); background: var(--bg); line-height: 1.5;
}
a { color: var(--brand); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.error { color: #b91c1c; background: #fef2f2; padding: 10px 12px; border-radius: 8px; }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between;
  background: #fff; border-bottom: 1px solid var(--line); padding: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-logo { height: 32px; width: auto; }
.brand-logo.sm { height: 26px; }
.brand-name { font-weight: 700; }
.site-nav { display: flex; align-items: center; gap: 18px; }
.site-nav a { text-decoration: none; color: var(--ink); font-weight: 500; }
.container { max-width: 1000px; margin: 0 auto; padding: 24px; }
.site-footer { text-align: center; color: var(--muted); font-size: 12px; padding: 30px 0; }

/* Buttons */
.btn {
  display: inline-block; border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 16px; border-radius: 8px; font-weight: 600; cursor: pointer; text-decoration: none;
  font-size: 14px;
}
.btn:hover { background: #f7f8fa; }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 11px; font-size: 13px; }
.btn-ghost { background: transparent; }
.btn-block { display: block; width: 100%; text-align: center; }
.linkbtn { background: none; border: none; color: var(--brand); cursor: pointer; font: inherit; padding: 4px 0; }

/* Cards / tables */
.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin-bottom: 20px; }
.card.narrow, .auth-card { max-width: 440px; margin: 40px auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
h1 { font-size: 24px; margin: 0 0 4px; }
label { display: block; font-weight: 600; font-size: 14px; margin: 14px 0 0; }
input[type=text], input[type=email], input[type=password], input[type=file], input[type=date], .title-input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 15px; margin-top: 6px; font-family: inherit;
}
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.table td { padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table.compact td { padding: 8px 10px; }
.hash { font-size: 11px; word-break: break-all; }
.empty { text-align: center; padding: 50px 20px; }
.doc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 700px) { .doc-grid { grid-template-columns: 1fr; } }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: capitalize; background: #eef0f4; color: #444; }
.pill-sent { background: #fff4e0; color: #b06a00; }
.pill-completed, .pill-signed { background: #e6f6ec; color: #1a7f45; }
.pill-draft, .pill-pending { background: #eef0f4; color: #555; }
.pill-viewed { background: #e7eefc; color: #2251c7; }
.pill-declined, .pill-voided { background: #fdeaea; color: #b91c1c; }

/* Prepare screen */
.prepare-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.prepare-actions { display: flex; align-items: center; gap: 12px; }
.prepare-body { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
@media (max-width: 800px) { .prepare-body { grid-template-columns: 1fr; } }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; position: sticky; top: 16px; }
.panel h3 { font-size: 13px; text-transform: uppercase; color: var(--muted); margin: 18px 0 8px; }
.panel h3:first-child { margin-top: 0; }
.radio { font-weight: 400; font-size: 14px; margin: 6px 0; }
.field-palette { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px dashed #b9c0cc; background: #f7f8fa; border-radius: 8px; padding: 7px 11px; font-size: 13px; cursor: grab; text-transform: capitalize; }
.signer-row { display: flex; gap: 8px; align-items: flex-start; border: 1px solid var(--line); border-left: 4px solid var(--sc, #ccc); border-radius: 8px; padding: 10px; margin-bottom: 8px; cursor: pointer; }
.signer-row.active { background: #f5f8ff; box-shadow: 0 0 0 2px rgba(37,99,235,.2); }
.signer-fields { flex: 1; }
.signer-fields input:not([type=checkbox]) { width: 100%; padding: 7px 9px; margin: 3px 0; font-size: 13px; border: 1px solid var(--line); border-radius: 6px; }
.auth-opt { display: flex; align-items: center; gap: 6px; }
.auth-opt input[type=checkbox] { width: auto; margin: 0; flex: none; }
.swatch { width: 14px; height: 14px; border-radius: 4px; margin-top: 6px; flex: none; }
.auth-methods { margin-top: 4px; }
.auth-opt { display: block; font-weight: 400; font-size: 12px; margin: 2px 0; }
.s-remove { border: none; background: none; font-size: 20px; color: var(--muted); cursor: pointer; }

.pages, .sign-pages { display: flex; flex-direction: column; gap: 16px; }
.page { position: relative; background: #fff; box-shadow: 0 1px 6px rgba(0,0,0,.12); border-radius: 4px; overflow: hidden; }
.page img { width: 100%; display: block; }
.page .overlay { position: absolute; inset: 0; }
.field-box { position: absolute; border: 1.5px solid var(--fc, #2563eb); background: color-mix(in srgb, var(--fc, #2563eb) 14%, transparent); border-radius: 3px; cursor: move; font-size: 10px; }
.fb-label { position: absolute; top: -15px; left: 0; font-size: 10px; color: var(--fc); white-space: nowrap; text-transform: capitalize; }
.fb-resize { position: absolute; right: -4px; bottom: -4px; width: 10px; height: 10px; background: var(--fc); border-radius: 2px; cursor: nwse-resize; }

/* Signer flow */
.signer-body { background: var(--bg); }
.signer-card { max-width: 440px; margin: 60px auto; background: #fff; border-radius: 14px; padding: 34px; box-shadow: 0 4px 24px rgba(0,0,0,.08); }
.signer-card.center { text-align: center; }
.signer-card input { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; font-size: 16px; margin: 10px 0; }
.signer-card .brand-logo { height: 40px; margin-bottom: 14px; }
.big-check { font-size: 46px; color: #1a7f45; }
.big-x { font-size: 46px; color: #b91c1c; }

.sign-flow { padding-bottom: 90px; }
.sign-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 18px; }
.sign-title { font-weight: 700; flex: 1; }
.sign-actions { display: flex; gap: 8px; }
.sign-note { background: #fff8e6; border-bottom: 1px solid #f0e2b6; padding: 10px 18px; font-size: 14px; }
.sign-pages { max-width: 800px; margin: 20px auto; padding: 0 12px; }
.consent-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 18px; font-size: 13px; }
.consent-bar.flash { animation: flash .5s 2; }
@keyframes flash { 50% { background: #fff1c9; } }

.sfield { position: absolute; border: 1.5px dashed var(--brand); background: rgba(37,99,235,.08); border-radius: 3px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.sfield.req { border-color: #d97706; }
.sfield input { width: 100%; height: 100%; border: none; background: transparent; font-size: 12px; padding: 0 4px; margin: 0; }
.sfield .sf-hint { font-size: 11px; color: var(--brand); text-transform: uppercase; }
.sfield.done { border-style: solid; background: transparent; }
.sfield.done img { width: 100%; height: 100%; object-fit: contain; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal[hidden] { display: none; }
.modal-card { background: #fff; border-radius: 12px; padding: 20px; width: min(560px, 92vw); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab { border: 1px solid var(--line); background: #f7f8fa; border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 600; font-size: 13px; }
.tab.active { background: var(--brand); color: #fff; border-color: var(--brand); }
#sigCanvas { border: 1px dashed #b9c0cc; border-radius: 8px; width: 100%; touch-action: none; background: #fff; }
.type-preview { font: italic 40px "Segoe Script", "Brush Script MT", cursive; padding: 20px 8px; min-height: 60px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

select { padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; font-family: inherit; background: #fff; }
.inline-form { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.fixed-signer { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.fixed-signer strong { min-width: 90px; }
.fixed-signer input { flex: 1; min-width: 180px; margin: 0; }
.inline-form input[type=email] { flex: 1; min-width: 220px; margin: 0; }
.center { text-align: center; }

/* Settings */
.toggle-row { display: flex; align-items: flex-start; gap: 12px; font-weight: 400; margin: 8px 0 4px; }
.toggle-row input[type=checkbox] { width: 20px; height: 20px; margin-top: 2px; flex: none; }

/* Auth (split marketing layout) */
.auth-body { margin: 0; background: #fff; }
.auth-split { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-hero { position: relative; overflow: hidden; color: #fff; padding: 60px 56px;
  display: flex; flex-direction: column; justify-content: center;
  background: linear-gradient(155deg, var(--brand) 0%, #0a1330 100%); }
.auth-hero::after { content: ""; position: absolute; right: -120px; top: -120px; width: 340px; height: 340px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 55%, transparent), transparent 70%); }
.auth-eyebrow { text-transform: uppercase; letter-spacing: .16em; font-size: 12px; opacity: .85; margin-bottom: 18px; }
.auth-hero h1 { font-size: 34px; line-height: 1.16; margin: 0 0 26px; max-width: 460px; font-weight: 800; }
.auth-benefits { list-style: none; padding: 0; margin: 0; max-width: 450px; }
.auth-benefits li { display: flex; gap: 12px; align-items: flex-start; margin: 15px 0; font-size: 15px; line-height: 1.4; }
.auth-benefits li::before { content: "✓"; flex: none; width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.18); display: grid; place-items: center; font-size: 12px; font-weight: 700; }
.auth-hero-foot { margin-top: 40px; opacity: .72; font-size: 13px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card2 { width: 100%; max-width: 400px; }
.auth-card2 .brand-logo { height: 34px; margin-bottom: 22px; }
.auth-card2 h2 { font-size: 25px; margin: 0 0 6px; }
.auth-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.auth-card2 form label { margin-top: 14px; }
.success { color: #1a7f45; background: #e6f6ec; padding: 10px 12px; border-radius: 8px; }
.row-between { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; }
.auth-alt { text-align: center; margin-top: 20px; font-size: 14px; color: var(--muted); }
.field-pw { position: relative; }
.pw-toggle { position: absolute; right: 10px; bottom: 11px; background: none; border: none;
  color: var(--brand); font-size: 12px; font-weight: 600; cursor: pointer; }

/* Password strength meter */
.pw-meter { margin: 10px 0 2px; }
.pw-bar { height: 6px; background: #eceef2; border-radius: 4px; overflow: hidden; }
.pw-bar-fill { height: 100%; width: 0; border-radius: 4px; transition: width .2s ease, background .2s ease; }
.pw-weak { background: #e5484d; } .pw-fair { background: #f5a524; }
.pw-good { background: #3b9c5a; } .pw-strong { background: #1a7f45; }
.pw-label { font-size: 12px; color: var(--muted); text-align: right; height: 16px; }
.pw-reqs { list-style: none; padding: 0; margin: 8px 0 4px; font-size: 12px; color: var(--muted);
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 14px; }
.pw-reqs li::before { content: "○"; margin-right: 6px; color: #c3c8d0; }
.pw-reqs li.ok { color: #1a7f45; }
.pw-reqs li.ok::before { content: "✓"; color: #1a7f45; }
@media (max-width: 860px) { .auth-split { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* Legal / long-form content */
.legal-header { border-bottom: 1px solid var(--line); padding: 14px 24px; }
.legal { max-width: 760px; margin: 0 auto; padding: 36px 24px 72px; }
.legal h1 { font-size: 30px; margin: 0 0 4px; }
.legal h2 { font-size: 19px; margin: 34px 0 8px; }
.legal p, .legal li { color: #33373f; font-size: 15px; line-height: 1.65; }
.legal ul { padding-left: 20px; margin: 8px 0; }
.legal li { margin: 6px 0; }
.legal .updated { color: var(--muted); font-size: 13px; }
.legal a { color: var(--brand); }
.site-footer a { color: var(--muted); }
