:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --line: #e3e8ef;
  --text: #1f2733;
  --muted: #6b7686;
  --primary: #1a6dff;
  --accent: #00a870;
  --danger: #e34d59;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 "PingFang SC", "Microsoft YaHei", -apple-system, sans-serif;
}
.hidden { display: none !important; }

/* 登录 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-card {
  width: 360px; background: var(--panel); padding: 32px; border-radius: 14px;
  box-shadow: 0 12px 32px rgba(20, 40, 80, .08);
}
.login-title { margin: 0 0 4px; font-size: 19px; text-align: center; }
.login-sub { margin: 0 0 20px; text-align: center; color: var(--muted); font-size: 13px; }
.login-err { color: var(--danger); min-height: 20px; font-size: 13px; margin: 4px 0; }
.login-tip { font-size: 12px; color: var(--muted); text-align: center; margin: 12px 0 0; }

/* 表单 */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-size: 14px; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid rgba(26,109,255,.25); border-color: var(--primary); }
.field.inline { display: inline-flex; align-items: center; gap: 6px; margin: 0 12px 10px 0; }
.field.inline > span { margin: 0; white-space: nowrap; }
.field.inline input, .field.inline select { width: auto; min-width: 130px; }

/* 按钮 */
.btn {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
  color: var(--text); cursor: pointer; font-size: 14px; transition: .15s;
}
.btn:hover { border-color: #c6d2e2; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: #0f5ae0; }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.35); color: #c9d6e8; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.icon-btn { background: none; border: 0; font-size: 16px; cursor: pointer; color: var(--muted); }

/* 布局 */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 200px; background: #17233d; color: #c9d6e8; display: flex; flex-direction: column; padding: 18px 0;
}
.brand { font-weight: 600; font-size: 16px; color: #fff; padding: 0 20px 18px; }
.menu { flex: 1; }
.menu-item { display: block; padding: 11px 20px; cursor: pointer; color: #c9d6e8; border-left: 3px solid transparent; }
.menu-item:hover { background: rgba(255,255,255,.05); }
.menu-item.active { background: rgba(26,109,255,.18); color: #fff; border-left-color: var(--primary); }
.sidebar-foot { padding: 12px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.sidebar-foot #whoami { margin-bottom: 10px; }
.content { flex: 1; padding: 22px 26px; overflow: auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-head h2 { margin: 0; font-size: 19px; }
.hint { font-size: 13px; color: var(--muted); margin-bottom: 12px; }

/* 面板 */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 15px; }
.panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.stat-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.stat-num { font-size: 28px; font-weight: 600; color: var(--primary); }
.stat-label { color: var(--muted); font-size: 13px; }

.bar-list { list-style: none; margin: 0; padding: 0; }
.bar-list li { display: flex; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.bar-list .bar-name { width: 120px; text-align: right; color: var(--muted); }
.bar-list .bar { flex: 1; height: 9px; background: #eef2f8; border-radius: 5px; overflow: hidden; }
.bar-list .bar > i { display: block; height: 100%; background: var(--primary); border-radius: 5px; }
.bar-list .bar-val { width: 42px; color: var(--text); }

/* 筛选与表格 */
.filter-bar {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 14px; display: flex; flex-wrap: wrap; align-items: center;
}
.table-wrap { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table th { background: #f7f9fc; color: var(--muted); font-weight: 500; position: sticky; top: 0; }
.table tbody tr:hover { background: #f8fbff; }
.tag { padding: 2px 8px; border-radius: 20px; font-size: 12px; background: #eef2f8; }
.tag-on { background: #e3f7ee; color: #0a7a52; }
.tag-off { background: #fdecef; color: #b3303a; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 2px; font-size: 13px; color: var(--muted); }

/* 弹窗与提示 */
.modal { position: fixed; inset: 0; background: rgba(15,25,45,.45); display: flex; align-items: center; justify-content: center; }
.modal-card { width: 520px; max-width: 92vw; max-height: 88vh; background: #fff; border-radius: 12px; display: flex; flex-direction: column; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.toast {
  position: fixed; top: 22px; left: 50%; transform: translateX(-50%);
  background: #17233d; color: #fff; padding: 10px 20px; border-radius: 8px; z-index: 99; font-size: 14px;
}
.toast.err { background: var(--danger); }
@media (max-width: 960px) {
  .panel-row, .stat-row { grid-template-columns: 1fr; }
  .sidebar { width: 62px; }
  .brand, .sidebar-foot #whoami { display: none; }
}
/* ========== 轮播图管理 ========== */
.banner-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; }
.banner-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.banner-thumb {
  position: relative; height: 130px; background: #eef2f8;
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.banner-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-thumb .ph { color: var(--muted); font-size: 13px; }
.banner-thumb .badge {
  position: absolute; top: 10px; right: 10px;
  padding: 3px 10px; border-radius: 20px; font-size: 12px; color: #fff;
}
.badge-live { background: #00a870; }
.badge-off { background: #8a94a6; }
.badge-expired { background: #e34d59; }
.banner-info { padding: 14px 16px; flex: 1; }
.banner-info h4 { margin: 0 0 8px; font-size: 15px; }
.banner-info p { margin: 0 0 10px; font-size: 13px; color: var(--muted); line-height: 1.6; }
.banner-meta { font-size: 12px; color: var(--muted); line-height: 1.9; }
.banner-ops { padding: 12px 16px; border-top: 1px solid var(--line); display: flex; gap: 8px; }

/* 弹窗内的图片上传区 */
.uploader {
  border: 2px dashed var(--line); border-radius: 10px; padding: 22px;
  text-align: center; cursor: pointer; transition: .15s; margin-bottom: 16px;
}
.uploader:hover { border-color: var(--primary); background: #f8fbff; }
.uploader img { max-width: 100%; max-height: 150px; display: block; margin: 0 auto 10px; border-radius: 8px; }
.uploader .tip { font-size: 13px; color: var(--muted); }
.color-row { display: flex; align-items: center; gap: 10px; }
.color-row input[type="color"] { width: 46px; height: 38px; padding: 2px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }

/* ===== 提报时间戳相关样式 ===== */
.mono { font-family: Menlo, Consolas, "Courier New", monospace; }
.stamp-badge {
  display: inline-block; font-size: 12px; padding: 2px 8px;
  border-radius: 10px; line-height: 1.6; white-space: nowrap;
}
.stamp-badge.ok { background: #e6f7ef; color: #00794d; }
.stamp-badge.bad { background: #ffeceb; color: #c02c22; }
.stamp-locked {
  background: #fff8e6; border-left: 3px solid #f5a623; border-radius: 4px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 13px; color: #854f0b; line-height: 1.8;
}
.stamp-locked strong { display: block; margin-bottom: 4px; font-size: 13px; }
.hint-inline { color: #8a94a6; font-size: 12px; line-height: 1.7; }

/* ===== 报表：合计行 / 空状态 / 排序表头 ===== */
.total-row td {
  background: #f4f6fa;
  font-weight: 500;
  color: #1f2733;
  border-top: 2rpx solid #c9d4e4;
  white-space: nowrap;
}
.empty-cell {
  text-align: center;
  color: #6b7686;
  padding: 32px 12px;
}
th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
th.sortable:hover { background: #eef2f8; }
th.sort-active { color: #1a6dff; }
.sort-ind { font-size: 11px; color: #1a6dff; }
select[multiple] {
  padding: 4px;
  border: 1px solid #d6dce6;
  border-radius: 4px;
  background: #fff;
}

/* ===== 紧凑多选下拉（.ms）===== */
.ms {
  position: relative;
  min-width: 190px;
  max-width: 260px;
  flex: 0 1 auto;
}
.ms-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #d6dce6;
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  color: #1f2733;
  text-align: left;
}
.ms-trigger:hover { border-color: #1a6dff; }
.ms-trigger:focus-visible {
  outline: 2px solid #1a6dff;
  outline-offset: 1px;
}
.ms.open .ms-trigger { border-color: #1a6dff; }
.ms-summary {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #6b7686;
}
.ms-summary.has-value { color: #1f2733; }
.ms-arrow {
  flex-shrink: 0;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid #8a94a6;
}
.ms.open .ms-arrow { border-top: 0; border-bottom: 5px solid #1a6dff; }

/* 下拉面板：宽度跟随触发器且不超出容器 */
.ms-panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  width: 100%;
  min-width: 100%;
  max-width: 100%;
  background: #fff;
  border: 1px solid #d6dce6;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(20, 40, 80, .12);
  overflow: hidden;
}
.ms-panel[hidden] { display: none; }
.ms-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-bottom: 1px solid #eef1f6;
  background: #fafbfd;
}
.ms-all {
  border: 1px solid #c7dbff;
  background: #eef4ff;
  color: #1a6dff;
  border-radius: 999px;
  padding: 3px 12px;
  font-size: 12px;
  cursor: pointer;
}
.ms-all:hover { background: #dbe8ff; }
.ms-all[data-state="clear"] {
  border-color: #ffd2d0;
  background: #fff1f0;
  color: #d93026;
}
.ms-count { font-size: 12px; color: #8a94a6; }
.ms-list {
  max-height: 232px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.ms-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font-size: 13px;
  color: #1f2733;
  border-bottom: 1px solid #f5f7fa;
}
.ms-opt:last-child { border-bottom: 0; }
.ms-opt:hover { background: #f4f8ff; }
.ms-opt.active { background: #eaf2ff; }
.ms-opt.disabled { color: #b6bdc9; cursor: not-allowed; }
.ms-box {
  flex-shrink: 0;
  width: 14px;
  height: 14px;
  border: 1px solid #c3ccd9;
  border-radius: 3px;
  background: #fff;
}
.ms-opt.selected .ms-box {
  background: #1a6dff;
  border-color: #1a6dff;
  position: relative;
}
.ms-opt.selected .ms-box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.ms-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ms-tag {
  flex-shrink: 0;
  font-size: 11px;
  color: #8a94a6;
  background: #f1f3f7;
  border-radius: 3px;
  padding: 1px 6px;
}

/* 窄屏适配：面板改为左对齐自适应宽度，绝不超出视口 */
@media (max-width: 900px) {
  .filter-bar { flex-wrap: wrap; }
  .ms { min-width: 160px; max-width: 100%; width: 100%; }
  .ms-panel {
    width: 100%;
    max-width: min(280px, calc(100vw - 32px));
  }
  .filter-bar .field.inline { flex: 1 1 160px; min-width: 0; }
}
.stamp-badge.warn { background: #fff3d6; color: #854f0b; }
