:root {
  --primary: #2878ff;
  --primary-light: #4d94ff;
  --primary-dark: #1a5cdb;
  --primary-bg: #e8f0ff;
  --success: #34c759;
  --warning: #ff9f0a;
  --danger: #ff3b30;
  --text-1: #1a1a1a;
  --text-2: #555;
  --text-3: #888;
  --text-4: #b0b0b0;
  --border: #e8e8e8;
  --bg-page: #f5f6f8;
  --bg-card: #fff;
  --bg-hover: #f0f4ff;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.1);
  --sidebar-w: 200px;
  --header-h: 52px;
}

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

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

/* Layout */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  background: #1a2233;
  color: #fff;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar-logo {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 600;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  gap: 8px;
}
.sidebar-logo .logo-icon {
  width: 28px; height: 28px;
  background: var(--primary);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: #fff;
}
.sidebar-nav { flex: 1; padding: 8px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all 0.15s;
  font-size: 13px;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,0.08); }
.nav-item.active {
  color: #fff;
  background: rgba(40,120,255,0.15);
  border-left-color: var(--primary);
}
.nav-item .nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.main-area {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  height: var(--header-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title { font-size: 15px; font-weight: 600; flex: 1; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-user {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.topbar-user:hover { background: var(--bg-page); }
.topbar-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.notif-bell {
  position: relative;
  cursor: pointer;
  font-size: 18px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.notif-bell:hover { background: var(--bg-page); }
.notif-bell .dot {
  position: absolute;
  top: 2px; right: 4px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 1.5px solid #fff;
}

.page-content { flex: 1; padding: 20px; overflow-y: auto; }

/* Card */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 16px 20px; }

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow 0.2s;
}
.stat-card:hover { box-shadow: var(--shadow-lg); }
.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.stat-icon.blue { background: #e8f0ff; color: var(--primary); }
.stat-icon.green { background: #e8f9ee; color: var(--success); }
.stat-icon.orange { background: #fff5e6; color: var(--warning); }
.stat-icon.red { background: #ffeaea; color: var(--danger); }
.stat-info { flex: 1; min-width: 0; }
.stat-value { font-size: 24px; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Table */
.table-wrap { overflow-x: auto; }
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  background: #fafafa;
  color: var(--text-3);
  font-weight: 500;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.data-table tr:hover td { background: #fafcff; }
.data-table tr:last-child td { border-bottom: none; }

/* Tags / Badges */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}
.tag-blue { background: #e8f0ff; color: var(--primary); }
.tag-green { background: #e8f9ee; color: var(--success); }
.tag-orange { background: #fff5e6; color: var(--warning); }
.tag-red { background: #ffeaea; color: var(--danger); }
.tag-gray { background: #f0f0f0; color: var(--text-3); }
.tag-purple { background: #f0e8ff; color: #7c3aed; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: none;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-default { background: #f0f0f0; color: var(--text-2); }
.btn-default:hover { background: #e4e4e4; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-text { background: none; color: var(--primary); padding: 2px 6px; }
.btn-text:hover { background: var(--primary-bg); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { opacity: 0.9; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: 0.9; }

/* Form */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: var(--text-2); margin-bottom: 4px; font-weight: 500; }
.form-label .req { color: var(--danger); }
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  transition: border-color 0.15s;
  background: #fff;
  color: var(--text-1);
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(40,120,255,0.1);
}
.form-textarea { resize: vertical; min-height: 60px; }

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff;
  border-radius: var(--radius);
  width: 520px;
  max-width: 90vw;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slideUp 0.2s;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { cursor: pointer; font-size: 20px; color: var(--text-3); background: none; border: none; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* Filter bar */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-bar .form-input, .filter-bar .form-select { width: auto; min-width: 140px; }

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-4);
  font-size: 13px;
}
.empty .empty-icon { font-size: 36px; margin-bottom: 8px; }

/* Timeline */
.timeline { padding: 0; list-style: none; }
.timeline-item {
  display: flex;
  gap: 12px;
  padding-bottom: 16px;
  position: relative;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: '';
  position: absolute;
  left: 7px;
  top: 18px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-item:last-child::before { display: none; }
.timeline-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--primary);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
  flex-shrink: 0;
  margin-top: 2px;
  z-index: 1;
}
.timeline-dot.done { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-content { flex: 1; }
.timeline-title { font-size: 13px; font-weight: 500; }
.timeline-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }

/* Toast */
.toast-container {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  background: #fff;
  border-radius: var(--radius);
  padding: 10px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-width: 240px;
  animation: slideIn 0.2s;
  border-left: 3px solid var(--primary);
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }

/* Progress steps */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin: 16px 0;
}
.step {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-3);
}
.step-num {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  background: #f0f0f0;
  color: var(--text-3);
}
.step.active .step-num { background: var(--primary); color: #fff; }
.step.done .step-num { background: var(--success); color: #fff; }
.step.active { color: var(--primary); font-weight: 500; }
.step-line {
  flex: 1;
  height: 2px;
  background: #f0f0f0;
  margin: 0 8px;
  min-width: 20px;
}
.step-line.done { background: var(--success); }

/* Notification list */
.notif-item {
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  cursor: pointer;
  transition: background 0.15s;
}
.notif-item:hover { background: #fafcff; }
.notif-item.unread { background: #f0f6ff; }
.notif-item.unread:hover { background: #e8f0ff; }
.notif-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}
.notif-content { flex: 1; min-width: 0; }
.notif-title { font-size: 13px; font-weight: 500; }
.notif-text { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.notif-time { font-size: 11px; color: var(--text-4); margin-top: 4px; }

/* Misc */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-warning { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-3); }
.font-bold { font-weight: 600; }
.font-sm { font-size: 12px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.cursor-pointer { cursor: pointer; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.no-data { color: var(--text-4); text-align: center; padding: 20px; font-size: 13px; }

/* QR code mock */
.qr-mock {
  width: 180px; height: 180px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  margin: 0 auto;
  position: relative;
}
.qr-mock .qr-pattern {
  width: 140px; height: 140px;
  background-image:
    linear-gradient(45deg, #000 25%, transparent 25%),
    linear-gradient(-45deg, #000 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #000 75%),
    linear-gradient(-45deg, transparent 75%, #000 75%);
  background-size: 14px 14px;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0px;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.2s; }
  .sidebar.show { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
}

/* Phase 2: 渠道管理 + 登录 */

/* 侧边栏底部 */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
}
.sidebar-footer .btn { width: 100%; color: #aaa; border-color: rgba(255,255,255,0.15); background: transparent; }
.sidebar-footer .btn:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* 页面工具栏 */
.page-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.page-toolbar input {
  flex: 1;
  max-width: 300px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.page-toolbar select {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.breadcrumb { color: var(--text-3); font-size: 13px; }

/* 统计卡片组 */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}
.stat-cards .stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.stat-cards .stat-label { color: var(--text-3); font-size: 13px; margin-bottom: 6px; }
.stat-cards .stat-value { font-size: 22px; font-weight: 700; }

/* 详情区块 */
.detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.detail-header h3 { font-size: 20px; }
.detail-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.detail-section h4 { font-size: 15px; margin-bottom: 12px; }

/* 信息表格 */
.info-table {
  width: 100%;
  border-collapse: collapse;
}
.info-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.info-table td:nth-child(odd) {
  color: var(--text-3);
  width: 120px;
}

/* 文本辅助 */
.text-muted { color: var(--text-3); }
.font-sm { font-size: 12px; }

/* 按钮变体 */
.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}
.btn-block { width: 100%; }
.btn-success { background: var(--success); color: #fff; }

/* 表单 */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
  color: var(--text-2);
}
.form-group input, .form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  box-sizing: border-box;
}
.form-group input:focus, .form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

/* 空行 */
.empty-row, .no-data {
  text-align: center;
  color: var(--text-4);
  padding: 24px;
}

