/* =============================================================
   员工电子工牌系统 - 全站样式
   纯手写 CSS，无任何外部依赖
   ============================================================= */

:root {
  --primary: #FF6B35;
  --primary-dim: #d4541f;
  --primary-soft: #fff1ea;
  --ink: #1f2937;
  --ink-2: #4b5563;
  --ink-3: #6b7280;
  --ink-4: #9ca3af;
  --line: #e8eaee;
  --bg: #f5f6f8;
  --white: #ffffff;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 8px rgba(17, 24, 39, 0.05);
  --shadow: 0 10px 30px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 22px 50px rgba(17, 24, 39, 0.14);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.35; }
p { margin: 0 0 10px; }
p:last-child { margin-bottom: 0; }

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 0 18px;
}
.wrap-wide { max-width: 1180px; }

/* ------------------------------ 头部 ------------------------------ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  height: 62px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  min-width: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dim));
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(255, 107, 53, 0.28);
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong {
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 46vw;
}
.brand-text small {
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.site-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}
.nav-link:hover { background: var(--primary-soft); color: var(--primary-dim); text-decoration: none; }
.nav-link.is-active { background: var(--primary-soft); color: var(--primary-dim); font-weight: 600; }
.nav-link-quiet { color: var(--ink-3); }
.nav-link-cta {
  background: linear-gradient(135deg, var(--primary), var(--primary-dim));
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(255, 107, 53, 0.25);
}
.nav-link-cta:hover { color: #fff; background: linear-gradient(135deg, var(--primary-dim), var(--primary-dim)); }

.nav-toggle {
  display: none;
  width: 38px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  padding: 8px 9px;
  cursor: pointer;
  flex-direction: column;
  justify-content: space-between;
}
.nav-toggle span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--ink-2);
}

/* ------------------------------ 主体 ------------------------------ */
.site-main {
  flex: 1 0 auto;
  padding: 26px 0 46px;
}

.page-title {
  font-size: 22px;
  margin: 0 0 6px;
}
.page-desc {
  color: var(--ink-3);
  font-size: 14px;
  margin: 0 0 20px;
}

/* ------------------------------ 提示条 ------------------------------ */
.alert {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin: 0 0 16px;
  border: 1px solid transparent;
  line-height: 1.6;
}
.alert p { margin: 0 0 6px; }
.alert p:last-child { margin-bottom: 0; }
.alert-success { background: #ecfdf5; border-color: #bbf7d0; color: #15803d; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #b45309; }
.alert-info { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }

.announce {
  background: linear-gradient(135deg, var(--primary-soft), #ffffff);
  border: 1px solid #ffe0d2;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--ink-2);
  margin-bottom: 20px;
}
.announce p { margin: 0 0 4px; }
.announce p:last-child { margin: 0; }

/* ------------------------------ 首页 ------------------------------ */
.hero {
  text-align: center;
  padding: 44px 0 30px;
}
.hero-title {
  font-size: 30px;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}
.hero-title em {
  font-style: normal;
  background: linear-gradient(135deg, var(--primary), var(--primary-dim));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  color: var(--ink-3);
  font-size: 15px;
  max-width: 560px;
  margin: 0 auto 26px;
  line-height: 1.8;
}
.hero-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 34px;
}
.feature {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.feature-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  margin-bottom: 12px;
  font-size: 15px;
}
.feature h3 { font-size: 15px; margin-bottom: 6px; }
.feature p { font-size: 13.5px; color: var(--ink-3); margin: 0; }

/* ------------------------------ 面板与表单 ------------------------------ */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}
.panel-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.panel-title { font-size: 16px; }
.panel-body { padding: 20px; }
.panel-narrow { max-width: 460px; margin: 0 auto; }

