/* eSign — paper, ballpoint ink, office stamp. */
:root {
  --paper: #F6F7F9;
  --surface: #FFFFFF;
  --surface-2: #EEF0F4;
  --ink: #162036;
  --muted: #5B6478;
  --line: #DCE0E7;
  --ballpoint: #2743C9;
  --ballpoint-hover: #1F37A8;
  --ballpoint-soft: #E7EBFB;
  --on-ballpoint: #FFFFFF;
  --stamp: #6E3FA3;
  --stamp-soft: #F1EAF8;
  --ok: #17784C;
  --ok-soft: #E3F4EA;
  --danger: #B9342A;
  --danger-soft: #FBE9E7;
  --warn: #8A5A00;
  --warn-soft: #FFF4DB;
  --shadow: 0 1px 2px rgba(22, 32, 54, .06), 0 8px 24px rgba(22, 32, 54, .06);
  --desk: #E4E7EC; /* backdrop behind PDF pages */
  color-scheme: light;
}
:root[data-theme="dark"] {
  --paper: #10141D; --surface: #171C27; --surface-2: #1F2533; --ink: #E6E9F0; --muted: #9AA3B5; --line: #2A3142;
  --ballpoint: #7D93FF; --ballpoint-hover: #95A7FF; --ballpoint-soft: #1E2748; --on-ballpoint: #0B1030;
  --stamp: #B58CE0; --stamp-soft: #2A2140; --ok: #4CC38A; --ok-soft: #14301F; --danger: #F07A6E; --danger-soft: #3A1C19;
  --warn: #E7B85A; --warn-soft: #33290F; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --desk: #0B0E14;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10141D; --surface: #171C27; --surface-2: #1F2533; --ink: #E6E9F0; --muted: #9AA3B5; --line: #2A3142;
    --ballpoint: #7D93FF; --ballpoint-hover: #95A7FF; --ballpoint-soft: #1E2748; --on-ballpoint: #0B1030;
    --stamp: #B58CE0; --stamp-soft: #2A2140; --ok: #4CC38A; --ok-soft: #14301F; --danger: #F07A6E; --danger-soft: #3A1C19;
    --warn: #E7B85A; --warn-soft: #33290F; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); --desk: #0B0E14;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font: 15px/1.55 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0; }
a { color: var(--ballpoint); }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); font-size: 14px; }
.error:empty { display: none; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  height: 60px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 18px; letter-spacing: -0.02em; flex: none; }
.brand img { width: 28px; height: 28px; }
.topbar .spacer { flex: 1; }
.topbar .title { min-width: 0; padding-left: 16px; border-left: 1px solid var(--line); }
.topbar .title strong { display: block; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.gmail-ok { display: inline-flex; align-items: center; gap: 6px; color: var(--ok); font-weight: 600; }
.gmail-ok::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
@media (max-width: 640px) { .who .email, .gmail-ok, .who a.btn { display: none !important; } .topbar { gap: 10px; padding: 0 12px; } .who { gap: 4px; } }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: 8px;
  font: inherit; font-size: 14px; font-weight: 600; white-space: nowrap;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--ballpoint); border-color: var(--ballpoint); color: var(--on-ballpoint); }
.btn.primary:hover { background: var(--ballpoint-hover); }
.btn.quiet { border-color: transparent; background: transparent; color: var(--muted); }
.btn.quiet:hover { color: var(--ink); background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.small { height: 32px; padding: 0 12px; font-size: 13px; }
.btn.large { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.icon { width: 38px; padding: 0; }
.btn svg { width: 18px; height: 18px; flex: none; }
:focus-visible { outline: 2px solid var(--ballpoint); outline-offset: 2px; }

/* ---------- form ---------- */
label.field { display: block; margin-top: 12px; }
label.field:first-child { margin-top: 0; }
label.field > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=url], textarea {
  width: 100%; height: 40px; padding: 0 12px; font: inherit; font-size: 14px;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
}
textarea { height: 96px; padding: 10px 12px; resize: vertical; }
input:focus, textarea:focus { outline: none; border-color: var(--ballpoint); box-shadow: 0 0 0 3px var(--ballpoint-soft); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--ballpoint); flex: none; }

/* ---------- status pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--muted); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.sent, .pill.viewed { background: var(--ballpoint-soft); color: var(--ballpoint); }
.pill.completed, .pill.signed { background: var(--ok-soft); color: var(--ok); }
.pill.declined { background: var(--danger-soft); color: var(--danger); }
.pill.voided { text-decoration: line-through; }

/* ---------- page shell ---------- */
.shell { max-width: 1080px; margin: 0 auto; padding: 32px 20px 64px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin-top: 4px; color: var(--muted); }

