:root {
  /* 方案 C · 蓝白基调：主文字/次级/辅助三层，辅助色已加深保证对比度 */
  --ink: #1c1f26;
  --ink-2: #4a5162;
  --ink-3: #5d6575;
  --line: #e8eaf1;
  --line-2: #dfe2ea;
  --bg: #f6f7fb;
  --bg-2: #eef1f8;
  --card-bg: #ffffff;
  --surface: rgba(255, 255, 255, .95);
  --radius: 18px;
  --shadow: 0 6px 22px rgba(31, 36, 54, .07);
  --ok: #178a52;
  --ok-bg: #e6f8ee;
  --warn: #8a5b08;
  --warn-bg: #fdf3e0;
  --danger: #b23a33;
  --danger-bg: #fceeee;
  --info: #0b7fb4;
  --info-bg: #e8f4fd;
  --accent: #00a1d6;
  --accent-soft: #e8f4fd;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--ink); text-decoration: none; }
a:hover { color: #000; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 24px; }

/* ---------- 顶栏 ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, .95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  height: 60px;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; }
.brand-mark { font-size: 20px; line-height: 1; }
.brand-name { letter-spacing: -.01em; }

.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
.nav-link {
  position: relative;
  padding: 6px 12px;
  border-radius: 999px;
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
  transition: all .2s ease;
}
.nav-link:hover { color: var(--ink); background: var(--bg-2); }
.nav-link.active { color: var(--ink); font-weight: 700; }
.nav-link.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
}

.userbox { display: flex; align-items: center; gap: 12px; }
.user-name { font-weight: 600; color: var(--ink); }

/* ---------- 页面 ---------- */
.page { padding: 32px 0 64px; }
.page-plain { padding: 0; }

.page-head { margin-bottom: 22px; }
.page-title { font-size: 26px; font-weight: 800; margin: 0 0 4px; letter-spacing: -.02em; }
.page-sub { margin: 0; color: var(--ink-2); font-size: 13px; }

/* ---------- 状态条 ---------- */
.statusbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  margin-bottom: 20px;
  font-size: 13px;
  color: var(--ink-2);
}
.statusbar b { color: var(--ink); font-variant-numeric: tabular-nums; }
.status-strong { font-weight: 700; color: var(--ink); }
.sep { color: var(--line-2); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: #26a65b; box-shadow: 0 0 0 3px rgba(38, 166, 91, .14); }
.dot-warn { background: #e0a020; box-shadow: 0 0 0 3px rgba(224, 160, 32, .14); }
.dot-off { background: var(--ink-3); }

/* ---------- 统计卡 ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--bg);
}
.stat-label { font-size: 12px; color: var(--ink-2); }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-foot { font-size: 12px; color: var(--ink-3); }

/* ---------- 卡片 ---------- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  background: var(--bg);
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.card-hint { font-size: 12.5px; color: var(--ink-2); margin: 0 0 14px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- 表格 ---------- */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left;
  font-weight: 600;
  color: var(--ink-2);
  padding: 10px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  font-size: 12.5px;
}
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-2); }
.table-compact td, .table-compact th { padding: 8px 8px; }
.strong { font-weight: 600; }
.muted { color: var(--ink-2); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ellipsis { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.right { text-align: right; }
.link { color: var(--info); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.7;
  white-space: nowrap;
}
.badge-ok { color: var(--ok); background: var(--ok-bg); }
.badge-warn { color: var(--warn); background: var(--warn-bg); }
.badge-danger { color: var(--danger); background: var(--danger-bg); }
.badge-info { color: var(--info); background: var(--info-bg); }
.badge-muted { color: var(--ink-2); background: #f2f2f2; }
.pin {
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--ink);
  color: #fff;
  margin-left: 4px;
}

/* ---------- 表单 ---------- */
.input {
  padding: 9px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  font-size: 13.5px;
  font-family: inherit;
  background: var(--bg);
  color: var(--ink);
  min-width: 220px;
  transition: border-color .2s ease;
}
.input:focus { outline: none; border-color: var(--ink); }
.searchbar { display: flex; gap: 8px; margin-bottom: 16px; }
.inline-form { display: flex; gap: 8px; margin-top: 14px; }
.inline { display: inline; }

.btn-primary {
  display: inline-block;
  padding: 9px 22px;
  border: 0;
  border-radius: 999px;
  background: #111;
  color: #fff;
  font-weight: 600;
  font-size: 13.5px;
  font-family: inherit;
  cursor: pointer;
  transition: opacity .2s ease;
}
.btn-primary:hover { opacity: .85; }
.btn-block { width: 100%; padding: 11px 22px; }
.btn-ghost {
  display: inline-block;
  padding: 7px 16px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .2s ease;
}
.btn-ghost:hover { background: var(--bg-2); }
.btn-sm { padding: 4px 12px; font-size: 12.5px; }

/* ---------- 登录页 ---------- */
.auth { background: var(--bg); }
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.auth-card {
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, .07);
  padding: 38px 36px 30px;
  background: var(--card-bg);
  text-align: center;
  position: relative;
  overflow: hidden;
}
/* 顶部渐变条：蓝紫主色贯穿 */
.auth-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), #6c5cff);
}
/* 背景光晕：贴合蓝白主题 */
.auth-shell::before {
  content: "";
  position: fixed;
  width: 560px; height: 420px;
  border-radius: 50%;
  top: -160px; left: 50%;
  transform: translateX(-50%);
  background: radial-gradient(circle, rgba(0, 161, 214, .10), transparent 70%);
  pointer-events: none;
}
.auth-sub { color: var(--ink); font-size: 14.5px; font-weight: 650; margin: 0 0 26px; }
.auth-form { text-align: left; }
.field { display: block; margin-bottom: 16px; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color .2s ease;
}
.field input:focus { outline: none; border-color: var(--ink); }
.auth-foot { margin: 20px 0 0; font-size: 12.5px; color: var(--ink-3); }
.auth-icp { margin: 8px 0 0; font-size: 12px; }
.auth-icp a { color: var(--ink-3); text-decoration: none; transition: color .2s ease; }
.auth-icp a:hover { color: var(--accent); }

