/* =========================================================
   告知书电子签名系统 - 全局样式（浅色主题）
   ========================================================= */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --success: #16a34a;
  --success-light: #f0fdf4;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --text: #111827;
  --text-2: #4b5563;
  --text-3: #9ca3af;
  --bg: #f5f7fa;
  --card: #ffffff;
  --border: #e5e7eb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(17, 24, 39, .06), 0 8px 24px -12px rgba(17, 24, 39, .12);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 顶栏 ---------------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-inner {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 22px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 17px;
  color: var(--text);
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-logo {
  width: 34px; height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #4f8dfd);
  color: #fff;
  display: grid; place-items: center;
  font-size: 17px; font-weight: 700;
  flex: 0 0 auto;
}
.brand small {
  display: block; font-size: 12px; font-weight: 400; color: var(--text-3);
  margin-top: -3px;
}
.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
  flex: 1;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-2);
  font-size: 14px;
  white-space: nowrap;
}
.nav a:hover { background: #f3f4f6; color: var(--text); text-decoration: none; }
.nav a.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--text-2); white-space: nowrap; }

/* ---------------- 布局 ---------------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }
.wrap-narrow { max-width: 860px; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 20px; flex-wrap: wrap;
}
.page-title { font-size: 22px; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.page-sub { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
}
.card + .card { margin-top: 18px; }
.card-title { font-size: 16px; font-weight: 700; margin: 0 0 14px; }
.card-hint { color: var(--text-3); font-size: 13px; }

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: .15s;
  line-height: 1.2;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-outline { background: #fff; border-color: var(--border); color: var(--text-2); }
.btn-outline:hover { background: #f9fafb; color: var(--text); border-color: #d1d5db; }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: #f3f4f6; color: var(--text); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #b91c1c; }
.btn-success { background: var(--success); }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 26px; font-size: 16px; border-radius: 11px; }
.btn-block { width: 100%; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
input[type=text], input[type=password], input[type=date], input[type=file], select, textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  outline: none;
  transition: .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; min-height: 220px; line-height: 1.8; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.checkbox { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; color: var(--text-2); cursor: pointer; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--primary); }
.radio-group { display: flex; gap: 16px; flex-wrap: wrap; }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; background: #fff; font-size: 14px; min-width: 640px; }
table.data th {
  background: #f9fafb; color: var(--text-2); font-weight: 600; font-size: 13px;
  text-align: left; padding: 11px 14px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
table.data td { padding: 11px 14px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #fafbfc; }
table.data td.num { color: var(--text-3); font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.nowrap { white-space: nowrap; }

/* ---------------- 标签 ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 500; line-height: 1.7;
  background: #f3f4f6; color: var(--text-2);
  white-space: nowrap;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: var(--success-light); color: var(--success); }
.badge-amber { background: var(--warning-light); color: var(--warning); }
.badge-red { background: var(--danger-light); color: var(--danger); }
.badge-gray { background: #f3f4f6; color: #6b7280; }

/* ---------------- 统计卡片 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow);
}
.stat-label { font-size: 13px; color: var(--text-3); }
.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -.5px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: 14px; font-weight: 500; color: var(--text-3); margin-left: 3px; }

/* ---------------- 进度条 ---------------- */
.progress { height: 7px; background: #eef2f7; border-radius: 99px; overflow: hidden; min-width: 70px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #60a5fa); border-radius: 99px; transition: width .4s; }
.progress-line { display: flex; align-items: center; gap: 9px; }
.progress-line span { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------------- 提示条 ---------------- */
.flash-area { max-width: 1240px; margin: 16px auto 0; padding: 0 20px; }
.flash {
  padding: 11px 16px; border-radius: 10px; font-size: 14px; margin-bottom: 10px;
  border: 1px solid transparent; display: flex; align-items: center; gap: 8px;
}
.flash-success { background: var(--success-light); color: #15803d; border-color: #bbf7d0; }
.flash-error { background: var(--danger-light); color: #b91c1c; border-color: #fecaca; }
.flash-warning { background: var(--warning-light); color: #b45309; border-color: #fde68a; }

/* ---------------- 登录页 ---------------- */
.auth-page {
  min-height: 100vh; display: grid; place-items: center;
  background: radial-gradient(1000px 500px at 50% -10%, #e8f0ff 0%, #f5f7fa 55%);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px; background: #fff; border-radius: 20px;
  padding: 36px 32px 28px; box-shadow: 0 20px 50px -20px rgba(17, 24, 39, .25);
  border: 1px solid var(--border);
}
.auth-logo {
  width: 56px; height: 56px; border-radius: 16px; margin: 0 auto 16px;
  background: linear-gradient(135deg, #2563eb, #60a5fa);
  display: grid; place-items: center; color: #fff; font-size: 26px; font-weight: 700;
  box-shadow: 0 10px 20px -8px rgba(37, 99, 235, .6);
}
.auth-title { text-align: center; font-size: 21px; font-weight: 700; margin: 0 0 4px; }
.auth-sub { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 26px; }
.auth-foot { text-align: center; font-size: 13px; color: var(--text-3); margin-top: 18px; }
.auth-foot a { color: var(--text-2); }

/* ---------------- 告知书正文 ---------------- */
.notice-paper {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 42px 46px; box-shadow: var(--shadow);
}
.notice-title { font-size: 25px; font-weight: 700; text-align: center; line-height: 1.5; margin: 0 0 6px; }
.notice-meta { text-align: center; color: var(--text-3); font-size: 13px; margin-bottom: 6px; }
.notice-divider { height: 3px; background: var(--primary); width: 100%; margin: 20px 0 24px; border-radius: 2px; opacity: .85; }
.notice-body { font-size: 16.5px; line-height: 2.05; color: #1f2937; white-space: pre-wrap; word-break: break-word; }
.notice-body p { margin: 0 0 12px; }
.notice-signline { margin-top: 36px; text-align: right; color: var(--text-2); font-size: 15px; line-height: 2; }
.notice-signline .org { font-weight: 600; }

/* ---------------- 签名区 ---------------- */
.sign-box {
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); margin-top: 20px;
}
.sign-box h3 { margin: 0 0 4px; font-size: 17px; }
.sign-hint { color: var(--text-3); font-size: 13px; margin-bottom: 14px; }
#signCanvas {
  width: 100%; height: 220px; display: block;
  background:
    linear-gradient(#f8fafc, #f8fafc),
    repeating-linear-gradient(90deg, transparent 0 39px, #e5e7eb 39px 40px);
  border: 1.5px dashed #cbd5e1; border-radius: 12px;
  touch-action: none; cursor: crosshair;
}
#signCanvas.active { border-color: var(--primary); border-style: solid; }
.sign-tools { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.sign-tools .baseline { font-size: 12px; color: var(--text-3); margin-left: auto; }
.confirm-row { display: flex; align-items: flex-start; gap: 9px; margin: 16px 0; font-size: 14px; color: var(--text-2); }
.confirm-row input { width: 17px; height: 17px; margin-top: 3px; accent-color: var(--primary); flex: 0 0 auto; }

/* ---------------- 已签结果 ---------------- */
.result-img {
  width: 100%; border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); background: #fff; display: block;
}
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

/* ---------------- 列表项 ---------------- */
.list-item {
  display: flex; align-items: center; gap: 16px;
  padding: 18px 20px; background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px; transition: .15s;
}
.list-item:hover { border-color: #c7d2fe; box-shadow: 0 6px 20px -12px rgba(37, 99, 235, .5); }
.list-main { flex: 1; min-width: 0; }
.list-title { font-size: 16px; font-weight: 600; margin: 0 0 4px; color: var(--text); }
.list-title:hover { color: var(--primary); text-decoration: none; }
.list-meta { font-size: 13px; color: var(--text-3); display: flex; gap: 14px; flex-wrap: wrap; }
.list-side { display: flex; align-items: center; gap: 12px; flex: 0 0 auto; }

/* ---------------- 空状态 ---------------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.empty .icon { font-size: 40px; margin-bottom: 8px; }
.empty p { margin: 4px 0; }
.empty a { font-weight: 500; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 20px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; color: var(--text-2); font-size: 13px;
}
.pager .cur { background: var(--primary); border-color: var(--primary); color: #fff; }
.pager a:hover { border-color: #c7d2fe; text-decoration: none; }

/* ---------------- 班级选择 ---------------- */
.grade-block { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.grade-block-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.grade-name { font-weight: 600; font-size: 14px; }
.class-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.class-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px;
  font-size: 13px; cursor: pointer; background: #fff; color: var(--text-2);
}
.class-chip input { accent-color: var(--primary); width: 15px; height: 15px; }
.class-chip:has(input:checked) { border-color: var(--primary); background: var(--primary-light); color: var(--primary); font-weight: 500; }

/* ---------------- 提示框 ---------------- */
.alert { padding: 14px 16px; border-radius: 10px; font-size: 13.5px; border: 1px solid; margin-bottom: 16px; }
.alert-info { background: var(--primary-light); border-color: #bfdbfe; color: #1e40af; }
.alert-warn { background: var(--warning-light); border-color: #fde68a; color: #92400e; }
.alert ul { margin: 6px 0 0; padding-left: 20px; }

/* ---------------- 页脚 ---------------- */
.site-foot { text-align: center; color: var(--text-3); font-size: 12.5px; padding: 28px 20px 40px; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 820px) {
  .topbar-inner { height: auto; padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .brand small { display: none; }
  .nav { order: 3; width: 100%; gap: 2px; padding-bottom: 2px; }
  .nav a { padding: 6px 10px; font-size: 13px; }
  .wrap { padding: 16px 14px 44px; }
  .card, .notice-paper { padding: 18px 16px; border-radius: 12px; }
  .notice-paper { padding: 26px 20px; }
  .notice-title { font-size: 20px; }
  .notice-body { font-size: 16px; line-height: 1.95; }
  .form-row, .form-row-3 { grid-template-columns: 1fr; gap: 0; }
  .page-title { font-size: 19px; }
  .stat-value { font-size: 23px; }
  .list-item { flex-direction: column; align-items: stretch; gap: 10px; }
  .list-side { justify-content: space-between; }
  .auth-card { padding: 28px 22px 22px; }
  .topbar-right .who { display: none; }
  table.data { min-width: 560px; }
}

@media print {
  .topbar, .sign-box, .site-foot, .flash-area, .no-print { display: none !important; }
  body { background: #fff; }
  .wrap { padding: 0; max-width: none; }
  .notice-paper { border: none; box-shadow: none; padding: 0; }
}