/* ---------- login ---------- */
/* Login backdrop: soft ballpoint-blue and stamp-purple glow, same tones as the logo. */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative;
  background:
    radial-gradient(60rem 40rem at 12% -10%, color-mix(in srgb, var(--ballpoint) 16%, transparent), transparent 60%),
    radial-gradient(50rem 36rem at 105% 110%, color-mix(in srgb, var(--stamp) 16%, transparent), transparent 60%),
    linear-gradient(160deg, color-mix(in srgb, var(--ballpoint) 5%, var(--paper)), var(--paper) 55%, color-mix(in srgb, var(--stamp) 6%, var(--paper)));
}
.login .theme-corner { position: absolute; top: 16px; right: 16px; }
.login-box { width: 100%; max-width: 400px; text-align: center; }
.login-box .mark { width: 64px; height: 64px; margin: 0 auto 20px; display: block; }
.login-box h1 { font-size: 28px; }
.login-box .lead { margin: 10px auto 28px; color: var(--muted); max-width: 34ch; }
.btn.google { width: 100%; height: 48px; font-size: 15px; box-shadow: var(--shadow); }
.btn.google svg { width: 20px; height: 20px; }
.login-box form { text-align: left; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.login-box form .btn { width: 100%; margin-top: 16px; }
.login-foot { margin-top: 28px; font-size: 12px; color: var(--muted); }

/* ---------- dashboard ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); background: none; border: 0; padding: 10px 12px; border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ballpoint); }
.tabs .count { font-weight: 500; color: var(--muted); margin-left: 4px; }

.dropzone {
  display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin-bottom: 20px;
  border: 1.5px dashed var(--line); border-radius: 12px; background: var(--surface);
  color: var(--muted); cursor: pointer; transition: border-color .15s, background-color .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--ballpoint); background: var(--ballpoint-soft); color: var(--ink); }
.dropzone > svg { width: 28px; height: 28px; color: var(--ballpoint); flex: none; }
.dropzone strong { color: var(--ink); }
.upload-status { padding: 16px 20px; margin-bottom: 20px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.upload-status .row { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; margin-bottom: 8px; }
.bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--ballpoint); border-radius: 99px; transition: width .2s; }
.bar.indeterminate > i { width: 35%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(300%); } }

/* No overflow:hidden here: it would clip the action tooltips. Corners are rounded on the rows instead. */
.doclist { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.doclist > :first-child { border-top-left-radius: 11px; border-top-right-radius: 11px; }
.doclist > :last-child { border-bottom-left-radius: 11px; border-bottom-right-radius: 11px; }
.doc { display: grid; grid-template-columns: minmax(0, 1fr) 180px 230px 130px; gap: 16px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); }
.doc:first-child { border-top: 0; }
.doc-title { display: flex; gap: 12px; align-items: center; min-width: 0; }
.fileicon { width: 34px; height: 42px; flex: none; }
.doc-title strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-title .muted { display: flex; gap: 12px; }
.signers { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.avatars { display: flex; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; border: 2px solid var(--surface); margin-left: -7px; position: relative; }
.avatars .avatar:first-child { margin-left: 0; }
.avatar.signed::after { content: "✓"; position: absolute; right: -4px; bottom: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 9px; display: grid; place-items: center; border: 1.5px solid var(--surface); }
.doc-actions { display: flex; gap: 6px; justify-content: flex-end; }
/* icon-only row actions */
.btn.act { width: 36px; height: 36px; padding: 0; border-radius: 10px; color: var(--muted); }
.btn.act:hover { color: var(--ink); }
.btn.act.primary { background: var(--ballpoint-soft); border-color: transparent; color: var(--ballpoint); }
.btn.act.primary:hover { background: var(--ballpoint); color: var(--on-ballpoint); }
.btn.act.danger { color: var(--danger); }
.btn.act.danger:hover { background: var(--danger-soft); border-color: transparent; }
/* tooltip for icon buttons */
[data-tip] { position: relative; }
[data-tip]:hover, [data-tip]:focus-visible { z-index: 40; }
[data-tip]::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translate(-50%, 4px);
  padding: 5px 9px; border-radius: 6px; background: var(--ink); color: var(--paper);
  font-size: 12px; font-weight: 600; white-space: nowrap; pointer-events: none; z-index: 40;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .18);
  opacity: 0; transition: opacity .12s, transform .12s;
}
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); font-size: 16px; margin-bottom: 4px; }
@media (max-width: 860px) {
  .doc { grid-template-columns: minmax(0, 1fr) auto; gap: 10px 12px; }
  .doc-title { grid-column: 1 / -1; }
  .doc .signers { grid-column: 1; min-width: 0; }
  .doc .signers > span:last-child { overflow: hidden; text-overflow: ellipsis; }
  .doc-actions { grid-column: 2; grid-row: 2 / span 2; align-self: end; }
}

