/* Self-hosted handwriting fonts for typed signatures (no third-party requests from signers' browsers) */
@font-face { font-family: "Dancing Script"; font-weight: 600; font-display: swap; src: url(/fonts/dancing-script/files/dancing-script-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Great Vibes"; font-weight: 400; font-display: swap; src: url(/fonts/great-vibes/files/great-vibes-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Caveat"; font-weight: 600; font-display: swap; src: url(/fonts/caveat/files/caveat-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Homemade Apple"; font-weight: 400; font-display: swap; src: url(/fonts/homemade-apple/files/homemade-apple-latin-400-normal.woff2) format("woff2"); }
:root {
  --ink: #c2410c;
  --ink-2: #9a3412;
  --ink-soft: #ffede0;
  --paper: #fffaf5;
  --surface: #ffffff;
  --line: #e4e0d8;
  --line-2: #d5d0c5;
  --text: #1b2333;
  --muted: #6b7385;
  --amber: #f59e0b;
  --amber-soft: #fff4de;
  --green: #1f9d6b;
  --green-soft: #e3f6ed;
  --red: #c8372d;
  --red-soft: #fdeceb;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(194, 65, 12, .06), 0 4px 16px rgba(194, 65, 12, .06);
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--sans); color: var(--text); background: var(--paper); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: var(--ink-2); }
h1, h2, h3, h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.ic { flex: none; vertical-align: -3px; }

/* ---------- buttons & inputs ---------- */
.btn { font: inherit; font-weight: 600; font-size: 14px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px; text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s; }
.btn:hover { background: #f4f1ea; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .field:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
.btn.primary:hover { background: var(--ink-2); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: rgba(194, 65, 12, .07); }
.btn.danger { color: var(--red); }
.btn.danger.solid { background: var(--red); color: #fff; border-color: var(--red); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
input[type=text], input[type=email], input[type=password], textarea, select { font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; color: var(--text); }
textarea { resize: vertical; min-height: 84px; }
label.lbl { display: block; font-size: 13px; font-weight: 600; margin: 0 0 5px; color: #3b4559; }
.field-row { margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.check input { width: 17px; height: 17px; accent-color: var(--ink); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: var(--ink-soft); color: var(--ink); text-transform: capitalize; }
.badge.completed, .badge.signed { background: var(--green-soft); color: #11754f; }
.badge.sent, .badge.pending, .badge.viewed { background: var(--amber-soft); color: #9a6200; }
.badge.waiting { background: #eef0f4; color: #596175; }
.badge.declined, .badge.voided { background: var(--red-soft); color: #a3281f; }

/* ---------- shell ---------- */
.topbar { height: 60px; background: linear-gradient(100deg, #9a3412 0%, #c2410c 38%, #ea580c 72%, #f59e0b 100%); border-bottom: 3px solid #fbbf24; box-shadow: 0 4px 18px rgba(154, 52, 18, .28); display: flex; align-items: center; gap: 22px; padding: 0 22px; position: sticky; top: 0; z-index: 20; color: #fff; }
.brand { font-family: var(--serif); font-size: 23px; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 9px; letter-spacing: -.02em; }
.brand .logo { border-radius: 6px; }
.topbar .brand { color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.topbar .brand .logo { border-radius: 7px; background: #fff; padding: 2px; }
.nav { display: flex; gap: 6px; }
.nav a { padding: 8px 16px; border-radius: 999px; text-decoration: none; color: #fff; font-weight: 700; font-size: 15px; letter-spacing: .01em; transition: background .15s, transform .15s; }
.nav a:hover { background: rgba(255, 255, 255, .22); }
.nav a.active { color: #9a3412; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.nav a:focus-visible, .topbar .btn:focus-visible, .brand:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
.topbar .muted { color: rgba(255, 255, 255, .92); font-weight: 600; }
.topbar .btn.ghost { color: #fff; border-color: rgba(255, 255, 255, .55); font-weight: 600; }
.topbar .btn.ghost:hover { background: rgba(255, 255, 255, .22); }
.page { max-width: 1600px; margin: 0 auto; padding: 30px 22px 80px; }
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--serif); font-size: 30px; font-weight: 500; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.list { display: flex; flex-direction: column; }
.item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item.click { cursor: pointer; }
.item.click:hover { background: #fbfaf6; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docicon { width: 38px; height: 46px; border-radius: 4px; background: var(--ink-soft); color: var(--ink); display: grid; place-items: center; flex: none; border: 1px solid #d3deee; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty h3 { color: var(--text); font-family: var(--serif); font-weight: 500; font-size: 22px; margin-bottom: 6px; }
.dropzone { border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 36px; text-align: center; color: var(--muted); transition: all .15s; }
.dropzone.over { border-color: var(--ink-2); background: var(--ink-soft); color: var(--ink); }
.chips { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line-2); background: #fff; border-radius: 99px; padding: 5px 13px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
details.menu { position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu .pop { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border: 1px solid var(--line-2); border-radius: 9px; box-shadow: 0 8px 28px rgba(20, 30, 50, .16); min-width: 190px; padding: 5px; z-index: 30; }
details.menu .pop button { display: flex; width: 100%; text-align: left; border: 0; background: none; font: inherit; padding: 8px 11px; border-radius: 6px; cursor: pointer; gap: 8px; }
details.menu .pop button:hover { background: #f4f1ea; }
details.menu .pop button.danger { color: var(--red); }
details.menu .pop a { display: block; padding: 8px 11px; border-radius: 6px; color: inherit; text-decoration: none; }
details.menu .pop a:hover { background: #f4f1ea; }

/* ---------- auth ---------- */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 500px at 50% -10%, #ffe6d2 0, transparent 70%), var(--paper); }
.auth .card { width: 100%; max-width: 410px; padding: 30px; }
.auth h1 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 6px 0 4px; }
.auth .brand { font-size: 26px; margin-bottom: 16px; }
.err { background: var(--red-soft); color: #9b2a21; border-radius: 8px; padding: 9px 12px; font-size: 14px; margin-bottom: 12px; }

/* ---------- modal & toast ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(18, 28, 46, .45); display: grid; place-items: center; padding: 20px; z-index: 100; animation: fade .12s; overflow: auto; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 520px; box-shadow: 0 24px 80px rgba(10, 20, 40, .35); display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.modal.wide { max-width: 680px; }
.modal-head { padding: 18px 22px 8px; display: flex; align-items: center; }
.modal-head h3 { font-family: var(--serif); font-weight: 500; font-size: 22px; flex: 1; }
.modal-body { padding: 8px 22px 6px; overflow: auto; }
.modal-foot { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 8px; }
@keyframes fade { from { opacity: 0; } }
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 200; align-items: center; }
.toast { background: #172338; color: #fff; padding: 10px 16px; border-radius: 9px; font-size: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, .25); animation: fade .15s; max-width: 90vw; }
.toast.error { background: #8e231b; }
.linkbox { display: flex; gap: 6px; }
.linkbox input { font-size: 13px; color: var(--muted); }
.recip { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin-bottom: 10px; }
.recip .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- PDF pages & fields (shared by editor and signing) ---------- */
.pdfpage { position: relative; width: min(860px, 100%); margin: 0 auto 18px; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .16), 0 8px 26px rgba(20, 30, 50, .1); container-type: inline-size; }
.pdfpage canvas { display: block; width: 100%; height: 100%; }
.pdfpage .layer { position: absolute; inset: 0; }
.pdfpage .pgnum { position: absolute; bottom: -22px; right: 0; font-size: 12px; color: var(--muted); }
.field { --c: #2f6fed; position: absolute; border: 1.5px solid var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); border-radius: 3px; font-size: max(10px, 1.5cqw); color: color-mix(in srgb, var(--c) 80%, #000); display: flex; align-items: center; user-select: none; touch-action: none; }
.field .in { display: flex; align-items: center; gap: .4em; padding: 0 .5em; overflow: hidden; white-space: nowrap; width: 100%; height: 100%; pointer-events: none; font-weight: 600; }
.field .in svg { width: 1.25em; height: 1.25em; }
.field.sel { outline: 2px solid var(--c); outline-offset: 2px; z-index: 5; }
.field.edit { cursor: move; }
.field .handle { position: absolute; right: -6px; bottom: -6px; width: 11px; height: 11px; background: #fff; border: 2px solid var(--c); border-radius: 3px; cursor: nwse-resize; display: none; }
.field.sel .handle { display: block; }
.field .rtag { position: absolute; left: -1.5px; top: -1.55em; font-size: .8em; padding: .1em .55em; background: var(--c); color: #fff; border-radius: 3px 3px 0 0; white-space: nowrap; display: none; font-weight: 600; line-height: 1.35; }
.field.sel .rtag { display: block; }
.field.cb .in { justify-content: center; padding: 0; }

/* ---------- editor ---------- */
.editor { height: 100vh; display: grid; grid-template-rows: 56px 1fr; grid-template-columns: 268px 1fr 288px; grid-template-areas: "top top top" "left pages right"; }
.ed-top { grid-area: top; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 16px; }
.ed-title { font: inherit; font-family: var(--serif); font-size: 19px; border: 1px solid transparent; border-radius: 7px; padding: 5px 9px; width: min(380px, 34vw); background: transparent; }
.ed-title:hover, .ed-title:focus { border-color: var(--line-2); background: #fff; }
.save-state { font-size: 13px; color: var(--muted); min-width: 110px; }
.ed-left, .ed-right { background: #fff; overflow-y: auto; padding: 16px; }
.ed-left { grid-area: left; border-right: 1px solid var(--line); }
.ed-right { grid-area: right; border-left: 1px solid var(--line); }
.ed-pages { grid-area: pages; overflow: auto; background: #e9e6df; padding: 26px 20px 60px; position: relative; }
.ed-pages.armed .layer { cursor: crosshair; }
.side-h { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; margin: 4px 0 9px; display: flex; align-items: center; }
.side-sec { margin-bottom: 22px; }
.role { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1.5px solid transparent; border-radius: 9px; cursor: pointer; margin-bottom: 3px; }
.role:hover { background: #f6f3ec; }
.role.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 9%, #fff); }
.role .dot { width: 13px; height: 13px; border-radius: 50%; background: var(--c); flex: none; }
.role input { border: 0; background: transparent; padding: 3px 4px; font-weight: 600; min-width: 0; flex: 1; border-radius: 5px; }
.role input:focus { background: #fff; outline: 2px solid var(--ink-2); }
.role .x { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; padding: 2px 5px; border-radius: 5px; }
.role .x:hover { color: var(--red); background: var(--red-soft); }
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.pal { --c: #2f6fed; display: flex; align-items: center; gap: 8px; padding: 9px 10px; border: 1.5px solid var(--line-2); border-left: 4px solid var(--c); border-radius: 8px; background: #fff; font-weight: 600; font-size: 13px; cursor: grab; user-select: none; }
.pal:hover { background: #f8f6f0; }
.pal.on { background: color-mix(in srgb, var(--c) 14%, #fff); border-color: var(--c); }
.pal svg { color: var(--c); }
.warn { background: var(--amber-soft); color: #8a5800; border-radius: 8px; padding: 9px 11px; font-size: 13px; margin-bottom: 8px; }
.tip { color: var(--muted); font-size: 13px; }
.tip li { margin-bottom: 5px; }
kbd { font: 12px var(--sans); background: #f1eee6; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; }

/* ---------- envelope detail ---------- */
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 8px 14px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 9px 0 9px 22px; position: relative; border-left: 2px solid var(--line); margin-left: 6px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--ink); border: 2px solid #fff; }
.timeline li .t { color: var(--muted); font-size: 12px; display: block; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }

/* ---------- signing page ---------- */
.sign-top { height: 58px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 18px; position: sticky; top: 0; z-index: 20; }
.sign-top .doc { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sign-stage { padding: 24px 12px 150px; background: #e9e6df; min-height: calc(100vh - 58px); }
.progress { font-size: 13px; color: var(--muted); white-space: nowrap; }
.progress b { color: var(--text); }
.field.mine { background: color-mix(in srgb, var(--amber) 22%, transparent); border-color: var(--amber); color: #7a4b00; cursor: pointer; --c: var(--amber); }
.field.mine.done { background: transparent; border-color: color-mix(in srgb, var(--green) 55%, transparent); border-style: solid; }
.field.mine.done.sig { border-color: transparent; }
.field.mine.todo { animation: pulse 1.8s ease-in-out infinite; }
.field.mine.focus { outline: 3px solid var(--ink-2); outline-offset: 2px; animation: none; }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(242, 169, 59, .28); } }
.field.mine .in { pointer-events: none; }
.field.mine.cb::after { content: ""; position: absolute; inset: -10px; }
.field.mine input, .field.mine select { all: unset; box-sizing: border-box; width: 100%; height: 100%; padding: 0 .55em; font-size: 1em; font-weight: 500; color: #0b1b4d; cursor: text; font-family: var(--sans); }
.field.mine select { cursor: pointer; }
.field.mine input::placeholder { color: #a8742a; font-weight: 600; }
.field.mine img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.field.mine.cb .tick { width: 100%; height: 100%; display: grid; place-items: center; color: #0b1b4d; }
.field.mine.cb .tick svg { width: 85%; height: 85%; }
.field.other { --c: #9aa2b2; background: rgba(154, 162, 178, .12); border-style: dashed; color: #6b7385; font-size: max(9px, 1.3cqw); }
.field.other img { width: 100%; height: 100%; object-fit: contain; }
.field.other.filled { background: transparent; border-color: transparent; color: #0b1b4d; }
.guide { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 30; display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line-2); border-radius: 99px; padding: 8px 10px 8px 18px; box-shadow: 0 10px 40px rgba(10, 20, 40, .25); }
.guide .btn { border-radius: 99px; padding: 10px 22px; font-size: 15px; }
.center-card { max-width: 560px; margin: 8vh auto; padding: 34px; text-align: center; }
.center-card h1 { font-family: var(--serif); font-weight: 500; font-size: 30px; margin: 14px 0 8px; }
.bigicon { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto; }
.bigicon.ok { background: var(--green-soft); color: var(--green); }
.bigicon.no { background: var(--red-soft); color: var(--red); }
.bigicon.wait { background: var(--amber-soft); color: #b87400; }
.signer-list { text-align: left; margin: 22px 0 4px; border: 1px solid var(--line); border-radius: 10px; }
.signer-list div { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.signer-list div:last-child { border: 0; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.tabs button { font: inherit; font-weight: 600; background: none; border: 0; border-bottom: 2.5px solid transparent; padding: 9px 14px; cursor: pointer; color: var(--muted); margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.padwrap { border: 1.5px dashed var(--line-2); border-radius: 10px; background: #fff; position: relative; }
.padwrap canvas { display: block; width: 100%; height: 190px; touch-action: none; cursor: crosshair; }
.padwrap .baseline { position: absolute; left: 16px; right: 16px; bottom: 44px; border-top: 1px solid #cbd2dd; pointer-events: none; }
.padwrap .hint { position: absolute; left: 18px; bottom: 18px; font-size: 12px; color: #9aa2b2; pointer-events: none; }
.styles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.style-opt { border: 1.5px solid var(--line-2); border-radius: 9px; padding: 8px 12px; background: #fff; cursor: pointer; font-size: 30px; color: #10205c; text-align: left; line-height: 1.25; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.style-opt.on { border-color: var(--ink); background: var(--ink-soft); }
.legal { font-size: 12.5px; color: var(--muted); margin-top: 12px; }

/* ---------- folders pane ---------- */
.with-side { display: grid; grid-template-columns: 280px minmax(0, 1fr); max-width: none; margin: 0; align-items: start; }
.with-side .page { max-width: none; margin: 0; padding-left: 28px; padding-right: 32px; }
.side { padding: 26px 8px 40px 18px; position: sticky; top: 60px; }
.side-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; padding: 0 4px; }
.side-head h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.side-toggle { display: none; }
.ftree { display: flex; flex-direction: column; gap: 1px; }
.ftree.collapsed { display: none; }
.frow { display: flex; align-items: center; border-radius: 8px; border: 1px solid transparent; min-height: 34px; padding-right: 2px; }
.frow:hover { background: rgba(194, 65, 12, .06); }
.frow.on { background: var(--ink-soft); }
.frow.on .fname { color: var(--ink-2); font-weight: 650; }
.frow.drop { background: var(--amber-soft); border-color: var(--amber); }
.ftoggle { width: 22px; height: 26px; flex: none; border: 0; background: none; color: var(--muted); cursor: pointer; display: grid; place-items: center; border-radius: 6px; padding: 0; }
.ftoggle .ic { transition: transform .12s; }
.ftoggle.open .ic { transform: rotate(90deg); }
.ftoggle.none { visibility: hidden; }
.fname { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; text-align: left; padding: 6px 4px; border-radius: 6px; }
.fname .ic { flex: none; color: var(--muted); }
.frow.on .fname .ic { color: var(--ink); }
.fl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fcount { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.fpad { width: 30px; flex: none; }
.fmenu { opacity: 0; }
.frow:hover .fmenu, .frow:focus-within .fmenu, .fmenu[open] { opacity: 1; }
.fmenu summary { padding: 3px 6px; }
.fmenu .pop { right: 0; left: auto; }
.crumbs { font-size: 13px; color: var(--muted); display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 2px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }
.docpath { display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.item[draggable="true"] { cursor: pointer; }
.picker { display: flex; flex-direction: column; gap: 2px; max-height: 50vh; overflow: auto; margin-bottom: 8px; }
.pick { display: flex; align-items: center; gap: 8px; border: 1px solid transparent; background: none; font: inherit; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; color: var(--text); }
.pick:hover { background: #f4f1ea; }
.pick.on { background: var(--ink-soft); border-color: var(--ink); color: var(--ink-2); font-weight: 650; }
@media (max-width: 800px) {
  .with-side { grid-template-columns: 1fr; }
  .side { position: static; padding: 14px 16px 0; }
  .side-toggle { display: inline-flex; }
  .fmenu { opacity: 1; }
}

@media (max-width: 960px) {
  .editor { grid-template-columns: 1fr; grid-template-rows: 56px auto 1fr auto; grid-template-areas: "top" "left" "pages" "right"; height: auto; min-height: 100vh; }
  .ed-pages { min-height: 70vh; }
  .ed-left, .ed-right { border: 0; border-bottom: 1px solid var(--line); }
  .kv { grid-template-columns: 1fr; }
  .topbar .nav a { padding: 7px 9px; }
}
@media (max-width: 700px) { input[type=text], input[type=email], input[type=password], textarea, select { font-size: 16px; } }
@media (max-width: 760px) {
  .topbar { gap: 8px 10px; padding: 8px 12px; height: auto; flex-wrap: wrap; }
  .topbar .spacer { flex: 1; }
  .nav { order: 3; width: 100%; }
  .topbar .brand .bt, .topbar > .muted { display: none; }
  .nav { gap: 4px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
  .nav a { padding: 7px 11px; font-size: 14px; white-space: nowrap; }
  .topbar .btn.sm { padding: 5px 9px; }
}
@media (max-width: 600px) {
  .sign-top .bname { display: none; }
  .grid2 { grid-template-columns: 1fr; }
  .sign-top .progress { display: none; }
  .guide { width: calc(100% - 24px); justify-content: space-between; }
  .item { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* two-step verification */
.qr { width: 190px; height: 190px; margin: 6px auto 0; padding: 6px; background: #fff; border: 1px solid var(--line, #e5ded6); border-radius: 10px; }
.qr svg { width: 100%; height: 100%; display: block; }
.secret { display: block; word-break: break-all; text-align: center; padding: 8px; margin-bottom: 14px; background: #fff7f0; border-radius: 8px; letter-spacing: .08em; font-size: 14px; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px; background: #fff7f0; border-radius: 10px; }
.codes code { font-size: 15px; letter-spacing: .06em; text-align: center; }
@media print { .auth .btn, .auth label, .auth .muted { display: none !important; } }

/* radio button fields */
.field .in.radio { flex-direction: column; align-items: flex-start; justify-content: space-around; gap: 0; padding: .15em .5em; }
.ropt { display: flex; align-items: center; gap: .45em; line-height: 1.2; font-weight: 500; white-space: nowrap; }
.ropt i { flex: none; width: .95em; height: .95em; border-radius: 50%; border: 1.5px solid currentColor; box-sizing: border-box; position: relative; }
.field.mine.rad { cursor: default; padding: 0 .4em; }
.field.mine .rgroup { display: flex; flex-direction: column; justify-content: space-around; width: 100%; height: 100%; }
.field.mine .ropt { cursor: pointer; color: #0b1b4d; }
.field.mine .ropt.on i::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: currentColor; }
.field.mine .ropt:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 1px; border-radius: 3px; }

/* preview mode (owner sees the recipient's view) */
.preview-bar { position: fixed; top: 0; left: 0; right: 0; z-index: 60; height: 40px; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: #1f2430; color: #fff; font-size: 14px; }
.preview-bar .btn { background: #fff; color: #1f2430; }
.preview-bar select { margin-left: 4px; padding: 3px 6px; border-radius: 6px; }
.preview-bar .pv-as { display: flex; align-items: center; white-space: nowrap; }
.preview-bar .spacer { flex: 1; }
body.previewing { padding-top: 40px; }
body.previewing .sign-top { top: 40px; }
@media (max-width: 700px) { .preview-bar .pv-text { display: none; } }
/* radio fields with the labels hidden: only the round buttons */
.ropt.dim span { opacity: .55; font-style: italic; }
.field.mine .rgroup.nolabels .ropt, .field.other .rgroup.nolabels .ropt { flex: 1; }
.field.mine .rgroup.nolabels .ropt i { width: 1.1em; height: 1.1em; }
.field.other .rgroup { display: flex; flex-direction: column; justify-content: space-around; width: 100%; height: 100%; padding: 0 .4em; }
.field.other .ropt.on i::after { content: ""; position: absolute; inset: 2px; border-radius: 50%; background: currentColor; }

/* Status shortcuts under the folder tree */
.status-pane { margin-top: 18px; padding-top: 6px; border-top: 1px solid var(--line, #e6e1d8); }
.status-pane .side-head { margin-bottom: 4px; }

/* Selecting several documents to send as one packet */
.item .selbox, .selall input { width: 18px; height: 18px; accent-color: var(--ink); flex: none; cursor: pointer; }
.item.sel { background: var(--ink-soft); }
.item.click.sel:hover { background: var(--ink-soft); }
.selhead { padding: 0 4px 8px; }
.selall { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.selbar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 12px; width: min(640px, calc(100% - 24px)); padding: 10px 12px 10px 18px; background: var(--text); color: #fff; border-radius: 14px; box-shadow: 0 12px 36px rgba(27, 35, 51, .35); }
.selbar.hidden { display: none; }
.selbar .muted { color: rgba(255, 255, 255, .7); }
.selbar .btn.ghost { color: #fff; }
.selbar .btn.ghost:hover { background: rgba(255, 255, 255, .15); }
.plist { margin: 0; padding-left: 20px; }
.plist.packet { list-style: decimal; padding: 6px 8px 6px 28px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.plist.packet li { display: flex; align-items: center; gap: 4px; padding: 4px 0; }
.sign-packet { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 16px; background: var(--ink-soft); border-bottom: 1px solid var(--line); font-size: 13px; }
.sign-packet button { border: 1px solid var(--line-2); background: #fff; border-radius: 999px; padding: 4px 12px; cursor: pointer; font: inherit; color: var(--ink-2); font-weight: 600; }
.pkt-divider { text-align: center; margin: 22px 0 8px; font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }
@media (max-width: 600px) { .selbar { bottom: 10px; padding-left: 12px; } .selbar .muted { display: none; } }