/* ---------- 消息 ---------- */
.messages { padding-top: 16px; }
.msg {
  padding: 11px 16px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 10px;
  border: 1px solid transparent;
}
.msg-error { color: var(--danger); background: var(--danger-bg); border-color: #f6d9d7; }
.msg-success { color: var(--ok); background: var(--ok-bg); border-color: #d6ecdf; }
.msg-info { color: var(--info); background: var(--info-bg); border-color: #dde7f2; }

/* ---------- 其他 ---------- */
.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 13px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
}

.chips { display: flex; flex-wrap: wrap; gap: 7px; padding: 0; margin: 0; list-style: none; }
.chip {
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  border: 1px solid var(--line-2);
  color: var(--ink-3);
  background: #fff;
}
.chip-on { border-color: var(--ink); color: var(--ink); font-weight: 600; }

.denied { text-align: center; padding: 80px 20px; }
.denied h1 { font-size: 60px; font-weight: 800; margin: 0; color: var(--line-2); }
.denied p { margin: 6px 0; }

.footer {
  border-top: 1px solid var(--line);
  padding: 20px 0 28px;
  color: var(--ink-3);
  font-size: 12px;
}

@media (max-width: 860px) {
  .grid-2 { grid-template-columns: 1fr; }
  .topbar .wrap { height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; gap: 10px; }
  .nav { order: 3; width: 100%; }
  .userbox { margin-left: auto; }
  /* 手机上 160px 的截断等于把活动名砍掉一半，横屏也补不回来；
     改成正常换行，宁可多占一行也要读全 */
  .ellipsis {
    max-width: none;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}

/* ---------- 筛选栏 / 标签页 ---------- */
.filterbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}
.input-wide { min-width: 340px; }
.select { min-width: 130px; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--ink-2);
  border: 1px solid transparent;
  transition: all .18s ease;
  white-space: nowrap;
}
.tab:hover { background: var(--bg-2); color: var(--ink); }
.tab.active {
  background: #111;
  color: #fff;
  font-weight: 600;
  border-color: #111;
}

/* ---------- 明日开始高亮提示条 ---------- */
.tomorrow-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 16px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: linear-gradient(90deg, #fff8e6 0%, #fffdf7 100%);
  border: 1px solid #f0dfae;
}
.tomorrow-label {
  font-size: 12.5px;
  font-weight: 700;
  color: #8a6414;
  white-space: nowrap;
}
.tomorrow-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 11px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid #ecdcae;
  color: #7a5a12;
  font-size: 12.5px;
  font-weight: 600;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: all .18s ease;
}
.tomorrow-chip:hover { background: #fff3d6; border-color: #ddc078; color: #6b4d0d; }
.chip-meta { font-weight: 400; color: #a08247; font-size: 11.5px; }

/* ---------- 分页 ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 0 8px;
}
.pager-btn {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  transition: background .18s ease;
}
.pager-btn:hover { background: var(--bg-2); }
.pager-off { color: var(--ink-3); border-color: var(--line); cursor: default; }
.pager-off:hover { background: transparent; }
.pager-info { font-size: 12.5px; color: var(--ink-2); }

/* ---------- 行链接 / 返回链接 ---------- */
.row-link { color: var(--ink); font-weight: 600; }
.row-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.back-link {
  display: inline-block;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 8px;
}
.back-link:hover { color: var(--ink); }

/* ---------- 信息条 ---------- */
.infobar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 11px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg-2);
  font-size: 13px;
  color: var(--ink-2);
}
.infobar b { color: var(--ink); }

