@font-face { font-family: Inter; src: url(/fonts/inter-400.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-500.woff2) format('woff2'); font-weight: 500; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-600.woff2) format('woff2'); font-weight: 600; font-display: swap; }
@font-face { font-family: Inter; src: url(/fonts/inter-700.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: HSSignature; src: url(/fonts/signature.woff2) format('woff2'); font-display: block; }

:root {
  --navy: #0E1A2B;
  --navy-2: #16263D;
  --brand: #0B5FFF;
  --brand-ink: #fff;
  --bg: #F3F5F9;
  --card: #fff;
  --ink: #1D2433;
  --muted: #6B7385;
  --line: #E1E5EE;
  --ok: #12805C;
  --warn: #B26A00;
  --bad: #C2341B;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 4px 16px rgba(16,24,40,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: Inter, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 24px; } h2 { font-size: 19px; } h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; gap: 12px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* Buttons */
.btn { appearance: none; border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 9px 16px; border-radius: 8px; font: inherit; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: #F7F8FB; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.lg { padding: 13px 22px; font-size: 16px; }
.btn.sm { padding: 6px 11px; font-size: 13px; }
.btn.block { width: 100%; justify-content: center; }

/* Forms */
label.f { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #3A4256; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #CBD2DE; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, transparent); border-color: var(--brand); }
textarea { min-height: 90px; resize: vertical; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; flex: none; accent-color: var(--brand); }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
.card.pad { padding: 22px; }
.err { background: #FDECEA; color: var(--bad); padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.okbox { background: #E7F6EF; color: var(--ok); padding: 10px 12px; border-radius: 8px; font-size: 14px; }

/* Top bar */
.topbar { background: var(--navy); color: #fff; height: 58px; display: flex; align-items: center; padding: 0 20px; gap: 18px; position: sticky; top: 0; z-index: 50; }
.logo { display: flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: #fff; letter-spacing: -.2px; }
.logo svg { width: 26px; height: 26px; }
.topbar a.nav { color: #C7D0E0; font-weight: 500; padding: 6px 10px; border-radius: 6px; }
.topbar a.nav.active, .topbar a.nav:hover { color: #fff; background: rgba(255,255,255,.08); text-decoration: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; cursor: pointer; border: 0; }
.menu { position: absolute; right: 16px; top: 54px; background: #fff; color: var(--ink); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.18); min-width: 220px; padding: 6px; z-index: 60; }
.menu a, .menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 6px; color: var(--ink); background: none; border: 0; font: inherit; cursor: pointer; }
.menu a:hover, .menu button:hover { background: var(--bg); text-decoration: none; }

.container { max-width: 1180px; margin: 0 auto; padding: 24px 20px 60px; }

/* Dashboard */
.layout { display: grid; grid-template-columns: 220px 1fr; gap: 24px; }
.sidenav a { display: flex; justify-content: space-between; padding: 9px 12px; border-radius: 8px; color: var(--ink); font-weight: 500; }
.sidenav a.active { background: color-mix(in srgb, var(--brand) 10%, white); color: var(--brand); text-decoration: none; }
.sidenav a:hover { text-decoration: none; background: #E9EDF4; }
.sidenav .count { color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.stat { padding: 16px 18px; }
.stat .n { font-size: 26px; font-weight: 700; }
.stat .l { color: var(--muted); font-size: 13px; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.list td { padding: 14px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: #F8FAFD; }
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: #EEF1F6; color: #4A5367; white-space: nowrap; }
.badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.sent { background: #FFF4E0; color: var(--warn); }
.badge.completed, .badge.signed { background: #E7F6EF; color: var(--ok); }
.badge.declined, .badge.voided, .badge.expired { background: #FDECEA; color: var(--bad); }
.badge.viewed { background: #E8F0FF; color: #2753C7; }
.empty { text-align: center; padding: 50px 20px; color: var(--muted); }

/* Editor */
.steps { display: flex; gap: 6px; align-items: center; font-size: 14px; font-weight: 600; color: var(--muted); }
.steps .s { padding: 6px 12px; border-radius: 99px; }
.steps .s.on { background: color-mix(in srgb, var(--brand) 12%, white); color: var(--brand); }
.dropzone { border: 2px dashed #B9C2D3; border-radius: 12px; padding: 30px; text-align: center; background: #FAFBFD; cursor: pointer; }
.dropzone.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, white); }
.doc-chip { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.doc-chip .ic { width: 34px; height: 42px; border-radius: 4px; background: #FDECEA; color: var(--bad); display: grid; place-items: center; font-size: 10px; font-weight: 700; }
.rcp { display: grid; grid-template-columns: 34px 1.2fr 1.4fr 1fr 145px 135px 32px; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--line); border-left-width: 5px; border-radius: 8px; background: #fff; }
.rcp .ord { width: 34px; text-align: center; padding: 8px 2px; }
.rcp-extra { grid-column: 2 / -1; display: flex; gap: 10px; align-items: center; font-size: 13px; }
.rcp-extra input { max-width: 200px; padding: 6px 9px; }
.iconbtn { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 18px; padding: 4px; border-radius: 6px; }
.iconbtn:hover { background: var(--bg); color: var(--bad); }

.prep { display: grid; grid-template-columns: 250px 1fr 260px; height: calc(100vh - 58px - 61px); }
.prep-bar { height: 61px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; padding: 0 18px; gap: 12px; }
.palette { background: #fff; border-right: 1px solid var(--line); padding: 16px; overflow: auto; }
.palette .ft { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 8px; background: #fff; cursor: grab; font: inherit; font-weight: 500; text-align: left; touch-action: none; }
.palette .ft:hover { border-color: var(--brand); }
.palette .ft.armed { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 8%, white); }
.palette .ft .sw { width: 22px; height: 22px; border-radius: 5px; display: grid; place-items: center; font-size: 12px; }
.canvas-area { overflow: auto; background: #DDE2EA; padding: 24px; }
.props { background: #fff; border-left: 1px solid var(--line); padding: 16px; overflow: auto; }
.page-wrap { position: relative; margin: 0 auto 22px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); }
.page-wrap canvas { display: block; width: 100%; height: auto; }
.page-label { text-align: center; font-size: 12px; color: #4A5367; margin: -14px 0 18px; }
.overlay { position: absolute; inset: 0; }
.fld { position: absolute; border: 1.5px solid rgba(0,0,0,.35); border-radius: 3px; font-size: 11px; font-weight: 600; color: #1D2433; display: flex; align-items: center; justify-content: center; overflow: hidden; user-select: none; touch-action: none; cursor: move; white-space: nowrap; }
.fld.sel { outline: 2px solid var(--brand); outline-offset: 1px; z-index: 5; }
.fld .rs { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; background: var(--brand); cursor: nwse-resize; border-radius: 2px; }
.fld .req { position: absolute; top: 1px; right: 3px; color: var(--bad); font-size: 12px; }

/* Signing */
.sign-top { background: var(--navy); color: #fff; padding: 10px 16px; display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40; min-height: 60px; }
.sign-top .org { font-weight: 700; }
.sign-banner { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 16px; display: flex; align-items: center; gap: 12px; position: sticky; top: 60px; z-index: 39; }
.sign-docs { max-width: 900px; margin: 0 auto; padding: 18px 10px 120px; }
.sfld { position: absolute; border-radius: 3px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #1D2433; cursor: pointer; overflow: hidden; }
.sfld.mine { border: 1.5px dashed #1D2433; animation: pulse 2.4s infinite; }
.sfld.mine.done { animation: none; border-style: solid; border-color: rgba(18,128,92,.7); background: rgba(231,246,239,.55) !important; }
.sfld.req::after { content: '*'; position: absolute; top: 0; right: 3px; color: var(--bad); }
.sfld.done::after { content: ''; }
.sfld img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.sfld input[type=text] { width: 100%; height: 100%; border: 0; background: transparent; padding: 0 4px; font-size: inherit; font-weight: 500; border-radius: 0; }
.sfld.other { background: transparent !important; cursor: default; }
.sfld .txtv { font-weight: 500; padding: 0 3px; width: 100%; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(11,95,255,0); } 50% { box-shadow: 0 0 0 4px rgba(11,95,255,.18); } }
.guide { position: fixed; left: 14px; bottom: 18px; z-index: 45; }
.sign-foot { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line); padding: 12px 16px; display: flex; gap: 12px; align-items: center; z-index: 44; }
.center-card { max-width: 520px; margin: 40px auto; padding: 0 14px; }

/* Modal */
.modal-bg { position: fixed; inset: 0; background: rgba(14,26,43,.55); z-index: 100; display: grid; place-items: center; padding: 14px; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal header { padding: 18px 22px 0; display: flex; align-items: center; }
.modal .body { padding: 16px 22px; }
.modal footer { padding: 14px 22px 20px; display: flex; gap: 10px; justify-content: flex-end; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { border: 0; background: none; padding: 9px 14px; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--brand); border-bottom-color: var(--brand); }
.pad-wrap { border: 1px solid #CBD2DE; border-radius: 10px; background: #FAFBFD; position: relative; }
.pad-wrap canvas { display: block; width: 100%; height: 170px; touch-action: none; cursor: crosshair; }
.pad-wrap .line { position: absolute; left: 24px; right: 24px; bottom: 40px; border-bottom: 1px solid #B9C2D3; pointer-events: none; }
.pad-wrap .x { position: absolute; left: 10px; bottom: 42px; color: #9AA3B5; pointer-events: none; }
.typed-preview { font-family: HSSignature, cursive; font-size: 44px; padding: 14px 18px; border: 1px solid #CBD2DE; border-radius: 10px; min-height: 86px; background: #FAFBFD; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 11px 18px; border-radius: 10px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-weight: 500; max-width: 90vw; }
.toast.bad { background: var(--bad); }

/* Timeline */
.tl { list-style: none; padding: 0; margin: 0; }
.tl li { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.tl li:last-child { border-bottom: 0; }

/* Auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth .side { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.auth .side h1 { font-size: 38px; letter-spacing: -.5px; max-width: 460px; }
.auth .side ul { padding: 0; list-style: none; color: #C7D0E0; }
.auth .side li { padding: 7px 0; }
.auth .side li::before { content: '✓'; color: #6EC1FF; margin-right: 10px; font-weight: 700; }
.auth .main { display: grid; place-items: center; padding: 30px 18px; }
.auth form { width: 100%; max-width: 380px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sidenav { display: flex; overflow-x: auto; gap: 4px; }
  .sidenav a { white-space: nowrap; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .prep { grid-template-columns: 1fr; height: auto; }
  .palette { border-right: 0; border-bottom: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px; position: sticky; top: 58px; z-index: 20; }
  .palette .ft { width: auto; margin: 0; padding: 7px 10px; font-size: 13px; }
  .palette h3, .palette .hint { width: 100%; margin: 0; }
  .props { border-left: 0; border-top: 1px solid var(--line); }
  .canvas-area { padding: 10px; }
  .rcp { grid-template-columns: 34px 1fr 32px; }
  .rcp > :nth-child(n+3):not(.iconbtn):not(.rcp-extra) { grid-column: 2 / 3; }
  .auth { grid-template-columns: 1fr; }
  .auth .side { padding: 28px 22px; }
  .auth .side h1 { font-size: 26px; }
  .auth .side ul { display: none; }
  .tl li { grid-template-columns: 1fr; gap: 2px; }
  table.list .hide-sm { display: none; }
  .topbar a.nav.hide-sm { display: none; }
}

/* Billing */
.hf { min-height: 44px; border: 1px solid #CBD2DE; border-radius: 8px; background: #fff; padding: 2px 6px; }
.hf iframe { width: 100% !important; height: 40px !important; border: 0; }
.banner { padding: 10px 20px; font-size: 14px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.banner.info { background: color-mix(in srgb, var(--brand) 10%, white); color: #18315f; }
.banner.warn { background: #FFF4E0; color: #6b4300; }
.banner.bad { background: #FDECEA; color: #8a2414; }
.plans { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.plan { padding: 20px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.plan.current { outline: 2px solid var(--brand); }
.plan .price { font-size: 30px; font-weight: 700; }
.plan .price small { font-size: 14px; color: var(--muted); font-weight: 500; }
.plan ul { padding: 0; margin: 0; list-style: none; font-size: 14px; }
.plan li { padding: 4px 0; }
.plan li.no { color: #A0A7B5; text-decoration: line-through; }
.plan .tag { position: absolute; top: -11px; left: 18px; background: var(--brand); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; }
@media (max-width: 900px) { .plans { grid-template-columns: 1fr; } }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-3 h3 { margin: 6px 0 4px; }
.grid-3 p { margin: 0; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: 1fr; } }
/* keep phones from scrolling sideways */
body { overflow-x: clip; }
@media (max-width: 600px) { .topbar { gap: 8px; padding: 0 12px; } .topbar a.nav { padding: 6px 6px; } }
