/* ============================================================
   电子合同签名系统 - 全局样式（响应式）
   ============================================================ */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-light: #eff6ff;
    --success: #16a34a;
    --warning: #d97706;
    --danger: #dc2626;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-300: #cbd5e1;
    --gray-500: #64748b;
    --gray-600: #475569;
    --gray-700: #334155;
    --gray-800: #1e293b;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 25px rgba(0,0,0,.1);
    --sidebar-w: 230px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--gray-100);
    color: var(--gray-800);
    font-size: 14px;
    line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { opacity: .85; }
img { max-width: 100%; }
button { font-family: inherit; }
input, select, textarea {
    font-family: inherit;
    font-size: 14px;
}

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #1e293b, #0f172a);
    color: #cbd5e1;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform .25s ease;
}
.sidebar-head {
    padding: 20px 18px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-head .logo { font-size: 24px; }
.sidebar-head .brand {
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    white-space: nowrap;
}
.side-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 8px;
    color: #cbd5e1;
    margin-bottom: 2px;
    transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; opacity: 1; }
.nav-item.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.35);
}
.nav-icon { width: 20px; text-align: center; font-size: 16px; }
.sidebar-foot { padding: 10px; border-top: 1px solid rgba(255,255,255,.08); }

.main {
    flex: 1;
    margin-left: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-width: 0;
}
.topbar {
    background: #fff;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 50;
}
.page-title { font-size: 17px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-menu { display: none; background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px 8px; color: var(--gray-700); }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.company-name { color: var(--gray-500); font-size: 13px; max-width: 180px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-dropdown { position: relative; }
.user-btn {
    display: flex; align-items: center; gap: 8px;
    background: none; border: none; cursor: pointer;
    padding: 6px 8px; border-radius: 8px; font-size: 14px; color: var(--gray-700);
}
.user-btn:hover { background: var(--gray-100); }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    object-fit: cover;
}
.avatar-text {
    background: var(--primary);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
}
.avatar-lg { width: 72px; height: 72px; font-size: 28px; }
.dropdown-menu {
    display: none;
    position: absolute; right: 0; top: 46px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 150px;
    padding: 6px;
    z-index: 200;
}
.dropdown-menu.show { display: block; }
.dropdown-menu a {
    display: block;
    padding: 9px 12px;
    border-radius: 6px;
    color: var(--gray-700);
    font-size: 13px;
}
.dropdown-menu a:hover { background: var(--gray-100); }

.content { flex: 1; padding: 24px; width: 100%; max-width: 1200px; margin: 0 auto; }
.footer {
    text-align: center;
    padding: 16px;
    color: var(--gray-500);
    font-size: 12px;
}
.mask {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 90;
}
.mask.show { display: block; }

/* ---------- 卡片与网格 ---------- */
.card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}
.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    gap: 10px;
}
.card-head h3 { font-size: 15px; color: var(--gray-800); }
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 20px;
}
.card-grid > .card { margin-bottom: 0; }