.form-row { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: 7px;
}
.form-label .required { color: #e11d48; margin-left: 2px; }
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 11px 13px;
  font-size: 14.5px;
  color: var(--ink);
  background: #fff;
  border: 1px solid #dfe3e8;
  border-radius: var(--radius-sm);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  font-family: inherit;
  outline: none;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.14);
}
.form-input::placeholder,
.form-textarea::placeholder { color: #b6bcc6; }
.form-textarea { min-height: 88px; resize: vertical; line-height: 1.7; }
.form-select { appearance: none; background-image: none; cursor: pointer; }
.form-hint {
  font-size: 12.5px;
  color: var(--ink-4);
  margin-top: 6px;
  line-height: 1.6;
}
.form-error {
  font-size: 12.5px;
  color: #dc2626;
  margin-top: 6px;
}
.form-input[readonly],
.form-input:disabled,
.form-select:disabled,
.form-textarea[readonly] {
  background: #f3f4f6;
  color: var(--ink-3);
  cursor: not-allowed;
}
.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 20px;
}
.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}

/* 验证码输入行 */
.code-row { display: flex; gap: 10px; }
.code-row .form-input { flex: 1 1 auto; min-width: 0; }
.code-row .btn { flex: 0 0 auto; white-space: nowrap; }

/* ------------------------------ 按钮 ------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  font-size: 14.5px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.18s ease, background 0.18s ease, color 0.18s ease;
  background: #eef0f3;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dim));
  color: #fff;
  box-shadow: 0 10px 22px rgba(255, 107, 53, 0.26);
}
.btn-primary:hover { color: #fff; box-shadow: 0 14px 26px rgba(255, 107, 53, 0.32); }
.btn-ghost {
  background: #fff;
  border-color: #dfe3e8;
  color: var(--ink-2);
}
.btn-ghost:hover { border-color: var(--primary); color: var(--primary-dim); }
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled,
.btn.is-disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ------------------------------ 工牌卡片 ------------------------------ */
.badge-wrap {
  display: flex;
  justify-content: center;
  padding: 6px 0 10px;
}
.badge-card {
  position: relative;
  width: 100%;
  max-width: 360px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transition: transform 0.25s ease;
}
.badge-card:hover { transform: translateY(-3px); }

.badge-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 82% 8%, rgba(255, 255, 255, 0.32), transparent 42%),
    radial-gradient(circle at 6% 96%, rgba(255, 255, 255, 0.18), transparent 46%);
}

.badge-inner {
  position: relative;
  padding: 22px 22px 18px;
  display: flex;
  flex-direction: column;
  min-height: 396px;
}

/* 顶部职务色条 */
.badge-stripe {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  border-radius: 22px 22px 0 0;
  opacity: 0.95;
}

.badge-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}
.badge-site {
  font-size: 12.5px;
  letter-spacing: 1px;
  font-weight: 600;
  opacity: 0.92;
  line-height: 1.4;
}
.badge-site small {
  display: block;
  font-size: 10px;
  letter-spacing: 1.6px;
  opacity: 0.62;
  font-weight: 400;
  text-transform: uppercase;
}
.badge-no {
  font-family: Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: 1.2px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.26);
  white-space: nowrap;
}

.badge-avatar {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  overflow: hidden;
  margin: 2px auto 14px;
  background: rgba(255, 255, 255, 0.22);
  border: 3px solid rgba(255, 255, 255, 0.55);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16);
  flex: 0 0 auto;
}
.badge-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.badge-name {
  text-align: center;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  word-break: break-all;
}
.badge-position {
  align-self: center;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.3);
  margin-bottom: 14px;
}
.badge-intro {
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
  opacity: 0.88;
  margin: 0 auto 16px;
  max-width: 268px;
  word-break: break-word;
}
.badge-foot {
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px dashed rgba(255, 255, 255, 0.32);
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 12.5px;
}
.badge-foot-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.badge-foot-row span:first-child { opacity: 0.68; }
.badge-foot-row span:last-child { font-weight: 600; text-align: right; word-break: break-all; }

