/* ========================================================
   SMOOTHLINK 控制中心 — 共享样式
   品牌色源自 branding.json
   ======================================================== */

:root {
  /* 品牌色 */
  --brand-primary:    #0052CC;
  --brand-secondary:  #00B8E0;
  --brand-grad-from:  #00B8E0;
  --brand-grad-to:    #0052CC;

  /* 中性色 */
  --bg:               #F7F9FC;
  --bg-card:          #FFFFFF;
  --bg-sidebar:       #0B1733;
  --bg-sidebar-hover: #15224A;

  --border:           #E4E9F2;
  --border-strong:    #C5CDE0;

  --text-primary:     #1A2233;
  --text-secondary:   #5A6478;
  --text-muted:       #8B96AB;
  --text-inverse:     #FFFFFF;

  /* 状态色 */
  --success:          #22C55E;
  --warning:          #F59E0B;
  --danger:           #EF4444;
  --info:             #3B82F6;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
  --shadow:    0 4px 12px -2px rgba(13, 30, 80, 0.08);
  --shadow-lg: 0 12px 40px -8px rgba(13, 30, 80, 0.18);

  /* 圆角 */
  --r-sm: 6px;
  --r:    10px;
  --r-lg: 16px;
  --r-xl: 24px;

  /* 间距 */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;

  /* 字体 */
  --font-sans: -apple-system, "SF Pro Display", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui, sans-serif;
  --font-mono: "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ========================================================
   Layout
   ======================================================== */

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  background: var(--bg-sidebar);
  color: var(--text-inverse);
  padding: var(--space-5) 0;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--space-5) var(--space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: var(--space-4);
}
.sidebar-logo img { width: 36px; height: 36px; }
.sidebar-logo .name { font-weight: 700; letter-spacing: 0.04em; font-size: 17px; }
.sidebar-logo .zh   { font-size: 11px; color: var(--brand-secondary); letter-spacing: 0.4em; margin-top: 2px; }

.nav { list-style: none; padding: 0; margin: 0; }
.nav li { margin: 0 var(--space-3); }
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: rgba(255, 255, 255, 0.7);
  border-radius: var(--r);
  font-size: 14px;
  transition: all 0.15s ease;
  text-decoration: none;
}
.nav a:hover { background: var(--bg-sidebar-hover); color: var(--text-inverse); text-decoration: none; }
.nav a.active {
  background: linear-gradient(135deg, var(--brand-grad-from), var(--brand-grad-to));
  color: var(--text-inverse);
  font-weight: 500;
}
.nav-icon { font-size: 16px; width: 18px; text-align: center; }

.sidebar-footer {
  position: absolute;
  bottom: var(--space-5);
  left: 0; right: 0;
  padding: 0 var(--space-5);
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Main ── */
.main {
  padding: var(--space-6);
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-6);
}
.topbar h1 { margin: 0; font-size: 24px; font-weight: 700; }
.topbar .subtitle { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 13px;
  cursor: pointer;
}
.user-chip .avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-grad-from), var(--brand-grad-to));
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

/* ========================================================
   Components
   ======================================================== */

/* ── Card ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-5);
  box-shadow: var(--shadow-sm);
}

/* ── Stat card ── */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}
.stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--space-5);
  position: relative;
  overflow: hidden;
}
.stat::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  background: linear-gradient(135deg, var(--brand-grad-from), var(--brand-grad-to));
  opacity: 0.06;
  border-radius: 50%;
  transform: translate(30px, -30px);
}
.stat .label { color: var(--text-muted); font-size: 13px; margin-bottom: var(--space-2); }
.stat .value { font-size: 32px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.stat .delta { font-size: 12px; margin-top: 6px; }
.stat .delta.up   { color: var(--success); }
.stat .delta.down { color: var(--danger); }

/* ── Button ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r);
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand-grad-from), var(--brand-grad-to));
  color: var(--text-inverse);
}
.btn-primary:hover { box-shadow: 0 6px 20px -4px rgba(0, 82, 204, 0.5); transform: translateY(-1px); }
.btn-secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--bg); border-color: var(--border-strong); }
.btn-danger {
  background: var(--bg-card);
  color: var(--danger);
  border-color: var(--border);
}
.btn-danger:hover { background: var(--danger); color: white; border-color: var(--danger); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Input ── */
.input, .select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  font-family: inherit;
  font-size: 14px;
  background: var(--bg-card);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(0, 82, 204, 0.1);
}

.field { margin-bottom: var(--space-4); }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }

/* ── Table ── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table thead th {
  text-align: left;
  padding: 10px 14px;
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.table tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(0, 82, 204, 0.02); }

/* ── Badge ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: rgba(34, 197, 94, 0.12); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.12); color: var(--warning); }
.badge-danger  { background: rgba(239, 68, 68, 0.12);  color: var(--danger);  }
.badge-info    { background: rgba(59, 130, 246, 0.12); color: var(--info);    }
.badge-muted   { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }

/* ── Toolbar ── */
.toolbar {
  display: flex;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  align-items: center;
}
.toolbar .search { flex: 1; max-width: 360px; }
.toolbar .filter-group { display: flex; gap: var(--space-2); }

/* ── Avatar ── */
.avatar-sm {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-grad-from), var(--brand-grad-to));
  color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600;
  font-size: 12px;
}

/* ── Section header ── */
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: var(--space-4);
}
.section-header h2 { margin: 0; font-size: 18px; font-weight: 600; }
