:root {
  --brand: #1f4e79;
  --brand-2: #2f7ed8;
  --brand-soft: #eaf2fb;
  --ink: #182234;
  --muted: #6b7a8f;
  --line: #e4e9f0;
  --bg: #f2f5f9;
  --card: #ffffff;
  --ok: #1f9d6b;
  --danger: #d9534f;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 39, 66, .04), 0 6px 20px rgba(16, 39, 66, .06);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "HarmonyOS Sans SC",
               "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.page { max-width: 780px; margin: 0 auto; padding: 0 14px 28px; }

/* ---------------- Hero ---------------- */
.hero {
  background: linear-gradient(140deg, #1f4e79 0%, #2f7ed8 100%);
  color: #fff;
  border-radius: 0 0 22px 22px;
  padding: 26px 20px 22px;
  margin: 0 -14px 16px;
  box-shadow: 0 8px 24px rgba(31, 78, 121, .22);
}
.hero-tag {
  display: inline-block;
  font-size: 12px;
  letter-spacing: .5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .28);
}
.hero h1 { font-size: 22px; margin: 12px 0 8px; letter-spacing: .5px; }
.hero-sub { margin: 0; font-size: 14px; color: rgba(255, 255, 255, .92); }
.hero-sub b { color: #fff; }
.hero-tips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  font-size: 12px;
  color: rgba(255, 255, 255, .9);
}
.hero-tips span {
  background: rgba(255, 255, 255, .14);
  padding: 4px 10px;
  border-radius: 8px;
}

/* ---------------- Flash / Panel ---------------- */
.flash-wrap { margin-bottom: 12px; }
.flash {
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 8px;
  border-left: 4px solid;
}
.flash-error { background: #fdeceb; color: #a8352f; border-color: var(--danger); }
.flash-success { background: #e9f7f1; color: #16724f; border-color: var(--ok); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.panel-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.panel-note { font-size: 12px; font-weight: 400; color: var(--muted); }
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.panel-head .panel-title { margin-bottom: 0; }

/* ---------------- Form ---------------- */
.field { margin-bottom: 12px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input {
  width: 100%;
  padding: 11px 13px;
  font-size: 15px;
  color: var(--ink);
  background: #fbfcfe;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(47, 126, 216, .14);
  background: #fff;
}
.hint { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------------- Requirement cards ---------------- */
.req-list { display: flex; flex-direction: column; gap: 10px; }
.req {
  position: relative;
  display: flex;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfcfe;
  cursor: pointer;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.req:hover { border-color: #c9d8ea; }
.req input { position: absolute; opacity: 0; pointer-events: none; }
.req-body { flex: 1; min-width: 0; }
.req-head { display: flex; align-items: baseline; gap: 8px; }
.req-seq {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 6px;
  padding: 1px 6px;
  line-height: 18px;
}
.req-title { font-size: 15px; font-weight: 700; }
.req-desc {
  margin: 6px 0 0;
  font-size: 13px;
  color: #43536b;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.req.is-open .req-desc { -webkit-line-clamp: unset; display: block; }
.req-meta {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  padding-top: 7px;
  border-top: 1px dashed var(--line);
}
.req-meta span {
  color: var(--brand-2);
  font-weight: 600;
  margin-right: 6px;
}
.req-more {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--brand-2);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.req-tick {
  flex: none;
  align-self: flex-start;
  width: 22px;
  height: 22px;
  margin-top: 2px;
  border: 1.5px solid #c3cfdd;
  border-radius: 7px;
  background: #fff;
  position: relative;
  transition: all .15s;
}
.req-tick::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 2.5px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform .15s;
}
.req.is-checked {
  border-color: var(--brand-2);
  background: #f2f8ff;
  box-shadow: 0 0 0 2px rgba(47, 126, 216, .12);
}
.req.is-checked .req-tick {
  background: var(--brand-2);
  border-color: var(--brand-2);
}
.req.is-checked .req-tick::after { transform: rotate(45deg) scale(1); }
.req.is-dim { opacity: .45; }

/* ---------------- Sticky submit bar ---------------- */
.sticky-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 18px rgba(16, 39, 66, .08);
}
.counter { font-size: 14px; color: var(--muted); }
.counter b { font-size: 19px; color: var(--brand); }
.counter.full b { color: var(--ok); }
.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  padding: 11px 30px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  border-radius: 10px;
  background: linear-gradient(135deg, #2f7ed8, #1f4e79);
  box-shadow: 0 4px 12px rgba(31, 78, 121, .22);
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled {
  background: #c3cfdd;
  box-shadow: none;
  cursor: not-allowed;
  color: #f2f5f9;
}
.sticky-placeholder { height: 74px; }

.foot {
  text-align: center;
  font-size: 12px;
  color: #9aa8ba;
  padding: 10px 0 4px;
}

/* ---------------- Done page ---------------- */
.done-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 20px;
  margin: 28px 0 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.done-icon {
  width: 58px;
  height: 58px;
  line-height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #e9f7f1;
  color: var(--ok);
  font-size: 30px;
  font-weight: 700;
}
.done-card h1 { font-size: 21px; margin: 0 0 6px; }
.done-sub { color: var(--muted); margin: 0 0 20px; font-size: 14px; }
.done-info {
  text-align: left;
  background: #f7f9fc;
  border-radius: 12px;
  padding: 12px 14px;
}
.done-info div {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 14px;
}
.done-info span { color: var(--muted); }
.done-list {
  text-align: left;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
}
.done-list-title { font-size: 14px; font-weight: 700; margin-bottom: 8px; }
.done-list ol { margin: 0; padding-left: 18px; }
.done-list li { font-size: 14px; padding: 4px 0; }
.done-list .seq {
  display: inline-block;
  font-size: 11px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 5px;
  padding: 0 5px;
  margin-right: 6px;
}
.done-tip { font-size: 12px; color: var(--muted); margin: 16px 0 0; }

/* ---------------- Login ---------------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-sub { font-size: 12px; color: var(--muted); margin: 0 0 20px; }
.login-card label { font-size: 13px; color: var(--muted); }
.login-card input {
  width: 100%;
  margin: 6px 0 16px;
  padding: 11px 13px;
  font-size: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #fbfcfe;
}
.login-card input:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(47, 126, 216, .14);
}
.login-card .btn { width: 100%; padding: 12px; }

/* ---------------- Admin ---------------- */
.admin { max-width: 1060px; margin: 0 auto; padding: 18px 14px 30px; }
.admin-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.admin-head h1 { font-size: 20px; margin: 0 0 2px; }
.admin-head p { margin: 0; font-size: 13px; color: var(--muted); }
.admin-actions { display: flex; gap: 8px; }
.btn-ghost {
  background: #fff;
  color: var(--brand);
  border: 1px solid #cfdcea;
  box-shadow: none;
  padding: 9px 16px;
  font-size: 13px;
  text-decoration: none;
  display: inline-block;
}
.btn-ghost:hover { background: var(--brand-soft); }

.kpis { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.kpi {
  flex: 1 1 160px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.kpi-num { font-size: 28px; font-weight: 800; color: var(--brand); line-height: 1.2; }
.kpi-label { font-size: 12px; color: var(--muted); margin-top: 2px; }

.filter select {
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbfcfe;
  color: var(--ink);
  outline: none;
  max-width: 240px;
}

.rank-list { display: flex; flex-direction: column; gap: 2px; }
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 6px;
  border-bottom: 1px solid #f0f3f8;
}
.rank-row:last-child { border-bottom: 0; }
.rank-row.top1 .rank-no { background: #f5c518; color: #fff; }
.rank-row.top2 .rank-no { background: #b9c4d2; color: #fff; }
.rank-row.top3 .rank-no { background: #d99b5f; color: #fff; }
.rank-no {
  flex: none;
  width: 26px;
  height: 26px;
  line-height: 26px;
  text-align: center;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  background: #eef2f8;
  color: var(--muted);
}
.rank-main { flex: 1; min-width: 0; }
.rank-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.rank-title .seq {
  font-size: 11px;
  color: var(--brand);
  background: var(--brand-soft);
  border-radius: 5px;
  padding: 0 5px;
  margin-right: 6px;
  font-weight: 700;
}
.rank-bar {
  height: 8px;
  background: #eef2f8;
  border-radius: 999px;
  overflow: hidden;
}
.rank-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #6aa9ea, #2f7ed8);
  transition: width .5s ease;
}
.rank-row.top1 .rank-bar-fill { background: linear-gradient(90deg, #f7d06b, #e8a921); }
.rank-row.top2 .rank-bar-fill { background: linear-gradient(90deg, #cdd6e2, #9aa9bd); }
.rank-row.top3 .rank-bar-fill { background: linear-gradient(90deg, #e9bd8f, #cd8b48); }
.rank-meta { font-size: 11px; color: #9aa8ba; margin-top: 5px; }
.rank-votes {
  flex: none;
  text-align: right;
  min-width: 56px;
}
.rank-votes b { font-size: 20px; color: var(--brand); }
.rank-votes span { display: block; font-size: 11px; color: var(--muted); }

.table-scroll { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 520px; }
.tbl th, .tbl td {
  padding: 9px 10px;
  border-bottom: 1px solid #f0f3f8;
  text-align: left;
}
.tbl th {
  background: #f7f9fc;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}
.tbl tbody tr:hover { background: #fafcff; }
.tbl .num { text-align: right; font-weight: 700; color: var(--brand); }
.tbl .muted { color: var(--muted); }
.tbl .center { text-align: center; }

@media (max-width: 560px) {
  .hero h1 { font-size: 20px; }
  .admin-head h1 { font-size: 17px; }
  .btn { padding: 11px 22px; }
  .rank-votes b { font-size: 17px; }
}