/* ---------- side drawer (audit) ---------- */
dialog { border: 0; padding: 0; color: var(--ink); background: var(--surface); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(10, 14, 24, .45); }
dialog.drawer { margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(560px, 100vw); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.drawer-head p { margin-top: 2px; }
.drawer-body { padding: 20px 24px 40px; }
.verify { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; padding: 12px 14px; border-radius: 10px; font-size: 14px; background: var(--surface-2); }
.verify.ok { background: var(--ok-soft); color: var(--ok); }
.verify.bad { background: var(--danger-soft); color: var(--danger); }
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: 8px; width: 2px; background: var(--line); }
.timeline li { position: relative; padding: 0 0 20px 26px; }
.timeline li::before { content: ""; position: absolute; left: 0; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--muted); }
.timeline li.good::before { border-color: var(--ok); background: var(--ok); }
.timeline li.bad::before { border-color: var(--danger); background: var(--danger); }
.timeline time { display: block; font-size: 12px; color: var(--muted); }
.timeline .what { font-size: 14px; margin: 2px 0 6px; }
.timeline .meta { display: flex; flex-wrap: wrap; gap: 6px; }
.timeline .meta span { font-size: 12px; color: var(--muted); background: var(--surface-2); border-radius: 6px; padding: 1px 8px; }
.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; }

/* ---------- workspace (editor + signing) ---------- */
.workspace { display: grid; grid-template-columns: 340px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.workspace > aside {
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--line); padding: 24px 20px;
}
.desk { background: var(--desk); padding: 28px 20px 120px; min-width: 0; }
.pages { display: flex; flex-direction: column; align-items: center; gap: 20px; }
.page { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 6px 20px rgba(0,0,0,.08); max-width: 100%; }
.page canvas { display: block; max-width: 100%; height: auto !important; }
.page-loading { color: var(--muted); padding: 80px 0; text-align: center; }
@media (max-width: 900px) {
  .workspace { grid-template-columns: 1fr; }
  .workspace > aside { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
}

.step { padding-bottom: 22px; margin-bottom: 22px; border-bottom: 1px solid var(--line); }
.step:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.step-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.step-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--ballpoint-soft); color: var(--ballpoint); flex: none; }
.step.done .step-num { background: var(--ok-soft); color: var(--ok); }

