/* 中华茶人联谊会 · 会员证书系统 */
:root {
  --brand: #2f7a4e;
  --brand-dark: #1f4d33;
  --brand-soft: #eaf5ee;
  --brand-tint: #f3faf5;
  --gold: #c9a227;
  --gold-soft: #fbf5e4;
  --ink: #211c19;
  --ink-2: #443c36;
  --muted: #837a72;
  --line: #ece5da;
  --bg: #f6f3ee;
  --card: #ffffff;
  --danger: #c02b2b;
  --warn: #9a6a12;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 6px 18px rgba(33, 28, 25, 0.06);
  --shadow-lg: 0 14px 34px rgba(33, 28, 25, 0.12);
  --font: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3 { line-height: 1.35; }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* ============ 顶部品牌区 ============ */
.h5-header {
  position: relative;
  overflow: hidden;
  background: linear-gradient(150deg, #17412b 0%, #2f7a4e 52%, #3f9264 100%);
  color: #fff;
  padding: 26px 18px 44px;
}
.h5-header::before {
  content: "";
  position: absolute;
  right: -46px;
  top: -60px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,0.16), rgba(255,255,255,0) 70%);
}
.h5-header::after {
  content: "";
  position: absolute;
  left: -30px;
  bottom: -70px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201,162,39,0.28), rgba(201,162,39,0) 70%);
}
.h5-header .logo-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  max-width: 640px;
  margin: 0 auto;
  padding: 0 2px;
}
.h5-header img.logo {
  width: 54px;
  height: 54px;
  flex: none;
  border-radius: 12px;
  padding: 3px;
  background: #fff;
  object-fit: contain;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}
.h5-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.h5-header p {
  margin: 3px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.82);
}

.h5-wrap {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: -26px auto 40px;
  padding: 0 14px;
}

/* ============ 卡片 ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(236, 229, 218, 0.9);
}

.card h2 {
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card h2::before {
  content: "";
  width: 3px;
  height: 15px;
  border-radius: 2px;
  background: var(--brand);
}
.card h2 .sub {
  margin-left: auto;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}
.card p { margin: 0 0 8px; }
.card p:last-child { margin-bottom: 0; }

.card-note {
  font-size: 13px;
  color: var(--muted);
  margin: 10px 0 0;
}

/* ============ 状态胶囊 ============ */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.7;
  white-space: nowrap;
  background: var(--brand-soft);
  color: var(--brand-dark);
  border: 1px solid rgba(47, 122, 78, 0.18);
}
.status-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}
.status-pill.warn { background: #fdf3de; color: var(--warn); border-color: rgba(154, 106, 18, 0.2); }
.status-pill.danger { background: #fdecec; color: var(--danger); border-color: rgba(192, 43, 43, 0.2); }
.status-pill.ok { background: var(--brand-soft); color: var(--brand); }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  width: 100%;
  transition: background .18s ease, box-shadow .18s ease, transform .12s ease;
  box-shadow: 0 3px 10px rgba(47, 122, 78, 0.22);
}
.btn:hover { background: #287043; }
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: #fff;
  color: var(--brand-dark);
  border-color: rgba(47, 122, 78, 0.45);
  box-shadow: none;
}
.btn.secondary:hover { background: var(--brand-tint); }
.btn.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed #d8cfc2;
  box-shadow: none;
}
.btn.ghost:hover { color: var(--brand-dark); border-color: var(--brand); }
.btn.danger { background: var(--danger); box-shadow: 0 3px 10px rgba(192, 43, 43, 0.2); }
.btn.danger:hover { background: #a82424; }
.btn:disabled { opacity: .6; cursor: not-allowed; box-shadow: none; }
.btn + .btn { margin-top: 10px; }

.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}
.btn-row .btn { margin-top: 0; }

/* ============ 表单 ============ */
.field { margin-bottom: 13px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--ink-2);
  margin-bottom: 6px;
  font-weight: 500;
}
.field label .req { color: var(--danger); }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid #e3ddd3;
  border-radius: var(--radius-sm);
  padding: 11px 12px;
  font-size: 15px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.field input:hover, .field textarea:hover, .field select:hover { border-color: #d0c9bd; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 122, 78, 0.14);
}
.field textarea { min-height: 96px; resize: vertical; }

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* 职务选择：卡片式 */
.type-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.type-picker label {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px 6px;
  border: 1px solid #e3ddd3;
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--ink-2);
  cursor: pointer;
  transition: all .16s ease;
  text-align: center;
}
.type-picker input { position: absolute; opacity: 0; pointer-events: none; }
.type-picker label:hover { border-color: var(--brand); background: var(--brand-tint); }
.type-picker label.checked {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(47, 122, 78, 0.1);
}