/* ---------- 统计卡 ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}
.stat-grid.small { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.stat-card {
    background: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 48px; height: 48px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px;
}
.stat-icon.blue { background: var(--primary-light); }
.stat-icon.orange { background: #fff7ed; }
.stat-icon.green { background: #f0fdf4; }
.stat-icon.gray { background: var(--gray-100); }
.stat-icon.purple { background: #faf5ff; }
.stat-icon.teal { background: #f0fdfa; }
.stat-num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.blue-text { color: var(--primary); }
.red-text { color: var(--danger); }
.stat-label { color: var(--gray-500); font-size: 13px; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; min-width: 680px; }
.table th, .table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
    white-space: nowrap;
}
.table th {
    background: var(--gray-50);
    color: var(--gray-600);
    font-size: 13px;
    font-weight: 600;
}
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-50); }
.empty { text-align: center; color: var(--gray-500); padding: 40px 0 !important; }
.table .chk { width: 40px; text-align: center; padding-left: 12px; }
.table .chk input { width: 15px; height: 15px; cursor: pointer; vertical-align: middle; }
.table .chk input:disabled { cursor: not-allowed; opacity: .4; }
.mono { font-family: Consolas, Monaco, monospace; }
.small { font-size: 12px; }
.muted { color: var(--gray-500); }
.ops { white-space: nowrap; }
.op-log-list { display: flex; flex-direction: column; gap: 8px; padding: 4px 0; }
.op-log-item { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--gray-100); }
.op-log-item:last-child { border-bottom: none; }

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--gray-300);
    background: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--gray-700);
    transition: all .15s;
    white-space: nowrap;
}
.btn:hover { border-color: var(--primary); color: var(--primary); opacity: 1; }
.btn-sm { padding: 5px 12px; font-size: 13px; }
.btn-lg { padding: 13px 24px; font-size: 16px; }
.btn-block { display: block; width: 100%; }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }
.btn-danger {
    background: #fff;
    border-color: #fecaca;
    color: var(--danger);
}
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- 表单 ---------- */
.form-card { max-width: 860px; }
.form-card.compact { max-width: 100%; }
.form-card.max-w { max-width: 640px; }
.form-section { margin-bottom: 26px; }
.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--gray-700);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-200);
    margin-bottom: 16px;
}
.section-title i { color: var(--danger); font-style: normal; }
.section-title .tip { color: var(--gray-500); font-weight: 400; font-size: 12px; margin-left: 8px; }
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--gray-600);
    font-size: 13px;
}
.form-group label i { color: var(--danger); font-style: normal; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    background: #fff;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.form-group textarea { resize: vertical; }
.readonly-input, input[readonly] { background: var(--gray-50); color: var(--gray-500); cursor: not-allowed; }
.code-area { font-family: Consolas, Monaco, monospace; font-size: 13px; line-height: 1.7; }
.form-actions {
    display: flex;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid var(--gray-200);
}
.search-form {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}
.search-form input {
    padding: 9px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    outline: none;
    min-width: 200px;
    flex: 1;
    max-width: 320px;
}
.search-form select {
    padding: 9px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    background: #fff;
    outline: none;
}
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}

