/* ============================================================
   安签云 AnSign Cloud · 设计系统
   企业级电子签署平台
   ============================================================ */

:root {
  --brand: #4f46e5;
  --brand-600: #4338ca;
  --brand-700: #3730a3;
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --violet: #7c3aed;
  --ink: #0f172a;
  --ink-2: #475569;
  --muted: #94a3b8;
  --line: #e5e9f0;
  --line-soft: #eef1f6;
  --bg: #f6f7fb;
  --card: #ffffff;
  --success: #059669;
  --success-bg: #ecfdf5;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-dark: #b45309;
  --info: #2563eb;
  --info-bg: #eff6ff;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .06), 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 12px rgba(15, 23, 42, .07), 0 2px 4px rgba(15, 23, 42, .04);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .16), 0 4px 14px rgba(15, 23, 42, .08);
  --topbar-h: 60px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", -apple-system, "Segoe UI", sans-serif;
  --serif: "Noto Serif SC", "Source Han Serif SC", "Songti SC", "SimSun", "STSong", serif;
  --mono: "SFMono-Regular", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, select, textarea { font-family: inherit; font-size: 14px; }
button, a { touch-action: manipulation; }
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-600); }
::selection { background: var(--brand-100); color: var(--brand-700); }
.hidden { display: none !important; }
.body-modal-open { overflow: hidden; }

/* ---------- 加载动画 ---------- */
.spin {
  width: 16px; height: 16px; border: 2px solid currentColor;
  border-top-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite; flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-busy { opacity: .85; cursor: wait; }
.btn.is-busy .spin { width: 14px; height: 14px; }

/* ---------- 视图切换 ---------- */
.view { animation: viewIn .22s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }

/* ---------- 图标 ---------- */
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.icon.sm { width: 15px; height: 15px; }
.icon.lg { width: 24px; height: 24px; }
.icon.xl { width: 32px; height: 32px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 9px 16px; font-size: 14px; font-weight: 600; line-height: 1.3;
  transition: all .16s ease; white-space: nowrap; user-select: none;
  box-shadow: var(--shadow-xs);
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; box-shadow: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-600); box-shadow: var(--shadow-sm); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #1e293b; }
.btn-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); box-shadow: none; }
.btn-ghost:hover { background: var(--bg); color: var(--ink); border-color: #d4dae4; }
.btn-danger { background: var(--danger-bg); color: var(--danger); box-shadow: none; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ---------- 表单 ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field label .req { color: var(--danger); }
.input, .select, .textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 9px 12px; background: #fff; color: var(--ink); outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder, .textarea::placeholder { color: #b6bfcc; }
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--brand); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.textarea { min-height: 110px; resize: vertical; line-height: 1.7; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-hint { font-size: 12px; color: var(--muted); margin-top: 4px; line-height: 1.5; }
.radio-line {
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500;
  padding: 9px 12px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; background: #fff; color: var(--ink-2); transition: all .15s;
}
.radio-line:hover { border-color: #cbd5e1; }
.radio-line:has(input:checked) { border-color: var(--brand); background: var(--brand-50); color: var(--brand-700); }
.radio-line input { accent-color: var(--brand); }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 1.5px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; line-height: 1.65;
  letter-spacing: .01em;
}
.badge .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.b-signing { background: var(--info-bg); color: var(--info); }
.b-completed { background: var(--success-bg); color: var(--success); }
.b-cancelled { background: #f1f5f9; color: #64748b; }
.b-draft { background: #f1f5f9; color: #64748b; }
.b-pending { background: var(--warning-bg); color: var(--warning); }
.b-approved { background: var(--success-bg); color: var(--success); }
.b-rejected { background: var(--danger-bg); color: var(--danger); }
.b-signed { background: var(--success-bg); color: var(--success); }
.b-active { background: var(--success-bg); color: var(--success); }
.b-disabled { background: #f1f5f9; color: #64748b; }

/* ---------- 应用外壳 ---------- */
.topbar {
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 60;
}
.topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 0 22px;
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--brand) 0%, var(--violet) 100%);
  color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 10px rgba(79, 70, 229, .28);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15.5px; font-weight: 700; letter-spacing: .01em; }
.brand-text small { font-size: 10.5px; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.topbar-right { display: flex; align-items: center; gap: 6px; }
.icon-btn {
  background: transparent; border: none; color: var(--ink-2); width: 36px; height: 36px;
  border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; position: relative;
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--bg); color: var(--ink); }
.icon-btn:active { transform: scale(.95); }
.icon-btn .badge-dot {
  position: absolute; top: 8px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--danger); border: 2px solid #fff;
}
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 12px 4px 5px; border-radius: 999px; border: 1px solid transparent; transition: all .15s; }
.user-chip:hover { background: var(--bg); border-color: var(--line); }
.avatar {
  width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--violet));
  color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.user-chip .u-name { font-size: 12.5px; font-weight: 600; line-height: 1.25; display: flex; flex-direction: column; }
