/* ╔══════════════════════════════════════════════════════════╗
   ║  隆创通讯 CRM  —  Premium SaaS Design System            ║
   ╚══════════════════════════════════════════════════════════╝ */

/* ── 重置 & 基础 ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #app { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 14px;
  color: #1e293b;
  background: #f1f5f9;
  -webkit-font-smoothing: antialiased;
}

/* ── 左侧边栏 ─────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  min-width: 220px;
  height: 100vh;
  background: linear-gradient(180deg, #0c1220 0%, #111827 50%, #0f172a 100%);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}
.sidebar::before {
  content: '';
  position: absolute;
  top: -60px; left: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(249,115,22,0.12) 0%, transparent 70%);
  pointer-events: none;
}
.sidebar::after {
  content: '';
  position: absolute;
  bottom: 0; right: -40px;
  width: 150px; height: 150px;
  background: radial-gradient(circle, rgba(249,115,22,0.06) 0%, transparent 70%);
  pointer-events: none;
}

/* 品牌区 */
.sidebar-brand {
  padding: 22px 20px 18px;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: relative; z-index: 1;
}
.sidebar-logo {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 900; color: #fff;
  box-shadow: 0 0 20px rgba(249,115,22,0.45), 0 4px 12px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.sidebar-brand-text { line-height: 1.2; }
.sidebar-brand-name {
  font-size: 14px; font-weight: 700; color: #f1f5f9;
  letter-spacing: 0.3px;
}
.sidebar-brand-sub {
  font-size: 11px; color: #475569; margin-top: 2px;
  letter-spacing: 0.5px;
}

/* 导航区 */
.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  overflow-y: auto;
  position: relative; z-index: 1;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section-title {
  font-size: 10px;
  font-weight: 700;
  color: #334155;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 14px 10px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: all 0.18s ease;
  position: relative;
  text-decoration: none;
  user-select: none;
}
.nav-item:hover {
  color: #e2e8f0;
  background: rgba(255,255,255,0.06);
}
.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(249,115,22,0.2), rgba(234,88,12,0.15));
  box-shadow: inset 0 0 0 1px rgba(249,115,22,0.25);
}
.nav-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 18px;
  background: linear-gradient(180deg, #fb923c, #f97316);
  border-radius: 0 3px 3px 0;
}
.nav-item .nav-icon {
  width: 18px; height: 18px;
  flex-shrink: 0; opacity: 0.85;
}
.nav-item.active .nav-icon { opacity: 1; }

