/* ============ 基础 ============ */
* { box-sizing: border-box; }

:root {
  --ink: #1f2430;
  --muted: #6b7280;
  --line: #e8e9ef;
  --bg: #f6f6f9;
  --card: #ffffff;
  --red: #c62828;
  --red-deep: #8e1b1b;
  --blue: #1565c0;
  --gold: #f2c14e;
  --green: #2e7d32;
  --shadow: 0 10px 30px rgba(31, 36, 48, 0.06);
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.65;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.3; }
h1 { font-size: 26px; letter-spacing: -0.3px; }
h2 { font-size: 18px; }
p { margin: 0 0 10px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f2f3f7; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
.page { padding: 26px 0 48px; }
.muted { color: var(--muted); font-size: 13px; }
.block { display: block; }
.right { text-align: right; }
.inline-form { display: inline; margin: 0; }
.text-link { color: var(--red); font-size: 13px; font-weight: 600; }
.text-danger { color: #c62828; }

/* ============ 顶栏 ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffb4a9, var(--red) 55%, var(--red-deep));
  box-shadow: 0 3px 8px rgba(198, 40, 40, 0.35);
}

.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav a {
  color: var(--muted);
  font-size: 14px;
  padding: 6px 11px;
  border-radius: 8px;
  white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: #f4f5f8; text-decoration: none; }
.nav a.active { color: var(--red); background: #fdeeee; font-weight: 600; }

.userbox { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.username { font-size: 13px; color: var(--muted); }
.link-btn {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 2px 4px;
}
.link-btn:hover { color: var(--red); }
.link-btn.danger:hover { color: #b00020; }

/* ============ 按钮 ============ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid var(--red);
  background: var(--red);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { background: var(--red-deep); text-decoration: none; box-shadow: 0 6px 16px rgba(198, 40, 40, 0.22); }
.btn:active { transform: translateY(1px); }
.btn-ghost { background: #fff; color: var(--red); }
.btn-ghost:hover { background: #fdf1f1; color: var(--red-deep); }
.btn-small { padding: 6px 13px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }

/* ============ 首页 ============ */
.hero {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: 34px 36px;
  border-radius: 20px;
  color: #fff;
  background:
    radial-gradient(circle at 88% 8%, rgba(255, 196, 120, 0.35), transparent 42%),
    radial-gradient(circle at 8% 92%, rgba(255, 255, 255, 0.14), transparent 45%),
    linear-gradient(120deg, #6f1018, #a01f27 55%, #c04a2c);
  box-shadow: 0 16px 40px rgba(120, 24, 30, 0.25);
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  right: -60px;
  bottom: -120px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 0 0 40px rgba(255, 255, 255, 0.05), 0 0 0 90px rgba(255, 255, 255, 0.04);
}
.hero-text { position: relative; z-index: 1; max-width: 590px; }
.hero h1 { font-size: 32px; font-weight: 800; letter-spacing: 0.5px; }
.hero-sub { margin: 10px 0 0; color: rgba(255, 255, 255, 0.82); }
.hero-stats {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 26px;
  padding: 18px 22px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.11);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.stat { display: flex; flex-direction: column; min-width: 78px; }
.stat-num { font-size: 21px; font-weight: 800; letter-spacing: 0.2px; }
.stat-label { font-size: 12px; color: rgba(255, 255, 255, 0.72); }

/* ============ 卡片 ============ */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 20px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin-top: 20px;
}
.grid-2 .card { margin-top: 0; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 18px; }
.card-head .inline-form { align-self: center; }

.draw-meta { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.issue { font-weight: 700; font-size: 15px; }
.draw-numbers { padding: 4px 0 12px; }
.draw-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px 0;
  border-top: 1px dashed var(--line);
}
.fact-label { display: block; color: var(--muted); font-size: 12px; }
.fact-value { font-weight: 600; font-size: 14px; }
.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 12px;
  color: var(--muted);
}
.sync-state { white-space: nowrap; }

/* ============ 号码球 ============ */
.balls { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.ball {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 33px;
  height: 33px;
  border-radius: 50%;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.3px;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.18), 0 2px 5px rgba(31, 36, 48, 0.12);
}
.ball.red { background: radial-gradient(circle at 32% 26%, #ff9a8f, #e53935 58%, #a81717); }
.ball.blue { background: radial-gradient(circle at 32% 26%, #8ec8ff, #1e88e5 58%, #0d47a1); }
.plus { color: var(--muted); font-weight: 700; margin: 0 2px; }

/* ============ 表格 ============ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td {
  padding: 12px 10px;
  border-bottom: 1px solid #f1f2f6;
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table .muted { margin-left: 6px; }
.actions { white-space: nowrap; }
.actions .inline-form + .inline-form { margin-left: 10px; }
.actions .ticket-edit { display: inline-block; margin-left: 10px; }
.actions .ticket-edit summary { list-style: none; cursor: pointer; }
.actions .ticket-edit summary::-webkit-details-marker { display: none; }
.actions .ticket-edit[open] { display: block; margin: 6px 0 0; }
.actions .ticket-edit form { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.field[hidden] { display: none !important; }
.row-muted { opacity: 0.55; }

.detail-row td { padding: 0 10px 12px; border-bottom: 1px solid #f1f2f6; }
.detail-row details { font-size: 13px; }
.detail-row summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.detail-row summary:hover { color: var(--red); }
.chevron { color: #c9ccd6; font-size: 12px; }
.mini-table { display: grid; gap: 4px; max-width: 560px; margin-top: 6px; }
.mini-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #fafafc;
}

/* ============ 徽标 / 状态 ============ */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: #f0f1f5;
  color: #5c6270;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-win { background: #fff4e0; color: #a35a00; }
.badge-on { background: #e8f5e9; color: var(--green); }
.badge-error { background: #fdecec; color: #b3261e; }

/* ============ 表单 ============ */
.form { display: block; }
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--muted); font-weight: 600; }
.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field select {
  width: 100%;
  height: 42px;
  padding: 10px 12px;
  border: 1px solid #dcdfe8;
  border-radius: 9px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.field input:focus,
.field select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.1); }
.field-action { justify-content: flex-end; }
.field-action .btn { width: 100%; }
.hint { font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 6px 0 14px; }
.checkbox input { width: 16px; height: 16px; accent-color: var(--red); }
/* 大乐透追加：整块可点，勾选框加粗放大 */
.append-toggle {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid rgba(198, 40, 40, 0.3);
  border-radius: 10px;
  background: #fff6f6;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}
.append-toggle:hover { border-color: rgba(198, 40, 40, 0.55); }
.append-toggle input[type="checkbox"] {
  flex: none;
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  accent-color: var(--red);
  cursor: pointer;
}
.append-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.append-text strong { font-size: 15px; line-height: 1.35; color: var(--ink); }
.append-text em { font-style: normal; font-size: 13px; line-height: 1.5; color: #8a5a5a; }
.append-toggle input:checked ~ .append-text strong { color: var(--red); }
.append-toggle:has(input:checked) {
  border-color: var(--red);
  background: #ffeded;
  box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.08);
}
@media (max-width: 760px) {
  .append-toggle { padding: 12px; gap: 10px; }
  .append-text strong { font-size: 14px; }
}
.form > .btn { margin-top: 12px; }
.form .field + .field { margin-top: 12px; }
.form-grid .field + .field { margin-top: 0; }
.field-wide { grid-column: 1 / -1; }
.test-push-form { margin-top: 14px; }
.field-wide > span { font-size: 13px; color: var(--muted); font-weight: 600; }
#number-groups { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.num-group[hidden] { display: none !important; }
.num-row { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
.num-row-label { flex: none; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.num-row-label em { font-style: normal; font-weight: 500; font-size: 12px; }
.num-cells { display: flex; gap: 5px; flex-wrap: nowrap; }
#number-groups .num-cell {
  width: 34px;
  height: 36px;
  padding: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: #fff;
  border: 1px solid #dcdfe8;
  border-radius: 7px;
  outline: none;
  flex: none;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
#number-groups .num-cell:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(198, 40, 40, 0.12); }
#number-groups .num-cell.is-invalid { border-color: #b3261e; background: #fdf0ef; }
.num-plus { flex: none; font-weight: 700; color: var(--muted); }
.num-range { font-size: 12px; color: var(--muted); white-space: nowrap; }
.hint.is-error { color: #b3261e; }
@media (max-width: 640px) {
  .num-row { flex-wrap: wrap; gap: 6px; }
  .num-row-label { width: 100%; white-space: normal; }
  #number-groups .num-cell { width: 32px; height: 38px; font-size: 14px; }
  .num-cells { gap: 4px; }
  .num-range { width: 100%; }
}

/* ============ 提示 / 空状态 ============ */
.flash {
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 14px;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.flash-success { background: #edf7ee; border-color: #cfe8d1; color: #22642a; }
.flash-error { background: #fdf0ef; border-color: #f3cfcc; color: #a2261e; }
.flash-info { background: #eef3fb; border-color: #d5e2f6; color: #244d80; }

.empty { padding: 34px 10px; text-align: center; color: var(--muted); font-size: 14px; }
.empty.small { padding: 20px 8px; }

/* ============ 页头 / 标签 / 分页 ============ */
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head h1 { font-size: 24px; }
.head-stat { color: var(--muted); font-size: 14px; }
.head-stat strong { font-size: 22px; color: var(--red); margin-right: 4px; }

.tabs { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 7px 16px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { background: var(--red); border-color: var(--red); color: #fff; font-weight: 600; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 16px; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 4px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: var(--shadow);
}
.stat-card .stat-num { font-size: 21px; color: var(--ink); }
.stat-card .stat-label { color: var(--muted); font-size: 12px; }

/* ============ 说明块 ============ */
.note-block {
  margin-top: 18px;
  padding: 16px 18px;
  background: #fafafc;
  border: 1px dashed #dcdfe8;
  border-radius: 12px;
  font-size: 13px;
  color: #4c5260;
}
.note-block h3 { font-size: 14px; margin-bottom: 8px; }
.note-block p { margin-bottom: 8px; }
.copy-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.copy-line code { word-break: break-all; }

/* ============ 登录页 ============ */
.auth-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px 16px;
  background:
    radial-gradient(circle at 80% 0%, rgba(198, 40, 40, 0.12), transparent 46%),
    radial-gradient(circle at 0% 100%, rgba(21, 101, 192, 0.1), transparent 42%),
    var(--bg);
}
.auth-box {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 30px 22px;
  box-shadow: 0 20px 50px rgba(31, 36, 48, 0.1);
}
.auth-brand { margin-bottom: 22px; }
.auth-title { font-size: 22px; margin-bottom: 6px; }
.auth-sub { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-link { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; }
.auth-foot { text-align: center; color: #a0a5b1; font-size: 12px; margin: 22px 0 0; }

/* ============ 页脚 ============ */
.footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 20px 0 26px;
  color: #9298a5;
  font-size: 12px;
}
.footer p { margin: 0 0 4px; }

/* ============ 响应式 ============ */
@media (max-width: 900px) {
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-stats { width: 100%; justify-content: space-between; }
}

@media (max-width: 760px) {
  h1 { font-size: 22px; }
  .topbar-inner { min-height: 56px; gap: 12px; flex-wrap: wrap; padding: 8px 0; }
  .nav { order: 3; width: 100%; flex: none; gap: 2px; }
  .nav a { padding: 5px 9px; font-size: 13px; }
  .userbox { margin-left: auto; }
  .page { padding: 18px 0 40px; }
  .hero { padding: 24px 20px; border-radius: 16px; }
  .hero h1 { font-size: 24px; }
  .hero-stats { gap: 14px; padding: 14px; }
  .stat { min-width: 0; flex: 1; }
  .stat-num { font-size: 17px; }
  .grid-2 { grid-template-columns: 1fr; }
  .card { padding: 18px 16px; border-radius: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .draw-facts { gap: 4px; }
  .fact-value { font-size: 13px; }
  .page-head { flex-direction: column; align-items: flex-start; gap: 4px; }
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 12px 14px; }
  .ball { width: 30px; height: 30px; font-size: 13px; }
  .auth-box { padding: 24px 20px 18px; }

  .table thead { display: none; }
  .table tbody tr { display: block; padding: 10px 0; border-bottom: 1px solid #f1f2f6; }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 5px 0;
    border-bottom: 0;
    text-align: left;
  }
  .table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    flex: 0 0 auto;
  }
  .table td.right { justify-content: flex-end; }
  .table td.right::before { content: none; }
  .table td.actions { justify-content: flex-end; }
  .detail-row { display: block; padding: 0 0 10px; }
  .detail-row td { display: block; padding: 0; }
  .detail-row td::before { content: none; }
  .detail-row details { padding: 2px 0 6px; }
  .mini-row { grid-template-columns: 1.1fr 0.9fr 1fr; font-size: 12px; }
  .card-head { flex-wrap: wrap; }
}

/* ---------- 购买期数 ---------- */
.issue-range { font-size: 13px; font-weight: 600; letter-spacing: 0.2px; }
.issue-range strong { color: var(--red); }
.progress {
  height: 6px;
  width: 100%;
  max-width: 220px;
  margin: 6px 0;
  background: #eef0f4;
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--red), #e5684f);
  border-radius: 999px;
  transition: width 0.3s ease;
}
.issue-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.issue-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink);
  background: #fbfbfd;
}
.issue-chip em { font-style: normal; font-size: 11px; color: var(--muted); }
.issue-chip.is-drawn { border-color: #cfe6d2; background: #f1f8f2; }
.issue-chip.is-drawn em { color: var(--green); }
.num-input {
  width: 52px;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 13px;
  text-align: center;
}
.renew-form { margin-right: 4px; }
.coverage-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.coverage-box { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fbfbfd; }
.coverage-box h3 { font-size: 14px; margin-bottom: 4px; }
.coverage-box .coverage-num { font-size: 22px; font-weight: 800; color: var(--red); }
.coverage-box .coverage-meta { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) {
  .coverage-grid { grid-template-columns: 1fr; }
}
.section-sub { font-size: 14px; margin: 18px 0 8px; }
