/* ============================================================================
   人民代表大会 · 议案表决系统  ——  样式表
   配色说明：#9E1B32 人大红为主色，深色底适合投影；
   赞成绿 / 反对红 / 弃权灰 三种表决色，在投影和手机上都足够区分。
   ============================================================================ */

:root {
  --red: #9e1b32;
  --red-light: #c2263f;
  --red-dark: #6f1223;
  --gold: #d9b382;
  --bg: #0e1116;
  --bg-soft: #161b23;
  --surface: #1c222c;
  --surface-2: #232a36;
  --line: #2f3846;
  --text: #eef2f7;
  --text-dim: #9aa5b4;
  --text-mute: #6b7684;
  --yes: #2fa84f;
  --no: #d33a3a;
  --abstain: #8a94a6;
  --radius: 12px;
  --radius-lg: 18px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Source Han Sans SC",
               system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

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

/* ---------------- 顶栏 ---------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 22px;
  background: linear-gradient(90deg, var(--red-dark), var(--red) 45%, var(--red-dark));
  border-bottom: 3px solid var(--gold);
  position: sticky;
  top: 0;
  z-index: 50;
  flex-wrap: wrap;
}

.emblem {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe9c4, var(--gold) 55%, #a37c46);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35);
  flex: 0 0 auto;
  position: relative;
}
.emblem::after {
  content: "★";
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--red-dark);
  font-size: 17px;
}

.topbar h1 {
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 1.5px;
}
.topbar .sub {
  font-size: 12px;
  color: rgba(255, 255, 255, .72);
  letter-spacing: .5px;
}

.topbar nav {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.navbtn {
  padding: 7px 15px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .35);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 13.5px;
  cursor: pointer;
  transition: all .18s;
  white-space: nowrap;
  font-family: inherit;
}
.navbtn:hover { background: rgba(255, 255, 255, .2); text-decoration: none; }
.navbtn.active { background: #fff; color: var(--red-dark); font-weight: 700; border-color: #fff; }

/* ---------------- 通用容器 ---------------- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 22px 70px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 17px;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 9px;
  letter-spacing: .6px;
}
.card h2::before {
  content: "";
  width: 4px; height: 17px;
  background: var(--red);
  border-radius: 2px;
}

.hint {
  font-size: 12.5px;
  color: var(--text-mute);
  margin-top: 8px;
  line-height: 1.75;
}

/* ---------------- 按钮 ---------------- */
.btn {
  padding: 9px 18px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
  transition: all .16s;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: #2c3542; border-color: #46536a; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary {
  background: linear-gradient(135deg, var(--red), var(--red-light));
  border-color: var(--red-light);
  font-weight: 700;
}
.btn.primary:hover:not(:disabled) { filter: brightness(1.12); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: #6d2a2a; color: #ff9b9b; }
.btn.danger:hover:not(:disabled) { background: #3a1e1e; }
.btn.sm { padding: 5px 12px; font-size: 12.5px; border-radius: 7px; }

/* ---------------- 表单 ---------------- */
label.field {
  display: block;
  margin-bottom: 13px;
}
label.field > span {
  display: block;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 6px;
}
input[type=text], input[type=password], textarea, select {
  width: 100%;
  padding: 10px 13px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  color: var(--text);
  font-size: 14.5px;
  font-family: inherit;
  transition: border-color .16s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--red-light);
  box-shadow: 0 0 0 3px rgba(194, 38, 63, .18);
}
textarea { resize: vertical; min-height: 62px; }
input[type=file] { font-size: 13.5px; color: var(--text-dim); }

.row { display: flex; gap: 14px; flex-wrap: wrap; }
.row > * { flex: 1 1 220px; }
.row.tight { gap: 9px; }
.row.tight > * { flex: 0 0 auto; }

/* ---------------- 上传拖拽区 ---------------- */
.dropzone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px;
  text-align: center;
  color: var(--text-mute);
  cursor: pointer;
  transition: all .18s;
  background: var(--bg-soft);
}
.dropzone:hover, .dropzone.over {
  border-color: var(--red-light);
  background: rgba(194, 38, 63, .07);
  color: var(--text-dim);
}
.dropzone .big { font-size: 30px; display: block; margin-bottom: 6px; }

.preview {
  margin-top: 12px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.preview img {
  max-width: 260px;
  max-height: 190px;
  border-radius: 10px;
  border: 1px solid var(--line);
  object-fit: contain;
  background: #000;
}

/* ---------------- 议案列表 ---------------- */
.bill-list { display: grid; gap: 14px; }

.bill-item {
  display: flex;
  gap: 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  align-items: flex-start;
}
.bill-item img.thumb {
  width: 148px;
  height: 100px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #000;
  flex: 0 0 auto;
}
.bill-item .meta { flex: 1; min-width: 0; }
.bill-item .meta h3 {
  font-size: 15.5px;
  margin-bottom: 5px;
  word-break: break-word;
}
.bill-item .meta p {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 4px;
  word-break: break-word;
}
.bill-item .acts {
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 0 0 auto;
}
.bill-item .qrmini {
  width: 84px; height: 84px;
  background: #fff;
  border-radius: 7px;
  padding: 3px;
  flex: 0 0 auto;
}
.bill-item .qrmini canvas { width: 100%; height: 100%; display: block; }

.badge {
  display: inline-block;
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim);
  margin-right: 6px;
}
.badge.yes { color: var(--yes); border-color: rgba(47, 168, 79, .5); }
.badge.no { color: var(--no); border-color: rgba(211, 58, 58, .5); }
.badge.abstain { color: var(--abstain); border-color: rgba(138, 148, 166, .5); }
.badge.total { color: var(--gold); border-color: rgba(217, 179, 130, .5); }
.badge.closed { color: #ffb4b4; border-color: #6d2a2a; }

/* ---------------- 表决页（手机端） ---------------- */
.vote-head {
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--red-light);
}
.vote-head h2 { font-size: 19px; border: none; padding: 0; margin-bottom: 6px; }
.vote-head h2::before { display: none; }
.vote-head p { font-size: 13.5px; color: rgba(255, 255, 255, .86); }

.vote-img {
  width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  margin-bottom: 18px;
  background: #000;
  display: block;
}

.choices {
  display: grid;
  grid-template-columns: 1fr;
  gap: 13px;
  margin-bottom: 20px;
}

.choice {
  border: 2px solid var(--line);
  background: var(--surface-2);
  border-radius: 15px;
  padding: 22px 18px;
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 5px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: all .16s;
  min-height: 78px;
  position: relative;
}
.choice .cn-sub {
  display: block;
  font-size: 12px;
  letter-spacing: 1px;
  font-weight: 400;
  color: var(--text-mute);
  margin-top: 4px;
}
.choice:active { transform: scale(.985); }
.choice.yes:hover, .choice.yes.picked { border-color: var(--yes); background: rgba(47, 168, 79, .18); color: #b6f2c6; }
.choice.no:hover, .choice.no.picked { border-color: var(--no); background: rgba(211, 58, 58, .18); color: #ffc0c0; }
.choice.abstain:hover, .choice.abstain.picked { border-color: var(--abstain); background: rgba(138, 148, 166, .18); color: #e2e8f0; }
.choice:disabled { opacity: .5; cursor: not-allowed; }

.tip {
  padding: 15px 17px;
  border-radius: var(--radius);
  font-size: 14.5px;
  margin-bottom: 15px;
  border: 1px solid;
  line-height: 1.7;
}
.tip.ok { background: rgba(47, 168, 79, .14); border-color: rgba(47, 168, 79, .5); color: #bdf0cb; }
.tip.err { background: rgba(211, 58, 58, .14); border-color: rgba(211, 58, 58, .5); color: #ffc4c4; }
.tip.info { background: rgba(217, 179, 130, .1); border-color: rgba(217, 179, 130, .38); color: #f0dcbd; }

/* ---------------- 大屏 ---------------- */
body.screen-mode .topbar { padding: 9px 22px; }
body.screen-mode .wrap { max-width: 100%; padding: 18px 30px 30px; }

.screen-grid {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 1080px) { .screen-grid { grid-template-columns: 1fr; } }

.qr-panel {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 18px;
  text-align: center;
  box-shadow: var(--shadow);
}
.qr-panel canvas { width: 100%; max-width: 380px; height: auto; display: block; margin: 0 auto; image-rendering: pixelated; }
.qr-panel .qr-tip {
  color: #333;
  font-size: 14px;
  font-weight: 700;
  margin-top: 10px;
  letter-spacing: .5px;
}
.qr-panel .qr-url {
  color: #888;
  font-size: 11px;
  margin-top: 5px;
  word-break: break-all;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
@media (max-width: 720px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  text-align: center;
}
.stat .num {
  font-size: 56px;
  font-weight: 800;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
}
.stat .lbl { font-size: 13px; color: var(--text-dim); margin-top: 5px; letter-spacing: 1px; }
.stat.yes .num { color: var(--yes); }
.stat.no .num { color: var(--no); }
.stat.abstain .num { color: var(--abstain); }
.stat.total .num { color: var(--gold); }

.bars { display: grid; gap: 14px; }
.bar-row { }
.bar-row .bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 15px;
  margin-bottom: 6px;
  align-items: baseline;
}
.bar-row .bar-top b { font-size: 26px; font-variant-numeric: tabular-nums; }
.bar-track {
  height: 34px;
  background: var(--bg-soft);
  border-radius: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.bar-fill {
  height: 100%;
  width: 0;
  border-radius: 8px;
  transition: width .6s cubic-bezier(.22, 1, .36, 1);
}
.bar-fill.yes { background: linear-gradient(90deg, #248a3f, var(--yes)); }
.bar-fill.no { background: linear-gradient(90deg, #a92b2b, var(--no)); }
.bar-fill.abstain { background: linear-gradient(90deg, #6d7686, var(--abstain)); }

.verdict {
  margin-top: 20px;
  padding: 20px;
  border-radius: var(--radius-lg);
  text-align: center;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 6px;
  border: 2px solid;
}
.verdict.pass { background: rgba(47, 168, 79, .16); border-color: var(--yes); color: #a5f0b9; }
.verdict.fail { background: rgba(211, 58, 58, .16); border-color: var(--no); color: #ffc0c0; }
.verdict.none { background: var(--surface); border-color: var(--line); color: var(--text-mute); font-size: 19px; letter-spacing: 2px; }

.bill-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.bill-tab {
  padding: 9px 17px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: all .16s;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bill-tab:hover { border-color: var(--red-light); color: var(--text); }
.bill-tab.active {
  background: linear-gradient(135deg, var(--red), var(--red-light));
  border-color: var(--red-light);
  color: #fff;
  font-weight: 700;
}
.bill-tab .dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--yes);
  margin-right: 7px;
  vertical-align: middle;
}

.big-title {
  font-size: 34px;
  font-weight: 800;
  letter-spacing: 2px;
  margin-bottom: 8px;
  line-height: 1.3;
}
@media (max-width: 720px) { .big-title { font-size: 24px; } }

.meta-line { font-size: 15px; color: var(--text-dim); margin-bottom: 16px; }

/* ---------------- 空状态 / 加载 ---------------- */
.empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--text-mute);
}
.empty .big { font-size: 46px; display: block; margin-bottom: 12px; opacity: .55; }

.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-mute);
  font-size: 14px;
}

.spinner {
  width: 22px; height: 22px;
  border: 2.5px solid var(--line);
  border-top-color: var(--red-light);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  display: inline-block;
  vertical-align: middle;
  margin-right: 9px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- 提示条 ---------------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 34px;
  transform: translate(-50%, 24px);
  background: #232a36;
  border: 1px solid var(--line);
  border-left: 4px solid var(--red-light);
  color: var(--text);
  padding: 13px 21px;
  border-radius: 10px;
  font-size: 14.5px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: all .28s;
  z-index: 999;
  max-width: 90vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.ok { border-left-color: var(--yes); }
#toast.err { border-left-color: var(--no); }

/* ---------------- 页脚 ---------------- */
.site-foot {
  text-align: center;
  color: var(--text-mute);
  font-size: 12.5px;
  padding: 22px;
  border-top: 1px solid var(--line);
  margin-top: 30px;
}

/* ---------------- 表单内联技巧 ---------------- */
.inline-token { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.inline-token input { flex: 1 1 220px; }

.kbd {
  display: inline-block;
  padding: 1px 7px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg-soft);
}

@media print {
  .topbar, .site-foot, .bill-tabs, .no-print { display: none !important; }
  body { background: #fff; color: #000; }
  .card { box-shadow: none; border-color: #ccc; }
}
