:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --green: #16a34a;
  --red: #dc2626;
  --orange: #d97706;
  --gray: #64748b;
  --blue: #2563eb;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { max-width: 1160px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.empty { color: var(--muted); padding: 18px 0; }

/* ---------- 顶栏 ---------- */
.topbar { background: #0f172a; color: #fff; position: sticky; top: 0; z-index: 20; }
.topbar-inner { display: flex; align-items: center; gap: 24px; height: 56px; }
.brand { color: #fff; font-weight: 700; font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.main-nav { display: flex; gap: 4px; overflow-x: auto; flex: 1; }
.main-nav a {
  color: #cbd5e1; padding: 6px 12px; border-radius: 8px; white-space: nowrap;
}
.main-nav a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.08); }
.main-nav a.active { color: #fff; background: rgba(255,255,255,.14); font-weight: 600; }
.topbar-user { display: flex; align-items: center; gap: 10px; color: #cbd5e1; font-size: 13px; }
.uname { white-space: nowrap; }

/* ---------- 页面 ---------- */
.page { padding: 20px 16px 60px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; margin: 8px 0 16px; gap: 12px; flex-wrap: wrap; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: var(--line); color: var(--muted); }
.tag-ok { background: #dcfce7; color: #166534; }
.tag-warn { background: #fef3c7; color: #92400e; }

/* ---------- 卡片 ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); margin-bottom: 16px; padding: 16px 18px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 16px; }

/* ---------- 统计 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.stat-num { font-size: 26px; font-weight: 700; }
.stat-num.blue { color: var(--blue); } .stat-num.green { color: var(--green); }
.stat-num.red { color: var(--red); } .stat-num.orange { color: var(--orange); }
.stat-label { color: var(--muted); font-size: 12px; }

/* ---------- 快捷入口 ---------- */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px,1fr)); gap: 10px; }
.qa { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 8px;
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--text); }
.qa:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; background: #f8fafc; }
.qa-ico { font-size: 24px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 12px; background: #f8fafc; }
.table tbody tr:hover { background: #f8fafc; }
.table .actions { white-space: nowrap; text-align: right; }
.table .actions a { margin-left: 8px; }
.empty-state { text-align: center; padding: 60px 0; }
.empty-state h2 { font-size: 40px; margin: 0; }

/* ---------- 徽章 ---------- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-orange { background: #fef3c7; color: #92400e; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-gray { background: #e2e8f0; color: #475569; }

/* ---------- 按钮 ---------- */
.btn { display: inline-block; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; color: var(--text); cursor: pointer; font-size: 14px; line-height: 1.4; }
.btn:hover { text-decoration: none; border-color: var(--primary); color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-danger { background: #fff; border-color: #fca5a5; color: var(--red); }
.btn-danger:hover { background: #fef2f2; color: var(--red); }
.btn-success { background: var(--green); border-color: var(--green); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-sm { padding: 3px 9px; font-size: 12px; }
.btn-block { display: block; width: 100%; }
.btn-ghost { background: transparent; border-color: transparent; color: #cbd5e1; }
.btn-ghost:hover { color: #fff; background: rgba(255,255,255,.1); border-color: transparent; }

/* ---------- 表单 ---------- */
.form .field { margin-bottom: 12px; }
.field label { display: block; margin-bottom: 4px; font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); }
.field input[type=text], .field input[type=password], .field input[type=number],
.field input[type=date], .field input[type=email], .field input[type=tel],
.field select, .field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff; color: var(--text);
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid #bfdbfe; border-color: var(--primary); }
.form-grid { display: grid; gap: 4px 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }
.form-grid .span2 { grid-column: 1 / -1; }
.check-line { display: flex; align-items: center; gap: 6px; margin: 8px 0 14px; color: var(--muted); }

/* ---------- 提示 ---------- */
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.alert.ok { background: #dcfce7; color: #166534; border: 1px solid #bbf7d0; }
.alert.err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert.warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

/* ---------- 认证页 ---------- */
.standalone-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.bare-wrap { min-height: 100vh; padding: 24px 12px 60px; }
.bare-wrap .pane { max-width: 820px; margin-left: auto; margin-right: auto; }
.auth-card { width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 30px 32px; box-shadow: var(--shadow); }
.auth-card.wide { width: 520px; }
.auth-card h1 { margin: 0 0 4px; font-size: 20px; text-align: center; }
.auth-card .sub { text-align: center; color: var(--muted); margin: 0 0 20px; }
.auth-card .btn { margin-top: 6px; }

/* ---------- 工具栏筛选 ---------- */
.filter-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar select, .filter-bar input[type=text] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ---------- 分页 ---------- */
.pagination { display: flex; gap: 6px; align-items: center; margin-top: 14px; }
.pagination a, .pagination span { padding: 5px 10px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--text); }
.pagination a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.pagination .current { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- 编辑器等后续页面公共 ---------- */
.row { display: flex; gap: 16px; align-items: flex-start; }
.row .col-main { flex: 1; min-width: 0; }
.row .col-side { width: 300px; flex-shrink: 0; }
@media (max-width: 900px) { .row { flex-direction: column; } .row .col-side { width: 100%; } }
.list-item + .list-item { border-top: 1px solid var(--line); }
.pane { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.pane h3 { margin: 0 0 10px; font-size: 15px; }
.sig-preview { border: 1px dashed #cbd5e1; border-radius: 8px; padding: 14px; background: #f8fafc; margin-top: 8px; font-size: 13px; }
.var { color: #b45309; font-weight: 600; }
.sigkey { font-weight: 700; }
.sigpad { display: inline-block; min-width: 90px; border-bottom: 1px solid #0f172a; }
.sigline { min-height: 26px; }
a.link { color: var(--primary); font-weight: 500; }
.empty-state h2 { font-size: 16px !important; margin: 6px 0 12px !important; font-weight: 600; }
.empty-state p { margin: 8px 0 14px; }
.doc-wrap img { max-width: 100%; }
iframe { background: #fff; }
