/* ============ 管理后台 ============ */
/* 登录 */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(90% 100% at 50% 45%, rgba(3, 18, 38, 0.12), rgba(3, 18, 38, 0.55) 100%),
    linear-gradient(150deg, rgba(5, 28, 60, 0.84), rgba(8, 49, 96, 0.68) 55%, rgba(16, 92, 165, 0.54)),
    url("/assets/hero.jpg") center 42% / cover no-repeat;
}
.login-card {
  width: min(410px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 30px 28px 26px;
  box-shadow: 0 30px 80px rgba(3, 20, 45, 0.4);
}
.login-brand { display: flex; align-items: center; gap: 11px; }
.login-brand img { width: 40px; height: 40px; object-fit: contain; }
.login-brand h2 { font-size: 14px; font-weight: 700; letter-spacing: 0.01em; }
.login-brand p { margin-top: 1px; font-size: 9.5px; letter-spacing: 0.14em; color: var(--muted-2); text-transform: uppercase; }
.login-card h1 { margin-top: 26px; font-size: 21px; font-weight: 700; letter-spacing: 0.01em; }
.login-card .login-desc { margin-top: 5px; font-size: 12px; color: var(--muted); }
.login-form { margin-top: 22px; display: flex; flex-direction: column; gap: 14px; }
.login-form .input { height: 46px; border-radius: 11px; padding-left: 40px; }
.pwd-wrap { position: relative; }
.pwd-wrap > .ico {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  color: #9fb0c5;
  pointer-events: none;
}
.login-hint {
  position: relative;
  margin-top: 16px;
  display: block;
  padding: 9px 11px 9px 33px;
  border-radius: 9px;
  background: #f4f8fd;
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--muted);
}
.login-hint .ico { position: absolute; left: 11px; top: 11px; width: 13px; height: 13px; margin: 0; }
.login-hint b { color: var(--ink-2); font-weight: 600; }
.login-foot { margin-top: 20px; text-align: center; font-size: 11px; color: var(--muted-2); }
.login-foot a { color: var(--muted); }

