/* Fonts are self-hosted so no visitor data is sent to third parties. */
@font-face { font-family: 'Inter'; font-weight: 400; font-style: normal; font-display: swap; src: url('/vendor/fonts/inter/files/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-style: normal; font-display: swap; src: url('/vendor/fonts/inter/files/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-style: normal; font-display: swap; src: url('/vendor/fonts/inter/files/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-style: normal; font-display: swap; src: url('/vendor/fonts/inter/files/inter-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Dancing Script'; font-weight: 600; font-style: normal; font-display: swap; src: url('/vendor/fonts/dancing-script/files/dancing-script-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Great Vibes'; font-weight: 400; font-style: normal; font-display: swap; src: url('/vendor/fonts/great-vibes/files/great-vibes-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Caveat'; font-weight: 600; font-style: normal; font-display: swap; src: url('/vendor/fonts/caveat/files/caveat-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Homemade Apple'; font-weight: 400; font-style: normal; font-display: swap; src: url('/vendor/fonts/homemade-apple/files/homemade-apple-latin-400-normal.woff2') format('woff2'); }

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f2f8;
  --ink: #161a33;
  --muted: #646a86;
  --line: #e3e5ef;
  --accent: #4a3aff;
  --accent-ink: #ffffff;
  --accent-soft: #ecebff;
  --ok: #0f9d6b; --ok-soft: #e3f6ee;
  --warn: #b7791f; --warn-soft: #fdf3e1;
  --bad: #d23c4b; --bad-soft: #fde8ea;
  --shadow: 0 1px 2px rgba(22, 26, 51, .06), 0 8px 24px rgba(22, 26, 51, .06);
  --radius: 12px;
  --r1: #4a3aff; --r2: #e8590c; --r3: #0ca678; --r4: #d6336c; --r5: #1c7ed6; --r6: #9c36b5;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1120; --surface: #171a2e; --surface-2: #1e2238; --ink: #eceefa; --muted: #9aa0bd; --line: #2a2f4a;
    --accent: #7b6dff; --accent-soft: #24224a; --ok-soft: #0f2f25; --warn-soft: #33270f; --bad-soft: #3a1820;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 Inter, system-ui, -apple-system, sans-serif; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 26px; } h2 { font-size: 19px; } h3 { font-size: 15px; }
p { margin: 0 0 1em; }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; font-weight: 700; font-size: 18px; color: var(--ink); letter-spacing: -.02em; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; color: #fff; }
.brand-mark svg { width: 17px; height: 17px; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 600 14px Inter, sans-serif; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.danger.solid { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 12px 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn svg { width: 16px; height: 16px; flex: none; }

label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; }
.field { margin-bottom: 16px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], input[type=date], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: 14px Inter, sans-serif; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 80px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.otp-input { font: 600 26px ui-monospace, Menlo, monospace !important; letter-spacing: .4em; text-align: center; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
.sidebar { background: var(--surface); border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 4px 8px 16px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 14px; }
.nav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--accent); }
.nav a svg { width: 18px; height: 18px; flex: none; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 14px 10px 4px; }
.sidebar .spacer { flex: 1; }
.org-switch { width: 100%; }
.main { padding: 28px 36px 60px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.mobile-bar { display: none; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card.pad { padding: 20px 22px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; font-size: 16px; }
.card-body { padding: 18px 20px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

.stat { padding: 18px 20px; }
.stat .n { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.stat .l { color: var(--muted); font-size: 13px; font-weight: 500; }

.tile { display: flex; gap: 14px; padding: 18px 20px; color: var(--ink); transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); text-decoration: none; transform: translateY(-1px); }
.tile .ic { width: 42px; height: 42px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; }
.tile .ic svg { width: 22px; height: 22px; }
.tile h3 { margin: 2px 0 3px; }
.tile p { margin: 0; color: var(--muted); font-size: 13.5px; }

/* ---------- Tables / lists ---------- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 20px; border-bottom: 1px solid var(--line); }
td { padding: 13px 20px; border-bottom: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--surface-2); }
.table-wrap { overflow-x: auto; }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); }
.empty svg { width: 40px; height: 40px; opacity: .5; margin-bottom: 8px; }

.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.sent, .pill.viewed { background: var(--accent-soft); color: var(--accent); }
.pill.completed, .pill.signed { background: var(--ok-soft); color: var(--ok); }
.pill.declined, .pill.voided { background: var(--bad-soft); color: var(--bad); }
.pill.expired, .pill.waiting { background: var(--warn-soft); color: var(--warn); }
.avatars { display: flex; gap: 4px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px; font-size: 12px; background: var(--surface-2); border: 1px solid var(--line); }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: 600 14px Inter, sans-serif; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 18px 1fr; gap: 12px; padding: 0 0 16px; position: relative; }
.timeline li::before { content: ''; position: absolute; left: 8px; top: 18px; bottom: 0; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent-soft); border: 2px solid var(--accent); margin-top: 2px; }
.timeline .dot.ok { background: var(--ok-soft); border-color: var(--ok); }
.timeline .dot.bad { background: var(--bad-soft); border-color: var(--bad); }
.timeline .t { font-weight: 600; font-size: 14px; }
.timeline .m { color: var(--muted); font-size: 12.5px; }

.callout { padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); color: var(--ink); font-size: 14px; border: 1px solid transparent; }
.callout.warn { background: var(--warn-soft); }
.callout.bad { background: var(--bad-soft); }
.callout.ok { background: var(--ok-soft); }
.secret { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px dashed var(--line); padding: 10px 12px; border-radius: 9px; word-break: break-all; }
.secret code { flex: 1; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; padding: 14px 18px; background: var(--surface-2); border-radius: 10px; font: 600 15px ui-monospace, Menlo, monospace; }

/* ---------- Toast & modal ---------- */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; }
.toast { background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 10px; font-weight: 500; font-size: 14px; box-shadow: var(--shadow); animation: pop .2s ease-out; max-width: 90vw; }
.toast.bad { background: var(--bad); color: #fff; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 17, 32, .5); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 900; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: pop .2s ease-out; }
.modal.wide { width: min(720px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px 0; }
.modal-head h2 { margin: 0; }
.modal-body { padding: 18px 22px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 0 22px 20px; }
.x { background: none; border: 0; font-size: 22px; color: var(--muted); cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.x:hover { background: var(--surface-2); }

/* ---------- Signature pad ---------- */
.sigpad-canvas { width: 100%; height: 190px; border: 1px solid var(--line); border-radius: 10px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.sigpad-line { position: relative; }
.sigpad-line::after { content: ''; position: absolute; left: 24px; right: 24px; bottom: 44px; border-bottom: 1px dashed #c8cbe0; pointer-events: none; }
.font-choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.font-choice { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #fff; color: #161a33; font-size: 28px; cursor: pointer; text-align: center; min-height: 72px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.font-choice.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.swatches { display: flex; gap: 8px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--muted); cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 2px var(--accent); }
.dropzone { border: 2px dashed var(--line); border-radius: 14px; padding: 40px 20px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color .15s, background .15s; background: var(--surface); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 40px; height: 40px; color: var(--accent); margin-bottom: 8px; }
.dropzone strong { color: var(--ink); display: block; font-size: 16px; margin-bottom: 4px; }

/* ---------- Document editor ---------- */
.doc-workspace { display: grid; grid-template-columns: 260px 1fr 260px; gap: 0; height: calc(100vh - 61px); }
.doc-workspace.no-right { grid-template-columns: 260px 1fr; }
.doc-panel { background: var(--surface); border-right: 1px solid var(--line); padding: 16px; overflow-y: auto; }
.doc-panel.right { border-right: 0; border-left: 1px solid var(--line); }
.doc-panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 0 8px; }
.doc-panel h3:first-child { margin-top: 0; }
.doc-scroll { overflow: auto; padding: 24px; background: var(--surface-2); }
.pages { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12); user-select: none; }
.page canvas { display: block; width: 100%; height: 100%; }
.page .overlay { position: absolute; inset: 0; }
.page-num { font-size: 12px; color: var(--muted); text-align: center; margin-top: -10px; }
.topbar { height: 61px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 0 18px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
.topbar .title-input { border: 1px solid transparent; background: transparent; font: 600 16px Inter, sans-serif; padding: 6px 8px; width: min(360px, 40vw); }
.topbar .title-input:hover { border-color: var(--line); }

.palette { display: grid; gap: 6px; }
.palette button { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); font: 500 13.5px Inter, sans-serif; cursor: grab; text-align: left; touch-action: none; }
.palette button:hover { border-color: var(--role, var(--accent)); background: var(--surface-2); }
.palette button svg { width: 16px; height: 16px; color: var(--role, var(--accent)); }
.roles { display: grid; gap: 6px; }
.role-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px; cursor: pointer; }
.role-item.active { border-color: var(--role); box-shadow: 0 0 0 2px color-mix(in srgb, var(--role) 20%, transparent); }
.role-item .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--role); flex: none; }
.role-item input { border: 0; padding: 2px 4px; background: transparent; font-size: 13.5px; font-weight: 500; }
.role-item input:focus { box-shadow: none; background: var(--surface-2); }

.fld { position: absolute; border: 1.5px solid var(--role, var(--accent)); background: color-mix(in srgb, var(--role, var(--accent)) 12%, transparent); border-radius: 4px; display: flex; align-items: center; justify-content: center; font: 600 11px Inter, sans-serif; color: var(--role, var(--accent)); cursor: move; overflow: hidden; touch-action: none; }
.fld .lbl { pointer-events: none; padding: 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 4px; }
.fld .lbl svg { width: 13px; height: 13px; flex: none; }
.fld.selected { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--role, var(--accent)); z-index: 5; }
.fld .handle { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; background: var(--role, var(--accent)); cursor: nwse-resize; border-radius: 3px 0 3px 0; }
.fld img { max-width: 100%; max-height: 100%; pointer-events: none; }
.fld.quick { border-style: dashed; background: transparent; }
.fld.quick.selected { background: rgba(74, 58, 255, .05); }
.fld .del { position: absolute; top: -1px; right: -1px; width: 18px; height: 18px; background: var(--bad); color: #fff; border: 0; border-radius: 0 3px 0 4px; font-size: 13px; line-height: 1; cursor: pointer; display: none; }
.fld.selected .del { display: block; }
.fld .text-val { color: #161a33; font: 400 13px Helvetica, Arial, sans-serif; white-space: nowrap; pointer-events: none; padding: 0 3px; width: 100%; text-align: left; }
.ghost-field { position: fixed; pointer-events: none; z-index: 2000; opacity: .85; }

/* ---------- Signing experience ---------- */
.sign-shell { min-height: 100vh; display: flex; flex-direction: column; }
.sign-bar { position: sticky; top: 0; z-index: 60; background: var(--surface); border-bottom: 1px solid var(--line); padding: 10px 18px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.sign-bar .doc-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sign-bar .meta { font-size: 12.5px; color: var(--muted); }
.progress { height: 4px; background: var(--line); }
.progress > div { height: 100%; background: var(--accent); width: 0; transition: width .3s; }
.sign-main { flex: 1; background: var(--surface-2); padding: 24px 16px 120px; }
.sign-field { position: absolute; border: 2px solid var(--accent); background: rgba(255, 214, 10, .28); border-radius: 4px; cursor: pointer; display: flex; align-items: center; justify-content: center; font: 600 11px Inter, sans-serif; color: #3b2fd1; transition: background .15s, box-shadow .15s; }
.sign-field:hover { background: rgba(255, 214, 10, .45); }
.sign-field.req::after { content: '*'; position: absolute; top: -2px; right: 3px; color: var(--bad); font-size: 14px; }
.sign-field.done { background: transparent; border-color: transparent; border-bottom: 1px solid rgba(74, 58, 255, .3); }
.sign-field.done:hover { border-color: rgba(74, 58, 255, .4); }
.sign-field.current { box-shadow: 0 0 0 4px rgba(74, 58, 255, .35); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(74, 58, 255, .12); } }
.sign-field img { max-width: 100%; max-height: 100%; }
.sign-field input[type=text] { width: 100%; height: 100%; border: 0; background: transparent; padding: 0 4px; font: 13px Helvetica, Arial, sans-serif; color: #161a33; border-radius: 0; }
.sign-field input[type=text]:focus { box-shadow: none; background: rgba(255,255,255,.6); }
.sign-field select { width: 100%; height: 100%; border: 0; background: transparent; font: 13px Helvetica, Arial, sans-serif; color: #161a33; padding: 0 4px; border-radius: 0; }
.sign-field select:focus { box-shadow: none; background: rgba(255,255,255,.6); }
.sign-field .choices { display: flex; gap: 3px; width: 100%; height: 100%; align-items: center; padding: 0 2px; overflow: hidden; }
.sign-field .choices button { flex: 1; min-width: 0; height: 84%; border: 1px solid #c0c4d8; background: #fff; border-radius: 4px; font: 600 11px Inter, sans-serif; color: #161a33; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 4px; }
.sign-field .choices button.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.sign-field .cb { width: 80%; height: 80%; display: grid; place-items: center; color: #161a33; }
.sign-field.other { border: 0; background: transparent; cursor: default; }
.sign-field.other.blank { border: 1px dashed #c0c4d8; background: rgba(0,0,0,.02); color: #9aa0bd; font-weight: 500; }
.next-btn { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 70; box-shadow: 0 10px 30px rgba(74, 58, 255, .35); }
.flag { position: absolute; left: -8px; transform: translateX(-100%); background: var(--accent); color: #fff; font: 700 11px Inter, sans-serif; padding: 5px 10px 5px 8px; border-radius: 4px 0 0 4px; white-space: nowrap; pointer-events: none; }
.flag::after { content: ''; position: absolute; right: -8px; top: 0; border: 12px solid transparent; border-left: 8px solid var(--accent); border-right: 0; height: 0; }

/* ---------- Public / auth pages ---------- */
.public-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 24px; max-width: 1120px; margin: 0 auto; }
.public-head nav { display: flex; gap: 6px; align-items: center; }
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-side { background: linear-gradient(150deg, #2b1fd1, #4a3aff 45%, #8a6bff); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side .brand { color: #fff; }
.auth-side .brand-mark { background: rgba(255,255,255,.2); }
.auth-side h2 { font-size: 30px; max-width: 440px; letter-spacing: -.02em; }
.auth-side ul { list-style: none; padding: 0; margin: 24px 0 0; display: grid; gap: 12px; max-width: 420px; }
.auth-side li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; opacity: .95; }
.auth-side li svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.auth-side .sig-art { position: absolute; right: -40px; bottom: 80px; font: 120px 'Great Vibes', cursive; opacity: .12; transform: rotate(-8deg); white-space: nowrap; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; background: var(--surface); }
.auth-card { width: min(400px, 100%); }
.auth-card h1 { font-size: 24px; }
.auth-foot { font-size: 13px; color: var(--muted); margin-top: 18px; text-align: center; }
.center-card { max-width: 520px; margin: 40px auto; }
.hero { text-align: center; padding: 30px 20px 10px; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: clamp(28px, 5vw, 42px); letter-spacing: -.03em; }
.hero p { color: var(--muted); font-size: 17px; }
.legal { max-width: 780px; margin: 0 auto; padding: 10px 24px 80px; }
.legal h1 { font-size: 32px; }
.legal h2 { margin-top: 32px; font-size: 20px; }
.legal h3 { margin-top: 20px; }
.legal p, .legal li { color: var(--ink); line-height: 1.7; }
.legal table td, .legal table th { padding: 8px 10px; font-size: 13.5px; border: 1px solid var(--line); vertical-align: top; text-transform: none; letter-spacing: 0; }
.legal .toc { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 20px; columns: 2; font-size: 14px; }
.legal .toc a { display: block; padding: 2px 0; }
.site-foot { border-top: 1px solid var(--line); padding: 22px 24px; display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.site-foot a { color: var(--muted); }

.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .doc-workspace { grid-template-columns: 220px 1fr; }
  .doc-panel.right { display: none; }
  .doc-panel.right.show { display: block; position: fixed; right: 0; top: 61px; bottom: 0; width: 280px; z-index: 40; box-shadow: var(--shadow); }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 100; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .mobile-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 50; }
  .main { padding: 20px 16px 60px; }
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .doc-workspace, .doc-workspace.no-right { grid-template-columns: 1fr; height: auto; }
  .doc-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .doc-scroll { padding: 12px; }
  .palette { grid-template-columns: repeat(2, 1fr); }
  th, td { padding: 10px 12px; }
  .legal .toc { columns: 1; }
  .hide-sm { display: none !important; }
  .topbar { height: auto; min-height: 56px; flex-wrap: wrap; padding: 8px 12px; }
  .topbar .title-input { width: 100%; }
}
