:root {
  --brand: #c8102e;
  --brand-dark: #9c0c23;
  --gold: #c9a227;
  --ink: #1f2329;
  --sub: #6b7280;
  --line: #e5e7eb;
  --bg: #f5f6f8;
  --ok: #16a34a;
  --warn: #d97706;
  --err: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--brand); text-decoration: none; }

.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar .inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 56px;
}
.brand { font-weight: 700; font-size: 16px; color: var(--brand); white-space: nowrap; }
.brand small { color: var(--sub); font-weight: 400; font-size: 12px; margin-left: 6px; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a {
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
}
.nav a:hover { background: #f1f2f4; }
.nav a.on { background: var(--brand); color: #fff; }

/* 一级分组 + 二级下拉菜单 */
.nav-group { position: relative; }
.nav-group-title {
  display: block;
  padding: 6px 12px;
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.nav-group:hover > .nav-group-title { background: #f1f2f4; }
.nav-group:hover .nav-dropdown { display: block; }
.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 120px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  padding: 4px;
  z-index: 100;
}
.nav-dropdown a {
  display: block;
  padding: 7px 12px;
  border-radius: 6px;
  white-space: nowrap;
}
.nav-dropdown a:hover { background: #f1f2f4; }
.nav-dropdown a.on { background: var(--brand); color: #fff; }
.who { color: var(--sub); font-size: 12px; white-space: nowrap; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 18px 16px 48px; }

.alert { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px; font-size: 13px; }
.alert.ok { background: #ecfdf5; color: var(--ok); border: 1px solid #bbf7d0; }
.alert.err { background: #fef2f2; color: var(--err); border: 1px solid #fecaca; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 16px;
}
.card h2 { margin: 0 0 12px; font-size: 15px; }
.card h3 { margin: 0 0 10px; font-size: 14px; }
.muted { color: var(--sub); }
.small { font-size: 12px; }

.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.stat .v { font-size: 22px; font-weight: 700; }
.stat .k { color: var(--sub); font-size: 12px; }
.stat .v.money { color: var(--brand); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--line); }
th { background: #fafafa; color: var(--sub); font-weight: 500; white-space: nowrap; }
tbody tr:hover { background: #fafbff; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.2;
}
.btn:hover { background: var(--brand-dark); }
.btn.ghost { background: #fff; color: var(--brand); }
.btn.gray { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.disabled {
  background: #e5e7eb; border-color: #e5e7eb; color: #9ca3af;
  cursor: not-allowed; pointer-events: none;
}
.btn.sm { padding: 5px 10px; font-size: 12px; }

form .row { margin-bottom: 12px; }
form label { display: block; font-size: 13px; margin-bottom: 5px; color: var(--sub); }
input, select, textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
input:focus, select:focus { outline: none; border-color: var(--brand); }
.inline { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline > * { flex: 1; min-width: 120px; }
.inline > .btn { flex: 0 0 auto; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 12px; }
.tag.a { background: #fef3c7; color: #92400e; }
.tag.b { background: #e0e7ff; color: #3730a3; }
.tag.on { background: #ecfdf5; color: var(--ok); }
.tag.off { background: #f3f4f6; color: var(--sub); }
.tag.wait { background: #fff7ed; color: var(--warn); }
.tag.done { background: #ecfdf5; color: var(--ok); }

.remain { display: flex; gap: 22px; margin: 6px 0 2px; }
.remain b { font-size: 26px; color: var(--brand); }
.remain span { color: var(--sub); font-size: 12px; }

.show-item { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.show-item .t { font-weight: 600; }
.gray-out { opacity: .5; }

.code-box {
  text-align: center;
  padding: 22px;
}
.code-box .code {
  font-size: 40px;
  letter-spacing: 8px;
  font-weight: 700;
  color: var(--brand);
  font-family: "Courier New", monospace;
}
.banner {
  background: linear-gradient(120deg, #c8102e, #7f0a1e);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 16px;
}
.banner h1 { margin: 0 0 6px; font-size: 20px; }
.banner p { margin: 0; opacity: .85; font-size: 13px; }

.hero { text-align: center; padding: 60px 16px 30px; }
.hero h1 { font-size: 28px; margin: 0 0 10px; }
.hero p { color: var(--sub); margin: 0 0 26px; }
.portals { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); max-width: 820px; margin: 0 auto; }
.portal {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 24px; text-align: center;
}
.portal h3 { margin: 0 0 6px; color: var(--brand); font-size: 17px; }
.portal p { color: var(--sub); font-size: 13px; min-height: 40px; }

.login-wrap { max-width: 400px; margin: 60px auto; }
.login-wrap .card { padding: 26px; }
.login-wrap h2 { text-align: center; font-size: 18px; }

/* ===== 手机端底部导航 ===== */
.m-bnav {
  display: none;
}
@media (max-width: 768px) {
  .topbar .nav { display: none; }
  .topbar .inner { gap: 8px; }
  .brand { font-size: 14px; }
  .wrap { padding-bottom: 70px; }
  .m-bnav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    z-index: 30;
    padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  }
  .m-bnav a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    color: var(--sub);
    font-size: 11px;
    padding: 4px 0;
    text-decoration: none;
  }
  .m-bnav a .ic { font-size: 20px; line-height: 1; }
  .m-bnav a.on { color: var(--brand); font-weight: 600; }
}
