:root {
  --ink: #16213a;
  --muted: #62708a;
  --line: #dde3ee;
  --bg: #f3f5fa;
  --card: #ffffff;
  --brand: #1d4ed8;
  --brand-dark: #1a3fae;
  --ok: #0f7a4d;
  --warn: #8a5a00;
  --err: #b42323;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand); }
h1 { font-size: 24px; margin: 0 0 6px; line-height: 1.25; }
h2 { font-size: 17px; margin: 0 0 10px; }
p { margin: 0 0 12px; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 22px; padding-bottom: 60px; }
.muted { color: var(--muted); font-size: 13.5px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }

.top { background: #101a33; color: #fff; }
.top-in { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 17px; }
.brand span { font-weight: 400; opacity: .7; }
.top nav { display: flex; gap: 18px; flex-wrap: wrap; }
.top nav a { color: #cfd8ee; text-decoration: none; font-size: 14px; }
.top nav a:hover { color: #fff; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; margin: 0 0 18px; }
.card.narrow { max-width: 440px; margin: 40px auto; }
.card.accent { border-color: #b9c8f5; background: #f7f9ff; }
.table-card { padding: 0; overflow-x: auto; }
.head-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }

label { display: block; font-weight: 600; font-size: 13.5px; margin: 0 0 14px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 9px 11px; font: inherit; font-weight: 400;
  color: var(--ink); background: #fff; border: 1px solid #c5cede; border-radius: 7px;
}
textarea { resize: vertical; line-height: 1.5; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9db5f7; outline-offset: 0; border-color: var(--brand); }
.hint { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14.5px; }
label.check input { width: 18px; height: 18px; margin: 3px 0 0; flex: none; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 14px; align-items: end; }
.grid-svc { display: grid; grid-template-columns: 1fr 110px; gap: 0 14px; }
@media (max-width: 700px) {
  .grid2, .grid3, .grid4, .grid-svc { grid-template-columns: 1fr; }
}

.btn {
  display: inline-block; border: 1px solid var(--brand); background: var(--brand); color: #fff;
  font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 7px; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--brand); border-color: #b9c8f5; }
.btn.ghost:hover { background: #eef2ff; }
.btn.ghost.danger { color: var(--err); border-color: #eab8b8; }
.btn.small { padding: 5px 11px; font-size: 13px; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.row-actions form { margin: 0; }
.row-actions select { width: auto; margin: 0; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
table.record th { width: 34%; font-weight: 600; }
table.record td { word-break: break-word; }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; vertical-align: middle; background: #e8ecf5; color: #44506b; white-space: nowrap; }
.badge.awaiting_customer { background: #fff1d1; color: var(--warn); }
.badge.signed { background: #d9f3e6; color: var(--ok); }
.badge.void { background: #fbdede; color: var(--err); }

.flash { padding: 11px 14px; border-radius: 8px; margin: 0 0 14px; border: 1px solid; }
.flash.ok { background: #e7f6ee; border-color: #b4e0c8; color: #0b5e3b; }
.flash.err { background: #fdeaea; border-color: #f1bcbc; color: var(--err); }
.flash.warn { background: #fff6e0; border-color: #f0d795; color: #6d4700; }

.svc-row { display: grid; grid-template-columns: 240px 1fr auto; gap: 10px; align-items: start; margin-bottom: 10px; }
.svc-row input, .svc-row textarea { margin-top: 0; }
@media (max-width: 700px) { .svc-row { grid-template-columns: 1fr; } }

.copy-row { display: flex; gap: 10px; margin-bottom: 10px; }
.copy-row input { margin: 0; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.copy-row .btn { white-space: nowrap; }

/* The agreement document */
.doc { font-family: Georgia, "Times New Roman", serif; font-size: 15px; line-height: 1.6; padding: 34px 38px; overflow-wrap: break-word; }
@media (max-width: 700px) { .doc { padding: 20px 16px; } }
.doc-title { text-align: center; font-weight: 700; font-size: 18px; letter-spacing: .02em; }
.doc-h { font-weight: 700; margin-top: 6px; }
.doc-p { margin: 0 0 3px; }
.doc-gap { height: 11px; }
.doc h2 { font-family: inherit; margin-top: 22px; }

.sig-blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 34px; break-inside: avoid; }
@media (max-width: 700px) { .sig-blocks { grid-template-columns: 1fr; } }
.sig-role { font-weight: 700; font-size: 13.5px; }
.sig-img { height: 90px; display: flex; align-items: flex-end; }
.sig-img img { max-height: 90px; max-width: 100%; }
.sig-line { border-top: 1px solid var(--ink); margin: 2px 0 5px; }

.sigpad { margin: 0 0 14px; }
.sigpad canvas { display: block; width: 100%; height: 180px; background: #fff; border: 1.5px dashed #8fa2c7; border-radius: 8px; touch-action: none; cursor: crosshair; }
.sigpad-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }

/* Print copy */
.print-page { background: #e9ecf3; }
.print-bar { max-width: 860px; margin: 16px auto 0; padding: 0 16px; display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.sheet { max-width: 860px; margin: 16px auto 40px; background: #fff; border: 1px solid var(--line); }
.print-status { font: 700 13px/1.4 Arial, sans-serif; color: var(--err); margin-bottom: 16px; }
.print-status.signed { color: var(--ok); }
.page-break { height: 10px; }

@media print {
  @page { margin: 16mm 15mm; }
  body, .print-page { background: #fff; }
  .no-print { display: none !important; }
  .wrap, main.wrap { max-width: none; padding: 0; }
  .card, .sheet { border: 0; padding: 0; margin: 0; max-width: none; }
  .doc { font-size: 11.5pt; }
  .page-break { break-after: page; height: 0; }
  a { color: inherit; text-decoration: none; }
}

/* Guided tour */
.tour-ring { display: none; position: fixed; z-index: 9000; border-radius: 10px; pointer-events: none;
  box-shadow: 0 0 0 3px #f5b301, 0 0 0 9999px rgba(12, 20, 40, .62); }
.tour-tip { display: none; position: fixed; z-index: 9001; width: 340px; max-width: calc(100vw - 16px);
  background: #fff; color: var(--ink); border-radius: 10px; padding: 16px 18px 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .35); font: 14.5px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; }
.tour-tip h3 { margin: 2px 0 6px; font-size: 16.5px; }
.tour-tip p { margin: 0 0 14px; }
.tour-count { font-size: 12px; font-weight: 600; color: var(--brand); text-transform: uppercase; letter-spacing: .04em; }
.tour-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tour-skip { background: none; border: 0; padding: 0; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.top nav a.tour-link { color: #ffd766; }

/* Getting-started checklist */
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps .dot { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 2px solid #c5cede; color: var(--muted);
  font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.steps li.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; }
.steps li.next .dot { border-color: var(--brand); color: var(--brand); }
.steps .what { flex: 1; }
.steps .what strong { display: block; }
.steps li.done .what strong { color: var(--muted); font-weight: 600; }

/* Onboarding form */
.ob-section h2 { font-size: 19px; padding-bottom: 10px; border-bottom: 2px solid #e4e9f5; margin-bottom: 14px; }
.ob-intro { background: #f4f7ff; border-left: 3px solid var(--brand); padding: 10px 14px; border-radius: 0 6px 6px 0; font-size: 14px; }
.ob-field { margin: 0 0 18px; }
.ob-field label { margin-bottom: 4px; }
.ob-field label.check { margin-bottom: 6px; }
.ob-label { font-weight: 600; font-size: 13.5px; margin-bottom: 7px; }
.ob-field .hint { margin-top: 2px; }
.ob-field.has-error input, .ob-field.has-error textarea, .ob-field.has-error select { border-color: var(--err); }
.ob-error { color: var(--err); font-size: 13px; font-weight: 600; margin-top: 4px; }
.req { color: var(--err); font-weight: 700; }
.lock { display: inline-block; font-size: 11px; font-weight: 600; color: var(--ok); background: #d9f3e6; border-radius: 99px; padding: 1px 8px; vertical-align: middle; }
.ob-notes { margin: 0; padding-left: 20px; font-size: 14px; }
.ob-notes li { margin-bottom: 4px; }
.ob-actions { position: sticky; bottom: 0; background: rgba(243, 245, 250, .96); border-top: 1px solid var(--line); padding: 12px 0; display: flex; gap: 10px; flex-wrap: wrap; }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; margin-right: 8px; }
.ob-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.ob-nav a { font-size: 13px; font-weight: 600; text-decoration: none; background: #fff; border: 1px solid #c9d5f5; border-radius: 99px; padding: 5px 12px; }
.ob-nav a:hover { background: #eef2ff; }
.ob-section { scroll-margin-top: 12px; }

/* Onboarding wizard */
.ob-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 12px; }
.ob-top h1 { margin-bottom: 2px; }
.ob-top p { margin: 0; }
.ob-meter { flex: 1; min-width: 180px; max-width: 320px; height: 10px; background: #dfe5f2; border-radius: 99px; overflow: hidden; }
.ob-meter span { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.ob-steps { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.ob-step { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; text-decoration: none; color: var(--muted);
  background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 5px 13px 5px 6px; }
.ob-step .n { width: 22px; height: 22px; border-radius: 50%; background: #e8ecf5; color: #44506b; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; }
.ob-step.done { color: var(--ok); border-color: #b4e0c8; }
.ob-step.done .n { background: var(--ok); color: #fff; }
.ob-step.todo { color: var(--warn); border-color: #f0d795; }
.ob-step.todo .n { background: #fff1d1; color: var(--warn); }
.ob-step.current { color: #fff; background: var(--brand); border-color: var(--brand); }
.ob-step.current .n { background: #fff; color: var(--brand); }
.ob-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0 18px; }
.ob-grid > * { grid-column: span 6; }
.ob-grid > .half { grid-column: span 3; }
.ob-grid > .third { grid-column: span 2; }
@media (max-width: 700px) { .ob-grid > .half { grid-column: span 6; } }
.ob-heading { margin: 10px 0 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.ob-heading h3 { margin: 0 0 2px; font-size: 15.5px; }
.ob-options { display: flex; flex-direction: column; gap: 7px; }
.ob-option { display: flex; align-items: flex-start; gap: 10px; margin: 0; font-weight: 400; font-size: 14.5px; border: 1px solid #c5cede; border-radius: 8px; padding: 9px 12px; cursor: pointer; background: #fff; }
.ob-option input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; }
.ob-option:hover { border-color: var(--brand); }
.ob-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.ob-row { border: 1px solid var(--line); background: #fafbfe; border-radius: 9px; padding: 12px 14px 6px; position: relative; }
.ob-row-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 12px; }
.ob-row-grid label { font-size: 12.5px; margin-bottom: 9px; }
.ob-row-grid label.wide { grid-column: span 3; }
@media (max-width: 700px) { .ob-row-grid { grid-template-columns: 1fr; } .ob-row-grid label.wide { grid-column: span 1; } }
.ob-row-remove { background: none; border: 0; color: var(--err); font: inherit; font-size: 12.5px; cursor: pointer; padding: 0 0 8px; text-decoration: underline; }
.ob-file { padding: 14px; border: 1.5px dashed #8fa2c7; background: #fafbfe; cursor: pointer; }
.ob-files { list-style: none; margin: 0 0 8px; padding: 0; }
.ob-files li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.ob-files em { color: var(--muted); font-style: normal; font-size: 12.5px; }
.ob-file-remove { display: inline-flex; align-items: center; gap: 5px; margin: 0; font-weight: 400; font-size: 13px; color: var(--err); }
.ob-file-remove input { width: auto; margin: 0; }
.ob-actions .grow { flex: 1; }
.ob-review { margin-bottom: 18px; }
.ob-review-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ob-review-row .n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; background: #fff1d1; color: var(--warn); }
.ob-review-row.done .n { background: var(--ok); color: #fff; }
.ob-review-row .what { flex: 1; }
.ob-review-row .what strong { display: block; }
.ob-done { text-align: center; padding: 40px 24px; }
.ob-done .ob-steps { justify-content: center; margin-top: 20px; }
.ob-done-tick { width: 64px; height: 64px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 34px; display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; }
.ob-view-head { background: #f4f7ff; color: var(--ink); font-size: 13px; }
.ob-view-rows { font-size: 13px; margin-top: 6px; }
.ob-view-rows th { font-size: 12px; color: var(--muted); white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.ob-grid > *, .ob-row-grid > * { min-width: 0; }
.ob-section { overflow-wrap: anywhere; }
