/* Assize brand: fonts are self-hosted (see fonts/LICENSE.txt), colours follow assizedata.co.uk. */
@font-face { font-family: "Source Serif 4"; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/fonts/source-serif-4-latin-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Source Serif 4"; font-style: normal; font-display: swap; font-weight: 200 900; src: url(/fonts/source-serif-4-latin-ext-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 100 700; src: url(/fonts/ibm-plex-sans-latin-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-display: swap; font-weight: 100 700; src: url(/fonts/ibm-plex-sans-latin-ext-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Caveat"; font-style: normal; font-display: swap; font-weight: 600; src: url(/fonts/caveat-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Caveat"; font-style: normal; font-display: swap; font-weight: 600; src: url(/fonts/caveat-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

:root {
  /* --brand is the workspace's colour on signer pages (setBrand); --assize stays the Assize accent. */
  --assize: #7b2331;
  --brand: var(--assize);
  --brand-ink: #fff;
  --bg: #fbfaf7;
  --panel: #ffffff;
  --ink: #17191c;
  --muted: #4a4f57;
  --line: #dcd8cf;
  --line-strong: #8f897d; /* form control borders: 3:1 against the panel */
  --ok: #138a52;
  --warn: #b26a00;
  --bad: #c2352b;
  --focus: #1a5fb4;
  --radius: 4px;
  --shadow: 0 1px 2px rgba(23, 25, 28, .05), 0 1px 3px rgba(23, 25, 28, .07);
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-serif: "Source Serif 4", Georgia, Cambria, "Times New Roman", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --assize: #e8a3ad; --brand-ink: #121416;
    --bg: #121416; --panel: #1a1d20; --ink: #ecebe7; --muted: #a9adb3; --line: #2e3236; --line-strong: #6b7077; --focus: #8ab4f8;
    --shadow: 0 1px 2px rgba(0,0,0,.4); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.55 var(--font-sans);
  background: var(--bg); color: var(--ink);
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: .18em; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin: 0 0 .6em; }
h1 { font-size: 1.7rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }
.grow { flex: 1; }
.hidden { display: none !important; }

/* ---------- controls ---------- */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-weight: 600; padding: 8px 14px; min-height: 40px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink); white-space: nowrap;
}
button:hover, .btn:hover { text-decoration: none; filter: brightness(.97); }
button:disabled { opacity: .55; cursor: not-allowed; }
.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.danger { color: var(--bad); }
.danger.primary { background: var(--bad); border-color: var(--bad); color: #fff; }
.ghost { background: transparent; border-color: transparent; }
.sm { padding: 4px 10px; font-size: .85rem; min-height: 32px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: var(--panel); width: 100%;
  border: 1px solid var(--line-strong); border-radius: var(--radius); padding: 8px 10px;
}
input[type="checkbox"], input[type="radio"] { width: auto; }
input[type="color"] { padding: 2px; height: 38px; width: 60px; }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 4px; }
label.inline { display: inline-flex; gap: 8px; align-items: center; font-weight: 500; font-size: .95rem; }
.field { margin-bottom: 14px; }
.error { color: var(--bad); font-size: .9rem; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .78rem; font-weight: 600; background: var(--line); color: var(--ink); text-transform: capitalize; }
.badge.completed, .badge.signed { background: #d9f3e6; color: #0c6b3e; }
.badge.sent, .badge.viewed { background: #e2eafe; color: #2142b3; }
.badge.declined, .badge.voided, .badge.expired { background: #fde3e1; color: #9f261d; }
.badge.draft, .badge.created { background: #eceef2; color: #495062; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
tr.click { cursor: pointer; }
tr.click:hover td { background: color-mix(in srgb, var(--brand) 5%, transparent); }
.table-wrap { overflow-x: auto; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: none; color: var(--muted); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--brand); }

/* ---------- marketing ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 14px 24px; max-width: 1160px; margin: 0 auto; }
.logo { font-family: var(--font-serif); font-size: 1.3rem; letter-spacing: -.01em; line-height: 1; white-space: nowrap; color: var(--ink); display: inline-flex; gap: .55rem; align-items: center; }
.logo:hover { text-decoration: none; }
.logo .wm-name { font-weight: 650; }
.logo .wm-desc { color: var(--assize); font-weight: 400; }
.assize-mark { flex: none; color: var(--ink); }
.assize-mark .stop { fill: currentColor; stroke: var(--bg); stroke-width: 1.75px; }
.assize-mark .here { fill: var(--assize); }
.hero { max-width: 1160px; margin: 0 auto; padding: 56px 24px 32px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(2rem, 4.5vw, 3.1rem); letter-spacing: -.02em; }
.hero p { font-size: 1.15rem; color: var(--muted); }
.hero-art { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 22px; box-shadow: 0 12px 40px rgba(23,25,28,.10); }
.section { max-width: 1160px; margin: 0 auto; padding: 40px 24px; }
.eyebrow { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 .75rem; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.plan { display: flex; flex-direction: column; }
.plan.highlight { border: 2px solid var(--brand); }
.plan .price { font-size: 2rem; font-weight: 800; }
.plan ul { padding-left: 18px; margin: 10px 0 16px; flex: 1; }
.plan li { margin: 4px 0; }
.footer { text-align: center; color: var(--muted); padding: 30px; font-size: .85rem; }
.footer.legal { border-top: 1px solid var(--line); margin-top: 40px; font-size: .8rem; }
.footer.legal nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; margin-bottom: 10px; }
.footer.legal p { max-width: 760px; margin: 6px auto; }

/* ---------- auth ---------- */
.auth { max-width: 420px; margin: 40px auto; padding: 0 16px; }
.kind-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kind-pick label { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; cursor: pointer; font-weight: 500; margin: 0; }
.kind-pick input { display: none; }
.kind-pick input:checked + span { color: var(--brand); font-weight: 700; }
.kind-pick label:has(input:checked) { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }

/* ---------- app shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; }
.side nav a { display: block; padding: 8px 10px; border-radius: var(--radius); color: var(--ink); font-weight: 500; }
.side nav a.active, .side nav a:hover { background: color-mix(in srgb, var(--brand) 9%, transparent); text-decoration: none; }
.main { padding: 24px 28px; min-width: 0; }
.usage { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.usage > div { height: 100%; background: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat .n { font-size: 1.7rem; font-weight: 800; }
.menu-toggle { display: none; }

/* ---------- editor & document view ---------- */
.editor { display: grid; grid-template-columns: 320px 1fr; gap: 18px; align-items: start; }
.editor .panel { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.page { position: relative; container-type: inline-size; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.15); max-width: 100%; }
.page canvas { display: block; width: 100%; height: auto; }
.page .layer { position: absolute; inset: 0; }
.page.placing { cursor: crosshair; }
.fld {
  position: absolute; border: 1.5px solid var(--c, var(--brand)); background: color-mix(in srgb, var(--c, var(--brand)) 14%, transparent);
  border-radius: 4px; font-size: clamp(7px, 1.35cqw, 12px); white-space: nowrap; color: #1b2130; display: flex; align-items: center; justify-content: center;
  overflow: hidden; user-select: none; touch-action: none; text-align: center; line-height: 1.1;
}
.fld.sel { outline: 2px solid var(--c, var(--brand)); outline-offset: 2px; }
.editor .fld { cursor: move; }
.fld .grip { position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; background: var(--c, var(--brand)); cursor: nwse-resize; }
.fld img { max-width: 100%; max-height: 100%; }
.fld.readonly { border-style: dashed; background: transparent; }
.fld.todo { cursor: pointer; animation: pulse 1.6s infinite; }
.fld.done { background: color-mix(in srgb, #138a52 10%, transparent); border-color: #138a52; animation: none; }
.fld input[type="text"] { border: 0; background: transparent; width: 100%; height: 100%; padding: 0 3px; font-size: clamp(9px, 1.5cqw, 13px); border-radius: 0; color: #1b2130; }
.fld input[type="checkbox"] { width: 80%; height: 80%; margin: 0; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--c, var(--brand)) 25%, transparent); } }
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.palette button { justify-content: flex-start; font-weight: 500; }
.palette button.active { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, transparent); }
.rcp { border: 1px solid var(--line); border-left: 4px solid var(--c); border-radius: var(--radius); padding: 10px; margin-bottom: 8px; }
.rcp.active { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 40%, transparent); }
.rcp .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }

/* ---------- signing ---------- */
.sign-top { position: sticky; top: 0; z-index: 5; background: var(--panel); border-bottom: 1px solid var(--line); }
.sign-top .inner { max-width: 980px; margin: 0 auto; padding: 10px 16px; display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.sign-body { max-width: 980px; margin: 0 auto; padding: 16px; }
.brandbar { height: 5px; background: var(--brand); }
.notice { border-left: 4px solid var(--brand); }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(10, 14, 22, .55); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border-radius: 6px; padding: 20px; width: min(560px, 100%); max-height: 90vh; overflow: auto; }
.pad { width: 100%; height: 180px; border: 1px dashed var(--line); border-radius: var(--radius); background: #fff; touch-action: none; display: block; }
.typed { font-family: "Caveat", cursive; font-size: 44px; color: #12204a; text-align: center; padding: 30px 0; background: #fff; border-radius: var(--radius); border: 1px dashed var(--line); min-height: 110px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: var(--radius); z-index: 60; font-weight: 500; max-width: calc(100% - 32px); }
.toast.bad { background: var(--bad); color: #fff; }
.code { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; word-break: break-all; }
.dropzone { border: 2px dashed var(--line); border-radius: 6px; padding: 50px 20px; text-align: center; cursor: pointer; background: var(--panel); }
.dropzone.over { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, var(--panel)); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 30; left: 0; top: 0; width: 260px; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .main { padding: 16px; }
  .editor { grid-template-columns: 1fr; }
  .editor .panel { position: static; max-height: none; }
  .kind-pick { grid-template-columns: 1fr; }
  .topbar { padding: 12px 16px; }
}
