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

:root {
  --primary: #0052d9;
  --primary-dark: #003cab;
  --primary-light: #e8f1ff;
  --bg: #f5f6f8;
  --card: #ffffff;
  --text: #1f2329;
  --text2: #646a73;
  --text3: #8f959e;
  --border: #e5e6eb;
  --input-bg: #f2f3f5;
  --danger: #d54941;
  --success: #2ba471;
  --radius: 8px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ---------- 登录 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  position: relative; overflow: hidden;
  background:
    radial-gradient(900px 500px at 12% 0%, rgba(0,82,217,.07) 0%, transparent 55%),
    radial-gradient(800px 500px at 95% 100%, rgba(0,82,217,.06) 0%, transparent 50%),
    linear-gradient(180deg, #f8fafc 0%, #eef2f8 100%);
}
.login-card {
  position: relative; z-index: 1;
  width: 400px; max-width: 92vw;
  background: #fff;
  border: 1px solid #eef0f3;
  border-radius: 12px;
  padding: 44px 40px 36px;
  box-shadow: 0 8px 32px rgba(31,35,41,.08), 0 1px 4px rgba(31,35,41,.04);
  text-align: center;
  animation: cardIn .45s cubic-bezier(.22,1,.36,1);
}
@keyframes cardIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.login-logo {
  width: 60px; height: 60px; margin: 0 auto 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0052d9, #3d7eff);
  box-shadow: 0 8px 20px rgba(0,82,217,.28);
  color: #fff; font-size: 28px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 21px; margin-bottom: 6px; letter-spacing: .5px; font-weight: 600; }
.login-sub { color: var(--text3); margin-bottom: 28px; font-size: 13px; }
.login-card .field { text-align: left; margin-bottom: 16px; }
.input-icon { position: relative; }
.input-icon > span {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  font-size: 14px; opacity: .5; pointer-events: none; line-height: 1;
}
.input-icon .input { padding-left: 38px; height: 42px; }
.login-card .btn-block {
  height: 44px; margin-top: 4px;
  font-size: 15px; font-weight: 600; letter-spacing: 6px; text-indent: 6px;
  border-radius: 6px;
}
.login-foot {
  position: relative; z-index: 1; margin-top: 24px;
  color: var(--text3); font-size: 12px; letter-spacing: 2px;
}

/* ---------- 顶栏 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; justify-content: space-between;
}
.brand { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.brand-icon {
  width: 28px; height: 28px; border-radius: 6px;
  background: linear-gradient(135deg, var(--primary), #3d7eff);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 14px;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }
.whoami { color: var(--text2); font-size: 13px; }

/* ---------- 布局 ---------- */
.container { max-width: 1100px; margin: 0 auto; padding: 20px; }

.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  margin-bottom: 14px;
}
.stat-card {
  background: var(--card); border-radius: var(--radius);
  padding: 18px;
  border: 1px solid #eef0f3;
  box-shadow: 0 1px 3px rgba(31,35,41,.04);
  transition: box-shadow .2s;
}
.stat-card:hover { box-shadow: 0 4px 14px rgba(31,35,41,.08); }
.stat-accent {
  background: linear-gradient(135deg, var(--primary), #3d7eff);
  border-color: transparent; color: #fff;
}
.stat-accent .stat-label, .stat-accent .stat-extra { color: rgba(255,255,255,.82); }
.stat-label { font-size: 12px; color: var(--text2); margin-bottom: 8px; }
.stat-value { font-size: 24px; font-weight: 600; letter-spacing: -.3px; font-variant-numeric: tabular-nums; }
.stat-extra { font-size: 12px; color: var(--text3); margin-top: 8px; }

.card {
  background: var(--card); border-radius: var(--radius);
  border: 1px solid #eef0f3;
  box-shadow: 0 1px 3px rgba(31,35,41,.04);
  padding: 20px; margin-bottom: 14px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 14px;
}
.card-title { font-size: 15px; font-weight: 600; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- 图表 ---------- */
.chart {
  display: flex; align-items: flex-end; gap: 18px;
  height: 180px; padding: 10px 6px 0;
}
.chart-col {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; height: 100%; gap: 6px;
}
.chart-bar {
  width: 100%; max-width: 52px;
  background: linear-gradient(180deg, #66a1ff, var(--primary));
  border-radius: 4px 4px 2px 2px;
  min-height: 3px;
  transition: height .4s ease;
}
.chart-sum { font-size: 12px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.chart-ym { font-size: 12px; color: var(--text2); }
.chart-count { font-size: 11px; color: var(--text3); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12px; color: var(--text2); font-weight: 500;
  padding: 10px 12px; background: #f7f8fa;
  white-space: nowrap;
}
.table th:first-child { border-radius: 6px 0 0 6px; }
.table th:last-child { border-radius: 0 6px 6px 0; }
.table td {
  padding: 12px; border-bottom: 1px solid #f2f3f5;
  vertical-align: middle; font-size: 13px;
}
.table tbody tr:hover { background: #f7f9fc; }
.table tbody tr:last-child td { border-bottom: none; }
.td-amount { font-weight: 600; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.td-time { color: var(--text2); white-space: nowrap; }
.td-orderno {
  font-family: ui-monospace, Consolas, monospace; font-size: 12px;
  color: var(--text3); max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.video-cell { display: flex; align-items: center; gap: 10px; min-width: 260px; }
.video-cover {
  width: 64px; height: 42px; border-radius: 4px; object-fit: cover;
  background: var(--input-bg); flex-shrink: 0; display: block;
}
.video-cover.placeholder { display: flex; align-items: center; justify-content: center; color: var(--text3); font-size: 16px; }
.video-info { min-width: 0; }
.video-title {
  max-width: 420px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 13px;
}
.video-meta { font-size: 12px; color: var(--text2); margin-top: 4px; display: flex; gap: 8px; align-items: center; }
.video-link { color: var(--primary); text-decoration: none; }
.video-link:hover { text-decoration: underline; }
.badge-author {
  background: var(--primary-light); color: var(--primary);
  border-radius: 3px; padding: 1px 6px; font-size: 11px;
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.note-text { color: var(--text3); font-size: 12px; margin-top: 2px; }

.empty { text-align: center; color: var(--text3); padding: 48px 0; font-size: 13px; }

.pager {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 12px; padding-top: 14px;
}
.pg-info { color: var(--text2); font-size: 13px; }

/* ---------- 按钮 / 表单 ---------- */
.btn {
  border: none; border-radius: 4px; cursor: pointer;
  font-size: 13px; padding: 8px 16px;
  transition: all .15s;
  font-family: inherit; line-height: 1.4;
}
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-block { width: 100%; padding: 11px; font-size: 14px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: #94b8f0; cursor: not-allowed; }
.btn-ghost { background: var(--input-bg); color: var(--text); }
.btn-ghost:hover { background: var(--border); }
.btn-danger-ghost { background: #fdeceb; color: var(--danger); }
.btn-danger-ghost:hover { background: #fbd9d7; }

.input {
  width: 100%;
  border: 1px solid transparent; border-radius: 4px;
  padding: 8px 12px; font-size: 13px;
  outline: none; font-family: inherit;
  background: var(--input-bg); color: var(--text);
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.input:hover { background: #e8eaee; }
.input:focus {
  background: #fff; border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0,82,217,.12);
}
.input-sm { width: auto; padding: 6px 10px; font-size: 12px; }
textarea.input { resize: vertical; }
select.input { cursor: pointer; }

.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; color: var(--text2);
  margin-bottom: 6px;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.form-err {
  background: #fdeceb; color: var(--danger);
  border-radius: 4px; padding: 9px 12px;
  font-size: 12px; margin-bottom: 12px;
}

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(31,35,41,.45);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 6vh 16px;
  overflow-y: auto;
}
.modal {
  width: 560px; max-width: 100%;
  background: #fff; border-radius: 10px;
  box-shadow: 0 16px 48px rgba(31,35,41,.18);
  animation: pop .18s ease;
}
.modal-sm { width: 380px; }
@keyframes pop { from { transform: scale(.97); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #f2f3f5;
  font-size: 15px; font-weight: 600;
}
.modal-x {
  border: none; background: none; font-size: 20px;
  color: var(--text3); cursor: pointer; line-height: 1;
}
.modal-x:hover { color: var(--text); }
.modal-body { padding: 18px 20px 6px; }
.modal-foot {
  padding: 14px 20px; display: flex; justify-content: flex-end; gap: 10px;
  border-top: 1px solid #f2f3f5;
}

.url-actions { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.parse-status { font-size: 12px; color: var(--text2); }
.parse-status.ok { color: var(--success); }
.parse-status.fail { color: var(--danger); }

.preview {
  display: flex; gap: 12px;
  background: #f7f8fa; border: 1px solid var(--border);
  border-radius: 6px; padding: 12px; margin-bottom: 14px;
}
.pv-cover {
  width: 120px; height: 80px; border-radius: 4px; object-fit: cover;
  background: var(--input-bg); flex-shrink: 0;
}
.pv-right { flex: 1; min-width: 0; }
.pv-right .field { margin-bottom: 10px; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: #1f2329; color: #fff;
  padding: 10px 20px; border-radius: 6px;
  font-size: 13px; z-index: 200;
  box-shadow: 0 8px 24px rgba(31,35,41,.22);
  animation: pop .2s ease;
}

/* ---------- 顶栏 Tab ---------- */
.tabs { display: flex; gap: 4px; margin-left: 24px; }
.tab {
  border: none; background: none; cursor: pointer;
  font-size: 14px; color: var(--text2);
  padding: 7px 14px; border-radius: 4px;
  font-family: inherit;
}
.tab:hover { color: var(--text); background: var(--input-bg); }
.tab.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }

/* ---------- 徽章 / 状态 ---------- */
.badge-owner {
  background: var(--input-bg); color: var(--text2);
  border-radius: 3px; padding: 2px 8px; font-size: 12px;
}
.badge-role {
  font-size: 11px; border-radius: 3px; padding: 1px 6px;
  background: var(--input-bg); color: var(--text2); margin-left: 6px; vertical-align: middle;
}
.badge-role.badge-admin { background: var(--primary-light); color: var(--primary); }
.you-tag { font-size: 11px; color: var(--text3); }
.status-on { color: var(--success); font-size: 12px; }
.status-off { color: var(--danger); font-size: 12px; }
.muted { color: var(--text3); font-size: 11px; }
.ops { display: flex; gap: 4px; flex-wrap: wrap; }
.ops .btn { padding: 4px 8px; font-size: 11px; }
.td-owner { white-space: nowrap; }
.td-author { white-space: nowrap; }

/* ---------- 响应式 ---------- */
@media (max-width: 860px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .video-title { max-width: 200px; }
  .tabs { margin-left: 0; }
}
