:root {
  --ink: #0f1f2e;
  --ink-soft: #566b7d;
  --line: #e2e8ee;
  --bg: #f4f7fa;
  --card: #ffffff;
  --brand: #0d7c86;
  --brand-deep: #0a5f67;
  --brand-soft: #e6f4f5;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #067647;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 31, 46, .06), 0 8px 24px rgba(15, 31, 46, .06);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px 48px; }

/* ---------- 顶部 ---------- */
.topbar {
  background: linear-gradient(135deg, #0d1b26 0%, #10293a 100%);
  color: #fff;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.topbar .wrap { padding-bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { height: 40px; width: auto; background: #fff; border-radius: 8px; padding: 4px 8px; }
.brand-txt { min-width: 0; }
.brand-txt b { display: block; font-size: 15px; letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-txt span { font-size: 11px; color: #9fb3c4; }

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.section-title { font-size: 13px; font-weight: 700; color: var(--ink-soft); letter-spacing: .5px; margin: 22px 0 10px; }
.muted { color: var(--ink-soft); }
.small { font-size: 12px; }

.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: .15s;
}
.btn:hover { border-color: #c7d3de; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-deep); border-color: var(--brand-deep); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.btn-danger { color: var(--danger); border-color: #f1c8c3; background: #fdf4f3; }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; justify-content: center; padding: 13px; font-size: 15px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-deep);
}
.badge.gray { background: #eef2f6; color: #5b6b7a; }
.badge.warn { background: #fdf3e6; color: var(--warn); }
.badge.ok { background: #e9f6ef; color: var(--ok); }
.badge.video { background: #eef0ff; color: #3f3fa8; }

/* ---------- 文件列表 ---------- */
.file-list { display: grid; gap: 10px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  cursor: pointer;
  transition: .15s;
}
.file-item:hover { border-color: #bcd3dd; transform: translateY(-1px); }
.file-ico {
  width: 44px; height: 44px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-deep);
  font-size: 11px; font-weight: 800; letter-spacing: .5px;
  flex: none;
}
.file-ico.video { background: #eef0ff; color: #3f3fa8; }
.file-main { flex: 1; min-width: 0; }
.file-main b { display: block; font-size: 15px; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-main span { font-size: 12px; color: var(--ink-soft); }

/* ---------- 阅读区 ---------- */
.viewer { margin-top: 12px; }
.pdf-pages { display: grid; gap: 10px; background: #eef2f6; padding: 10px; border-radius: 10px; max-height: 62vh; overflow: auto; }
.pdf-pages canvas { width: 100%; height: auto; display: block; background: #fff; border-radius: 6px; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.video-box { background: #000; border-radius: 10px; overflow: hidden; }
.video-box video { width: 100%; max-height: 60vh; display: block; }

/* ---------- 表单 ---------- */
.form-grid { display: grid; gap: 12px; margin-top: 12px; }
@media (min-width: 640px) { .form-grid.two { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-size: 12px; font-weight: 700; color: var(--ink-soft); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}
.field input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(13, 124, 134, .12); }

.pad-wrap { border: 1px dashed #c3d2dd; border-radius: 12px; background: #fbfdff; padding: 8px; }
.pad-wrap canvas { width: 100%; height: 180px; display: block; touch-action: none; background: transparent; cursor: crosshair; }
.pad-tip { font-size: 11px; color: var(--ink-soft); display: flex; justify-content: space-between; margin-top: 6px; }

.sticky-actions { margin-top: 18px; padding: 0 0 8px; }

.check-row { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; font-size: 13px; line-height: 1.6; }
.check-row input { margin-top: 3px; width: 18px; height: 18px; flex: none; }

/* ---------- 结果 ---------- */
.result { text-align: center; padding: 40px 20px; }
.result .tick {
  width: 64px; height: 64px; border-radius: 50%;
  background: #e9f6ef; color: var(--ok);
  display: grid; place-items: center; margin: 0 auto 14px; font-size: 30px;
}
.kv { display: grid; grid-template-columns: 76px 1fr; gap: 6px 10px; text-align: left; font-size: 13px; margin: 18px auto 0; max-width: 380px; }
.kv dt { color: var(--ink-soft); }
.kv dd { margin: 0; word-break: break-all; }

/* ---------- 管理端 ---------- */
.tabs { display: flex; gap: 6px; margin: 18px 0 0; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 14px; font-size: 14px; font-weight: 700; color: var(--ink-soft); cursor: pointer; border-bottom: 2px solid transparent; }
.tab.active { color: var(--brand-deep); border-bottom-color: var(--brand); }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 8px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; color: var(--ink-soft); font-weight: 700; white-space: nowrap; }
.table tr:hover td { background: #fafcfe; }
.table .nowrap { white-space: nowrap; }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.toolbar input[type="search"], .toolbar input[type="text"] {
  flex: 1; min-width: 160px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px;
}
.spacer { flex: 1; }

.upload-zone {
  border: 2px dashed #c3d2dd;
  border-radius: 12px;
  padding: 26px 16px;
  text-align: center;
  background: #fbfdff;
  cursor: pointer;
  transition: .15s;
}
.upload-zone:hover, .upload-zone.drag { border-color: var(--brand); background: var(--brand-soft); }
.upload-zone b { display: block; font-size: 15px; margin-bottom: 4px; }
.upload-zone span { font-size: 12px; color: var(--ink-soft); }

/* 签名位置编辑器 */
.pos-stage { position: relative; background: #eef2f6; border-radius: 10px; padding: 10px; overflow: auto; max-height: 58vh; }
.pos-stage canvas { width: 100%; height: auto; display: block; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.pos-box {
  position: absolute;
  border: 2px solid var(--brand);
  background: rgba(13, 124, 134, .12);
  border-radius: 4px;
  cursor: move;
  display: grid;
  place-items: center;
  color: var(--brand-deep);
  font-size: 11px;
  font-weight: 700;
  user-select: none;
  touch-action: none;
}

/* ---------- 弹层 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(9, 20, 30, .55);
  display: none; align-items: center; justify-content: center; padding: 16px; z-index: 100;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 720px;
  max-height: 92vh; overflow: auto; padding: 18px;
}
.modal h3 { margin: 0 0 4px; font-size: 17px; }
.modal .sub { font-size: 12px; color: var(--ink-soft); margin-bottom: 14px; }

/* ---------- 提示 ---------- */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translate(-50%, 20px);
  background: #10293a; color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; max-width: 88vw;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }

.empty { text-align: center; padding: 40px 16px; color: var(--ink-soft); font-size: 13px; }
.loading { text-align: center; padding: 32px; color: var(--ink-soft); font-size: 13px; }

@media (max-width: 640px) {
  .brand img { height: 34px; }
  .brand-txt b { font-size: 13px; }
  .brand-txt span { display: none; }
  .table th:nth-child(3), .table td:nth-child(3) { display: none; }
}