.recipient { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.recipient:first-child { border-top: 0; padding-top: 0; }
.recipient .info { flex: 1; min-width: 0; }
.recipient .info strong { display: flex; gap: 6px; align-items: center; font-size: 14px; }
.recipient .info strong b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recipient .info span { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag { font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted); flex: none; }
.add-recipient { margin-top: 12px; padding: 14px; border-radius: 10px; background: var(--surface-2); }
.add-recipient .order-row { display: flex; align-items: center; gap: 10px; }
.add-recipient .order-row input { width: 72px; flex: none; }
.add-recipient .order-row small { line-height: 1.35; }
.add-recipient .check { margin-top: 14px; font-size: 13px; line-height: 1.45; }
.add-recipient .actions { margin-top: 14px; }
.add-recipient .actions { display: flex; gap: 8px; margin-top: 12px; }

/* option tiles */
.tiles { display: grid; gap: 6px; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tile { position: relative; cursor: pointer; display: block; }
.tile input { position: absolute; opacity: 0; pointer-events: none; }
.tile > span {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px;
  border: 1.5px solid var(--line); background: var(--surface); font-size: 14px; font-weight: 600;
}
.tiles.three .tile > span { flex-direction: column; gap: 4px; padding: 12px 4px; font-size: 12.5px; text-align: center; white-space: nowrap; }
.tile svg { width: 22px; height: 22px; color: var(--muted); }
.tile input:checked + span { border-color: var(--ballpoint); background: var(--ballpoint-soft); color: var(--ballpoint); }
.tile input:checked + span svg { color: var(--ballpoint); }
.tile input:focus-visible + span { outline: 2px solid var(--ballpoint); outline-offset: 2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.hint { margin-top: 12px; font-size: 13px; color: var(--muted); padding: 10px 12px; border-radius: 8px; background: var(--surface-2); }
.subhead { font-size: 13px; font-weight: 600; margin: 14px 0 8px; }

/* fields on the PDF (pages are always white paper) */
.field-box {
  position: absolute; display: flex; align-items: center; justify-content: center; gap: 4px;
  border: 1.5px solid; border-radius: 4px; font-size: 12px; font-weight: 600; color: #162036;
  overflow: visible; cursor: pointer; user-select: none; container-type: size; background: rgba(255,255,255,.6); font: inherit; font-size: 12px; font-weight: 600; padding: 0;
}
.field-box svg { width: 14px; height: 14px; flex: none; }
.field-box > span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
@container (max-width: 64px) { .field-box > span { display: none; } }
@container (max-height: 16px) { .field-box svg { display: none; } }
.field-box .x { position: absolute; top: -9px; right: -9px; width: 18px; height: 18px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-size: 12px; line-height: 1; opacity: 0; transition: opacity .1s; }
.field-box:hover .x, .field-box:focus-visible .x { opacity: 1; }
.field-box.todo { border-style: dashed; border-color: #2743C9; background: rgba(39, 67, 201, .08); color: #2743C9; }
.field-box.todo.current { border-style: solid; box-shadow: 0 0 0 4px rgba(39, 67, 201, .25); }
.field-box.filled { border-color: transparent; background: transparent; }
.field-box.filled:hover { border-color: rgba(39, 67, 201, .5); }
.field-box img { max-width: 100%; max-height: 100%; }
.field-box .typed { font-size: 13px; color: #1A2A8F; font-weight: 500; }

/* ---------- signing ---------- */
.signbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 15;
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(22, 32, 54, .06);
}
.signbar .progress { flex: 1; min-width: 0; font-size: 14px; }
.signbar .progress strong { display: block; }
.signbar .bar { margin-top: 6px; max-width: 280px; }
@media (max-width: 560px) { .signbar .decline-btn { display: none; } }

.center { min-height: calc(100vh - 60px); display: grid; place-items: center; padding: 24px; }
.panel { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.panel.centered { text-align: center; }
.panel h1 { font-size: 22px; margin-bottom: 8px; }
.panel .lead { color: var(--muted); }
.panel .btn.wide { width: 100%; margin-top: 20px; }
.doc-chip { display: flex; gap: 12px; align-items: center; margin: 20px 0 0; padding: 12px; border-radius: 10px; background: var(--surface-2); text-align: left; }
.doc-chip .fileicon { width: 28px; height: 34px; }
.doc-chip strong { display: block; font-size: 14px; }
.notice { padding: 12px 14px; border-radius: 10px; font-size: 14px; background: var(--warn-soft); color: var(--warn); margin-bottom: 16px; text-align: left; }
.notice.bad { background: var(--danger-soft); color: var(--danger); }

/* signed stamp — the one bold moment */
.stamp {
  display: inline-grid; place-items: center; width: 136px; height: 136px; border-radius: 50%;
  border: 4px double var(--stamp); color: var(--stamp); background: var(--stamp-soft);
  font-weight: 800; font-size: 14px; letter-spacing: .03em; line-height: 1.15;
  transform: rotate(-8deg); margin: 4px auto 20px;
  animation: stamp-in .5s cubic-bezier(.2, 1.4, .4, 1) both;
}
.stamp > span { display: block; }
.stamp small { display: block; font-weight: 600; font-size: 11px; letter-spacing: 0; margin-top: 6px; }
@keyframes stamp-in { from { transform: rotate(-8deg) scale(1.7); opacity: 0; } to { transform: rotate(-8deg) scale(1); opacity: 1; } }

/* ---------- dialogs ---------- */
dialog.modal { width: min(520px, calc(100vw - 32px)); border-radius: 14px; }
.modal-body { padding: 24px; }
.modal-body > p { margin-top: 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); }
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-2); margin: 16px 0 12px; }
.segmented button { font: inherit; font-size: 14px; font-weight: 600; border: 0; background: none; color: var(--muted); padding: 7px 16px; border-radius: 8px; cursor: pointer; }
.segmented button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.sig-surface { position: relative; height: 170px; border-radius: 10px; background: #fff; border: 1px solid var(--line); overflow: hidden; }
.sig-surface::after { content: ""; position: absolute; left: 24px; right: 24px; bottom: 44px; border-bottom: 1.5px solid #C9CFDA; pointer-events: none; }
.sig-surface .x-mark { position: absolute; left: 24px; bottom: 50px; color: #9AA3B5; font-size: 18px; pointer-events: none; }
.sig-surface canvas { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
.sig-preview { position: absolute; left: 48px; right: 24px; bottom: 46px; font-family: "Mr Dafoe", cursive; font-size: 48px; line-height: 1; color: #111111; white-space: nowrap; overflow: hidden; }
.ink-row { display: flex; align-items: center; gap: 14px; margin: -4px 0 12px; font-size: 13px; }
.ink { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.ink input { position: absolute; opacity: 0; pointer-events: none; }
.ink span { width: 18px; height: 18px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--line); }
.ink input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ballpoint); }
.ink input:focus-visible + span { outline: 2px solid var(--ballpoint); outline-offset: 4px; }
.ink em { font-style: normal; color: var(--ink-label, inherit); }
.sig-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
/* uploaded signature */
.sig-drop { cursor: pointer; display: grid; place-items: center; }
.sig-drop::after { display: none; }
.sig-drop:hover, .sig-drop.over { border-color: var(--ballpoint); }
.sig-drop img { max-width: calc(100% - 32px); max-height: calc(100% - 32px); object-fit: contain; }
.sig-drop-hint { display: grid; gap: 4px; text-align: center; color: #162036; font-size: 14px; }
.sig-drop-hint .muted { color: #5B6478; }
.consent { margin-top: 16px; padding: 14px; border-radius: 10px; background: var(--surface-2); }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 40px)); }
body.has-signbar #toasts { bottom: 88px; }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; border-radius: 10px; font-size: 14px; background: var(--ink); color: var(--paper); box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast::before { content: ""; width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: none; background: #7D93FF; }
.toast.ok::before { background: #4CC38A; }
.toast.error::before { background: #F07A6E; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
.theme-corner { display: flex; gap: 4px; align-items: center; }
/* Same box as the theme icon button so the two line up. */
.btn.lang-toggle { height: 38px; min-width: 38px; padding: 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .02em; }

/* login selling points */
.points { list-style: none; margin: -8px auto 28px; padding: 0; display: grid; gap: 10px; text-align: left; max-width: 360px; }
.points li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink); }
.points svg { width: 18px; height: 18px; flex: none; margin-top: 2px; color: var(--ok); stroke-width: 2.4; }

/* dashboard sidebar */
.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: calc(100vh - 60px); }
.sidenav { position: sticky; top: 60px; align-self: start; height: calc(100vh - 60px); padding: 20px 12px; border-right: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 4px; }
.sidenav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 600; text-decoration: none; }
.sidenav a:hover { background: var(--surface-2); color: var(--ink); }
.sidenav a[aria-current="page"] { background: var(--ballpoint-soft); color: var(--ballpoint); }
.sidenav svg { width: 18px; height: 18px; flex: none; }
.app .shell { margin: 0; max-width: none; width: 100%; padding: 32px 32px 64px; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: static; height: auto; flex-direction: row; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .sidenav a { white-space: nowrap; }
  .app .shell { padding: 20px 16px 48px; }
}

/* email template editor */
.tpl-grid { display: grid; grid-template-columns: minmax(0, 380px) minmax(0, 1fr); gap: 24px; align-items: start; }
.card-form { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.card-form h3 { margin-bottom: 4px; }
.card-form small { display: block; margin-top: 6px; line-height: 1.45; }
.color-row { display: flex; gap: 8px; align-items: center; }
.color-row input[type=color] { width: 44px; height: 40px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; flex: none; }
.color-row input[type=text] { width: 110px; font-family: ui-monospace, Consolas, monospace; }
.tiles.two { grid-template-columns: 1fr 1fr; }
.tpl-preview { position: sticky; top: 84px; }
.tpl-preview .segmented { margin-top: 0; }
.mail-chrome { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow); }
.mail-subject { display: flex; gap: 10px; align-items: baseline; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.mail-subject strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#tplFrame { display: block; width: 100%; height: 640px; border: 0; background: #F1F3F6; }
@media (max-width: 1100px) { .tpl-grid { grid-template-columns: 1fr; } .tpl-preview { position: static; } }
