:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #182230;
  --muted: #687386;
  --line: #e4e9f0;
  --primary: #2667ff;
  --primary-dark: #174fcf;
  --secondary: #eef3ff;
  --success: #0d9f6e;
  --danger: #d43f52;
  --warning: #c57b00;
  --sidebar: #101827;
  --shadow: 0 14px 40px rgba(25, 47, 83, .09);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--bg); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
button, input, select { font: inherit; }
input, select {
  width: 100%; min-height: 44px; border: 1px solid #cfd7e3; border-radius: 10px;
  padding: 10px 12px; background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(38,103,255,.12); }
label { display: grid; gap: 7px; color: #364153; font-weight: 600; }
h1, h2, p { margin-top: 0; }
h2 { font-size: 18px; margin-bottom: 16px; }
.public-body { min-height: 100vh; background: linear-gradient(145deg, #edf3ff, #f8fafc 55%, #eef8f5); }
.public-shell { width: min(100% - 28px, 520px); margin: 0 auto; padding: 36px 0 24px; }
.brand { display: flex; align-items: center; gap: 14px; margin: 0 4px 26px; }
.brand.compact { margin: 0 0 28px; }
.brand-mark {
  width: 48px; height: 48px; display: grid; place-items: center; border-radius: 14px;
  background: var(--primary); color: #fff; font-weight: 800; box-shadow: 0 8px 20px rgba(38,103,255,.3);
}
.brand h1 { font-size: 21px; margin: 0 0 4px; }
.brand p { color: var(--muted); margin: 0; }
.panel { background: var(--panel); border: 1px solid rgba(220,227,237,.9); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.step-label { color: var(--primary); font-weight: 700; font-size: 12px; letter-spacing: .04em; margin-bottom: 10px; }
.stack-form { display: grid; gap: 12px; }
.top-divider { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 22px; }
.button {
  border: 0; border-radius: 10px; min-height: 45px; padding: 11px 18px; display: inline-flex;
  justify-content: center; align-items: center; font-weight: 700; cursor: pointer; width: 100%;
}
.button.primary { background: var(--primary); color: #fff; }
.button.primary:hover { background: var(--primary-dark); }
.button.secondary { background: var(--secondary); color: var(--primary); }
.button.ghost { background: transparent; color: #4e5b6e; border: 1px solid var(--line); margin-top: 12px; }
.button.danger { background: #fff0f2; color: var(--danger); }
.button.fit { width: auto; }
.muted, .fine-print { color: var(--muted); }
.fine-print { font-size: 12px; margin: 12px 0 0; }
.alert, .notice { padding: 13px 14px; border-radius: 10px; margin-bottom: 16px; line-height: 1.55; }
.alert-info, .notice { background: #eef3ff; color: #294a91; }
.alert-success, .success-note { background: #eaf8f3; color: #087453; }
.alert-error { background: #fff0f2; color: #a92739; }
.summary-strip, .detail-list > div { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.summary-strip { background: #f6f8fb; padding: 12px 14px; border-radius: 10px; margin-bottom: 18px; }
.detail-list { margin: 0 0 20px; }
.detail-list > div { padding: 11px 0; border-bottom: 1px solid var(--line); }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; text-align: right; font-weight: 600; word-break: break-all; }
.detail-list .highlight dd { color: var(--primary); font-size: 18px; }
.task-result { text-align: center; }
.status-icon { margin: 6px auto 14px; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--primary); font-size: 30px; font-weight: 800; }
.status-icon.status-completed { background: var(--success); }
.status-icon.status-abnormal, .status-icon.status-closed { background: var(--danger); }
.status-icon.status-processing { background: #eef4ff; animation: none; }
.status-icon.status-queued { animation: status-pulse 1.4s ease-in-out infinite; }
.spinner-dot { width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(38,103,255,.16); border-top-color: var(--primary); position: relative; animation: dot-spin 1s linear infinite; }
.spinner-dot::after { content: ''; position: absolute; top: -4px; left: 50%; margin-left: -5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--primary); }
@keyframes dot-spin { to { transform: rotate(360deg); } }
@keyframes status-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.12); opacity: .7; }
}
.progress-track { height: 10px; background: #e9eef5; border-radius: 99px; overflow: hidden; margin: 22px 0 8px; }
.progress-value { height: 100%; background: linear-gradient(90deg, var(--primary), #49a1ff); }
.progress-number { font-weight: 700; margin-bottom: 20px; }
.progress-value.fake { width: 0; animation: fake-progress 10s ease-in-out forwards; }
@keyframes fake-progress { from { width: 6%; } to { width: 88%; } }
.public-footer { color: #8390a3; text-align: center; font-size: 12px; padding: 8px; }
.login-shell { padding-top: 12vh; }
.admin-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--sidebar); color: #fff; padding: 18px 14px; display: flex; flex-direction: column; z-index: 30; }
.sidebar-brand { height: 56px; display: flex; align-items: center; gap: 10px; padding: 0 10px; margin-bottom: 14px; }
.sidebar-brand span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--primary); font-weight: 800; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { color: #aeb9ca; padding: 11px 13px; border-radius: 9px; font-weight: 600; }
.sidebar nav a:hover, .sidebar nav a.active { background: #1e2a3d; color: #fff; }
.sidebar-logout { margin-top: auto; }
.sidebar-logout button { width: 100%; border: 1px solid #344258; background: transparent; color: #aeb9ca; padding: 10px; border-radius: 9px; cursor: pointer; }
.admin-main { padding: 24px 28px 60px; min-width: 0; }
.admin-topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.admin-topbar h1 { font-size: 24px; margin: 0 0 4px; }
.admin-topbar p { color: var(--muted); margin: 0; }
.menu-button { display: none; border: 0; background: #fff; border-radius: 9px; width: 42px; height: 42px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-grid article { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: 0 7px 24px rgba(25,47,83,.05); }
.stat-grid span { display: block; color: var(--muted); margin-bottom: 10px; }
.stat-grid strong { font-size: 28px; }
.stat-grid strong.small { font-size: 20px; }
.stat-grid small { display: block; color: var(--muted); margin-top: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { border-bottom: 1px solid var(--line); text-align: left; padding: 12px 10px; vertical-align: top; }
th { color: #5b6677; font-size: 12px; background: #f8fafc; white-space: nowrap; }
td { word-break: break-word; }
.empty { text-align: center; color: var(--muted); padding: 30px; }
.status-tag { display: inline-flex; border-radius: 99px; padding: 4px 9px; background: #edf1f6; font-size: 12px; white-space: nowrap; }
.status-tag.completed, .status-tag.confirmed, .status-tag.success, .status-tag.used { background: #e5f7f0; color: #087453; }
.status-tag.abnormal, .status-tag.failed, .status-tag.closed, .status-tag.disabled { background: #fff0f2; color: #a92739; }
.status-tag.processing, .status-tag.queued, .status-tag.wait_confirm { background: #eef3ff; color: #294a91; }
.chip-row, .filter-row, .action-row { display: flex; flex-wrap: wrap; gap: 9px; }
.chip { background: #f0f3f7; color: #4c5869; border-radius: 99px; padding: 7px 11px; }
.chip.selected { background: var(--primary); color: #fff; }
.inline-form { display: grid; grid-template-columns: repeat(4, minmax(130px, 1fr)) auto; gap: 12px; align-items: end; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.settings-section h2 { border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.sticky-save { position: sticky; bottom: 18px; box-shadow: 0 8px 30px rgba(38,103,255,.3); margin-bottom: 18px; }
.link-button { border: 0; background: none; color: var(--primary); padding: 0; cursor: pointer; }
/* 用户列表操作按钮：药丸型 */
.pill-form { display: inline; }
.pill-button {
  display: inline-flex; align-items: center;
  border: 1px solid #d7e2ff; border-radius: 99px;
  padding: 4px 12px; background: #eef3ff;
  color: var(--primary); font-size: 12px; font-weight: 600;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.pill-button:hover { background: #dfe9ff; border-color: var(--primary); }
.pill-button + .pill-button { margin-left: 6px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.action-row .button { width: auto; }
.inline-test { display: inline-block; margin-bottom: 12px; }
.inline-test .button { width: auto; }
.admin-details { display: grid; grid-template-columns: 1fr 1fr; gap: 0 30px; }
.search-bar { display: flex; gap: 10px; align-items: center; margin: 0 0 18px; }
.search-bar input { max-width: 520px; }
.button.no-margin { margin-top: 0; }
.export-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.secret-toggle { border: 0; background: #eef3ff; color: #294a91; border-radius: 7px; padding: 6px 9px; cursor: pointer; max-width: 420px; word-break: break-all; text-align: left; }
.secret-toggle:hover { background: #dfe8ff; }
.eligibility-result { display: grid; gap: 8px; text-align: center; padding: 24px 18px; border-radius: 14px; margin: 18px 0 22px; }
.eligibility-result strong { font-size: 22px; }
.eligibility-result span { color: inherit; opacity: .85; }
.quota-check-card h2 { margin-bottom: 6px; }
.button:disabled { cursor: not-allowed; opacity: .65; }
.signin-modal-mask { position: fixed; inset: 0; background: rgba(16, 24, 39, .45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 16px; }
.signin-modal { background: #fff; border-radius: 14px; padding: 26px 24px 22px; max-width: 360px; width: 100%; box-shadow: var(--shadow); text-align: center; }
.signin-modal h3 { margin: 0 0 10px; font-size: 18px; }
.signin-modal p { margin: 0 0 20px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.signin-modal-actions { display: flex; gap: 10px; justify-content: center; }
.signin-modal-actions form { margin: 0; }
.signin-modal-actions .button { width: auto; margin-top: 0; }
input[type="checkbox"].card-check,
#selectAllCards {
  width: 16px; height: 16px; min-height: 0; padding: 0;
  accent-color: var(--primary); cursor: pointer; flex: none;
}
.table-wrap td input[type="checkbox"].card-check,
.table-wrap th input[type="checkbox"] { margin: 0; }
/* 卡密解锁表单：输入框与按钮并排，避免撑高行 */
.inline-unlock { display: flex; align-items: center; gap: 6px; }
.inline-unlock input[name="reason"] {
  width: 132px; height: 30px; min-height: 30px; padding: 4px 8px;
  font-size: 13px; border-radius: 8px; flex: none;
}
.inline-unlock .link-button { white-space: nowrap; }
/* 用户列表关联卡密：紧凑小徽章排列 */
.card-chip {
  display: inline-block; margin: 2px 4px 2px 0; padding: 2px 8px;
  font-size: 12px; line-height: 1.5; white-space: nowrap;
  border: 1px solid #dbe3ef; border-radius: 6px;
  background: #f4f7fb; color: #294a91;
}
.card-chip:hover { border-color: var(--primary); color: var(--primary); }
@media (max-width: 980px) {
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inline-form { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .public-shell { width: min(100% - 20px, 520px); padding-top: 20px; }
  .panel { padding: 18px; border-radius: 14px; }
  .admin-layout { display: block; }
  .sidebar { position: fixed; left: -250px; width: 230px; transition: left .2s ease; box-shadow: 12px 0 35px rgba(0,0,0,.18); }
  .sidebar-open .sidebar { left: 0; }
  .admin-main { padding: 16px 12px 50px; }
  .menu-button { display: block; }
  .admin-topbar h1 { font-size: 20px; }
  .stat-grid, .form-grid, .inline-form, .admin-details { grid-template-columns: 1fr; }
  .compact-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid strong { font-size: 23px; }
  .action-row { display: grid; }
  .action-row .button { width: 100%; }
  .search-bar { align-items: stretch; flex-wrap: wrap; }
  .search-bar input { max-width: none; flex-basis: 100%; }
  .responsive-head { align-items: flex-start; gap: 12px; flex-direction: column; }
}
/* 登录页验证码输入框：大号 + 呼吸效果边框 */
@keyframes code-breathe {
  0%, 100% { border-color: rgba(38, 103, 255, .55); box-shadow: 0 0 0 3px rgba(38, 103, 255, .12); }
  50% { border-color: var(--primary); box-shadow: 0 0 0 7px rgba(38, 103, 255, .30); }
}
.stack-form input[name="code"] {
  width: 100%; height: 56px; min-height: 56px;
  font-size: 26px; font-weight: 700; letter-spacing: .5em; text-indent: .5em;
  text-align: center; border: 2px solid var(--primary); border-radius: 12px;
  background: #f7faff; color: #182230;
  animation: code-breathe 2.2s ease-in-out infinite;
}
.stack-form input[name="code"]:focus {
  animation: none; border-color: var(--primary-dark); outline: none;
  box-shadow: 0 0 0 4px rgba(38, 103, 255, .30);
}
.stack-form input[name="code"]::placeholder {
  color: #9fb3d9; font-weight: 400; letter-spacing: normal; text-indent: 0; font-size: 14px;
  text-align: center;
}
/* 卡密输入框：显眼边框 + 呼吸强调 */
@keyframes card-breathe {
  0%, 100% { border-color: rgba(38, 103, 255, .60); box-shadow: 0 0 0 3px rgba(38, 103, 255, .12); }
  50% { border-color: var(--primary); box-shadow: 0 0 0 7px rgba(38, 103, 255, .28); }
}
.stack-form input[name="card_code"] {
  width: 100%; height: 54px; min-height: 54px;
  font-size: 16px; font-weight: 600; letter-spacing: .06em;
  text-align: center; border: 2px solid var(--primary); border-radius: 12px;
  background: #f7faff; color: #182230;
  animation: card-breathe 2.4s ease-in-out infinite;
}
.stack-form input[name="card_code"]:focus {
  animation: none; border-color: var(--primary-dark); outline: none;
  box-shadow: 0 0 0 4px rgba(38, 103, 255, .30);
}
.stack-form input[name="card_code"]::placeholder {
  color: #9fb3d9; font-weight: 400; letter-spacing: normal; font-size: 14px;
}