/* ---------- 文本域 ---------- */
.textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  margin-bottom: 12px;
  transition: border-color .18s ease;
}
.textarea:focus { outline: none; border-color: var(--ink); }

/* ---------- 滚动容器 ---------- */
.scroll-box { max-height: 320px; overflow-y: auto; }

/* ---------- 操作按钮组 ---------- */
.actions { white-space: nowrap; }
.actions .btn-ghost { margin-right: 4px; }
.btn-danger { color: var(--danger); border-color: #f0d3d1; }
.btn-danger:hover { background: var(--danger-bg); }

/* ---------- 状态条操作位 ---------- */
.statusbar-actions { margin-left: auto; }

/* ---------- 区块标题 ---------- */
.section-title {
  font-size: 16px;
  font-weight: 700;
  margin: 26px 0 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

@media (max-width: 860px) {
  .input-wide { min-width: 100%; }
  .tomorrow-chip { max-width: 100%; }
  .statusbar-actions { margin-left: 0; width: 100%; }
}

/* ---------- 明日开始：展开式面板 ---------- */
.tomorrow-panel {
  border: 1px solid #f0dfae;
  border-radius: 14px;
  background: linear-gradient(180deg, #fffaf0 0%, #fffdf9 100%);
  padding: 14px 18px;
  margin-bottom: 20px;
}
.tomorrow-panel-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 10px;
}
.tomorrow-hint { font-size: 12px; color: #a08247; }
.tomorrow-list { display: flex; flex-direction: column; gap: 2px; }
.tomorrow-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 10px;
  border-radius: 9px;
  transition: background .15s ease;
}
.tomorrow-item:hover { background: #fff4dc; }
.tomorrow-item-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: 1;
  min-width: 0;
}
.tomorrow-item-time {
  font-family: var(--mono);
  font-size: 12px;
  color: #96772f;
  white-space: nowrap;
}
.tomorrow-item-name {
  font-weight: 600;
  font-size: 13.5px;
  color: #6b4d0d;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tomorrow-item-links { display: flex; gap: 6px; flex-shrink: 0; }
.link-pill {
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid #ecdcae;
  background: #fff;
  color: #7a5a12;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
  transition: all .15s ease;
}
.link-pill:hover { background: #fff3d6; border-color: #ddc078; color: #5e430a; }

/* ---------- 中奖页：监控中置顶 ---------- */
.row-monitored { background: #f7fdf9; }
.row-monitored:hover { background: #f0faf4; }
.row-monitored td:first-child { box-shadow: inset 3px 0 0 #26a65b; }
.live-badge { margin-left: 8px; font-size: 11px; padding: 1px 7px; }

/* ---------- 监控页：即将结束 ---------- */
.ending-summary {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.ending-chip {
  padding: 5px 13px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: #fff;
  font-size: 12.5px;
  color: var(--ink-2);
}
.ending-chip b { color: var(--ink); font-variant-numeric: tabular-nums; }
.ending-danger { border-color: #f2d0ce; background: var(--danger-bg); color: var(--danger); }
.ending-danger b { color: var(--danger); }
.ending-warn { border-color: #f0e0b8; background: var(--warn-bg); color: var(--warn); }
.ending-warn b { color: var(--warn); }
.ending-note { font-size: 12px; color: var(--ink-3); margin-left: 4px; }

.remain { font-weight: 600; }
.remain-danger { color: var(--danger); }
.remain-warn { color: var(--warn); }
.remain-normal { color: var(--ink-2); }
.urgency-danger td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.urgency-warn td:first-child { box-shadow: inset 3px 0 0 #e0a020; }

/* ---------- 提示块 ---------- */
.notice {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--info-bg);
  border: 1px solid #dde7f2;
  color: var(--info);
  font-size: 13px;
  margin-bottom: 18px;
}
.notice b { font-weight: 700; }

.form-actions { margin-top: 10px; }
code {
  font-family: var(--mono);
  font-size: 12px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #f2f2f2;
  color: var(--ink-2);
}

@media (max-width: 860px) {
  .tomorrow-item { flex-direction: column; align-items: flex-start; gap: 6px; }
  .tomorrow-item-name { white-space: normal; }
}

/* ---------- 监控中行置顶高亮 ---------- */
.row-live { background: #fbfdfb; }
.row-live:hover { background: #f5faf7; }
.row-off td { opacity: .55; }

/* ---------- 卡片计数徽章 ---------- */
.card-count {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
}
.card-count-warn { background: var(--warn-bg); color: var(--warn); }

/* ---------- 明日提示（展开所有链接） ---------- */
.tomorrow-bar-tall { align-items: flex-start; padding: 14px 16px; }
.tomorrow-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  background: #fff;
  border: 1px solid #ecdcae;
  border-radius: 10px;
  font-size: 12.5px;
}
.tomorrow-name { font-weight: 600; color: #7a5a12; max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tomorrow-time { color: #a08247; font-family: var(--mono); font-size: 11.5px; }
.tomorrow-links { display: flex; gap: 5px; }
.mini-link {
  padding: 1px 8px;
  border-radius: 999px;
  background: #fff7e2;
  border: 1px solid #e8d3a0;
  color: #7a5a12;
  font-size: 11.5px;
  font-weight: 600;
}
.mini-link:hover { background: #ffefc9; border-color: #d9bd76; }

/* ---------- 列表符号 ---------- */
.bullet { margin: 0; padding-left: 20px; font-size: 13px; color: var(--ink-2); line-height: 2; }
.bullet b { color: var(--ink); }

/* ---------- 危险操作区 ---------- */
.danger-zone {
  margin-top: 26px;
  padding: 14px 18px;
  border: 1px dashed #f0d3d1;
  border-radius: 12px;
  background: #fffafa;
}
.danger-zone form { display: flex; align-items: center; gap: 14px; }

@media (max-width: 860px) {
  .tomorrow-card { flex-wrap: wrap; }
  .tomorrow-name { max-width: 100%; }
}

/* ---------- 模块配置页 ---------- */
.config-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
  align-items: start;
}
.config-nav { display: flex; flex-direction: column; gap: 6px; position: sticky; top: 76px; }
.config-tab {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--bg);
  transition: all .18s ease;
}
.config-tab:hover { border-color: var(--line-2); background: var(--bg-2); }
.config-tab.active { border-color: var(--ink); background: #fafafa; }
.config-tab-name { font-weight: 600; font-size: 13.5px; }
.config-tab-meta { font-size: 11.5px; color: var(--ink-3); display: flex; gap: 6px; align-items: center; }
.config-main { min-width: 0; }
.config-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.config-badges { display: flex; gap: 6px; flex-shrink: 0; }

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px 22px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field-wide { grid-column: 1 / -1; }
.form-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.label-tag {
  font-size: 10.5px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--info-bg);
  color: var(--info);
}
.form-field .input, .form-field .textarea { min-width: 0; width: 100%; }
.form-help { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.form-range { font-size: 11px; color: var(--ink-3); font-family: var(--mono); }
.form-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 26px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

/* 长表单（推送 17 个字段、监控 22 个）的保存按钮原来只在页面最底部，
   填完顶部字段后要滚很久才找得到，看起来像「没有保存按钮」。
   改成吸底：任何时候都在视口底部，且只在滚动时才浮起，静置时不挡内容。 */
.sticky-save {
  position: sticky;
  bottom: 0;
  z-index: 20;
  margin: 26px 0 0;
  padding: 14px 0 calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-top: 1px solid var(--line);
  transition: box-shadow .18s ease, background .18s ease;
}
.card:has(.sticky-save) { position: relative; padding-bottom: 0; }
/* 重置区在吸底栏下方，需要自己的留白，否则会被浮起的保存条压住 */
.card:has(.sticky-save) > .danger-zone { margin-bottom: 20px; }
.sticky-save.is-dirty {
  background: #fffaf3;
  box-shadow: 0 -6px 18px rgba(0, 0, 0, .07);
}
.unsaved-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: #b26a00;
  white-space: nowrap;
}
.unsaved-hint::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e8a33d;
  animation: unsaved-pulse 1.6s ease-in-out infinite;
}
@keyframes unsaved-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .35; }
}
@media (prefers-reduced-motion: reduce) {
  .unsaved-hint::before { animation: none; }
}
@media (max-width: 860px) {
  /* 手机上保存条贴到屏幕底边，两侧不留内缩 */
  .sticky-save {
    margin: 20px 0 0;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px));
    flex-wrap: wrap;
    gap: 10px;
  }
  .sticky-save .btn-primary { flex: 1; min-height: 44px; }
  .sticky-save .muted.small { display: none; }
  .unsaved-hint { width: 100%; }
}

/* 开关 */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute;
  inset: 0;
  background: #ddd;
  border-radius: 999px;
  cursor: pointer;
  transition: background .2s ease;
}
.switch-track::before {
  content: "";
  position: absolute;
  width: 20px; height: 20px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,.18);
}
.switch input:checked + .switch-track { background: #1f7a44; }
.switch input:checked + .switch-track::before { transform: translateX(20px); }
.switch input:disabled + .switch-track { opacity: .5; cursor: not-allowed; }

/* ---------- 任务触发 ---------- */
.trigger-grid { display: flex; flex-direction: column; gap: 10px; }
.trigger-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.trigger-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trigger-name { font-weight: 600; font-size: 13.5px; }
.trigger-desc { font-size: 12px; color: var(--ink-3); }
.trigger-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ---------- 进度条 ---------- */
.progress-cell { display: flex; align-items: center; gap: 8px; min-width: 120px; }
.progress-cell .progress-bar {
  height: 5px;
  background: #111;
  border-radius: 3px;
  min-width: 2px;
  max-width: 80px;
}
.progress-cell::before {
  content: "";
  position: absolute;
}

/* ---------- 错误展开 ---------- */
.error-row td { background: var(--danger-bg); border-bottom: 1px solid #f6d9d7; }
.error-pre {
  margin: 8px 0 0;
  padding: 12px;
  background: #fff;
  border: 1px solid #f0d3d1;
  border-radius: 8px;
  font-size: 11.5px;
  font-family: var(--mono);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 280px;
  overflow: auto;
}
details summary { cursor: pointer; font-size: 12.5px; color: var(--danger); font-weight: 600; }

@media (max-width: 900px) {
  .config-layout { grid-template-columns: 1fr; }
  /* 模块切换在窄屏铺成两列网格，不用横向拖动去找第三个模块 */
  .config-nav {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    overflow: visible;
  }
  .config-tab { min-width: 0; padding: 10px 12px; }
  .config-tab-meta { flex-wrap: wrap; }
  .trigger-card { flex-direction: column; align-items: flex-start; }
}

/* ---------- 定时设置 ---------- */
.schedule-status {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 11px 16px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 13px;
}
.schedule-ok { background: var(--ok-bg); border: 1px solid #d6ecdf; color: var(--ok); }
.schedule-bad { background: var(--danger-bg); border: 1px solid #f6d9d7; color: var(--danger); }
.schedule-desc { font-weight: 600; }
.schedule-next { color: var(--ink-2); font-family: var(--mono); font-size: 12px; }

/* 可视化定时选择器 */
.sched-picker { display: grid; gap: 14px; }
.sched-modes {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  width: fit-content;
}
.sched-mode {
  border: 0;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 15px;
  border-radius: 7px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.sched-mode:hover { color: var(--ink); }
.sched-mode.active { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

.sched-pane[hidden] { display: none; }
.sched-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 7px; }
.sched-chip {
  border: 1px solid var(--line-2);
  background: var(--bg);
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s ease;
}
.sched-chip:hover { border-color: var(--ink-3); color: var(--ink); }
.sched-chip.active {
  background: var(--accent-soft, #fff0f4);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 600;
}

.sched-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-2);
  border: 1px dashed var(--line-2);
  border-radius: 9px;
}
.sched-preview-label { font-size: 12px; color: var(--ink-3); font-weight: 600; }
#cron-preview { font-family: var(--mono); font-size: 13px; color: var(--ink); }

/* ---------- 统计小标签 ---------- */
.stats-row td { padding-top: 0; border-bottom: 1px solid var(--line); }
.stats-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-sm {
  padding: 1px 8px;
  border-radius: 5px;
  background: var(--bg-2);
  color: var(--ink-2);
  font-size: 11.5px;
  font-family: var(--mono);
}

code {
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--bg-2);
  font-family: var(--mono);
  font-size: 12px;
}

/* ---------- 活动表：进行中高亮 + 详情展开 ---------- */
.activity-table td { vertical-align: middle; }
.row-active {
  background: linear-gradient(90deg, rgba(31, 122, 68, .055), rgba(31, 122, 68, .015));
  box-shadow: inset 3px 0 0 var(--ok);
}
.row-active:hover { background: rgba(31, 122, 68, .1); }
.row-active .strong a { color: #14532d; font-weight: 700; }

.live-dot {
  display: inline-block;
  width: 7px; height: 7px;
  margin-left: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 0 rgba(31, 122, 68, .5);
  animation: live-pulse 2s infinite;
  vertical-align: middle;
}
@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(31, 122, 68, .45); }
  70%  { box-shadow: 0 0 0 7px rgba(31, 122, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(31, 122, 68, 0); }
}

.expand-btn {
  width: 22px; height: 22px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink-2);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s ease;
}
.expand-btn:hover { border-color: var(--ink); color: var(--ink); }
.expand-btn.open { background: var(--ink); border-color: var(--ink); color: #fff; }

.detail-row > td { background: var(--bg-2); padding: 0 !important; border-bottom: 1px solid var(--line); }
.detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 24px;
  padding: 16px 20px 18px;
}
.detail-title {
  margin: 0 0 9px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: .04em;
}
.detail-count {
  font-weight: 400;
  color: var(--ink-3);
  font-family: var(--mono);
}
.prize-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.prize-chip {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 3px 3px 3px 9px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--bg);
  font-size: 12px;
}
.prize-chip .prize-name { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prize-block {
  width: 19px; height: 19px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s ease;
}
.prize-block:hover { background: var(--danger-bg); color: var(--danger); }

.sid-list { display: flex; flex-wrap: wrap; gap: 5px; }
.sid-tag {
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid var(--line-2);
  font-size: 11.5px;
}
.detail-meta {
  display: flex;
  gap: 16px;
  margin-top: 12px;
  font-size: 12px;
  color: var(--ink-3);
}
.empty.small { padding: 6px 0; font-size: 12.5px; }

/* ---------- 出货统计 ---------- */
.draw-card { padding: 18px 20px 20px; }
.draw-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.draw-summary { font-size: 13px; color: var(--ink-2); }
.draw-sub {
  margin: 16px 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ok);
  letter-spacing: .03em;
}
.draw-sub-warn { color: var(--warn); }
.draw-list { display: flex; flex-wrap: wrap; gap: 7px; }
.draw-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 5px 5px 5px 11px;
  border-radius: 8px;
  font-size: 12.5px;
  border: 1px solid transparent;
}
.draw-hit { background: var(--ok-bg); border-color: #d6ecdf; }
.draw-dry { background: var(--warn-bg); border-color: #f0e2c0; }
.draw-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.draw-count {
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .06);
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 600;
}
.draw-unit { font-weight: 400; opacity: .6; margin-left: 1px; }
.draw-zero { font-size: 11px; color: var(--warn); opacity: .85; }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }

/* ---------- 模块控制 ---------- */
.module-control-card { padding: 18px 20px 20px; }
.module-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.module-item {
  padding: 13px 15px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--bg);
  transition: border-color .18s ease;
}
.module-item.module-on { border-color: #cfe7d9; background: linear-gradient(180deg, var(--ok-bg), var(--bg) 65%); }
.module-head {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
}
.module-name { font-weight: 600; font-size: 13.5px; }
.module-head .badge { margin-left: auto; }
.module-detail {
  margin: 0 0 4px;
  font-size: 12.5px;
  color: var(--ink-2);
  min-height: 17px;
}
.module-meta {
  margin: 0;
  font-size: 11.5px;
  color: var(--ink-3);
}
.module-actions {
  display: flex;
  gap: 6px;
  margin-top: 11px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

@media (max-width: 820px) {
  .detail-grid { grid-template-columns: 1fr; gap: 14px; }
  .module-grid { grid-template-columns: 1fr; }
}

/* ---------- 管理页：标签 + 用户表 + 配置分组 ---------- */
.admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0;
}
.admin-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  transition: all .16s ease;
  margin-bottom: -1px;
}
.admin-tab:hover { background: var(--bg-2); color: var(--ink); }
.admin-tab.active {
  background: var(--bg);
  border-color: var(--line);
  border-bottom-color: var(--bg);
  color: var(--ink);
  font-weight: 700;
}
.admin-tab-icon { font-size: 14px; opacity: .8; }
.admin-intro { margin: 4px 0 16px; }
.admin-hint { margin: 0 0 18px; }
.admin-notes { margin-top: 22px; }
.note-list { margin: 10px 0 0; padding-left: 20px; color: var(--ink-2); font-size: 13px; line-height: 1.9; }
.note-list b { color: var(--ink); }

/* 用户表 */
.member-table td { vertical-align: top; }
.row-muted { opacity: .55; }
.perm-form { display: flex; flex-direction: column; gap: 8px; }
.perm-groups { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; }
.perm-group-label {
  font-size: 11px;
  color: var(--ink-3);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 2px;
}
.perm-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.perm-check input { accent-color: #111; }
.perm-actions { display: flex; gap: 6px; align-items: center; }
.select-sm { padding: 4px 10px; font-size: 12.5px; width: auto; }
.input-mini {
  width: 96px;
  padding: 4px 8px;
  font-size: 12px;
  display: inline-block;
  margin-bottom: 4px;
}
.member-form {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: flex-end;
}
.member-form .form-field { min-width: 170px; }
.member-form .form-actions { margin: 0 0 2px; }
.pwd-form { max-width: 380px; }

/* 配置字段分组卡片 */
.spec-group {
  padding: 16px 18px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  margin-bottom: 16px;
  background: var(--bg);
}
.spec-group:last-of-type { margin-bottom: 4px; }
.spec-group-head { margin-bottom: 14px; }
.spec-group-title {
  margin: 0 0 4px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--ink);
}
.spec-group-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.65;
}
.spec-group-scan { border-left: 3px solid var(--info); }
.spec-group-win { border-left: 3px solid var(--ok); }
.spec-group-admin { border-left: 3px solid var(--warn); }
.spec-group-common { border-left: 3px solid var(--line-2); background: var(--bg-2); }

@media (max-width: 820px) {
  .admin-tabs { overflow-x: auto; }
  .admin-tab { padding: 9px 12px; font-size: 12.5px; white-space: nowrap; }
  .member-form { flex-direction: column; align-items: stretch; }
  .member-form .form-field { min-width: 0; }
}

/* 模块按钮禁用态：保持布局稳定，仍可辨认 */
.module-actions button[disabled] {
  opacity: .38;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- 实时刷新：数值变化时轻微高亮 ---------- */
@keyframes live-flash {
  0%   { background: var(--accent-soft, #fff0f4); color: var(--accent); }
  100% { background: transparent; color: inherit; }
}
.live-changed {
  animation: live-flash 1.2s ease-out;
  border-radius: 4px;
  padding: 0 2px;
  margin: 0 -2px;
}
@media (prefers-reduced-motion: reduce) {
  .live-changed { animation: none; }
}

/* ---------- 推送分区的收件人健康度 ---------- */
.group-health {
  margin-top: 12px;
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.gh-ok { background: var(--ok-bg); color: var(--ok); border: 1px solid #d6ecdf; }
.gh-bad { background: var(--danger-bg); color: var(--danger); border: 1px solid #f6d9d7; }
.group-health b { font-family: var(--mono); }

/* ---------- 凭据清除勾选框 ---------- */
.clear-secret {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
  font-size: 12px;
  color: var(--ink-3);
  cursor: pointer;
}
.clear-secret input { accent-color: var(--danger, #d9534f); }
.clear-secret:hover { color: var(--danger, #d9534f); }

/* ---------- 危险操作区（恢复默认） ---------- */
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 14px 0 0;
  padding: 13px 16px;
  border: 1px solid #f0d3d1;
  border-radius: 10px;
  background: #fffafa;
}
.danger-form { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.danger-text { display: flex; flex-direction: column; gap: 3px; }
.danger-text b { font-size: 13px; color: var(--ink); }
.danger-text span { font-size: 12px; color: var(--ink-3); line-height: 1.5; }
.danger-zone form { margin: 0; flex-shrink: 0; }

@media (max-width: 860px) {
  .danger-zone { flex-direction: column; align-items: stretch; gap: 10px; }
  .danger-form { flex-wrap: wrap; }
  .danger-zone .btn-ghost { flex: 1; min-height: 42px; }
}

.form-help-quiet { color: var(--ink-3); opacity: .75; font-size: 11.5px; }

.purge-option { margin-top: 8px; font-size: 11.5px; }

/* ---------- 逐行输入（收件人 UID 等） ---------- */
.lines-field { display: flex; flex-direction: column; gap: 8px; }
.lines-rows { display: flex; flex-direction: column; gap: 7px; }
.line-row { display: flex; align-items: center; gap: 8px; }
.line-row .line-input { flex: 1; min-width: 0; }
.line-del {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink-3);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: all .15s ease;
}
.line-del:hover { border-color: #f0c2c0; background: #fff5f5; color: var(--danger, #d9534f); }
.line-add {
  align-self: flex-start;
  border: 1px dashed var(--line-2);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  padding: 7px 14px;
  cursor: pointer;
  transition: all .15s ease;
}
.line-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft, #fff0f4); }

@media (max-width: 860px) {
  .line-del { width: 40px; height: 40px; font-size: 19px; }
  .line-add { width: 100%; min-height: 40px; }
}

/* ---------- 角色权限定义（三列对照） ---------- */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 4px;
}
.preset-col {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 14px 16px 16px;
  background: var(--bg);
  min-width: 0;
}
/* details 元素上的 padding 会套在 summary 外面，收起来时留白很难看 */
details.preset-col { padding: 0; }
details.preset-col > summary { padding: 13px 16px; }
details.preset-col[open] > summary {
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
details.preset-col > .preset-group:first-of-type { margin-top: 0; }
details.preset-col > *:not(summary) { margin-left: 16px; margin-right: 16px; }
details.preset-col > .preset-group:last-of-type { margin-bottom: 14px; }
.preset-col summary::-webkit-details-marker { display: none; }
.preset-col summary { list-style: none; cursor: pointer; }
.preset-col summary .preset-count::after { content: " ▾"; color: var(--ink-3); }
details.preset-col[open] summary .preset-count::after { content: " ▴"; }
.preset-col-admin { border-color: #f3d3d9; background: #fffafb; }
.preset-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.preset-count { font-size: 12px; color: var(--ink-3); font-family: var(--mono); }
.preset-group { margin-bottom: 12px; }
.preset-group:last-child { margin-bottom: 0; }
.preset-group-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink-3);
  text-transform: uppercase;
  margin-bottom: 6px;
}
.preset-col .perm-check { display: flex; align-items: center; gap: 7px; padding: 3px 0; }
.section-gap { margin-top: 30px; }

@media (min-width: 861px) {
  /* 宽屏三列并排是为了对照，收起一列就没意义了：禁用折叠 */
  details.preset-col > summary { cursor: default; pointer-events: none; }
  details.preset-col > summary .preset-count::after { content: ""; }
}

@media (max-width: 860px) {
  .preset-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .preset-col .perm-check { min-height: 34px; }
  /* 收起时三个角色都在首屏，保存条吸底永远够得着 */
  details.preset-col > summary { padding: 13px 16px; }
}

/* ---------- 全站交互基线：按钮加载态与过渡动画 ---------- */
/* 功能优先：所有动画 ≤0.25s、只动透明度/位移/阴影这类低成本属性，
   且尊重系统的"减少动态效果"设置。 */

/* 提交中的按钮：转圈 + 半透明，防止"点了没反应"的错觉 */
.btn-loading {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}
.btn-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 255, 255, .45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin .6s linear infinite;
}
.btn-ghost.btn-loading::after {
  border-color: rgba(17, 17, 17, .25);
  border-top-color: #111;
}
@keyframes btn-spin { to { transform: rotate(360deg); } }

/* 卡片与消息：进入页面时轻轻浮起，替代"瞬间糊脸" */
.card { animation: rise-in .22s ease-out both; }
.msg { animation: rise-in .22s ease-out both; }
@keyframes rise-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

/* 表格行、列表项：悬停时轻微反馈，点击目标更明确 */
tbody tr { transition: background .15s ease; }
.chip, .prize-chip, .day-chip, .sid-tag { transition: transform .12s ease, border-color .15s ease; }
.chip:active, .prize-chip:active { transform: scale(.97); }

/* 按钮：统一的按压反馈（原有 hover 已有，这里补 active） */
.btn-primary:active, .btn-ghost:active { transform: scale(.97); }
.btn-primary, .btn-ghost { will-change: auto; }

/* 侧栏项悬停：背景过渡更顺滑 */
.side-nav a, .portal-card, .config-tab, .admin-tab {
  transition: background .18s ease, border-color .18s ease, transform .12s ease;
}
.portal-card:hover { transform: translateY(-2px); }

/* 消息条自动淡出由 Django 侧控制，这里只加出现动画（上面 .msg 已有） */

/* 系统开了"减少动态效果"时全部关闭 */
@media (prefers-reduced-motion: reduce) {
  .card, .msg { animation: none; }
  .btn-loading::after { animation-duration: 1.2s; }
  * { transition-duration: .01ms !important; }
}