/* ---------- 标签 ---------- */
.tag {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.tag-draft { background: var(--gray-100); color: var(--gray-600); }
.tag-signing { background: #fff7ed; color: var(--warning); }
.tag-completed { background: #f0fdf4; color: var(--success); }
.tag-cancelled { background: #fef2f2; color: var(--danger); }
.tag-blue { background: var(--primary-light); color: var(--primary); }
.tag-red { background: #fef2f2; color: var(--danger); }
.tag-green { background: #f0fdf4; color: var(--success); }
.tag-gray { background: var(--gray-100); color: var(--gray-600); }

/* ---------- 提示条 ---------- */
.flash {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 18px;
    border-radius: 8px;
    margin: 0 24px 16px;
    font-size: 14px;
}
.flash button { background: none; border: none; font-size: 18px; cursor: pointer; color: inherit; opacity: .6; }
.flash-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.flash-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.flash-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ---------- 行内表单 ---------- */
.form-inline {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 4px 0;
}
.form-inline input[type="number"], .form-inline input[type="text"] {
    padding: 8px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    font-size: 14px;
}

/* ---------- 导入合同文件区域 ---------- */
.import-zone {
    border-top: 1px dashed var(--gray-200);
    padding-top: 16px;
    margin-top: 4px;
}
.import-zone > label { font-weight: 600; display: block; margin-bottom: 8px; }
/* 正文图片快捷上传 */
.img-upload-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.img-upload-row .btn { min-height: 34px; }

/* ---------- 分页 ---------- */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding-top: 16px;
    flex-wrap: wrap;
}
.page-link {
    min-width: 34px;
    padding: 6px 10px;
    text-align: center;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    color: var(--gray-600);
    font-size: 13px;
}
.page-link.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-link.disabled { opacity: .4; pointer-events: none; }
.page-ellipsis { color: var(--gray-500); }
.page-info { color: var(--gray-500); font-size: 13px; margin-left: 8px; }

/* ---------- 合同详情 ---------- */
.detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
    flex-wrap: wrap;
}
.detail-head h2 { font-size: 20px; }
.detail-actions { display: flex; align-items: center; gap: 10px; }
.detail-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}
.meta-item span { display: block; color: var(--gray-500); font-size: 12px; margin-bottom: 3px; }
.meta-item b { font-size: 14px; font-weight: 600; }
.contract-content {
    line-height: 2;
    color: var(--gray-700);
    padding: 8px 4px;
}
.contract-content h3 { margin-bottom: 12px; color: var(--gray-800); }
.contract-content p { margin-bottom: 10px; }
/* 正文图片：宽度自适应容器、高度等比，保证手机端与签署/详情展示完整清晰 */
.contract-content img { max-width: 100%; height: auto; }
.contract-content table { border-collapse: collapse; width: 100%; margin: 10px 0; }
.contract-content table td, .contract-content table th { border: 1px solid var(--gray-300); padding: 6px 10px; }

/* 已签署 PDF 内嵌预览（合同详情页） */
.pdf-preview-wrap {
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    overflow: hidden;
    background: #f7f7f8;
}
.pdf-frame {
    display: block;
    width: 100%;
    height: min(76vh, 820px);
    min-height: 460px;
    border: 0;
    background: #fff;
}

/* ---------- 附件上传 ---------- */
.upload-drop {
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    padding: 26px 16px;
    text-align: center;
    color: var(--gray-500);
    cursor: pointer;
    transition: border-color .2s, background .2s;
    background: #fafbfc;
}
.upload-drop:hover { border-color: var(--primary); background: #f5f9ff; }
.upload-drop input[type="file"] { display: none; }
.upload-drop p { margin: 4px 0; }
.file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
    padding: 10px 12px;
    background: #f7f9fc;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
}
.file-item .file-name { font-weight: 600; color: var(--gray-800); word-break: break-all; }
.file-item .file-size { font-size: 12px; margin-left: auto; }
.contract-attachment { padding: 4px 0; }

/* ---------- 签署页 ---------- */
.sign-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    align-items: start;
}
.sign-preview { position: sticky; top: 80px; max-height: calc(100vh - 100px); overflow-y: auto; }
.sign-preview .card-head { position: sticky; top: 0; background: #fff; z-index: 2; padding-bottom: 10px; }
.sign-preview-foot { padding-top: 12px; border-top: 1px dashed var(--gray-200); }
.sign-panel { display: flex; flex-direction: column; gap: 20px; }
.sign-box {
    border: 2px dashed var(--gray-300);
    border-radius: 8px;
    background: #fff;
    padding: 8px;
}
.sign-canvas {
    width: 100%;
    height: 180px;
    display: block;
    touch-action: none;
    cursor: crosshair;
    border-radius: 4px;
    background: #fff;
}
.sign-tips { text-align: center; font-size: 12px; padding-top: 6px; }
.sign-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 10px;
}
.saved-sign {
    height: 40px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 2px 6px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s;
}
.saved-sign:hover { border-color: var(--primary); }
.saved-seal {
    height: 56px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 2px 6px;
    background: #fff;
    cursor: pointer;
    transition: border-color .15s;
}
.saved-seal:hover { border-color: var(--primary); }
.saved-seal.active { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.seal-divider { border: 0; border-top: 1px dashed var(--gray-200); margin: 12px 0; }
.seal-saved { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.seal-box { display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.seal-form { flex: 1; min-width: 200px; }
.seal-preview {
    width: 130px;
    height: 130px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px dashed var(--gray-300);
    border-radius: 8px;
    background: #fff;
    text-align: center;
}
.seal-preview img { width: 100%; height: 100%; object-fit: contain; }
.confirm-summary { display: flex; gap: 24px; margin-bottom: 14px; flex-wrap: wrap; }
.summary-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: center;
}
.confirm-img {
    width: 140px;
    height: 60px;
    object-fit: contain;
    border: 1px dashed var(--gray-300);
    border-radius: 6px;
    background: #fff;
    padding: 4px;
}
.confirm-img:empty { display: none; }

/* ---------- 签署页：印章/签名拖拽放置 ---------- */
.sign-stage { position: relative; }
.sign-stage.place-on { cursor: copy; }
.place-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    background: #f0f6ff;
    border: 1px dashed var(--primary);
    color: var(--primary);
    font-size: 13px;
    line-height: 1.5;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
}
.place-bar.drag-on { background: #e3efff; }
.place-bar .bar-btn {
    margin-left: auto;
    font-size: 12px;
    padding: 2px 10px;
    color: var(--gray-600);
    border: 1px solid var(--gray-300);
    border-radius: 14px;
    background: #fff;
    cursor: pointer;
}
.place-bar .bar-btn:hover { border-color: var(--primary); color: var(--primary); }
.stamp-el {
    position: absolute;
    cursor: move;
    z-index: 1;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    line-height: 0;
}
.stamp-el img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
}
.stamp-el:hover, .stamp-el.moving { box-shadow: 0 0 0 2px rgba(37, 99, 235, .5); }
.stamp-el.moving { opacity: .85; }
.stamp-x {
    position: absolute;
    top: -9px;
    right: -9px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #dc2626;
    color: #fff;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    z-index: 3;
    display: none;
    box-shadow: 0 0 0 2px #fff;
}
.stamp-el:hover .stamp-x { display: block; }
.stamp-pick {
    position: fixed;
    z-index: 9999;
    pointer-events: none;
    opacity: .9;
    filter: drop-shadow(0 6px 14px rgba(15, 23, 42, .22));
    line-height: 0;
}
.stamp-pick img { width: 100%; height: 100%; object-fit: contain; }
.stamp-count { font-size: 12px; color: var(--gray-500); }
.sign-source { cursor: pointer; }
.sign-source.armed { outline: 2px solid var(--primary); outline-offset: 1px; }
@media (pointer: coarse) {
    .stamp-el .stamp-x { display: block; width: 22px; height: 22px; line-height: 22px; top: -11px; right: -11px; }
}
.agree-line {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 14px;
    color: var(--gray-600);
    font-size: 13px;
}
.agree-line input { margin-top: 3px; }

/* ---------- 签署记录 ---------- */
.mini-img { height: 36px; border-radius: 4px; border: 1px solid var(--gray-200); }
.proof-big-img {
    max-height: 160px;
    display: block;
    margin-bottom: 16px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 8px;
    background: #fff;
}
.sign-proofs { display: flex; flex-direction: column; gap: 14px; }
.sign-proof {
    display: flex;
    gap: 14px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
}
.sign-img {
    width: 120px;
    height: 60px;
    object-fit: contain;
    background: #fff;
    border: 1px dashed var(--gray-300);
    border-radius: 6px;
}
.proof-info { flex: 1; }
.proof-info .muted { font-size: 12px; margin-top: 3px; }
.detail-table { width: 100%; }
.detail-table th {
    width: 130px;
    text-align: left;
    color: var(--gray-500);
    font-weight: 500;
    font-size: 13px;
    padding: 10px 12px 10px 0;
    vertical-align: top;
}
.detail-table td { padding: 10px 0; border-bottom: 1px solid var(--gray-100); }

/* ---------- 状态条 ---------- */
.status-bars { display: flex; flex-direction: column; gap: 12px; }
.status-bar-row { display: flex; align-items: center; gap: 12px; }
.sb-label { width: 90px; font-size: 13px; color: var(--gray-600); }
.sb-track { flex: 1; height: 10px; background: var(--gray-100); border-radius: 10px; overflow: hidden; }
.sb-fill { height: 100%; border-radius: 10px; transition: width .5s; }
.sb-draft { background: var(--gray-500); }
.sb-signing { background: var(--warning); }
.sb-completed { background: var(--success); }
.sb-cancelled { background: var(--danger); }
.sb-pct { width: 40px; text-align: right; font-size: 13px; color: var(--gray-600); }

/* ---------- 登录/注册 ---------- */
.auth-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #38bdf8 100%);
    padding: 20px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
    padding: 36px 32px;
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
    width: 60px; height: 60px;
    margin: 0 auto 12px;
    background: var(--primary-light);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 30px;
}
.auth-brand h1 { font-size: 20px; margin-bottom: 6px; }
.auth-brand p { color: var(--gray-500); font-size: 13px; }
.auth-form .form-group { margin-bottom: 16px; }
.auth-form input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    font-size: 14px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
}
.auth-form input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.auth-form .btn { margin-top: 4px; }
.auth-links { text-align: center; margin-top: 14px; font-size: 13px; }

/* ---------- 验证码 ---------- */
.captcha-row { display: flex; gap: 10px; align-items: stretch; }
.captcha-row input { flex: 1; min-width: 0; }
.captcha-img {
    width: 120px;
    height: 42px;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    cursor: pointer;
    background: #f6f8fc;
    flex-shrink: 0;
}
.captcha-img:hover { border-color: var(--primary); }

/* ---------- 角色权限 ---------- */
.perm-group {
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    margin-bottom: 14px;
    overflow: hidden;
}
.perm-group-title {
    background: var(--gray-50);
    padding: 10px 14px;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
}
.perm-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    padding: 12px 14px;
}
.perm-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    transition: background .15s;
}
.perm-item:hover { background: var(--gray-50); }
.perm-item input { accent-color: var(--primary); }
.check-item { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check-item input { accent-color: var(--primary); width: 16px; height: 16px; }
.role-check-list { display: flex; flex-direction: column; gap: 10px; }
.role-check-list .check-item {
    padding: 10px 14px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    transition: background .15s;
}
.role-check-list .check-item:hover { background: var(--gray-50); }

/* ---------- 签名库 ---------- */
.sig-list { display: flex; flex-direction: column; gap: 12px; }
.sig-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    flex-wrap: wrap;
}
.sig-item img {
    height: 56px;
    border: 1px dashed var(--gray-300);
    border-radius: 6px;
    background: #fff;
    padding: 4px;
}
.sig-item .seal-thumb { width: 56px; height: 56px; object-fit: contain; }
.sig-meta { flex: 1; display: flex; flex-direction: column; gap: 4px; }
.sig-ops { display: flex; gap: 8px; }

