@font-face { font-family: 'SigCaveat'; src: url('/fonts/sign/Caveat.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'SigBelle'; src: url('/fonts/sign/LaBelleAurore.ttf') format('truetype'); font-display: swap; }
@font-face { font-family: 'SigNothing'; src: url('/fonts/sign/NothingYouCouldDo.ttf') format('truetype'); font-display: swap; }

:root {
  /* approved brand 2026-10-15 (design/brand/SignLucid品牌规范.html). The --teal* names are historical: they are now the coral action color */
  --ink: #1f2a44; --ink-2: #33405c; --muted: #55607a; --faint: #8b93a6; --line: #efe5df; --line-2: #f6eee9;
  --paper: #fff8f4; --card: #ffffff; --teal: #c8432a; --teal-2: #ff6b4a; --teal-soft: #ffede6; --mint: #ff9478;
  --amber: #ff6b4a; --amber-soft: #fff1ea; --red: #dc2626; --red-soft: #fdecec; --green: #15803d; --green-soft: #e8f6ee; --blue: #2563eb; --blue-soft: #eaf1ff;
  --r: 12px; --r-sm: 8px; --shadow: 0 1px 2px rgba(31, 42, 68, .06), 0 8px 24px rgba(31, 42, 68, .06); --shadow-lg: 0 24px 60px rgba(31, 42, 68, .18);
  --font: 'Inter', 'Noto Sans SC', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--paper); font-size: 14.5px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
body.modal-open { overflow: hidden; }
a { color: var(--teal); }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.01em; }
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input:not([type]), select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--r-sm); padding: .55rem .7rem; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal-2); box-shadow: 0 0 0 3px rgba(232, 85, 58, .18); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: .25rem; }
label > input, label > select, label > textarea { margin-top: .3rem; font-weight: 400; }
.muted { color: var(--muted); } .small { font-size: 12.5px; } .tiny { font-size: 11.5px; }
.row { display: flex; gap: .6rem; align-items: center; } .row.wrap { flex-wrap: wrap; } .grow { flex: 1; } .spacer { flex: 1; }
.stack > * + * { margin-top: .75rem; }
.hidden { display: none !important; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; border: 1px solid transparent; border-radius: 10px; padding: .55rem 1rem; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .05s, box-shadow .15s; background: var(--card); color: var(--ink); border-color: var(--line); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); box-shadow: 0 1px 0 rgba(255, 255, 255, .15) inset, 0 4px 14px rgba(232, 85, 58, .28); }
.btn.primary:hover { background: #b23a23; border-color: #b23a23; }
.btn.dark { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn.amber { background: var(--amber); color: var(--ink); border-color: var(--amber); }   /* navy on coral: 5:1 contrast */
.btn.danger { background: var(--red); color: #fff; border-color: var(--red); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--line-2); }
.btn.sm { padding: .32rem .65rem; font-size: 12.5px; border-radius: 8px; }
.btn.lg { padding: .8rem 1.3rem; font-size: 15.5px; border-radius: 12px; }
.btn.block { width: 100%; }
.icon-btn { border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 15px; }
.icon-btn:hover { background: var(--line-2); color: var(--ink); }

.badge { display: inline-flex; align-items: center; gap: .3rem; font-size: 11.5px; font-weight: 600; padding: .15rem .55rem; border-radius: 999px; white-space: nowrap; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.blue { background: var(--blue-soft); color: var(--blue); } .badge.green { background: var(--green-soft); color: var(--green); } .badge.amber { background: var(--amber-soft); color: #b45309; }
.badge.red { background: var(--red-soft); color: var(--red); } .badge.grey { background: var(--line-2); color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-pad { padding: 1.1rem 1.2rem; }

/* brand */
.sl-brand { display: inline-flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.sl-mark { width: 28px; height: 28px; flex: none; border-radius: 7px; }
.sl-logo { display: block; height: 26px; width: auto; }
.sl-word { font-size: 18px; letter-spacing: -.02em; font-weight: 500; } .sl-word b { font-weight: 800; color: var(--teal); }

/* toasts and modals */
#sl-toasts { position: fixed; z-index: 9999; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: .5rem; width: min(92vw, 440px); }
.sl-toast { background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .2s ease-out; }
.sl-toast.success { background: #0f5132; } .sl-toast.error { background: #8b1c1c; } .sl-toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.sl-modal-wrap { position: fixed; inset: 0; z-index: 1000; background: rgba(31, 42, 68, .45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sl-modal { background: #fff; border-radius: 16px; width: min(520px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow-lg); animation: pop .18s ease-out; }
.sl-modal.wide { width: min(760px, 100%); }
@keyframes pop { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.sl-modal header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem .4rem; }
.sl-modal header h3 { font-size: 17px; }
.sl-modal-body { padding: .6rem 1.2rem 1rem; overflow: auto; }
.sl-modal footer { display: flex; justify-content: flex-end; gap: .5rem; padding: .8rem 1.2rem 1.1rem; border-top: 1px solid var(--line-2); }

/* PDF stack */
.pdf-scroll { overflow: auto; background: #e9edf2; }
.pdf-stack { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 22px 12px 120px; }
.pdf-page { position: relative; background: #fff; box-shadow: 0 2px 10px rgba(31, 42, 68, .12); border-radius: 2px; }
.pdf-page canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.pdf-layer { position: absolute; inset: 0; }
.pdf-page-no { position: absolute; right: 8px; bottom: -18px; font-size: 11px; color: var(--faint); }

/* fields (shared look in editor, signer page and detail view) */
.fld { position: absolute; border: 1.5px solid var(--c, var(--blue)); background: color-mix(in srgb, var(--c, var(--blue)) 12%, transparent); border-radius: 4px; display: flex; align-items: center; gap: 4px; padding: 0 5px; font-size: 11px; font-weight: 600; color: var(--c, var(--blue)); overflow: hidden; white-space: nowrap; user-select: none; }
.fld .k { overflow: hidden; text-overflow: ellipsis; }
.fld img { position: absolute; left: 2px; top: 1px; bottom: 1px; max-width: calc(100% - 4px); height: calc(100% - 2px); object-fit: contain; object-position: left center; }
.fld.filled { background: transparent; border-style: dashed; border-color: color-mix(in srgb, var(--c) 45%, transparent); }
.fld.filled .k { display: none; }
.fld .val { color: var(--ink); font-weight: 500; font-size: 12px; }

/* layout bits */
.page-head { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.page-head h1 { font-size: 22px; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: .5rem; }
.kbd { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--line-2); padding: .1rem .35rem; border-radius: 5px; }
.copy-line { display: flex; gap: .4rem; align-items: center; }
.copy-line input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; background: var(--paper); }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.seg { display: inline-flex; background: var(--line-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: .35rem .8rem; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(31, 42, 68, .12); }
.lang-toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; background: #fff; }
.lang-toggle button { border: 0; background: transparent; padding: .25rem .7rem; font-size: 12.5px; cursor: pointer; color: var(--muted); }
.lang-toggle button.on { background: var(--ink); color: #fff; }

/* signature adopt dialog */
.adopt-fonts { display: grid; gap: .5rem; margin-top: .6rem; }
.adopt-fonts button { border: 1.5px solid var(--line); background: #fff; border-radius: 10px; height: 64px; font-size: 30px; color: var(--ink); cursor: pointer; text-align: left; padding: 0 1rem; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.adopt-fonts button.on { border-color: var(--teal-2); box-shadow: 0 0 0 3px rgba(232, 85, 58, .18); }
.pad-wrap { position: relative; border: 1.5px dashed #9fb3c8; border-radius: 12px; background: #fbfdff; margin-top: .6rem; }
.pad-wrap canvas { width: 100%; height: 170px; display: block; touch-action: none; cursor: crosshair; }
.pad-wrap .hint { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); pointer-events: none; font-size: 13px; }
.pad-wrap .baseline { position: absolute; left: 18px; right: 18px; bottom: 38px; border-bottom: 1px solid #cbd5e1; pointer-events: none; }
@media (max-width: 640px) { .sl-modal { border-radius: 16px 16px 0 0; align-self: end; } .sl-modal-wrap { padding: 0; place-items: end center; } }
.sg-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid #cbd5e1; border-top-color: var(--teal); animation: spin .8s linear infinite; margin: 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.sg-progress { height: 4px; background: var(--line-2); position: relative; }
.sg-progress i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--teal-2), var(--mint)); transition: width .3s; }

/* language menu */
.lang-select { width: auto; font-size: 12.5px; font-weight: 600; padding: .3rem 1.6rem .3rem .6rem; border-radius: 999px; border: 1px solid var(--line); background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%2355607a' stroke-width='1.5'/%3E%3C/svg%3E") no-repeat right .6rem center; -webkit-appearance: none; appearance: none; cursor: pointer; color: var(--ink); }
