/* ===== 后台管理样式 ===== */
:root {
  --primary: #4f6df5;
  --primary-dark: #3b56c7;
  --primary-light: #eef1fe;
  --sidebar-bg: #1e293b;
  --sidebar-hover: #334155;
  --sidebar-active: #4f6df5;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --border: #e2e8f0;
  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
}

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

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

/* ===== 布局 ===== */
.admin-layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 220px;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.sidebar-logo {
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 1px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-nav { flex: 1; padding: 12px 0; overflow-y: auto; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 24px;
  color: #94a3b8;
  text-decoration: none;
  transition: all .2s;
  font-size: 14px;
}

.sidebar-nav a:hover { color: #fff; background: var(--sidebar-hover); }
.sidebar-nav a.active { color: #fff; background: var(--sidebar-active); }
.sidebar-nav a .icon { width: 20px; text-align: center; font-style: normal; }

.main { flex: 1; margin-left: 220px; }

.topbar {
  height: 60px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}

.topbar h1 { font-size: 17px; font-weight: 600; }
.topbar .user-area { display: flex; align-items: center; gap: 12px; }
.topbar .btn-logout {
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 6px;
  transition: all .2s;
  font-size: 13px;
}
.topbar .btn-logout:hover { background: var(--danger); color: #fff; }

.content { padding: 24px; }

/* ===== 卡片 ===== */
.card {
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.02);
  border: 1px solid var(--border);
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 20px; }

/* ===== 统计卡片 ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.stat-card .label { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.stat-card .value { font-size: 28px; font-weight: 700; color: var(--text-main); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.primary { color: var(--primary); }

/* ===== 表单 ===== */
.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
}
.form-row .label {
  width: 140px;
  flex-shrink: 0;
  text-align: right;
  color: var(--text-muted);
  font-size: 13px;
}
.form-row .control { flex: 1; }
.form-row .hint { color: var(--text-light); font-size: 12px; margin-top: 4px; }

.form-section {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.form-section-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.form-section-title .badge {
  font-size: 11px;
  font-weight: 400;
  padding: 2px 8px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
}

/* ===== 按钮 ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  transition: all .2s;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--text-main); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .9; }
.btn-sm { padding: 4px 12px; font-size: 12px; }

/* ===== 表格 ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-main);
}
.data-table tr:hover td { background: #f8fafc; }
.data-table .mono { font-family: "SF Mono", Consolas, monospace; font-size: 12px; }
.data-table .truncate {
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== 状态标签 ===== */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
}
.tag-success { background: #dcfce7; color: #16a34a; }
.tag-danger { background: #fee2e2; color: #dc2626; }
.tag-muted { background: #f1f5f9; color: #64748b; }

/* ===== 分页 ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
}
.pagination .info { color: var(--text-muted); font-size: 13px; }
.pagination .pages { display: flex; gap: 4px; }
.pagination .pages a {
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--text-main);
  font-size: 13px;
  border: 1px solid var(--border);
  background: #fff;
  transition: all .2s;
}
.pagination .pages a:hover { border-color: var(--primary); color: var(--primary); }
.pagination .pages a.current { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .pages a.disabled { color: var(--text-light); cursor: not-allowed; }

/* ===== 筛选栏 ===== */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-bar .field { display: flex; flex-direction: column; gap: 4px; }
.filter-bar .field label { font-size: 12px; color: var(--text-muted); }
.filter-bar input, .filter-bar select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--primary); }

/* ===== 登录页 ===== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}
.login-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
}
.login-card .icon-wrap {
  width: 64px; height: 64px;
  margin: 0 auto 20px;
  background: var(--primary-light);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}
.login-card h2 { text-align: center; font-size: 20px; margin-bottom: 6px; }
.login-card .subtitle { text-align: center; color: var(--text-muted); font-size: 13px; margin-bottom: 28px; }
.login-card .input-group { margin-bottom: 18px; }
.login-card .input-group label { display: block; font-size: 13px; color: var(--text-muted); margin-bottom: 6px; }
.login-card .input-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
  font-family: inherit;
}
.login-card .input-group input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }
.login-card .btn-login {
  width: 100%;
  padding: 12px;
  font-size: 15px;
  margin-top: 6px;
}

/* ===== 通道卡片 ===== */
.channel-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}
.channel-block-header {
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
}
.channel-block-header .title { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.channel-block-header .actions { display: flex; gap: 6px; flex-shrink: 0; }
.channel-block-header .channel-urls {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 24px;
  min-width: 0;
  font-size: 12px;
}
.channel-block-header .channel-urls .url-item {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.channel-block-header .channel-urls .url-label {
  color: var(--text-light);
  white-space: nowrap;
  flex-shrink: 0;
}
.channel-block-header .channel-urls .url-value {
  color: var(--text-muted);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-block-body { padding: 0; }

/* ===== 开关 ===== */
.switch {
  position: relative;
  display: inline-block;
  width: 40px; height: 22px;
}
.switch input { display: none; }
.switch .slider {
  position: absolute;
  inset: 0;
  background: #cbd5e1;
  border-radius: 22px;
  cursor: pointer;
  transition: .3s;
}
.switch .slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  left: 2px; bottom: 2px;
  background: #fff;
  border-radius: 50%;
  transition: .3s;
}
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* ===== 通用工具类 ===== */
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.items-center { align-items: center; }