/* ---------- 其他 ---------- */
.link { color: var(--primary); font-size: 13px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; cursor: pointer; }
.switch input { display: none; }
.switch span {
    position: absolute; inset: 0;
    background: var(--gray-300);
    border-radius: 24px;
    transition: background .2s;
}
.switch span::before {
    content: "";
    position: absolute;
    width: 18px; height: 18px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(20px); }
.avatar-upload { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.template-fields { margin: 10px 0; }
.template-fields .form-grid { margin-top: 8px; }

/* ---------- 响应式 ---------- */
@media (max-width: 960px) {
    .sign-layout { grid-template-columns: 1fr; }
    .sign-preview { position: static; max-height: none; }
}
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-lg); }
    .main { margin-left: 0; }
    .btn-menu { display: block; }
    .content { padding: 14px; }
    .topbar { padding: 0 12px; }
    .flash { margin: 0 14px 12px; }
    .company-name { display: none; }
    .card { padding: 14px; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-num { font-size: 20px; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .search-form { width: 100%; }
    .search-form input { max-width: none; flex: 1; min-width: 0; }
    .form-grid { grid-template-columns: 1fr; }
    .page-title { font-size: 15px; }
    .uname { display: none; }
    .detail-head h2 { font-size: 17px; }
    .perm-items { grid-template-columns: 1fr 1fr; }
    .img-upload-row { flex-direction: column; align-items: stretch; gap: 6px; }
    .img-upload-row .btn { width: 100%; padding: 11px 12px; font-size: 15px; }
    .pdf-frame { min-height: 380px; }
}
@media (max-width: 420px) {
    .perm-items { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .confirm-img { width: 110px; }
}

/* ---------- 合同分享签署弹窗 ---------- */
.share-mask {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .5);
    z-index: 1000;
}
.share-mask.show { display: block; }
.share-modal {
    display: none;
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 90%; max-width: 460px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
    z-index: 1001;
    overflow: hidden;
}
.share-modal.show { display: block; }
.share-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
}
.share-head h3 { font-size: 16px; }
.share-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--gray-500);
    cursor: pointer;
    padding: 2px 6px;
}
.share-close:hover { color: var(--danger); }
.share-body { padding: 18px 20px 22px; }
.share-body p { margin-bottom: 14px; line-height: 1.7; }
.share-row { display: flex; gap: 10px; }
.share-row input {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-size: 13px;
    color: var(--gray-700);
    background: var(--gray-50);
}