/* 子菜单 */
.nav-sub { padding-left: 14px; }
.nav-sub .nav-item {
  font-size: 13px;
  padding: 8px 12px;
  color: #475569;
}
.nav-sub .nav-item:hover { color: #e2e8f0; }
.nav-sub .nav-item.active { color: #fb923c; background: rgba(249,115,22,0.1); }
.nav-sub .nav-item.active::before { height: 14px; }

/* 展开箭头 */
.nav-arrow {
  margin-left: auto;
  transition: transform 0.2s;
  opacity: 0.5;
  font-size: 11px;
}
.nav-arrow.open { transform: rotate(90deg); }

/* 用户区 */
.sidebar-user {
  padding: 14px 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
  position: relative; z-index: 1;
}
.sidebar-user-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.18s;
}
.sidebar-user-card:hover { background: rgba(255,255,255,0.05); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff; font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(249,115,22,0.4);
}
.user-info { flex: 1; overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: #475569; margin-top: 1px; }
.logout-btn {
  color: #334155;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: all 0.15s;
  display: flex; align-items: center;
}
.logout-btn:hover { color: #ef4444; background: rgba(239,68,68,0.1); }

/* ── 主内容区 ─────────────────────────────────────────────── */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* 顶部栏 */
.topbar {
  height: 56px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid #e5eaf0;
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 12px;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.topbar-title {
  font-size: 16px; font-weight: 700; color: #0f172a;
  flex: 1;
}
.topbar-badge {
  font-size: 11px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px;
  background: linear-gradient(135deg, rgba(249,115,22,0.12), rgba(234,88,12,0.08));
  color: #f97316;
  border: 1px solid rgba(249,115,22,0.2);
}

/* 页面内容滚动区 */
.main-content {
  flex: 1;
  overflow-y: auto;
  background: #f1f5f9;
}
.main-content::-webkit-scrollbar { width: 6px; }
.main-content::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
.main-content::-webkit-scrollbar-track { background: transparent; }

/* ── 卡片 ─────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,0.8);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.06), 0 8px 24px rgba(0,0,0,0.06); }

/* 指标卡 */
.metric-card {
  background: #fff;
  border-radius: 14px;
  border: 1px solid rgba(226,232,240,0.8);
  padding: 20px 22px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);
  position: relative; overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
}
.metric-card:hover { transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.metric-card .bg-glow {
  position: absolute; top: -20px; right: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  pointer-events: none;
}
.metric-card .label { font-size: 12px; font-weight: 600; color: #64748b; letter-spacing: 0.5px; text-transform: uppercase; }
.metric-card .value { font-size: 36px; font-weight: 800; color: #0f172a; margin: 8px 0 4px; line-height: 1; }
.metric-card .sub { font-size: 12px; color: #94a3b8; }

/* ── 卡片标题栏 ───────────────────────────────────────────── */
.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
}
.card-header .title { font-size: 14px; font-weight: 700; color: #0f172a; }
.card-header .sub   { font-size: 12px; color: #94a3b8; }

/* ── 状态标签栏 ───────────────────────────────────────────── */
.status-tabs {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 14px 20px 0;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
}
.status-tab {
  position: relative;
  padding: 8px 16px 10px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; color: #64748b;
  border-bottom: 2px solid transparent;
  border-radius: 6px 6px 0 0;
  transition: all 0.15s;
  margin-bottom: -1px;
  user-select: none;
}
.status-tab:hover { color: #f97316; background: #fff7ed; }
.status-tab.active {
  color: #f97316;
  border-bottom-color: #f97316;
  background: #fff7ed;
  font-weight: 700;
}
.status-tab .count {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 11px;
  background: #f1f5f9; color: #94a3b8;
}
.status-tab.active .count { background: rgba(249,115,22,0.15); color: #f97316; }
.status-tab .del-btn {
  position: absolute; top: -5px; right: -5px;
  background: #ef4444; color: #fff;
  width: 16px; height: 16px; border-radius: 50%;
  font-size: 10px; line-height: 16px; text-align: center;
  display: none; cursor: pointer;
  box-shadow: 0 2px 4px rgba(239,68,68,0.4);
  z-index: 2;
}
.status-tabs.editing .status-tab .del-btn { display: block; }

/* ── 数据表格 ─────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; background: #fff; }
.data-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  padding: 12px 18px;
  border-bottom: 1px solid #e5eaf0;
  text-align: left;
  white-space: nowrap;
}
.data-table td {
  padding: 13px 18px;
  border-bottom: 1px solid #f8fafc;
  font-size: 14px; color: #334155;
  vertical-align: middle;
}
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover td { background: #fefaf6; }
.data-table tbody tr:last-child td { border-bottom: none; }

/* 表格内小头像 */
.table-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff; font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ── 按钮 ─────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, #f97316 0%, #ea580c 100%);
  color: #fff;
  padding: 9px 20px;
  border-radius: 9px;
  font-size: 14px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  border: none;
  box-shadow: 0 2px 8px rgba(249,115,22,0.35), 0 1px 2px rgba(0,0,0,0.1);
  transition: all 0.2s;
  white-space: nowrap;
  letter-spacing: 0.2px;
}
.btn-primary:hover {
  box-shadow: 0 4px 16px rgba(249,115,22,0.5), 0 2px 4px rgba(0,0,0,0.15);
  transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-default {
  background: #fff;
  color: #475569;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 14px; font-weight: 500;
  cursor: pointer;
  border: 1.5px solid #e2e8f0;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all 0.18s;
  white-space: nowrap;
}
.btn-default:hover { color: #f97316; border-color: #fdba74; background: #fff7ed; }

.btn-link { color: #f97316; cursor: pointer; font-size: 14px; font-weight: 500; transition: all 0.15s; }
.btn-link:hover { color: #ea580c; }
.btn-danger-link { color: #ef4444; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-danger-link:hover { color: #dc2626; }

/* ── 状态徽章 ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px; font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.badge-jiawei    { background: linear-gradient(135deg,#fff7ed,#fef3e8); color: #c2410c; border: 1px solid #fdba74; }
.badge-weijiewei { background: linear-gradient(135deg,#fefce8,#fefde4); color: #a16207; border: 1px solid #fde047; }
.badge-qianzai   { background: linear-gradient(135deg,#eff6ff,#eef4ff); color: #1d4ed8; border: 1px solid #93c5fd; }
.badge-gaoyixiang{ background: linear-gradient(135deg,#fdf2f8,#fdf0f7); color: #be185d; border: 1px solid #f9a8d4; }
.badge-qiandan   { background: linear-gradient(135deg,#f0fdf4,#ecfdf5); color: #15803d; border: 1px solid #86efac; }
.badge-shibai    { background: linear-gradient(135deg,#fef2f2,#fef1f1); color: #b91c1c; border: 1px solid #fca5a5; }
.badge-wuhao     { background: #f8fafc; color: #64748b; border: 1px solid #cbd5e1; }
.badge-wuxiao    { background: linear-gradient(135deg,#1e293b,#334155); color: #e2e8f0; border: 1px solid #475569; }
.badge-default   { background: #f8fafc; color: #475569; border: 1px solid #e2e8f0; }

/* ── 表单 ─────────────────────────────────────────────────── */
.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  font-size: 14px; color: #1e293b;
  background: #fff;
  transition: all 0.2s;
  outline: none;
}
.form-input:focus {
  border-color: #f97316;
  box-shadow: 0 0 0 3px rgba(249,115,22,0.12);
}
.form-input::placeholder { color: #94a3b8; }
.form-label {
  display: block;
  font-size: 12px; font-weight: 700;
  color: #374151;
  margin-bottom: 6px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* ── 弹窗 ─────────────────────────────────────────────────── */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(10,18,36,0.6);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex; align-items: center; justify-content: center;
}
.modal {
  background: #fff;
  border-radius: 16px;
  min-width: 500px; max-width: 92vw; max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3), 0 0 0 1px rgba(226,232,240,0.5);
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid #f1f5f9;
  display: flex; justify-content: space-between; align-items: center;
  background: linear-gradient(180deg,#fff 0%,#fafafa 100%);
}
.modal-header .title { font-size: 16px; font-weight: 800; color: #0f172a; }
.modal-body { padding: 24px; overflow: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid #f1f5f9;
  display: flex; justify-content: flex-end; gap: 10px;
  background: #fafafa;
}

/* ── 分页 ─────────────────────────────────────────────────── */
.pagination {
  display: flex; align-items: center; justify-content: center;
  padding: 18px; gap: 6px;
}
.pagination .page {
  padding: 7px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 9px;
  cursor: pointer; font-size: 14px; font-weight: 500; color: #475569;
  transition: all 0.15s;
}
.pagination .page:hover { border-color: #f97316; color: #f97316; background: #fff7ed; }
.pagination .page.active {
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff; border-color: transparent;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(249,115,22,0.4);
}

/* ── 图表容器 ─────────────────────────────────────────────── */
.chart-box    { width: 100%; height: 300px; }
.chart-box-sm { width: 100%; height: 240px; }

/* ── 登录页 ───────────────────────────────────────────────── */
.login-bg {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(145deg, #020817 0%, #0f172a 40%, #130a1f 100%);
  position: relative; overflow: hidden;
}
.login-bg::before {
  content: '';
  position: absolute; inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 800px 600px at 20% 60%, rgba(249,115,22,0.12) 0%, transparent 70%),
    radial-gradient(ellipse 600px 400px at 80% 20%, rgba(251,146,60,0.07) 0%, transparent 60%);
}
.login-card {
  position: relative; z-index: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 44px 40px;
  width: 400px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(249,115,22,0.1);
}

/* ── Toast ────────────────────────────────────────────────── */
.toast {
  position: fixed; top: 24px; left: 50%; transform: translateX(-50%);
  background: linear-gradient(135deg, #1e293b, #0f172a);
  color: #f1f5f9;
  padding: 12px 24px;
  border-radius: 12px;
  z-index: 300;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(249,115,22,0.2);
  letter-spacing: 0.3px;
  white-space: nowrap;
}

/* ── 工具栏 ───────────────────────────────────────────────── */
.toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid #f1f5f9;
}

/* ── 操作列 ───────────────────────────────────────────────── */
.action-btns { display: flex; gap: 12px; align-items: center; }

/* ── 全局滚动条 ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── 动画 ─────────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
.page-enter { animation: fadeIn 0.2s ease; }