/* 上传 */
.upload-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  border: 1px dashed #cec6b8;
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  background: #fcfbf8;
  cursor: pointer;
  transition: all .18s ease;
}
.upload-box:hover { border-color: var(--brand); background: var(--brand-tint); }
.upload-box .plus {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 18px;
  line-height: 28px;
  font-weight: 600;
}
.upload-box.dragover { border-color: var(--brand); background: var(--brand-soft); }
.upload-box.has-file {
  border-color: var(--brand);
  border-style: solid;
  color: var(--brand-dark);
  background: var(--brand-soft);
}
.upload-box.has-file .plus { background: var(--brand); color: #fff; }
.upload-box .hint { font-size: 12px; color: var(--muted); }
.upload-box .filename { font-size: 13px; font-weight: 600; word-break: break-all; }
.upload-box input { display: none; }

/* ============ 证书卡片 ============ */
.cert-item {
  position: relative;
  border: 1px solid #ece4d6;
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, #fffdf7 0%, #fff 62%);
  overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease;
}
.cert-item:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.cert-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: linear-gradient(180deg, var(--gold), rgba(201, 162, 39, 0.15));
}
.cert-item.revoked { filter: grayscale(.55); opacity: .85; }
.cert-item.revoked::before { background: #cfc7bd; }
.cert-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.type-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: linear-gradient(135deg, #f6e8bd, #e9d49a);
  color: #6d5320;
  border: 1px solid rgba(183, 148, 58, 0.35);
}
.cert-item .no {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  color: var(--brand-dark);
  font-weight: 700;
  letter-spacing: 0.04em;
  font-size: 14px;
}
.cert-item .unit {
  font-size: 17px;
  font-weight: 600;
  margin: 2px 0 10px;
  letter-spacing: 0.01em;
}
.cert-item .btn { margin-top: 12px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 34px 12px;
  font-size: 14px;
}
.empty .empty-icon {
  display: block;
  margin: 0 auto 10px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 22px;
  line-height: 52px;
}

/* 办理流程步骤条 */
.steps { display: flex; flex-direction: column; gap: 12px; }
.step {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}
.step .idx {
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}
.step strong { font-size: 14px; }
.step .card-note { margin: 0; font-size: 12.5px; }

.result-ok {
  border-left: 4px solid var(--brand);
  padding-left: 14px;
  animation: fade-up .25s ease both;
}
.result-fail {
  border-left: 4px solid var(--danger);
  padding-left: 14px;
  animation: fade-up .25s ease both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.kv {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 7px 10px;
  font-size: 14px;
  margin: 8px 0;
}
.kv .k { color: var(--muted); }

.footer-note {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 0 34px;
}

/* ============ 首页入口 ============ */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 11px;
  margin-bottom: 14px;
}
.nav-grid a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  background: var(--card);
  border: 1px solid rgba(236, 229, 218, 0.9);
  border-radius: var(--radius);
  padding: 18px 8px 15px;
  box-shadow: var(--shadow);
  color: var(--ink);
  font-size: 13px;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.nav-grid a:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: rgba(47, 122, 78, 0.35);
}
.nav-grid .icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(140deg, var(--brand-soft), #dcefe3);
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 19px;
  font-weight: 700;
}
.nav-grid a .desc {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.4;
}

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  margin-bottom: 12px;
  border: 1px solid transparent;
}
.alert.info { background: var(--brand-soft); color: var(--brand-dark); border-color: rgba(47,122,78,.18); }
.alert.error { background: #fdecec; color: var(--danger); border-color: rgba(192,43,43,.18); }
.alert.warn { background: #fdf3de; color: var(--warn); border-color: rgba(154,106,18,.18); }
.alert a { color: inherit; text-decoration: underline; }

/* ============ 管理后台 ============ */
body.admin { background: #f4f2ee; }
.admin-shell {
  display: grid;
  grid-template-columns: 218px 1fr;
  min-height: 100vh;
}
.admin-side {
  background: linear-gradient(180deg, #17412b, #1f4d33);
  color: #fff;
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}
.admin-side .brand {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.5;
  padding: 0 4px;
}
.admin-side .brand small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
  margin-top: 3px;
}
.admin-side a {
  display: flex;
  align-items: center;
  gap: 9px;
  color: rgba(255, 255, 255, 0.82);
  padding: 10px 12px;
  border-radius: 9px;
  margin-bottom: 3px;
  font-size: 14px;
  transition: background .15s ease, color .15s ease;
}
.admin-side a .nav-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.4);
  flex: none;
}
.admin-side a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.admin-side a.active {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  font-weight: 600;
}
.admin-side a.active .nav-dot { background: #8ed8a9; }
.admin-side .spacer { flex: 1; }
.admin-side .logout { color: rgba(255, 255, 255, 0.7); font-size: 13px; }

.admin-main { padding: 26px 30px 44px; min-width: 0; }
.admin-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 20px;
}
.admin-top h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 600;
}
.admin-top .crumb {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  position: relative;
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(236, 229, 218, 0.9);
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -18px;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--brand-tint);
}
.stat .num {
  font-size: 30px;
  font-weight: 700;
  color: var(--brand-dark);
  line-height: 1.2;
}
.stat .lbl { color: var(--muted); font-size: 13px; }
.stat.warn .num { color: var(--warn); }
.stat.warn::after { background: #fdf3de; }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  border: 1px solid rgba(236, 229, 218, 0.9);
}
table.data th, table.data td {
  padding: 12px 13px;
  border-bottom: 1px solid #f1ece2;
  font-size: 13px;
  text-align: left;
  vertical-align: middle;
}
table.data th {
  background: #faf8f3;
  color: var(--ink-2);
  font-weight: 600;
  white-space: nowrap;
}
table.data tbody tr { transition: background .14s ease; }
table.data tbody tr:hover { background: #fbfaf7; }
table.data tr:last-child td { border-bottom: none; }
table.data .mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
}
table.data td.nowrap { white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}
.toolbar input, .toolbar select, .toolbar button {
  border: 1px solid #ddd6c8;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color .16s ease, box-shadow .16s ease;
}
.toolbar input:focus, .toolbar select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 122, 78, 0.14);
}
.toolbar button {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  cursor: pointer;
  font-weight: 600;
  padding: 9px 18px;
}
.toolbar button:hover { background: #287043; }
.toolbar .link-reset {
  font-size: 13px;
  color: var(--muted);
}

.btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 8px;
  font-size: 12px;
  border: 1px solid rgba(47, 122, 78, 0.4);
  color: var(--brand-dark);
  background: #fff;
  cursor: pointer;
  margin: 2px 4px 2px 0;
  font-family: inherit;
  transition: all .15s ease;
}
.btn-sm:hover { background: var(--brand-tint); border-color: var(--brand); }
.btn-sm.primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-sm.primary:hover { background: #287043; }
.btn-sm.danger { border-color: rgba(192, 43, 43, 0.4); color: var(--danger); }
.btn-sm.danger:hover { background: #fdecec; border-color: var(--danger); }

.pager {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  flex-wrap: wrap;
  font-size: 13px;
}
.pager .info { color: var(--muted); margin-right: auto; }
.pager a, .pager span.cur {
  min-width: 32px;
  height: 32px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid #e3ddd3;
  background: #fff;
  color: var(--ink-2);
}
.pager a:hover { border-color: var(--brand); color: var(--brand-dark); }
.pager span.cur {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}
.pager .gap { color: var(--muted); padding: 0 2px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  align-items: start;
}

.action-card {
  border: 1px solid rgba(236, 229, 218, 0.9);
  border-radius: var(--radius);
  padding: 16px;
  background: #fff;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.action-card h2 { margin-bottom: 8px; }
.action-card .divider {
  height: 1px;
  background: #f1ece2;
  margin: 14px 0;
}

.log-item {
  border-bottom: 1px solid #f1ece2;
  padding: 9px 0;
}
.log-item:last-child { border-bottom: none; }
.log-item .head { font-size: 13px; }
.log-item .head strong { font-weight: 600; }
.log-item .head .time { color: var(--muted); font-size: 12px; }
.log-item .comment { font-size: 12px; color: var(--muted); }

/* 已通过审核的申请：表单整体置灰锁定，避免误提交 */
form.form-locked {
  opacity: 0.55;
  pointer-events: none;
  filter: grayscale(0.35);
}

/* ============ 后台登录页 ============ */
.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px 40px;
  background:
    radial-gradient(880px 400px at 50% -210px, rgba(47, 122, 78, 0.17), rgba(47, 122, 78, 0) 72%),
    var(--bg);
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  text-align: center;
}
.login-brand img {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  background: #fff;
  padding: 4px;
  object-fit: contain;
  box-shadow: var(--shadow);
}
.login-brand h1 {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.login-brand p {
  margin: 3px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.login-card {
  width: 100%;
  max-width: 400px;
  padding: 24px 24px 20px;
  margin-bottom: 12px;
}
.login-card h2 {
  justify-content: center;
  font-size: 17px;
}
.login-card .btn { margin-top: 4px; }
.login-tip { font-size: 12px; margin: 0; }

@media (max-width: 900px) {
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { flex-direction: row; align-items: center; gap: 6px; overflow-x: auto; padding: 12px 14px; }
  .admin-side .brand { margin: 0 10px 0 0; font-size: 13px; white-space: nowrap; }
  .admin-side .brand small { display: none; }
  .admin-side .spacer { display: none; }
  .admin-side a { margin: 0; white-space: nowrap; }
  .admin-main { padding: 20px 16px 36px; }
  .detail-grid, .stats { grid-template-columns: 1fr; }
  .nav-grid { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
}