/* 框架 */
.admin-shell { display: flex; min-height: 100vh; background: #f1f5fa; }
.admin-side {
  width: 230px;
  flex: none;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-right: 1px solid #e6edf6;
}
.admin-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid #eff4fa;
}
.admin-brand img { width: 34px; height: 34px; object-fit: contain; }
.admin-brand h2 { font-size: 12px; line-height: 1.4; font-weight: 700; letter-spacing: 0.01em; }
.admin-brand p { margin-top: 1px; font-size: 9px; letter-spacing: 0.12em; color: var(--muted-2); text-transform: uppercase; }
.admin-nav { flex: 1; padding: 13px 11px; display: flex; flex-direction: column; gap: 3px; overflow: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 41px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink-2);
  font-size: 12.5px;
  text-align: left;
  transition: background 0.16s, color 0.16s;
}
.nav-item .ico { width: 18px; height: 18px; color: #8294aa; }
.nav-item:hover { background: #f5f9fe; }
.nav-item.is-active { background: #eaf3ff; color: var(--brand-ink); font-weight: 600; }
.nav-item.is-active .ico { color: var(--brand); }
.nav-item .nav-badge {
  margin-left: auto;
  min-width: 20px;
  height: 19px;
  padding: 0 6px;
  border-radius: 999px;
  background: #f0f4fa;
  color: var(--muted);
  font-size: 10px;
  display: grid;
  place-items: center;
  font-weight: 600;
}
.nav-item.is-active .nav-badge { background: #d8eaff; color: var(--brand-ink); }
.admin-side-foot { padding: 12px; border-top: 1px solid #eff4fa; }
.admin-user { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 10px; }
.admin-user .avatar {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #2f8fe0, #1667c9);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.admin-user b { display: block; font-size: 11.5px; font-weight: 600; }
.admin-user span { display: block; font-size: 9.5px; color: var(--muted-2); }
.admin-user .icon-btn { margin-left: auto; width: 29px; height: 29px; }

.admin-main { flex: 1; min-width: 0; margin-left: 230px; padding: 24px 30px 60px; }
.admin-inner { max-width: 1180px; margin: 0 auto; }
.admin-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.admin-top h1 { font-size: 21px; font-weight: 700; letter-spacing: 0.01em; }
.admin-top p { margin-top: 4px; font-size: 11.5px; color: var(--muted); }
.admin-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-tabs-mobile { display: none; }

/* 统计卡片 */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; }
.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px 16px;
  background: #fff;
  border: 1px solid #e8eff7;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(18, 55, 100, 0.03);
}
.stat-ico {
  width: 41px;
  height: 41px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  flex: none;
}
.stat-ico .ico { width: 21px; height: 21px; }
.stat-ico.blue { background: #eaf3ff; color: #1667c9; }
.stat-ico.green { background: #e9f8f1; color: #159a63; }
.stat-ico.amber { background: #fff5e4; color: #c47a12; }
.stat-ico.violet { background: #f0edfe; color: #6753c9; }
.stat-label { font-size: 10.5px; color: var(--muted); }
.stat-value { font-size: 22px; font-weight: 700; line-height: 1.25; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.stat-value small { font-size: 10.5px; font-weight: 500; color: var(--muted-2); margin-left: 3px; }
.stat-sub { font-size: 9.5px; color: var(--muted-2); margin-top: 1px; }

/* 面板 */
.panel {
  background: #fff;
  border: 1px solid #e8eff7;
  border-radius: 15px;
  margin-top: 16px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(18, 55, 100, 0.025);
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 17px;
  border-bottom: 1px solid #f0f4fa;
  flex-wrap: wrap;
}
.panel-head h2 { font-size: 14px; font-weight: 700; }
.panel-head p { margin-top: 2px; font-size: 10.5px; color: var(--muted); }
.panel-head .head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.panel-body { padding: 17px; }
.panel-body.is-flush { padding: 0; }

.grid-2 { display: grid; grid-template-columns: 1.45fr 1fr; gap: 16px; align-items: start; }
.grid-2 > .panel { margin-top: 0; }

/* 表格 */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 620px; }
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--muted);
  font-size: 10.5px;
  padding: 9px 14px;
  background: #f8fafd;
  border-bottom: 1px solid #eef3f9;
  white-space: nowrap;
}
.table td { padding: 10px 14px; border-bottom: 1px solid #f2f6fb; vertical-align: middle; color: var(--ink-2); white-space: nowrap; }
.table td .ellipsis { max-width: 320px; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fbfdff; }
.table .num { font-variant-numeric: tabular-nums; }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .actions .icon-btn { width: 29px; height: 29px; border-radius: 8px; }
.table .actions .icon-btn .ico { width: 15px; height: 15px; }
.table .muted { color: var(--muted-2); }

.cand-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.cand-thumb {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  object-fit: cover;
  background: #eef2f7;
  flex: none;
}
.cand-thumb.is-empty { display: grid; place-items: center; color: #a3b4c8; font-size: 13px; font-weight: 700; }
.cand-cell .cell-main { min-width: 0; }
.cand-cell b { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.cand-cell span { display: block; font-size: 10px; color: var(--muted-2); margin-top: 1px; }

.ballot-admin-list { display: flex; flex-direction: column; }
.ballot-admin {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 14px 17px;
  border-bottom: 1px solid #f1f5fa;
}
.ballot-admin:last-child { border-bottom: 0; }
.ballot-admin .ballot-icon { width: 40px; height: 40px; border-radius: 11px; }
.ballot-admin .ballot-icon .ico { width: 21px; height: 21px; }
.ballot-admin .ba-main { flex: 1; min-width: 0; }
.ballot-admin h3 { font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.ballot-admin p { margin-top: 2px; font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ballot-admin .ba-meta { display: flex; gap: 10px; margin-top: 4px; font-size: 10px; color: var(--muted-2); flex-wrap: wrap; }
.ballot-admin .ba-actions { display: flex; align-items: center; gap: 6px; flex: none; }

.progress-line { display: flex; align-items: center; gap: 9px; }
.progress-line .track { flex: 1; height: 5px; border-radius: 999px; background: #edf2f9; overflow: hidden; min-width: 70px; }
.progress-line .track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #2f8fe0, #1667c9); }
.progress-line b { font-size: 10.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; min-width: 28px; text-align: right; }

/* 结果排行 */
.result-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 4px; }
.rs-item { padding: 12px 14px; background: #f8fbff; border: 1px solid #edf3fa; border-radius: 11px; }
.rs-item span { display: block; font-size: 10px; color: var(--muted); }
.rs-item b { display: block; margin-top: 2px; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rs-item small { font-size: 9.5px; color: var(--muted-2); font-weight: 500; }

.rank-list { margin-top: 6px; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid #f2f6fb;
}
.rank-row:last-child { border-bottom: 0; }
.rank-no {
  width: 25px;
  height: 25px;
  border-radius: 8px;
  background: #f1f5fa;
  color: #7d8ea5;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  flex: none;
  font-variant-numeric: tabular-nums;
}
.rank-no.r1 { background: linear-gradient(145deg, #fff1cf, #ffd88c); color: #9a6100; }
.rank-no.r2 { background: linear-gradient(145deg, #f1f5fa, #dbe5f1); color: #5f6f85; }
.rank-no.r3 { background: linear-gradient(145deg, #faeadf, #f2cfb6); color: #93551f; }
.rank-photo { width: 36px; height: 36px; border-radius: 9px; object-fit: cover; flex: none; background: #eef2f7; }
.rank-photo.is-empty { display: grid; place-items: center; color: #a3b4c8; font-size: 12px; font-weight: 700; }
.rank-main { flex: 1; min-width: 0; }
.rank-name { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; }
.rank-name span { font-size: 10px; font-weight: 500; color: var(--muted-2); }
.rank-bar { margin-top: 5px; height: 5px; border-radius: 999px; background: #eef3fa; overflow: hidden; }
.rank-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4aa3ea, #1667c9); }
.rank-votes { flex: none; text-align: right; min-width: 58px; }
.rank-votes b { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.rank-votes span { font-size: 9.5px; color: var(--muted-2); display: block; }

/* 候选人工具栏 */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar .select { height: 36px; width: auto; min-width: 150px; font-size: 12px; padding-top: 0; padding-bottom: 0; }
.toolbar .search-box { margin: 0; height: 36px; flex: 1; min-width: 160px; max-width: 260px; border-radius: 9px; }
.toolbar .search-box input { font-size: 12px; }
.toolbar .btn { height: 36px; font-size: 12px; border-radius: 9px; }
.count-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f3f8ff;
  color: var(--brand-ink);
  border: 1px solid #e2eefc;
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}
.count-pill b { font-weight: 700; }

/* 表单 / 弹窗 */
.form-block { display: flex; flex-direction: column; gap: 14px; }
.photo-field { display: flex; gap: 14px; align-items: flex-start; }
.photo-drop {
  width: 104px;
  height: 138px;
  border-radius: 11px;
  border: 1.5px dashed #cfddee;
  background: #f8fbff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  color: #93a7bf;
  font-size: 10px;
  overflow: hidden;
  position: relative;
  flex: none;
  cursor: pointer;
  transition: border-color 0.18s, background 0.18s;
}
.photo-drop:hover, .photo-drop.is-drag { border-color: var(--brand-2); background: #f0f7ff; color: var(--brand); }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.photo-drop .ico { width: 20px; height: 20px; }
.photo-drop .replace {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 4px 0;
  background: rgba(12, 32, 58, 0.62);
  color: #fff;
  font-size: 9.5px;
  text-align: center;
  backdrop-filter: blur(3px);
}
.photo-side { flex: 1; display: flex; flex-direction: column; gap: 7px; justify-content: center; padding-top: 4px; }
.photo-side .form-hint { line-height: 1.65; }
.photo-side .btn { align-self: flex-start; }

.import-area {
  width: 100%;
  min-height: 170px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 11.5px;
  line-height: 1.65;
  white-space: pre;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  padding: 11px 12px;
  resize: vertical;
}
.import-area:focus { outline: none; border-color: #8db9ea; box-shadow: 0 0 0 3px rgba(35, 120, 210, 0.1); }
.import-tip {
  margin-top: 9px;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 10.5px;
  line-height: 1.65;
  color: var(--muted);
}
.import-tip .ico { width: 13px; height: 13px; flex: none; margin-top: 1px; }
.import-preview { margin-top: 12px; border: 1px solid #edf3fa; border-radius: 9px; overflow: hidden; }
.import-preview table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.import-preview th, .import-preview td { padding: 6px 9px; text-align: left; border-bottom: 1px solid #f2f6fb; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.import-preview th { background: #f8fafd; color: var(--muted); font-weight: 600; }
.import-preview tr:last-child td { border-bottom: 0; }

.confirm-text { font-size: 13px; line-height: 1.75; color: var(--ink-2); }
.confirm-text b { color: var(--ink); }

/* 设置 */
.settings-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 16px; align-items: start; }
.settings-card { background: #fff; border: 1px solid #e8eff7; border-radius: 15px; padding: 18px; }
.settings-card h2 { font-size: 14px; font-weight: 700; }
.settings-card > p { margin-top: 3px; font-size: 10.5px; color: var(--muted); line-height: 1.6; }
.settings-form { display: flex; flex-direction: column; gap: 13px; margin-top: 15px; }
.danger-zone { border-color: #f3d6d6; background: #fffdfd; }
.danger-zone h2 { color: #b53b3b; }
.danger-item { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid #f7eaea; }
.danger-item:last-child { border-bottom: 0; padding-bottom: 0; }
.danger-item .di-main { flex: 1; min-width: 0; }
.danger-item b { display: block; font-size: 11.5px; font-weight: 600; }
.danger-item span { display: block; margin-top: 2px; font-size: 10px; color: var(--muted); line-height: 1.55; }
.danger-item .btn { flex: none; }

.data-note {
  display: block;
  position: relative;
  margin-top: 14px;
  padding: 10px 12px 10px 34px;
  border-radius: 9px;
  background: #f7fafd;
  border: 1px solid #edf3fa;
  font-size: 10px;
  line-height: 1.75;
  color: var(--muted);
}
.data-note .ico { position: absolute; left: 12px; top: 11px; width: 14px; height: 14px; margin: 0; }
.data-note code { white-space: nowrap; }
.data-note code { background: #eef4fa; padding: 1px 4px; border-radius: 4px; font-size: 9.5px; }

/* 空态 */
.admin-empty { padding: 45px 20px; text-align: center; color: var(--muted); font-size: 12px; }
.admin-empty .empty-ico { margin: 0 auto 10px; }

/* 响应式 */
@media (max-width: 1080px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .result-summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .admin-shell { flex-direction: column; }
  .admin-side {
    position: sticky;
    top: 0;
    width: 100%;
    height: auto;
    flex-direction: column;
    border-right: 0;
    border-bottom: 1px solid #e6edf6;
  }
  .admin-brand { flex-direction: row; align-items: center; gap: 10px; padding: 12px 14px; }
  .admin-brand p { display: none; }
  .admin-brand img { width: 28px; height: 28px; }
  .admin-nav {
    flex-direction: row;
    padding: 0 10px 9px;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .admin-nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: none; height: 34px; padding: 0 10px; font-size: 11.5px; }
  .nav-item .ico { width: 15px; height: 15px; }
  .nav-item .nav-badge { display: none; }
  .admin-side-foot { display: none; }
  .admin-main { margin-left: 0; padding: 16px 14px 40px; }
  .admin-top { margin-bottom: 14px; }
  .admin-top h1 { font-size: 18px; }
  .stat-grid { gap: 9px; }
  .stat-card { padding: 11px 12px; gap: 9px; }
  .stat-ico { width: 34px; height: 34px; border-radius: 9px; }
  .stat-ico .ico { width: 18px; height: 18px; }
  .stat-value { font-size: 18px; }
  .panel-head { padding: 12px 14px; }
  .panel-body { padding: 14px; }
  .ballot-admin { padding: 12px 14px; flex-wrap: wrap; }
  .ballot-admin .ba-actions { width: 100%; justify-content: flex-end; }
  .toolbar .search-box { max-width: none; flex-basis: 100%; }
  .toolbar .select { flex: 1; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .stat-sub { display: none; }
  .result-summary { grid-template-columns: 1fr 1fr; }
  .admin-actions .btn span { display: none; }
}

/* v2 支部 / 总览 / 签名 */
.dist-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.dist-card { border: 1px solid #edf3fa; border-radius: 12px; padding: 14px 15px; background: #fbfdff; }
.dist-card h3 { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 10px; }
.dist-list { display: flex; flex-direction: column; gap: 8px; }
.dist-row { display: flex; align-items: center; gap: 9px; font-size: 11px; }
.dist-label { width: 78px; flex: none; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dist-bar { flex: 1; height: 6px; border-radius: 999px; background: #eef3fa; overflow: hidden; }
.dist-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #4aa3ea, #1667c9); }
.dist-row b { width: 66px; text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; }
.dist-row b small { color: var(--muted-2); font-weight: 500; margin-left: 3px; font-size: 9px; }

.signature-thumb {
  width: 108px;
  height: 42px;
  border: 1px solid #e3ebf5;
  border-radius: 7px;
  background: #fff;
  overflow: hidden;
  display: grid;
  place-items: center;
}
.signature-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }

@media (max-width: 720px) {
  .dist-grid { grid-template-columns: 1fr; }
}