.user-chip .u-meta { font-weight: 400; color: var(--muted); font-size: 10.5px; }
.user-chip .u-portal { color: var(--brand); font-size: 10px; }

.app-body { display: flex; align-items: stretch; max-width: 1320px; margin: 0 auto; min-height: calc(100vh - var(--topbar-h)); }

/* ---------- 侧边导航 ---------- */
.navbar {
  width: 230px; flex: none; background: #fff;
  border-right: 1px solid var(--line);
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  overflow-y: auto; scrollbar-width: thin;
}
.navbar-inner { display: flex; flex-direction: column; gap: 2px; padding: 18px 12px 32px; }
.nav-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em; color: #a7b0bd;
  padding: 14px 12px 6px; text-transform: uppercase;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  font-size: 13.5px; font-weight: 500; color: var(--ink-2); border-radius: 9px;
  border-bottom: none; white-space: nowrap; transition: all .14s ease;
}
.nav-item .icon { color: #a5aebc; transition: color .14s; }
.nav-item:hover { background: var(--bg); color: var(--ink); }
.nav-item:hover .icon { color: var(--ink-2); }
.nav-item.active { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }
.nav-item.active .icon { color: var(--brand); }
.nav-item .nav-badge { margin-left: auto; font-size: 10.5px; background: var(--danger-bg); color: var(--danger); padding: 0 6px; border-radius: 999px; font-weight: 700; }

/* ---------- 主视图 ---------- */
.view { flex: 1; min-width: 0; padding: 26px 30px 90px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 700; letter-spacing: -.01em; line-height: 1.3; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* ---------- 卡片 ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-xs); }
.card-pad { padding: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--line-soft); }
.card-head h2 { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.card-body { padding: 18px 20px; }

/* ---------- 统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-xs); display: flex; align-items: center; gap: 13px;
  transition: all .18s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #d9dfea; }
.stat-card .stat-icon {
  width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex: none;
}
.stat-card .stat-num { font-size: 23px; font-weight: 750; line-height: 1.15; letter-spacing: -.02em; }
.stat-card .stat-label { font-size: 12px; color: var(--muted); margin-top: 1px; }
.bg-yellow { background: var(--warning-bg); color: var(--warning); }
.bg-blue { background: var(--info-bg); color: var(--info); }
.bg-green { background: var(--success-bg); color: var(--success); }
.bg-red { background: var(--danger-bg); color: var(--danger); }
.bg-orange { background: var(--warning-bg); color: #ea580c; }
.bg-gray { background: #f1f5f9; color: #64748b; }
.bg-brand { background: var(--brand-50); color: var(--brand); }

/* ---------- 快捷入口 ---------- */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 22px; }
.quick-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px;
  display: flex; flex-direction: column; gap: 7px; align-items: flex-start; box-shadow: var(--shadow-xs);
  transition: all .18s ease;
}
.quick-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.quick-card .qc-icon { width: 34px; height: 34px; border-radius: 9px; display: flex; align-items: center; justify-content: center; }
.quick-card strong { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.quick-card small { font-size: 11.5px; color: var(--muted); line-height: 1.45; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; padding: 10px 14px; color: #7b8494; font-size: 11.5px; font-weight: 650;
  border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; letter-spacing: .02em;
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: #f8fafd; }
.table tr:last-child td { border-bottom: none; }
.table .cell-main { font-weight: 600; color: var(--ink); }
.table .cell-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.table .row-link { cursor: pointer; }

/* ---------- 列表项 ---------- */
.list-item { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .13s; }
.list-item:last-child { border-bottom: none; }
.list-item:hover { background: #f8fafd; }
.list-item .li-main { font-weight: 600; font-size: 14px; }
.list-item .li-sub { font-size: 12px; color: var(--muted); }
.list-item .li-right { margin-left: auto; text-align: right; flex: none; }

/* ---------- 空状态 ---------- */
.empty { text-align: center; padding: 52px 20px; color: var(--muted); }
.empty .empty-art { width: 64px; height: 64px; margin: 0 auto 14px; color: #c3cad6; }
.empty .empty-art svg { width: 100%; height: 100%; }
.empty p { font-size: 13.5px; color: #8b94a5; }
.empty .empty-sub { font-size: 12px; color: #b0b8c6; margin-top: 4px; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fadeIn .16s ease; backdrop-filter: blur(3px);
  transition: opacity .16s ease;
}
.modal-mask.leaving { opacity: 0; pointer-events: none; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 560px; max-height: 88vh;
  display: flex; flex-direction: column; overflow: hidden; animation: modalIn .2s cubic-bezier(.21, 1.02, .55, 1);
  box-shadow: var(--shadow-lg);
  transition: transform .16s ease, opacity .16s ease;
}
.modal.leaving { transform: translateY(12px) scale(.98); opacity: 0; }
.modal-lg { max-width: 880px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot { padding: 13px 20px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 10px; background: #fafbfd; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { transform: translateY(16px) scale(.98); opacity: 0; } }

/* ---------- Toast ---------- */
#toastRoot {
  position: fixed; right: 20px; bottom: 20px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end; width: min(360px, calc(100vw - 40px));
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fff; color: var(--ink); padding: 11px 14px; border-radius: 11px; font-size: 13.5px; font-weight: 500;
  box-shadow: var(--shadow-lg); border: 1px solid var(--line);
  animation: toastIn .25s cubic-bezier(.21, 1.02, .55, 1); max-width: 100%;
  transition: opacity .28s ease, transform .28s ease;
}
.toast.leaving { opacity: 0; transform: translateX(20px); }
.toast .toast-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.toast.ok .toast-icon { color: var(--success); }
.toast.err .toast-icon { color: var(--danger); }
.toast.ok { border-left: 3px solid var(--success); }
.toast.err { border-left: 3px solid var(--danger); }
@keyframes toastIn { from { transform: translateX(24px); opacity: 0; } }

/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh; display: flex; background: #fafbff;
}
.login-side {
  flex: 1.1; display: flex; flex-direction: column; justify-content: center;
  padding: 60px 7vw; position: relative; overflow: hidden; color: #fff;
  background:
    radial-gradient(900px 600px at 85% -10%, rgba(124, 58, 237, .45), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(79, 70, 229, .55), transparent 55%),
    linear-gradient(160deg, #1e1b4b 0%, #312e81 55%, #4338ca 100%);
}
.login-side::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .09) 1px, transparent 1px);
  background-size: 26px 26px; opacity: .5; pointer-events: none;
}
.login-side .ls-inner { position: relative; z-index: 1; max-width: 480px; }
.login-side .ls-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 34px; }
.login-side .ls-logo {
  width: 46px; height: 46px; border-radius: 13px; background: rgba(255, 255, 255, .16);
  border: 1px solid rgba(255, 255, 255, .25); display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.login-side .ls-brand strong { font-size: 19px; font-weight: 700; letter-spacing: .02em; }
.login-side .ls-brand small { display: block; font-size: 11px; opacity: .65; letter-spacing: .12em; text-transform: uppercase; }
.login-side h2 { font-size: 30px; font-weight: 750; line-height: 1.25; letter-spacing: -.02em; margin-bottom: 14px; }
.login-side p.lead { font-size: 14.5px; opacity: .78; line-height: 1.8; margin-bottom: 34px; max-width: 420px; }
.ls-feature { display: flex; gap: 13px; align-items: flex-start; padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, .12); }
.ls-feature .ls-ic {
  width: 34px; height: 34px; border-radius: 9px; flex: none; background: rgba(255, 255, 255, .14);
  display: flex; align-items: center; justify-content: center;
}
.ls-feature strong { font-size: 13.5px; font-weight: 600; }
.ls-feature p { font-size: 12.5px; opacity: .68; margin-top: 1px; }

.login-card {
  flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center;
  padding: 48px 6vw; max-width: 620px; margin: 0 auto;
}
.login-card-inner { width: 100%; max-width: 400px; margin: 0 auto; }
.login-head { margin-bottom: 22px; }
.login-logo { display: none; }
.login-head h1 { font-size: 24px; font-weight: 750; letter-spacing: -.02em; color: var(--ink); }
.login-head p { font-size: 13.5px; color: var(--muted); margin-top: 5px; }
.login-tabs {
  display: flex; background: #eef0f6; border-radius: 10px; padding: 4px; margin-bottom: 22px;
}
.login-tab {
  flex: 1; padding: 8px; text-align: center; font-weight: 600; font-size: 13.5px; color: var(--ink-2);
  background: transparent; border: none; border-radius: 8px; transition: all .18s;
}
.login-tab.active { color: var(--ink); background: #fff; box-shadow: var(--shadow-sm); }
.login-body { width: 100%; }
.login-body .btn { padding: 11px 16px; }
#loginForm, #registerForm { animation: formIn .18s ease; }
#companyFields { animation: formIn .18s ease; }
@keyframes formIn { from { opacity: 0; transform: translateY(4px); } }
.login-foot { text-align: center; font-size: 12px; color: var(--muted); padding: 20px 0 0; border-top: 1px solid var(--line-soft); margin-top: 24px; }

/* ---------- 工作台 ---------- */
.greet-banner {
  background: linear-gradient(120deg, #1e1b4b, #3730a3);
  color: #fff; border-radius: 14px; padding: 24px 26px; margin-bottom: 22px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap; position: relative; overflow: hidden;
  box-shadow: 0 8px 24px rgba(49, 46, 129, .18);
}
.greet-banner::after {
  content: ""; position: absolute; right: -70px; top: -70px; width: 260px; height: 260px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 65%);
}
.greet-banner h2 { font-size: 19px; font-weight: 700; letter-spacing: -.01em; }
.greet-banner p { font-size: 13px; color: rgba(255, 255, 255, .68); margin-top: 3px; }
.greet-banner .btn { position: relative; z-index: 1; background: #fff; color: var(--brand-700); box-shadow: var(--shadow-sm); }
.greet-banner .btn:hover { background: #f4f4ff; }

/* ---------- 合同纸面 ---------- */
.paper {
  background: #fff; border: 1px solid var(--line); border-radius: 6px; box-shadow: var(--shadow-md);
  max-width: 860px; margin: 0 auto; padding: 52px 58px 48px;
  font-family: var(--serif); font-size: 15.5px; color: #1f2937; position: relative; line-height: 1.95;
}
.paper::before {
  content: "安签云 AnSign Cloud"; position: absolute; top: 18px; left: 58px;
  font-family: var(--font); font-size: 10px; letter-spacing: .12em; color: #c3cad6;
}
.paper::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, transparent, rgba(79, 70, 229, .28), transparent);
}
.contract-title { text-align: center; font-size: 22px; font-weight: 800; margin-bottom: 24px; letter-spacing: 4px; }
.contract-parties { white-space: pre-line; margin-bottom: 18px; line-height: 2; }
.contract-body p { text-indent: 2em; margin-bottom: 8px; line-height: 2; }
.sign-block {
  border: 1.5px dashed #d0b25e; border-radius: 12px; padding: 18px 20px; margin-top: 34px;
  background: #fffdf6;
}
.sign-block.rejected { border-color: #f3b8b8; background: var(--danger-bg); }
.sign-block.done { border-style: solid; border-color: #a7e3c8; background: var(--success-bg); }
.sign-block h4 { font-family: var(--font); font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sign-block .sb-info { font-family: var(--font); font-size: 12.5px; color: #64748b; margin-top: 8px; line-height: 1.8; }
.sign-img { max-height: 120px; max-width: 100%; margin-top: 10px; }
.sign-imgs { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.sign-imgs .sign-img { margin-top: 0; max-height: 110px; }
.cert-line {
  font-family: var(--font); font-size: 11.5px; color: #7a6b1e; background: #faf3d4;
  border-radius: 8px; padding: 7px 11px; margin-top: 10px; word-break: break-all;
}
.cross-seal-wrap { position: absolute; right: 14px; top: 0; bottom: 0; width: 44px; pointer-events: none; opacity: .9; }
.cross-seal { position: absolute; right: 0; width: 78px; height: 78px; object-fit: contain; clip-path: inset(0 0 0 50%); }

/* ---------- 签名板 ---------- */
.sig-box { position: relative; border: 1.5px dashed #cbd5e1; border-radius: 12px; background: #fbfcfe; overflow: hidden; }
.sig-box canvas { display: block; width: 100%; height: 190px; touch-action: none; }
.sig-hint { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 12px; color: #b0b8c6; pointer-events: none; letter-spacing: .08em; }
.sig-line { position: absolute; left: 9%; right: 9%; bottom: 36px; border-top: 1px solid #dde3ec; pointer-events: none; }

/* ---------- 印章 ---------- */
.seal-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.seal-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: #fff; padding: 18px 16px 16px;
  text-align: center; position: relative; box-shadow: var(--shadow-xs); transition: all .18s;
}
.seal-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.seal-card img { width: 112px; height: 112px; object-fit: contain; margin-bottom: 10px; }
.seal-card .seal-name { font-weight: 650; font-size: 13.5px; }
.seal-card .seal-type { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ---------- 图表 ---------- */
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 172px; padding-top: 12px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.bar {
  width: 100%; max-width: 40px; border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--brand), var(--violet)); min-height: 3px;
  transition: height .4s cubic-bezier(.22, 1, .36, 1); opacity: .92;
}
.bar.muted { background: linear-gradient(180deg, #c7d2fe, #a5b4fc); opacity: .75; }
.bar-val { font-size: 11px; font-weight: 700; color: var(--ink-2); }
.bar-label { font-size: 11px; color: var(--muted); }
.legend {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px;
  padding: 5px 12px; background: #fafbfd; border: 1px solid var(--line); border-radius: 999px;
  margin: 0 6px 8px 0; color: var(--ink-2);
}
.legend .sw { width: 10px; height: 10px; border-radius: 3px; }

/* ---------- 筛选与分页 ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar .input { width: auto; min-width: 180px; flex: 1; max-width: 320px; }
.filter-bar .select { width: auto; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 18px; color: var(--muted); font-size: 12.5px; }
.tabs-line { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs-line button {
  background: none; border: none; padding: 9px 14px; font-size: 13.5px; font-weight: 600;
  color: var(--ink-2); border-bottom: 2px solid transparent; white-space: nowrap;
  margin-bottom: -1px; transition: color .15s;
}
.tabs-line button:hover { color: var(--ink); }
.tabs-line button.active { color: var(--brand-700); border-bottom-color: var(--brand); }

/* ---------- 描述信息 ---------- */
.kv { display: grid; grid-template-columns: 112px 1fr; gap: 9px 16px; font-size: 13.5px; }
.kv .k { color: var(--muted); }
.kv .v { word-break: break-all; color: var(--ink); }
.divider { height: 1px; background: var(--line-soft); margin: 16px 0; }
.mono { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.text-danger { color: var(--danger); }
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }

/* ---------- 向导 ---------- */
.wizard-card { max-width: 860px; margin: 0 auto; }
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: stepIn .25s ease; }
@keyframes stepIn { from { opacity: 0; transform: translateY(8px); } }
.step-dots { display: flex; justify-content: center; align-items: center; gap: 6px; margin-bottom: 26px; }
.step-dot { width: 8px; height: 8px; border-radius: 50%; background: #d8dee9; transition: all .25s; }
.step-dot.active { background: var(--brand); width: 28px; border-radius: 999px; }
.step-dot.done { background: var(--success); }
.signer-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 15px; margin-bottom: 11px; background: #fff; transition: border-color .15s; }
.signer-card:hover { border-color: #cbd5e1; }
.signer-card .sc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

/* ---------- 消息 ---------- */
.notice-item { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .13s; }
.notice-item:last-child { border-bottom: none; }
.notice-item:hover { background: #f8fafd; }
.notice-item.unread { background: #fafbff; }
.notice-item.unread .ni-title { font-weight: 700; }
.notice-item .ni-title { font-size: 13.5px; }
.notice-item .ni-content { font-size: 12.5px; color: var(--muted); }
.notice-item .ni-time { font-size: 11.5px; color: var(--muted); flex: none; white-space: nowrap; }
.notice-dot { width: 7px; height: 7px; border-radius: 50%; background: #d8dee9; flex: none; margin-top: 7px; }
.notice-item.unread .notice-dot { background: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.status-strip { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.status-strip .sep { color: #d3d9e3; }

/* ---------- 验证结果 ---------- */
.verify-result { border-radius: 12px; padding: 16px 18px; margin-top: 14px; font-size: 13.5px; }
.verify-ok { background: var(--success-bg); border: 1px solid #bbf0d5; }
.verify-fail { background: var(--danger-bg); border: 1px solid #f4c7c7; }

/* ---------- 响应式 ---------- */
@media (max-width: 980px) {
  .app-body { flex-direction: column; }
  .navbar {
    width: 100%; height: auto; position: sticky; top: var(--topbar-h); z-index: 40;
    border-right: none; border-bottom: 1px solid var(--line); overflow-x: auto;
  }
  .navbar-inner { flex-direction: row; padding: 8px 14px; gap: 4px; }
  .nav-label { display: none; }
  .nav-item { white-space: nowrap; padding: 8px 12px; }
  .view { padding: 18px 16px 80px; }
  .login-side { display: none; }
  .login-card { padding: 40px 24px; max-width: 480px; }
}

@media (max-width: 640px) {
  .view { padding: 14px 12px 84px; }
  .paper { padding: 40px 22px 36px; font-size: 14.5px; }
  .paper::before { left: 22px; }
  .form-row { grid-template-columns: 1fr; }
  .greet-banner { padding: 18px; }
  .user-chip .u-name { display: none; }
  .stat-card { padding: 13px 14px; }
  .stat-card .stat-num { font-size: 20px; }
  .table th, .table td { padding: 9px 10px; }
  .hide-sm { display: none !important; }
  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(145px, 1fr)); }
}

/* ---------- 打印 ---------- */
@media print {
  body { background: #fff; }
  .topbar, .navbar, .view > :not(#printArea), .modal-mask, #toastRoot, .login-page, .login-side { display: none !important; }
  #printArea { display: block !important; }
  .paper { box-shadow: none; border: none; max-width: 100%; padding: 0; }
  .sign-block { break-inside: avoid; }
}

/* ---------- 注册：账号类型选择 ---------- */
.acc-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.acc-picker-card {
  display: flex; align-items: center; gap: 10px; padding: 12px 13px;
  border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; background: #fff;
  transition: all .16s;
}
.acc-picker-card:hover { border-color: #c7d2fe; }
.acc-picker-card:has(input:checked) { border-color: var(--brand); background: var(--brand-50); box-shadow: 0 0 0 3px rgba(79, 70, 229, .1); }
.acc-picker-card input { display: none; }
.acc-picker-ic {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  background: #f1f5f9; color: #64748b; display: flex; align-items: center; justify-content: center;
  transition: all .16s;
}
.acc-picker-card:has(input:checked) .acc-picker-ic { background: var(--brand); color: #fff; }
.acc-picker-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.acc-picker-txt strong { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.acc-picker-txt small { font-size: 11px; color: var(--muted); margin-top: 2px; }
@media (max-width: 480px) { .acc-picker { grid-template-columns: 1fr; } }

/* ---------- 邀请签署 ---------- */
.invite-wrap { max-width: 560px; margin: 44px auto; }
.invite-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 34px 36px; box-shadow: var(--shadow-md); text-align: center; }
.invite-brand { display: flex; align-items: center; justify-content: center; gap: 9px; font-weight: 700; font-size: 14px; color: var(--ink); margin-bottom: 22px; }
.invite-card h1 { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.invite-sub { color: var(--ink-2); font-size: 14px; margin: 8px 0 22px; }
.invite-meta { text-align: left; background: #f8fafd; border: 1px solid var(--line-soft); border-radius: 12px; padding: 14px 16px; margin-bottom: 22px; }
.invite-action { margin-top: 6px; }
.invite-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-soft); }
.invite-row:last-child { border-bottom: none; }

/* ---------- 文书排版 ---------- */
.doc-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--ink); padding-bottom: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.doc-brand { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink); font-family: var(--font); }
.doc-brand-mark {
  width: 26px; height: 26px; border-radius: 7px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--violet)); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800;
}
.doc-meta { font-family: var(--font); font-size: 11px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; }
.doc-title { text-align: center; font-size: 22px; font-weight: 800; letter-spacing: 4px; margin: 6px 0 22px; }
.doc-body p { text-indent: 2em; margin-bottom: 10px; line-height: 2; }
.doc-signs { margin-top: 34px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.doc-signs .sign-block { margin-top: 0; }
.doc-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line); margin-top: 30px; padding-top: 10px;
  font-family: var(--font); font-size: 10.5px; color: var(--muted);
}
.doc-pageno::before { content: "第 " counter(page) " 页 / 共 " counter(pages) " 页"; }
@media (max-width: 720px) { .doc-signs { grid-template-columns: 1fr; } }

@media print {
  .doc-paper { padding: 0; }
  .doc-header { border-bottom: 2px solid #111; }
  .doc-signs { grid-template-columns: 1fr 1fr; }
  .doc-signs .sign-block, .sign-block { break-inside: avoid; page-break-inside: avoid; }
  .doc-footer { display: flex; }
}

/* ============================================================
   移动端优先 · 底部导航 / 抽屉 / 卡片化 / 大触控
   ============================================================ */
.tabbar { display: none; }
.fn-center { display: none; }
.fn-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fn-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 6px; border: 1px solid var(--line); border-radius: 12px;
  color: var(--ink-2); font-size: 12px; font-weight: 600; text-align: center; transition: all .15s;
}
.fn-card:hover { border-color: var(--brand); color: var(--brand-700); }
.fn-ic { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.advanced {
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-top: 14px;
  background: #fafbfd;
}
.advanced summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); outline: none; padding: 2px 0; }
.advanced[open] summary { color: var(--brand-700); margin-bottom: 12px; }

@media (max-width: 980px) {
  .fn-center { display: block; }
  .navbar { display: none; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 90;
    background: rgba(255, 255, 255, .97); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 10px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around; align-items: flex-end;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, .06);
  }
  .tab-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 5px 0 4px; font-size: 10.5px; font-weight: 600; color: var(--muted);
    border-radius: 10px; transition: color .15s;
  }
  .tab-item.active { color: var(--brand-700); }
  .tab-item .tab-ic { width: 22px; height: 22px; display: flex; align-items: center; justify-content: center; }
  .tab-item .tab-ic .icon { width: 21px; height: 21px; }
  .tab-fab {
    flex: none; width: 54px; height: 54px; border-radius: 50%; margin: -26px 6px 0;
    background: linear-gradient(135deg, var(--brand), var(--violet)); color: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 8px 22px rgba(79, 70, 229, .42); transition: transform .15s;
  }
  .tab-fab:active { transform: scale(.94); }
  .view { padding-bottom: 104px; }
}

@media (max-width: 640px) {
  .modal-mask { align-items: flex-end; padding: 0; }
  .modal { width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh; }
  .modal-body { padding: 18px 16px 24px; }
  .modal-head { padding: 14px 16px; }
  .btn { min-height: 42px; padding: 10px 16px; }
  .btn-sm { min-height: 34px; padding: 5px 10px; }
  .input, .select, .textarea { padding: 11px 12px; }
  .list-item { padding: 15px 14px; }
  .notice-item { padding: 15px 14px; }
  .seal-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .invite-wrap { margin: 16px auto; }
  .invite-card { padding: 26px 18px; }
  .invite-card h1 { font-size: 19px; }
  .page-head { margin-bottom: 16px; }
  .page-head h1 { font-size: 19px; }
  .tabs-line button { padding: 10px 12px; }
  .wizard-card { padding: 16px 14px; }
  .card-head { padding: 13px 14px; }
  .card-body { padding: 14px; }
  .greet-banner { padding: 18px 16px; }
  .greet-banner h2 { font-size: 17px; }
  .step-dots { margin-bottom: 18px; }
  .sign-block { padding: 15px 14px; }
  .table-wrap { border: 1px solid var(--line); border-radius: 10px; }
}

/* ============================================================
   合同通用签署模板（预览 + 打印）
   ============================================================ */
.doc-parties {
  display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 4px 0 18px;
  padding: 12px 14px; background: #fafbfd; border: 1px solid var(--line-soft); border-radius: 8px;
  font-family: var(--font);
}
.party { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; }
.party-tag {
  background: var(--brand-50); color: var(--brand-700); font-weight: 700; font-size: 12px;
  padding: 2px 8px; border-radius: 999px;
}
.party-name { font-weight: 600; color: var(--ink); }
.party-type { font-size: 11.5px; color: var(--muted); }
.doc-signs-title {
  font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--ink);
  margin: 30px 0 10px; padding-left: 10px; border-left: 4px solid var(--brand);
}
.sign-block {
  border: 1.5px dashed #d0b25e; border-radius: 12px; padding: 16px 18px; margin-top: 0;
  background: #fffdf6;
}
.sign-block.done { border-style: solid; border-color: #a7e3c8; background: var(--success-bg); }
.sb-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-family: var(--font); }
.sb-party { font-size: 12px; font-weight: 700; color: var(--brand-700); }
.sb-name { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.sb-state { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--success); }
.sb-meta { font-family: var(--font); font-size: 12px; color: #64748b; margin-top: 6px; line-height: 1.7; }
.doc-footnote {
  font-family: var(--font); font-size: 11px; color: #94a3b8; text-align: center;
  margin: 26px 0 0; padding: 10px 0 0; border-top: 1px dashed var(--line);
}

/* ---------- 打印强规则：只打印合同文书，隐藏全部平台 UI ---------- */
@page { size: A4; margin: 12mm 13mm; }
@media print {
  html, body { background: #fff !important; }
  #appView { display: block !important; }
  .app-body { display: block !important; }
  .topbar, .navbar, .tabbar, .modal-mask, #toastRoot, .login-page, .login-side,
  .view > :not(#printArea), #paperPreview, .view .page-head, .view .card, .view .tabs-line,
  .view .filter-bar, .view .pager, .view .greet-banner, .view .stat-grid, .view .quick-grid {
    display: none !important;
  }
  .view { padding: 0 !important; margin: 0 !important; max-width: none !important; }
  #printArea { display: block !important; }
  #printArea .paper {
    box-shadow: none; border: none; max-width: 100%; margin: 0; padding: 0;
    font-size: 13.5px; line-height: 1.85;
  }
  .doc-header { border-bottom: 1.5px solid #111; padding-bottom: 10px; margin-bottom: 16px; }
  .doc-title { font-size: 19px; margin: 4px 0 14px; }
  .doc-parties { margin-bottom: 14px; }
  .doc-body p { margin-bottom: 8px; }
  .doc-signs-title { margin-top: 20px; }
  .doc-signs { grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
  .sign-block, .doc-header, .doc-title, .doc-parties, .doc-signs-title, .doc-footnote { break-inside: avoid; page-break-inside: avoid; }
  .doc-footer { display: flex; margin-top: 18px; }
  .cross-seal-wrap { display: none; }
}
@media print and (max-width: 720px) {
  .doc-signs { grid-template-columns: 1fr 1fr; }
}

/* ---------- 紧凑签署栏（正常合同样式） ---------- */
.doc-signs { margin-top: 10px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 36px; }
.sign-block {
  border: none; border-top: 1px solid #cbd5e1; border-radius: 0;
  padding: 12px 2px 10px; margin: 0; background: none;
}
.sign-block.done { border-top-color: #7db89b; background: none; }
.sign-block.rejected { border-top-color: #e5a3a3; background: none; }
.sign-slot-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-family: var(--font); }
.sign-slot-head strong { font-size: 13.5px; font-weight: 700; color: var(--ink); }
.sign-slot-head span { font-size: 13px; color: var(--ink-2); }
.sign-imgs { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.sign-imgs img { max-height: 88px; max-width: 46%; object-fit: contain; }
.sign-slot-date { font-family: var(--font); font-size: 11.5px; color: #64748b; margin-top: 5px; }
.sign-slot-actions { display: flex; gap: 8px; margin-top: 8px; }
.cert-line {
  font-family: var(--font); font-size: 11px; color: #94a3b8; background: none;
  border-radius: 0; padding: 8px 2px 0; margin-top: 10px; border-top: 1px dashed var(--line);
}