/* 主题：渐变（默认） */
body.theme-gradient .badge-card,
.badge-card.theme-gradient {
  background: linear-gradient(148deg, var(--primary) 0%, var(--primary-dim) 62%, #8c3410 100%);
  color: #fff;
}

/* 主题：浅色 */
body.theme-light .badge-card,
.badge-card.theme-light {
  background: linear-gradient(160deg, #ffffff 0%, #fdfbf9 100%);
  border: 1px solid #f0e2d9;
  color: var(--ink);
}
body.theme-light .badge-card::before,
.badge-card.theme-light::before {
  background:
    radial-gradient(circle at 84% 6%, rgba(255, 107, 53, 0.16), transparent 46%),
    radial-gradient(circle at 4% 98%, rgba(255, 107, 53, 0.09), transparent 48%);
}
body.theme-light .badge-avatar,
.badge-card.theme-light .badge-avatar {
  background: #fff;
  border-color: #ffe6d9;
  box-shadow: 0 8px 20px rgba(255, 107, 53, 0.16);
}
body.theme-light .badge-no,
.badge-card.theme-light .badge-no {
  background: var(--primary-soft);
  border-color: #ffd9c6;
  color: var(--primary-dim);
}
body.theme-light .badge-position,
.badge-card.theme-light .badge-position {
  background: var(--primary-soft);
  border-color: #ffd9c6;
  color: var(--primary-dim);
}
body.theme-light .badge-foot,
.badge-card.theme-light .badge-foot { border-top-color: #efe3da; }
body.theme-light .badge-site { color: var(--ink-2); }

/* 主题：深色 */
body.theme-dark .badge-card,
.badge-card.theme-dark {
  background: linear-gradient(150deg, #2b3444 0%, #1b2230 58%, #12161f 100%);
  color: #f3f4f6;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
body.theme-dark .badge-position,
.badge-card.theme-dark .badge-position {
  background: rgba(255, 107, 53, 0.18);
  border-color: rgba(255, 107, 53, 0.42);
  color: #ffb89a;
}

/* 工牌状态标记 */
.badge-lock {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.22);
}
body.theme-light .badge-lock,
.badge-card.theme-light .badge-lock {
  background: #f4f5f7;
  border-color: #e5e7eb;
  color: var(--ink-3);
}

/* 工牌操作区 */
.badge-toolbar {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 18px 0 8px;
}
.badge-hint {
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-4);
  margin-top: 4px;
}

/* ------------------------------ 成员目录 ------------------------------ */
.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 14px;
}
.member-card {
  display: flex;
  gap: 13px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.member-card:hover {
  text-decoration: none;
  transform: translateY(-2px);
  border-color: #ffd0bb;
  box-shadow: var(--shadow);
}
.member-avatar {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--primary-soft);
  border: 2px solid #fff;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.1);
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.member-info { min-width: 0; flex: 1 1 auto; }
.member-name {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.member-pos {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dim);
  margin-bottom: 5px;
}
.member-meta {
  font-size: 12px;
  color: var(--ink-4);
  font-family: Menlo, Consolas, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.toolbar .form-input { flex: 1 1 200px; }
.toolbar select.form-select { flex: 0 0 150px; width: auto; }

.empty {
  text-align: center;
  padding: 46px 20px;
  color: var(--ink-4);
  font-size: 14px;
  background: #fff;
  border: 1px dashed #dfe3e8;
  border-radius: var(--radius);
}

/* ------------------------------ 分页 ------------------------------ */
.pager {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 22px;
}
.pager-link {
  min-width: 38px;
  padding: 7px 13px;
  text-align: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13.5px;
  color: var(--ink-2);
}
.pager-link:hover { border-color: var(--primary); color: var(--primary-dim); text-decoration: none; }
.pager-link.is-current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}
.pager-link.is-disabled { color: #c7ccd4; background: #fafbfc; }
.pager-gap { color: var(--ink-4); }

/* ------------------------------ 其他组件 ------------------------------ */
.kv-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.kv-item {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
}
.kv-key { font-size: 12px; color: var(--ink-4); margin-bottom: 3px; }
.kv-val { font-size: 14px; font-weight: 600; word-break: break-all; }

.locked-field {
  position: relative;
  padding: 12px 14px;
  background: #f3f4f6;
  border: 1px dashed #d8dce2;
  border-radius: var(--radius-sm);
  color: var(--ink-3);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.locked-field .lock-icon {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  background: #e5e7eb;
  color: var(--ink-3);
  white-space: nowrap;
}
.unlock-toggle {
  font-size: 13px;
  color: var(--primary-dim);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.unlock-toggle:hover { text-decoration: underline; }
.unlock-box {
  margin-top: 12px;
  padding: 14px;
  background: #fff9f5;
  border: 1px dashed #ffd0bb;
  border-radius: var(--radius-sm);
}
.unlock-box[hidden] { display: none; }

.avatar-upload {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.avatar-preview {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid #fff;
  box-shadow: 0 4px 14px rgba(17, 24, 39, 0.12);
  flex: 0 0 76px;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

.steps {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.step {
  flex: 1 1 120px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--ink-4);
  display: flex;
  align-items: center;
  gap: 8px;
}
.step-num {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  border-radius: 50%;
  background: #eef0f3;
  color: var(--ink-4);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.step.is-done { color: var(--ink-2); border-color: #ffd9c6; }
.step.is-done .step-num { background: var(--primary); color: #fff; }
.step.is-current { color: var(--primary-dim); border-color: var(--primary); font-weight: 600; }
.step.is-current .step-num { background: var(--primary); color: #fff; }

.divider {
  height: 1px;
  background: var(--line);
  margin: 20px 0;
  border: none;
}

.center-note {
  text-align: center;
  font-size: 13px;
  color: var(--ink-4);
  margin-top: 14px;
}

/* ------------------------------ 页脚 ------------------------------ */
.site-footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 18px 0;
}
.footer-inner { text-align: center; }
.footer-line {
  font-size: 12.5px;
  color: var(--ink-4);
  margin: 0 0 4px;
}
.footer-meta { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.footer-meta a { color: var(--ink-3); }
.footer-meta .dot { color: #d5d9df; }

/* ------------------------------ 响应式 ------------------------------ */
@media (max-width: 760px) {
  .wrap { padding: 0 14px; }
  .nav-toggle { display: flex; }
  .site-nav {
    display: none;
    position: absolute;
    top: 62px;
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(17, 24, 39, 0.08);
    padding: 10px 14px 14px;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .site-nav.is-open { display: flex; }
  .nav-link { padding: 11px 12px; border-radius: 10px; }
  .nav-link-cta { text-align: center; margin-top: 4px; }
  .brand-text small { display: none; }
  .brand-text strong { max-width: 52vw; }

  .hero { padding: 26px 0 18px; }
  .hero-title { font-size: 23px; }
  .hero-sub { font-size: 14px; }
  .hero-actions .btn { flex: 1 1 140px; }

  .site-main { padding: 18px 0 34px; }
  .panel-body { padding: 16px; }
  .panel-head { padding: 14px 16px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .badge-card { max-width: 100%; }
  .badge-inner { min-height: 0; padding: 20px 18px 16px; }
  .member-grid { grid-template-columns: 1fr; }
  .toolbar select.form-select { flex: 1 1 140px; }
  .code-row { flex-wrap: wrap; }
  .code-row .btn { width: 100%; }
}

@media (max-width: 380px) {
  .badge-avatar { width: 78px; height: 78px; }
  .badge-name { font-size: 19px; }
}

/* ------------------------------ 打印 / 导出 PDF ------------------------------ */
@media print {
  @page { size: A4 portrait; margin: 14mm; }
  html, body {
    background: #fff !important;
    color: #000;
  }
  body { display: block; }
  .site-header,
  .site-footer,
  .badge-toolbar,
  .badge-hint,
  .alert,
  .announce,
  .no-print,
  .btn {
    display: none !important;
  }
  .site-main { padding: 0; }
  .wrap, .wrap-wide { max-width: none; padding: 0; }
  .badge-wrap { padding: 0; display: block; }
  .badge-card {
    max-width: 88mm;
    margin: 0 auto;
    box-shadow: none !important;
    border: 1px solid #d9d9d9;
    transform: none !important;
    page-break-inside: avoid;
  }
  .badge-card::before {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .badge-card, .badge-card * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  .member-grid { grid-template-columns: repeat(2, 1fr); }
  .member-card { box-shadow: none; page-break-inside: avoid; }
}

/* =============================================================
   页面头部 / 工牌双栏布局 / 信息卡（个人页、查看页补充样式）
   ============================================================= */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.page-title { font-size: 24px; font-weight: 800; letter-spacing: -0.4px; margin: 0 0 6px; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.badge-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.badge-col { position: sticky; top: 18px; }
.info-col { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* 信息行（与 .kv-item 视觉一致） */
.kv-row {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  min-width: 0;
}
.kv-row .kv-key { display: block; }
.kv-row .kv-val { display: block; }

/* 空状态 */
.empty-state {
  padding: 46px 16px;
  text-align: center;
  color: var(--ink-4);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: #fbfcfd;
}
.empty-state p { margin: 0 0 6px; font-size: 14px; }

/* 验证码输入行 */
.code-row { display: flex; gap: 10px; align-items: stretch; }
.code-row .form-input { flex: 1 1 auto; min-width: 0; }
.code-row .btn { flex: 0 0 auto; white-space: nowrap; }

/* 表单双列 */
.form-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }

/* 头像上传 */
.avatar-upload { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.avatar-preview {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--line);
  background: #f3f4f6;
  flex: 0 0 auto;
}
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }

@media (max-width: 900px) {
  .badge-layout { grid-template-columns: 1fr; }
  .badge-col { position: static; }
  .page-title { font-size: 20px; }
}

/* 编辑资料双栏 */
.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .profile-grid { grid-template-columns: 1fr; }
}


/* =============================================================
   后台管理（admin）专用样式
   ============================================================= */
.admin-body { background: #f2f4f7; }

.admin-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin: 0 0 18px;
  padding: 8px 10px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
}
.admin-nav-link {
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 13.5px;
  color: var(--ink-2);
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}
.admin-nav-link:hover { background: var(--primary-soft); color: var(--primary-dim); text-decoration: none; }
.admin-nav-link.is-active { background: var(--primary); color: #fff; font-weight: 600; }
.admin-nav-quiet { margin-left: auto; color: var(--ink-4); }
.admin-nav-quiet:hover { background: #fdeaea; color: #c0392b; }

.page-head-actions { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.panel-note { font-size: 12.5px; color: var(--ink-4); white-space: nowrap; }
.panel-link { font-size: 13px; color: var(--primary-dim); white-space: nowrap; }

/* 统计卡片 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(152px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  box-shadow: var(--shadow-sm);
}
.stat-label { font-size: 12.5px; color: var(--ink-3); margin-bottom: 4px; }
.stat-value { font-size: 26px; font-weight: 800; line-height: 1.15; letter-spacing: -0.5px; }
.stat-hint { font-size: 11.5px; color: var(--ink-4); margin-top: 4px; }
.stat-card-warn .stat-value { color: #b7791f; }
.stat-card-off .stat-value { color: #b91c1c; }

/* 仪表盘布局 */
.dash-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 18px;
  align-items: start;
}

/* 纯 CSS 柱状图 */
.chart-col { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1 1 0; min-width: 0; }
.chart-value { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.chart-track {
  width: 100%;
  max-width: 46px;
  height: 132px;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(180deg, #fafbfc, #f1f3f6);
  border-radius: 8px;
  overflow: hidden;
}
.chart-fill {
  width: 100%;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--primary), var(--primary-dim));
  transition: height 0.3s ease;
  min-height: 3px;
}
.chart-label { font-size: 11.5px; color: var(--ink-4); white-space: nowrap; }

/* 最近记录列表 */
.log-list { display: flex; flex-direction: column; gap: 0; }
.log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.log-item:last-child { border-bottom: none; }
.log-role {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-dim);
  font-size: 11.5px;
  font-weight: 600;
}
.log-main { flex: 1 1 auto; min-width: 0; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-time { flex: 0 0 auto; font-size: 12px; color: var(--ink-4); }
.log-state { flex: 0 0 auto; font-size: 12px; font-weight: 600; }
.log-state.is-ok { color: #15803d; }
.log-state.is-fail { color: #b91c1c; }

/* 表格 */
.table-wrap { width: 100%; overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th,
.admin-table td {
  padding: 11px 12px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.admin-table th {
  background: #fafbfc;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-3);
  position: sticky;
  top: 0;
  z-index: 1;
}
.admin-table tbody tr:hover { background: #fcfcfd; }
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table td:nth-child(2),
.admin-table th:nth-child(2) { white-space: normal; min-width: 150px; }
.admin-table .col-act { width: 1%; text-align: right; }
.admin-table .col-num { width: 1%; text-align: center; }
.admin-table .col-sort { width: 1%; text-align: center; }

.cell-main { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.cell-muted { color: var(--ink-4); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace; font-size: 12.5px; }

.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: nowrap; }
.row-actions form { display: inline; margin: 0; }
.inline-form { display: inline; margin: 0; }
.row-expand > td { background: #fbfcfd; white-space: normal; }

.link-sm {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--primary-dim);
  cursor: pointer;
  font-family: inherit;
}
.link-sm:hover { text-decoration: underline; }
.link-danger { color: #c0392b; }
.link-primary { color: var(--primary-dim); }

/* 状态胶囊 */
.status-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
}
.status-ok { background: #e8f7ee; color: #15803d; }
.status-pending { background: #fff5e6; color: #b7791f; }
.status-off { background: #fdeaea; color: #b91c1c; }

/* 标签式筛选 */
.tab-line { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 4px; }
.tab-link {
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  font-size: 13px;
  color: var(--ink-2);
}
.tab-link:hover { border-color: var(--primary); color: var(--primary-dim); text-decoration: none; }
.tab-link.is-active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary-dim); font-weight: 600; }

/* 验证码 */
.code-text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13.5px;
  letter-spacing: 1px;
  background: #f6f7f9;
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 3px 8px;
}
.btn-copy {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  font-family: inherit;
}
.btn-copy:hover { border-color: var(--primary); color: var(--primary-dim); }

/* 排序按钮 */
.sort-btns { display: inline-flex; flex-direction: column; gap: 2px; }
.btn-sort {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  width: 24px;
  height: 18px;
  line-height: 1;
  font-size: 10px;
  color: var(--ink-3);
  cursor: pointer;
  padding: 0;
}
.btn-sort:hover { border-color: var(--primary); color: var(--primary-dim); }
.sort-num { font-family: ui-monospace, Consolas, monospace; color: var(--ink-3); font-size: 12.5px; }

/* 标签 / 复选框行 */
.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 6px;
  background: #f2f4f7;
  color: var(--ink-2);
  font-size: 12px;
}
.tag-lock { background: var(--primary-soft); color: var(--primary-dim); }
.check-line { display: flex; align-items: flex-start; gap: 9px; font-size: 14px; cursor: pointer; }
.check-line input[type="checkbox"] { margin-top: 4px; flex: 0 0 auto; width: 16px; height: 16px; accent-color: var(--primary); }

/* 表单补充 */
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }
.form-color { padding: 4px; height: 44px; cursor: pointer; }
.form-actions-sticky {
  position: sticky;
  bottom: 0;
  background: rgba(245, 246, 248, 0.94);
  backdrop-filter: blur(6px);
  padding: 12px 0;
  border-top: 1px solid var(--line);
  z-index: 5;
}

/* 面板补充 */
.panel-body-flush { padding: 0; }
.panel-body-pager { padding: 14px 20px; border-top: 1px solid var(--line); }
.panel-body-flush .empty-state { margin: 20px; }

/* SMTP 日志 */
.log-pre {
  margin: 0;
  padding: 14px 16px;
  background: #1f2937;
  color: #d1e7dd;
  border-radius: var(--radius-sm);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.7;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* 后台双栏 */
.admin-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }

/* 后台登录页 */
.auth-shell { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 40px 18px; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 26px 24px;
}
.auth-title { font-size: 21px; font-weight: 800; margin-bottom: 6px; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 12.5px; color: var(--ink-4); }

@media (max-width: 900px) {
  .admin-cols, .dash-grid { grid-template-columns: 1fr; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
  .admin-nav { border-radius: var(--radius-sm); }
  .admin-nav-quiet { margin-left: 0; }
  .admin-table td:nth-child(2), .admin-table th:nth-child(2) { min-width: 120px; }
}

@media (max-width: 560px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-value { font-size: 22px; }
  .chart-track { height: 104px; }
  .row-actions { gap: 6px; }
}

/* 柱状图容器 */
.chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 4px 4px;
}
