:root {
  --red: #c8102e;
  --red-dark: #8f1020;
  --red-deep: #5f0b16;
  --gold: #f0d264;
  --gold-light: #e7c95c;
  --ink: #1a1a1a;
  --bg: #f4f5f7;
  --card: #ffffff;
  --line: #e5e7eb;
  --muted: #6b7280;
  --green: #1a7f37;
  --amber: #b45309;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.05);
}

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

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

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

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--red-deep) 0%, var(--red-dark) 45%, var(--red) 100%);
  padding: 24px;
}
.login-card {
  width: 400px;
  background: var(--card);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,.35);
  overflow: hidden;
}
.login-head {
  background: linear-gradient(135deg, var(--red-dark), var(--red));
  color: #fff;
  padding: 28px 32px;
}
.login-head h1 { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.login-head p { font-size: 13px; opacity: .85; margin-top: 6px; }
.login-body { padding: 28px 32px 32px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  transition: border .15s, box-shadow .15s;
}
.field input:focus, .field select:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(200,16,46,.12);
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--red); color: #fff; }
.btn-primary:hover { opacity: .9; }
.btn-gold { background: var(--gold); color: var(--red-deep); }
.btn-ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { border-color: var(--red); color: var(--red); }
.btn-danger { background: #fff; color: var(--red); border: 1px solid #f0c4cb; }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 布局 ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, var(--red-deep), var(--red-dark));
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
}
.brand {
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.brand .logo { font-size: 17px; font-weight: 700; letter-spacing: 1px; }
.brand .logo span { color: var(--gold-light); }
.brand .sub { font-size: 11px; opacity: .7; margin-top: 4px; }
.nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 8px;
  cursor: pointer;
  color: rgba(255,255,255,.85);
  font-size: 14px;
  margin-bottom: 4px;
  transition: background .15s;
}
.nav-item:hover { background: rgba(255,255,255,.1); }
.nav-item.active { background: var(--red); color: #fff; font-weight: 600; }
.nav-item .ico { width: 18px; text-align: center; }
.sidebar .user-box {
  padding: 16px 18px;
  border-top: 1px solid rgba(255,255,255,.12);
}
.sidebar .user-box .uname { font-size: 14px; font-weight: 600; }
.sidebar .user-box .urole { font-size: 12px; opacity: .75; margin-top: 2px; }
.badge-role {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 20px;
  font-size: 11px;
  background: var(--gold);
  color: var(--red-deep);
  font-weight: 700;
  margin-left: 6px;
}

.main { flex: 1; margin-left: 220px; min-width: 0; }
.topbar {
  height: 60px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar .page-title { font-size: 18px; font-weight: 700; }
.topbar .actions { display: flex; gap: 10px; align-items: center; }
.content { padding: 24px; max-width: 1800px; margin: 0 auto; }

/* ---------- 通用 ---------- */
.card {
  background: var(--card);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}
.card h3 { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3 .bar { width: 4px; height: 16px; background: var(--red); border-radius: 2px; display: inline-block; }
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.stat { background: #fff; border-radius: 12px; padding: 18px; box-shadow: var(--shadow); border-top: 3px solid var(--red); }
.stat.gold { border-top-color: var(--gold); }
.stat .num { font-size: 28px; font-weight: 800; color: var(--red-dark); }
.stat.gold .num { color: var(--gold); }
.stat .lbl { font-size: 13px; color: var(--muted); margin-top: 4px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #fafafa; font-weight: 600; color: #374151; position: sticky; top: 0; }
tr:hover td { background: #fdf6f7; }
.td-num { text-align: right; font-variant-numeric: tabular-nums; }
.summary-row td { background: #fff8e6; font-weight: 700; border-top: 2px solid var(--gold); color: #7a5b00; }
.hl-cell { background: #fde8eb !important; color: var(--red) !important; font-weight: 600; }
th.hl-cell { background: var(--red) !important; color: #fff !important; }

/* 数据分析报表 markdown 内容 */
.md-body { font-size: 14px; line-height: 1.75; color: var(--ink); }
.md-body h3, .md-body h4, .md-body h5 { margin: 14px 0 6px; color: var(--red-dark); }
.md-body p { margin: 6px 0; }
.md-body ul { margin: 6px 0; padding-left: 22px; }
.md-body li { margin: 4px 0; }
.md-body strong { color: var(--red); }
.md-body code { background: #f4f5f7; padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.md-body blockquote { border-left: 3px solid var(--gold); padding-left: 10px; color: var(--muted); margin: 8px 0; }
.md-body table { border-collapse: collapse; margin: 10px 0; width: 100%; }
.md-body table th, .md-body table td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; white-space: normal; }
.md-body table th { background: #fafafa; font-weight: 600; }

/* 播放量排行榜 */
.lb-tier { margin-bottom: 18px; }
.lb-tier-title { font-size: 14px; font-weight: 700; color: var(--red-dark); margin: 12px 0 8px; padding-left: 8px; border-left: 3px solid var(--gold); }
.lb-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 8px; background: #fff; transition: box-shadow .15s ease; }
.lb-item:hover { box-shadow: var(--shadow); }
.lb-img { width: 56px; height: 56px; flex-shrink: 0; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #f4f5f7; }
.lb-img img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.lb-noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 11px; }
.lb-info { flex: 1; min-width: 0; }
.lb-content { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 5px; font-size: 12px; color: var(--muted); }
.lb-play { font-size: 18px; font-weight: 800; color: var(--red); flex-shrink: 0; min-width: 70px; text-align: right; }
.lb-action { flex-shrink: 0; min-width: 90px; text-align: right; }

/* 排行榜卡片（两列网格，块状） */
.lb-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 6px; }
.lb-grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .lb-grid-3 { grid-template-columns: repeat(2, 1fr); } }
.lb-card { position: relative; border: 1px solid var(--line); border-radius: 12px; background: #fff; overflow: hidden; transition: box-shadow .15s ease; display: flex; flex-direction: column; }
.lb-card:hover { box-shadow: var(--shadow); }
.lb-rank { position: absolute; top: 10px; left: 10px; z-index: 2; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; padding: 3px 9px; border-radius: 6px; letter-spacing: .5px; }
.lb-card-img { width: 100%; height: 150px; background: #f4f5f7; border-bottom: 1px solid var(--line); }
.lb-card-img img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; display: block; }
.lb-card-img .lb-noimg { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; color: #9ca3af; font-size: 12px; }
.lb-card-content { padding: 10px 12px 0; font-size: 13px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-copy { margin: 8px 12px 0; align-self: flex-start; padding: 3px 10px; font-size: 12px; }
.lb-card-meta { padding: 8px 12px 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.lb-card-foot { padding: 10px 12px 12px; display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.lb-card-foot .lb-play { min-width: 0; }
@media (max-width: 720px) { .lb-grid { grid-template-columns: 1fr; } }

.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.badge-red { background: #fde8eb; color: var(--red); }
.badge-green { background: #e4f4e9; color: var(--green); }
.badge-amber { background: #fdf0dc; color: var(--amber); }
.badge-gray { background: #f0f1f3; color: #4b5563; }
.badge-gold { background: #f7efd4; color: #8a6d1a; }
.badge-blue { background: #e3effd; color: #1d4ed8; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 5px; font-size: 12px; margin: 2px; cursor: pointer; border: 1px solid transparent; }
.pill-sel { border-color: var(--red); background: #fde8eb; color: var(--red); font-weight: 600; }
.pill-plain { border-color: var(--line); background: #fff; color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }

/* 工具栏下拉与输入框统一圆润美化 */
.toolbar select,
.toolbar input[type="text"],
.toolbar input[type="month"],
.toolbar input[type="date"] {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 14px;
  font-size: 13px;
  color: #374151;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.toolbar select { cursor: pointer; padding-right: 28px; }
.toolbar select:hover, .toolbar input[type="text"]:hover { border-color: #d1d5db; }
.toolbar select:focus, .toolbar input[type="text"]:focus,
.toolbar input[type="month"]:focus, .toolbar input[type="date"]:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(200,16,46,.1);
}

/* 组长规则小组筛选 */
.filter-inline { display: flex; align-items: center; gap: 8px; }
.filter-inline label { font-size: 13px; font-weight: 600; color: #374151; }
.filter-inline select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0 14px;
  font-size: 13px;
  color: #374151;
  background: #fff;
  outline: none;
  cursor: pointer;
  padding-right: 28px;
  transition: border-color .15s, box-shadow .15s;
}
.filter-inline select:hover { border-color: #d1d5db; }
.filter-inline select:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200,16,46,.1); }

/* ---------- 代发表筛选栏 ---------- */
.filter-card { padding: 14px 18px; }
.filter-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-row:last-child { margin-bottom: 0; }
.filter-label { font-size: 13px; font-weight: 600; color: #374151; min-width: 72px; flex-shrink: 0; }
.filter-row input[type="date"], .filter-row input[type="number"] {
  height: 34px; border: 1px solid var(--line); border-radius: 6px; padding: 0 10px;
  font-size: 13px; outline: none; background: #fff;
}
.filter-row input[type="date"]:focus, .filter-row input[type="number"]:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200,16,46,.1); }
.filter-row input[type="number"] { width: 170px; }
.filter-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 12px;
  border: 1px solid var(--line); border-radius: 20px; font-size: 12px; cursor: pointer;
  background: #fff; color: #374151; user-select: none; transition: all .15s;
}
.filter-pill input { display: none; }
.filter-pill:hover { border-color: #f0c4cb; }
.filter-pill.on { background: #fde8eb; border-color: var(--red); color: var(--red); font-weight: 600; }

/* ---------- 工作台今日任务大框架 ---------- */
.daily-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.daily-list { display: flex; flex-direction: column; gap: 12px; }
.daily-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px;
  background: #fafbfc; transition: border-color .15s;
}
.daily-item.is-warn { border-color: #f6d4a0; background: #fffaf2; }
.daily-item.is-done { border-color: #cfe8d6; background: #f5fbf6; }
.daily-item .daily-ico {
  width: 42px; height: 42px; border-radius: 10px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.daily-info { flex: 1; min-width: 0; }
.daily-name { font-weight: 700; font-size: 14px; color: var(--ink); }
.daily-sub { font-size: 12px; color: var(--muted); margin-top: 3px; }
.daily-subtable { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 14px; }

/* ---------- 分页 ---------- */
.pagination { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 16px; }
.page-btn {
  min-width: 32px; height: 32px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 6px; background: #fff;
  cursor: pointer; font-size: 13px; color: #374151;
}
.page-btn:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.page-btn.active { background: var(--red); color: #fff; border-color: var(--red); font-weight: 600; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }
.page-ellipsis { color: var(--muted); padding: 0 2px; }
.pagination-info { font-size: 12px; color: var(--muted); margin-left: 8px; }

/* ---------- 报表标题（子报表/总表） ---------- */
.report-title {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 16px;
  padding: 4px 0;
}
.report-title-total {
  font-size: 20px;
  color: var(--red-dark);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--red);
}
.block-arrow { display: inline-block; font-size: 13px; color: var(--red); margin-right: 4px; transition: transform .15s ease; }
.report-block .report-title:hover { color: var(--red); }

.modal-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; font-weight: 700; font-size: 16px; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.modal .close { cursor: pointer; font-size: 20px; color: var(--muted); }
.modal .close:hover { color: var(--red); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.field textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px;
  font-size: 14px; outline: none; resize: vertical; min-height: 80px; font-family: inherit;
}
.field textarea:focus { border-color: var(--red); box-shadow: 0 0 0 3px rgba(200,16,46,.12); }

.alert-item {
  display: flex; gap: 12px; padding: 13px 14px; border: 1px solid var(--line);
  border-radius: 10px; margin-bottom: 10px; align-items: flex-start; background: #fff;
}
.alert-item .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.dot-red { background: var(--red); }
.dot-amber { background: var(--amber); }
.alert-item .msg { flex: 1; }
.alert-item .meta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.empty { text-align: center; color: var(--muted); padding: 40px 20px; }

.toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 11px 22px; border-radius: 8px;
  font-size: 14px; z-index: 200; opacity: 0; pointer-events: none; transition: opacity .25s;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
}
.toast.show { opacity: 1; }
.toast.err { background: var(--red); }
.toast.ok { background: var(--green); }

.hint { font-size: 12px; color: var(--muted); }
.section-title { font-size: 15px; font-weight: 700; margin: 20px 0 12px; color: var(--red-dark); }

@media (max-width: 960px) {
  .grid-4, .grid-3, .grid-5 { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .sidebar { width: 64px; }
  .sidebar .brand .logo, .sidebar .nav-item span, .sidebar .user-box .uname, .sidebar .user-box .urole { display: none; }
  .main { margin-left: 64px; }
}

/* ---------- 工作机月度总表 ---------- */
.month-matrix th, .month-matrix td { padding: 5px 7px; text-align: center; border: 1px solid #d1d5db; }
.month-matrix th { font-size: 12px; color: #374151; }
.month-matrix td { font-size: 12px; }
.month-matrix th.col-today { font-weight: 700; }
.month-matrix .badge { font-size: 11px; padding: 2px 7px; white-space: nowrap; }
.daily-select { height: 28px; width: 76px; min-width: 76px; border: 1px solid #e5e7eb; border-radius: 6px; font-size: 12px; background: #fff; color: #1a1a1a; cursor: pointer; text-align: center; text-align-last: center; }
.daily-select:hover { background: #f3f4f6; }
.daily-select option { background: #fff; color: #1a1a1a; }
.daily-select option:hover { background: #f3f4f6; }
.daily-select:focus { outline: none; border-color: var(--red); }
.daily-select.not-filled { border-color: var(--red); background: #fff5f5; color: var(--red); font-weight: 600; }
.daily-editable { cursor: pointer; display: inline-block; }
.daily-editable:hover { opacity: .75; }
.daily-empty { display: inline-block; width: 100%; min-width: 40px; padding: 3px 0; border-radius: 5px; background: #fafafa; color: #9ca3af; font-size: 14px; font-weight: 700; text-align: center; border: 1px dashed #d1d5db; }
.daily-empty:hover { color: var(--red); border-color: var(--red); background: #fff5f5; }
.unban-badge { display: inline-block; padding: 3px 8px; border-radius: 5px; font-size: 12px; font-weight: 700; background: #16a34a; color: #ffffff; white-space: nowrap; }
.cell-unban { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.cell-unban .unban-badge { font-size: 11px; padding: 2px 6px; }

.todo-card { margin: 0; cursor: pointer; transition: box-shadow .15s ease, transform .15s ease; }
.todo-card:hover { box-shadow: 0 4px 14px rgba(200, 16, 46, .12); transform: translateY(-2px); border-color: var(--red); }