/* ---------- 公开匿名签署页 ---------- */
.pub-body {
    min-height: 100vh;
    background: #f1f5f9;
}
.pub-wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 40px; }
.pub-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
    padding: 16px 18px;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 60%, #38bdf8 100%);
    border-radius: 14px;
    color: #fff;
}
.pub-head-main { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.pub-brand { font-weight: 700; font-size: 15px; white-space: nowrap; }
.pub-head-contract h1 { font-size: 18px; margin-bottom: 4px; }
.pub-head-contract .muted { color: rgba(255,255,255,.85); }
.pub-head-tip { font-size: 13px; background: rgba(255,255,255,.15); padding: 6px 12px; border-radius: 8px; }
.pub-head-tip b.pub-signer { color: #fff; font-weight: 700; }
.pub-tabs { display: flex; gap: 10px; flex-wrap: wrap; }
.pub-tab {
    flex: 1;
    min-width: 140px;
    padding: 12px 16px;
    border: 1px solid var(--gray-300);
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all .15s;
}
.pub-tab:hover { border-color: var(--primary); }
.pub-tab.active {
    border-color: var(--primary);
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(37,99,235,.25);
}
.pub-success {
    text-align: center;
    padding: 48px 24px;
    max-width: 480px;
    margin: 40px auto;
}
.pub-success-icon { font-size: 56px; margin-bottom: 14px; }
.pub-success h3 { font-size: 22px; margin-bottom: 10px; }
.pub-foot { text-align: center; margin-top: 28px; font-size: 13px; }
