/* =========================================================
   管理后台样式
   ========================================================= */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --dark: #0f172a;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f1f5f9;
  --radius: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body.admin-body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

/* ---------- 布局 ---------- */
.admin-body { display: flex; min-height: 100vh; }
.side {
  width: 228px;
  flex-shrink: 0;
  background: #03162c; /* 与 Logo 背景色一致，mix-blend-mode: screen 下无缝 */
  color: #94a3b8;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

/* ---------- 侧栏 ---------- */
.side-brand {
  display: flex;
  align-items: center;
  padding: 18px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.side-brand .brand-logo { height: 30px; width: auto; }
.side-brand strong { display: block; color: #fff; font-size: 15px; line-height: 1.3; }
.side-brand span { font-size: 12px; opacity: .7; }
.side-nav { padding: 14px 12px; flex: 1; }
.side-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  margin-bottom: 4px;
  transition: background .2s, color .2s;
}
.side-nav a svg { width: 17px; height: 17px; }
.side-nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.side-nav a.active { background: var(--primary); color: #fff; }
.badge {
  margin-left: auto;
  background: #ef4444;
  color: #fff;
  font-size: 11.5px;
  font-style: normal;
  border-radius: 999px;
  padding: 1px 7px;
  line-height: 1.5;
}
.side-foot { padding: 14px 18px; border-top: 1px solid rgba(255, 255, 255, .08); font-size: 13.5px; }
.side-foot a { display: block; padding: 5px 0; opacity: .8; }
.side-foot a:hover { opacity: 1; color: #fff; }

/* ---------- 顶栏 / 内容 ---------- */
.topbar {
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 16px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar h1 { font-size: 18px; color: var(--dark); }
.admin-user { font-size: 13.5px; color: var(--muted); }
.content { padding: 26px 28px 48px; }

/* ---------- 卡片 / 面板 ---------- */
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin-bottom: 22px;
}
.panel h2 { font-size: 16px; color: var(--dark); margin-bottom: 16px; padding-left: 10px; border-left: 4px solid var(--primary); }
.panel-tip { font-size: 13px; color: var(--muted); margin-bottom: 16px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-block;
  padding: 9px 20px;
  border-radius: 9px;
  font-size: 14.5px;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all .2s;
  font-family: inherit;
  line-height: 1.5;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: #fff; border-color: #cbd5e1; color: var(--text); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: #fef2f2; color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-sm { padding: 5px 12px; font-size: 13px; border-radius: 7px; }
.btn-block { width: 100%; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 13px; background: #f8fafc; white-space: nowrap; }
tr:hover td { background: #fafcff; }
.table-thumb { width: 64px; height: 42px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #f1f5f9; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 14px; font-weight: 600; color: var(--dark); margin-bottom: 6px; }
.form-row label em { color: #e63946; font-style: normal; }
.form-row .tip { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
input[type="text"], input[type="password"], input[type="number"], textarea, select {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-size: 14.5px;
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}
textarea { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.check-line { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.check-line input { width: auto; }
.form-actions { margin-top: 8px; display: flex; gap: 12px; align-items: center; }
.inline-input { width: 90px !important; }

/* ---------- 图片 ---------- */
.img-preview {
  margin-top: 8px;
  max-width: 340px;
  border-radius: 10px;
  border: 1px solid var(--line);
}
.file-label {
  display: inline-block;
  padding: 9px 18px;
  background: #fff;
  border: 1px dashed #94a3b8;
  border-radius: 9px;
  font-size: 14px;
  cursor: pointer;
  color: var(--muted);
}
.file-label:hover { border-color: var(--primary); color: var(--primary); }
input[type="file"] { display: none; }

/* ---------- 标签状态 ---------- */
.tag-on { color: #047857; background: #ecfdf5; border-radius: 6px; padding: 2px 9px; font-size: 12.5px; }
.tag-off { color: #9a3412; background: #fff7ed; border-radius: 6px; padding: 2px 9px; font-size: 12.5px; }
.tag-unread { color: #1d4ed8; font-weight: 700; }

/* 通用标签 */
.tag { display: inline-block; border-radius: 6px; padding: 2px 9px; font-size: 12.5px; white-space: nowrap; }
.tag-green { color: #047857; background: #ecfdf5; }
.tag-blue  { color: #1d4ed8; background: #eff6ff; }
.tag-red   { color: #b91c1c; background: #fef2f2; }
.tag-gray  { color: #64748b; background: #f1f5f9; }
.tag-orange{ color: #9a3412; background: #fff7ed; }

.msg-content { white-space: pre-wrap; word-break: break-all; }

/* ---------- 提示 ---------- */
.alert { border-radius: 10px; padding: 12px 16px; font-size: 14px; margin-bottom: 18px; }
.alert-success { background: #ecfdf5; color: #047857; border: 1px solid #a7f3d0; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }
.alert-warn { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }

/* ---------- 面板头部 / 工具条 ---------- */
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.panel-title { font-size: 16px; color: var(--dark); margin: 0; padding-left: 10px; border-left: 4px solid var(--primary); }
.head-ops { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.filter-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-bar input[type="text"], .filter-bar select {
  padding: 7px 11px; border: 1px solid #dbe4ef; border-radius: 8px;
  font-size: 13.5px; color: var(--dark); background: #fff; outline: none; min-width: 0;
}
.filter-bar input[type="text"] { width: 170px; }
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--primary); }

/* ---------- 表格补充 ---------- */
.nowrap { white-space: nowrap; }
.empty {
  padding: 40px 20px; text-align: center; color: var(--muted);
  font-size: 14px; background: #f8fafc; border: 1px dashed #dbe4ef; border-radius: 10px;
}
.text-red { color: #dc2626; }
.ok-text { color: #047857; }
.off-text { color: #b45309; }
.warn-text { color: #b45309; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 18px; }
.pager a, .pager span.current, .pager span.disabled {
  display: inline-block; min-width: 34px; padding: 6px 10px; text-align: center;
  border: 1px solid #dbe4ef; border-radius: 8px; font-size: 13.5px;
  color: var(--dark); background: #fff; text-decoration: none;
}
.pager a:hover { border-color: var(--primary); color: var(--primary); }
.pager span.current { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 600; }
.pager span.disabled { color: #c3cddb; background: #f8fafc; }
.pager .pager-info { margin-left: auto; font-size: 13px; color: var(--muted); border: 0; background: none; }

/* ---------- 操作日志 / 角色标签 ---------- */
.role-tag {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600; letter-spacing: .3px;
}
.role-super { background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #fff; }
.role-editor { background: #e0f2fe; color: #0369a1; }

.perm-note {
  margin-top: 14px; padding: 11px 14px; border-radius: 9px;
  background: #f6f9fc; border-left: 3px solid var(--primary);
  font-size: 13px; color: var(--muted); line-height: 1.75;
}
.perm-note code { background: #e8eef6; padding: 1px 6px; border-radius: 5px; color: #0f2540; font-size: 12.5px; }

/* 权限说明面板 */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.perm-card { border: 1px solid #e6eef7; border-radius: 11px; padding: 15px 17px; background: #fbfdff; }
.perm-card h4 { font-size: 14px; color: var(--dark); margin-bottom: 10px; }
.perm-card ul { list-style: none; padding: 0; margin: 0; }
.perm-card li { font-size: 13px; color: var(--muted); padding: 3px 0 3px 18px; position: relative; }
.perm-card li::before { content: '✓'; position: absolute; left: 0; color: #10b981; font-weight: 700; }

/* ---------- 仪表盘：统计卡片 ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  display: flex; align-items: center; gap: 14px; padding: 18px;
  background: #fff; border: 1px solid #e6eef7; border-radius: 13px;
  text-decoration: none; transition: all .18s;
}
.stat-card:hover { border-color: var(--primary); box-shadow: 0 8px 22px rgba(14, 165, 233, .12); transform: translateY(-2px); }
.stat-ico {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 12px;
  background: linear-gradient(135deg, #e0f2fe, #dbeafe);
  display: flex; align-items: center; justify-content: center; color: #0369a1;
}
.stat-ico svg { width: 22px; height: 22px; }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-num { font-size: 24px; font-weight: 700; color: var(--dark); line-height: 1.15; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 1px; }
.stat-sub { font-size: 12px; color: #94a3b8; margin-top: 3px; }

/* ---------- 仪表盘：两栏 ---------- */
.grid-2col { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; }
@media (max-width: 1000px) { .grid-2col { grid-template-columns: 1fr; } }

/* ---------- 仪表盘：趋势柱状 ---------- */
.trend-chart { display: flex; align-items: flex-end; gap: 5px; height: 190px; padding: 10px 2px 0; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; min-width: 0; }
.trend-bar {
  width: 100%; max-width: 34px; border-radius: 5px 5px 0 0;
  background: linear-gradient(180deg, #38bdf8, #0284c7);
  display: flex; align-items: flex-start; justify-content: center;
  position: relative; transition: background .18s; min-height: 3px;
}
.trend-col:hover .trend-bar { background: linear-gradient(180deg, #0ea5e9, #075985); }
.trend-pv { font-size: 10.5px; color: #eaf6ff; padding-top: 2px; font-weight: 600; }
.trend-label { font-size: 10.5px; color: var(--muted); margin-top: 6px; white-space: nowrap; }

/* ---------- 仪表盘：系统状态 ---------- */
.status-list { list-style: none; padding: 0; margin: 0; }
.status-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed #eef3f9; font-size: 13.5px; }
.status-list li:last-child { border-bottom: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; }
.status-dot.is-ok { background: #10b981; box-shadow: 0 0 0 3px rgba(16, 185, 129, .16); }
.status-dot.is-warn { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, .16); }
.status-name { color: var(--dark); }
.status-val { margin-left: auto; font-weight: 600; }

/* ---------- 校验码输入（二次验证） ---------- */
.login-badge {
  display: inline-block; margin: 0 auto 14px; padding: 4px 12px; border-radius: 20px;
  background: #e0f2fe; color: #0369a1; font-size: 12.5px; font-weight: 600;
}
.code-input {
  width: 100%; padding: 14px; text-align: center; letter-spacing: 12px;
  font-size: 26px; font-weight: 700; color: var(--dark);
  border: 2px solid #dbe4ef; border-radius: 11px; outline: none;
  font-family: ui-monospace, Menlo, Consolas, monospace;
}
.code-input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(14, 165, 233, .12); }
.login-ops { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; font-size: 13px; }
.login-ops .dot { color: #cbd5e1; }
.link-btn { background: none; border: 0; padding: 0; color: var(--primary); font-size: 13px; cursor: pointer; font-family: inherit; }
.link-btn:hover { text-decoration: underline; }

/* ---------- 管理员/账号 ---------- */
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: 0 0 32px;
  background: linear-gradient(135deg, #0ea5e9, #2563eb); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13.5px; font-weight: 700; text-transform: uppercase;
}
.user-meta { display: flex; flex-direction: column; min-width: 0; }
.user-meta small { color: var(--muted); font-size: 12px; }

/* ---------- 其它 ---------- */
.switch-row { display: flex; align-items: center; gap: 10px; }
.muted-sm { font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.inline-form { display: inline; }
.w-100 { width: 100%; }


/* ---------- 登录页 ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(600px 300px at 85% 15%, rgba(56, 189, 248, .25), transparent),
    linear-gradient(135deg, #0b1b33, #142c55);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 16px;
  padding: 36px 32px;
  box-shadow: 0 24px 70px rgba(2, 8, 20, .45);
}
.login-card .login-logo { display: block; margin: 0 auto 12px; height: 60px; width: auto; mix-blend-mode: normal; border-radius: 10px; }
.login-card h1 { text-align: center; font-size: 20px; color: var(--dark); margin-bottom: 4px; }
.login-card .login-sub { text-align: center; font-size: 13px; color: var(--muted); margin-bottom: 24px; }
.login-card .form-row { margin-bottom: 14px; }
.login-card .btn { margin-top: 8px; }
.login-foot { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 18px; }
.login-foot a { color: var(--primary); }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .admin-body { display: block; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; flex-wrap: wrap; }
  .side-brand { border-bottom: 0; }
  .side-nav { display: flex; padding: 8px; flex: 1; }
  .side-nav a { margin-bottom: 0; padding: 8px 12px; }
  .side-foot { border-top: 0; display: flex; gap: 14px; }
  .content { padding: 18px 14px 40px; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { padding: 13px 14px; }
}

/* ---------- 标签页 ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; background: #fff;
  border: 1px solid #e6eef7; border-radius: 12px; padding: 6px; }
.tab { padding: 9px 18px; border-radius: 9px; font-size: 14px; color: var(--muted); text-decoration: none; transition: all .16s; }
.tab:hover { background: #f1f7ff; color: var(--primary); }
.tab.active { background: var(--primary); color: #fff; font-weight: 600; }

/* ---------- 品牌图片预览 ---------- */
.brand-preview {
  margin-top: 12px; padding: 16px; border-radius: 10px; text-align: center;
  background: #03162c;
  background-image:
    linear-gradient(45deg, rgba(255,255,255,.045) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.045) 75%),
    linear-gradient(45deg, rgba(255,255,255,.045) 25%, transparent 25%, transparent 75%, rgba(255,255,255,.045) 75%);
  background-size: 18px 18px; background-position: 0 0, 9px 9px;
}
.brand-preview img { max-height: 64px; max-width: 100%; width: auto; }
.brand-preview-sm img { max-height: 48px; }

/* ---------- 媒体库 ---------- */
.upload-drop { margin-bottom: 20px; }
.drop-inner {
  display: flex; align-items: center; gap: 16px; padding: 22px 24px; cursor: pointer;
  border: 2px dashed #c9d9ec; border-radius: 13px; background: #f8fbff; transition: all .18s;
}
.drop-inner:hover { border-color: var(--primary); background: #f0f7ff; }
.drop-ico {
  flex: 0 0 46px; width: 46px; height: 46px; border-radius: 12px;
  background: #e0edff; color: var(--primary); font-size: 22px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.drop-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.drop-text strong { font-size: 15px; color: var(--dark); }
.drop-text span { font-size: 12.5px; color: var(--muted); }
.upload-drop input[type="file"] { display: none; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 15px; }
.media-item { border: 1px solid #e6eef7; border-radius: 12px; overflow: hidden; background: #fff; transition: all .18s; }
.media-item:hover { border-color: #bcd8f7; box-shadow: 0 8px 20px rgba(37, 99, 235, .1); }
.media-thumb {
  height: 132px; background: #f4f7fb; display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.media-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.media-broken { font-size: 12.5px; color: #b91c1c; }
.media-info { padding: 10px 12px 6px; }
.media-name { display: block; font-size: 13px; color: var(--dark); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta { display: block; font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.media-ops { display: flex; gap: 7px; padding: 8px 12px 12px; }

/* ---------- 访问统计 ---------- */
.stat-card .stat-sub { font-size: 12px; color: #94a3b8; margin-top: 4px; }
.stat-card .stat-sub .up   { color: #e11d48; font-weight: 600; }
.stat-card .stat-sub .down { color: #059669; font-weight: 600; }

.trend-bar-wrap {
  width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center;
}
.trend-col .trend-bar { max-width: 34px; }

/* 迷你占比条 */
.mini-bar { width: 100%; height: 7px; background: #eef3f9; border-radius: 4px; overflow: hidden; }
.mini-bar span { display: block; height: 100%; background: linear-gradient(90deg, #38bdf8, #0284c7); border-radius: 4px; }

/* 时段分布 */
.hour-chart { display: flex; align-items: flex-end; gap: 3px; height: 140px; padding: 10px 2px 0; }
.hour-col { flex: 1; display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; min-width: 0; }
.hour-bar-wrap { width: 100%; flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.hour-bar { width: 100%; max-width: 20px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, #7dd3fc, #0ea5e9); min-height: 2px; transition: background .18s; }
.hour-col:hover .hour-bar { background: linear-gradient(180deg, #38bdf8, #0369a1); }
.hour-x { font-size: 9.5px; color: var(--muted); margin-top: 4px; }

/* 紧凑表格 */
.data-table-sm th, .data-table-sm td { padding: 7px 9px; font-size: 13px; }
.ellipsis { max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 数据维护提示列表 */
.tip-list { margin: 8px 0 0; padding-left: 18px; }
.tip-list li { font-size: 13.5px; color: #475569; line-height: 2; }

/* 恢复确认弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(3, 22, 44, .55); z-index: 9999;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-box {
  background: #fff; border-radius: 12px; padding: 24px 26px; width: 100%; max-width: 440px;
  box-shadow: 0 24px 60px rgba(3, 22, 44, .3);
}
.modal-box h3 { margin: 0 0 12px; color: var(--dark); font-size: 17px; }
.modal-box p { font-size: 13.5px; color: #475569; margin: 0 0 10px; line-height: 1.7; }
.modal-box input[type="text"] {
  width: 100%; padding: 9px 12px; border: 1px solid #d7e2ee; border-radius: 8px; font-size: 14px;
  box-sizing: border-box; margin-bottom: 12px;
}
.modal-box input[type="text"]:focus { outline: none; border-color: #38bdf8; box-shadow: 0 0 0 3px rgba(56, 189, 248, .15); }
