:root {
  --brand-50: #eef2ff;
  --brand-100: #e0e7ff;
  --brand-200: #c7d2fe;
  --brand-300: #a5b4fc;
  --brand-400: #818cf8;
  --brand-500: #6366f1;
  --brand-600: #4f46e5;
  --brand-700: #4338ca;
  --brand-800: #3730a3;
  --brand-900: #312e81;

  --accent-500: #06b6d4;
  --accent-600: #0891b2;

  --success-500: #10b981;
  --warning-500: #f59e0b;
  --danger-500: #ef4444;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #0b0f1a;

  --sidebar-w: 256px;
  --sidebar-w-collapsed: 72px;
  --topbar-h: 64px;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px rgba(17, 24, 39, 0.05);
  --shadow-md: 0 4px 12px rgba(17, 24, 39, 0.08);
  --shadow-lg: 0 12px 28px rgba(17, 24, 39, 0.12);
  --shadow-glow: 0 0 0 4px rgba(99, 102, 241, 0.15);

  --font-sans: "Plus Jakarta Sans", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

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

html, body, #root { height: 100%; }

body {
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--gray-800);
  background: var(--gray-50);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font-family: inherit; }

/* ========== Scrollbar ========== */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ========== App Shell ========== */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 100%);
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 20;
}

.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  height: var(--topbar-h);
}

.brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
}

.brand-name {
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff, #a5b4fc);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  white-space: nowrap;
  opacity: 1;
  transition: opacity 0.2s;
}

.sidebar.collapsed .brand-name,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-section-title {
  opacity: 0;
  pointer-events: none;
}

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

.nav-section { margin-bottom: 18px; }

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(148, 163, 184, 0.7);
  padding: 0 10px 8px;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  white-space: nowrap;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.25), rgba(6, 182, 212, 0.15));
  color: #fff;
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: linear-gradient(180deg, var(--brand-400), var(--accent-500));
  border-radius: 0 3px 3px 0;
}

.nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-badge {
  margin-left: auto;
  background: var(--danger-500);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s;
}
.user-card:hover { background: rgba(255,255,255,0.05); }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-500), var(--accent-500));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  position: relative;
}
.avatar.online::after {
  content: '';
  position: absolute;
  bottom: -1px;
  right: -1px;
  width: 10px;
  height: 10px;
  background: var(--success-500);
  border: 2px solid #1e1b4b;
  border-radius: 50%;
}

.user-info { overflow: hidden; flex: 1; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; }
.user-role { font-size: 11px; color: #94a3b8; }

/* ========== Main Area ========== */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: relative;
  z-index: 10;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-600);
  transition: all 0.2s;
  position: relative;
}
.icon-btn:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--gray-500);
}
.breadcrumb .current { color: var(--gray-900); font-weight: 600; }

.search-box {
  flex: 1;
  max-width: 420px;
  margin: 0 auto;
  position: relative;
}
.search-box input {
  width: 100%;
  height: 38px;
  padding: 0 14px 0 40px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  background: var(--gray-50);
  font-size: 13px;
  color: var(--gray-800);
  outline: none;
  transition: all 0.2s;
}
.search-box input:focus {
  border-color: var(--brand-400);
  background: #fff;
  box-shadow: var(--shadow-glow);
}
.search-box .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
}

.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--danger-500);
  border-radius: 50%;
  border: 2px solid #fff;
}

.page-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px;
  position: relative;
}

/* ========== Page transition ========== */
.page-enter {
  animation: pageIn 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========== Cards ========== */
.card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
  padding: 20px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-subtitle {
  font-size: 12px;
  color: var(--gray-500);
  font-weight: 400;
}

/* ========== KPI ========== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.kpi-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: transform 0.25s, box-shadow 0.25s;
  cursor: default;
}
.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--kpi-color, var(--brand-500));
  opacity: 0.8;
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--gray-500);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--kpi-bg, var(--brand-50));
  color: var(--kpi-color, var(--brand-600));
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: auto;
}

.kpi-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--gray-900);
  letter-spacing: -0.02em;
  line-height: 1.2;
  font-family: var(--font-mono);
}

.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
  margin-top: 8px;
}
.kpi-delta.up { color: var(--success-500); background: #ecfdf5; }
.kpi-delta.down { color: var(--danger-500); background: #fef2f2; }

.kpi-spark {
  position: absolute;
  right: 12px;
  bottom: 8px;
  width: 80px;
  height: 36px;
  opacity: 0.6;
}

/* ========== Dashboard grid ========== */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.dashboard-grid.row-2 {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 1200px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid.row-2 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .dashboard-grid.row-2 { grid-template-columns: 1fr; }
}

/* ========== Table ========== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  font-weight: 600;
  color: var(--gray-500);
  font-size: 12px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.data-table tr:hover td { background: var(--gray-50); }
.data-table tr:last-child td { border-bottom: none; }

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.status-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status-badge.success { background: #ecfdf5; color: var(--success-500); }
.status-badge.warning { background: #fffbeb; color: var(--warning-500); }
.status-badge.danger { background: #fef2f2; color: var(--danger-500); }
.status-badge.info { background: #eff6ff; color: var(--brand-600); }

/* ========== Buttons ========== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  transition: all 0.2s;
  cursor: pointer;
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  color: #fff;
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}
.btn-secondary {
  background: #fff;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}
.btn-secondary:hover {
  background: var(--gray-50);
  border-color: var(--gray-400);
}
.btn-ghost { color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ========== Tabs ========== */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 20px;
  padding: 0 4px;
}
.tab {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--gray-500);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 0.2s;
}
.tab:hover { color: var(--gray-800); }
.tab.active {
  color: var(--brand-600);
  border-bottom-color: var(--brand-600);
  font-weight: 600;
}

/* ========== Toast ========== */
.toast-container {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 280px;
  max-width: 360px;
  animation: toastIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: auto;
}
.toast.closing { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateX(20px); }
}
.toast-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.toast-icon.success { background: #ecfdf5; color: var(--success-500); }
.toast-icon.warning { background: #fffbeb; color: var(--warning-500); }
.toast-icon.danger { background: #fef2f2; color: var(--danger-500); }
.toast-icon.info { background: #eff6ff; color: var(--brand-600); }

.toast-content { flex: 1; min-width: 0; }
.toast-title { font-size: 13px; font-weight: 600; color: var(--gray-900); }
.toast-msg { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

/* ========== Modal ========== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.25s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: #fff;
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--gray-50);
}

/* ========== Input ========== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--gray-800);
  outline: none;
  transition: all 0.2s;
}
.form-input:focus {
  border-color: var(--brand-400);
  box-shadow: var(--shadow-glow);
}

/* ========== Activity feed ========== */
.activity-list { display: flex; flex-direction: column; gap: 14px; }
.activity-item {
  display: flex;
  gap: 12px;
  animation: fadeSlideIn 0.4s ease;
}
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}
.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 6px;
  flex-shrink: 0;
  background: var(--brand-500);
}
.activity-content { flex: 1; }
.activity-text { font-size: 13px; color: var(--gray-700); line-height: 1.5; }
.activity-text strong { color: var(--gray-900); }
.activity-time { font-size: 11px; color: var(--gray-400); margin-top: 3px; }

/* ========== Chat ========== */
.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 48px);
  max-height: 700px;
}
.chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.chat-body {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--gray-50);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.msg {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.55;
  animation: msgIn 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  word-wrap: break-word;
}
@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.msg.bot {
  background: #fff;
  border: 1px solid var(--gray-200);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.msg.user {
  background: linear-gradient(135deg, var(--brand-600), var(--brand-500));
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.typing-indicator {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}
.typing-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gray-400);
  animation: typing 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}

.chat-input-area {
  padding: 14px 16px;
  background: #fff;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.chat-input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--gray-300);
  border-radius: 24px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--brand-400); }

/* ========== Messages list ========== */
.msg-list { display: flex; flex-direction: column; gap: 2px; }
.msg-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background 0.2s;
  border-bottom: 1px solid var(--gray-100);
}
.msg-card:hover { background: var(--gray-50); }
.msg-card.unread { background: #f8fafc; }
.msg-card.unread .msg-title { font-weight: 700; color: var(--gray-900); }
.msg-avatar { flex-shrink: 0; }
.msg-main { flex: 1; min-width: 0; }
.msg-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.msg-title { font-size: 14px; font-weight: 500; color: var(--gray-700); }
.msg-time { font-size: 11px; color: var(--gray-400); }
.msg-preview {
  font-size: 12px;
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.unread-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-500);
  margin-left: 8px;
}

/* ========== Profile ========== */
.profile-header {
  background: linear-gradient(135deg, var(--brand-700), var(--accent-600));
  border-radius: var(--radius-lg);
  padding: 32px;
  color: #fff;
  position: relative;
  overflow: hidden;
  margin-bottom: 20px;
}
.profile-header::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
}
.profile-info {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
}
.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  border: 3px solid rgba(255,255,255,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}
.profile-name { font-size: 24px; font-weight: 700; margin-bottom: 4px; }
.profile-role { font-size: 14px; opacity: 0.85; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
  padding: 16px 20px;
  text-align: center;
}
.stat-value {
  font-size: 24px;
  font-weight: 800;
  color: var(--gray-900);
  font-family: var(--font-mono);
}
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 4px; }

/* ========== Skeleton ========== */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeleton 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ========== Realtime pulse ========== */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success-500);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success-500);
  position: relative;
}
.live-dot::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--success-500);
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(2.5); opacity: 0; }
}

/* ========== Notification pop ========== */
.notif-pop {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 320px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 14px 16px;
  z-index: 150;
  animation: notifPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  cursor: pointer;
}
.notif-pop.closing { animation: notifOut 0.3s ease forwards; }
@keyframes notifPop {
  from { opacity: 0; transform: translateY(30px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes notifOut {
  to { opacity: 0; transform: translateY(20px) scale(0.95); }
}
.notif-pop-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.notif-pop-title { font-size: 13px; font-weight: 700; color: var(--gray-900); }
.notif-pop-body { font-size: 12px; color: var(--gray-600); line-height: 1.5; }

/* ========== Carousel ========== */
.carousel {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  height: 200px;
}
.carousel-slide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 28px;
  color: #fff;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.6s ease;
}
.carousel-slide h3 { font-size: 22px; font-weight: 800; margin-bottom: 8px; letter-spacing: -0.02em; }
.carousel-slide p { font-size: 13px; opacity: 0.9; max-width: 360px; line-height: 1.5; }
.carousel-dots {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
}
.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255,255,255,0.4);
  cursor: pointer;
  transition: all 0.3s;
}
.carousel-dot.active {
  background: #fff;
  width: 22px;
  border-radius: 4px;
}

/* ========== Users page ========== */
.users-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.users-filters { display: flex; gap: 8px; }
.chip {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  background: #fff;
  border: 1px solid var(--gray-200);
  color: var(--gray-600);
  cursor: pointer;
  transition: all 0.2s;
}
.chip:hover { border-color: var(--gray-300); color: var(--gray-800); }
.chip.active {
  background: var(--brand-50);
  border-color: var(--brand-300);
  color: var(--brand-700);
  font-weight: 600;
}

/* ========== Hero / Welcome ========== */
.welcome-banner {
  background: linear-gradient(135deg, #4f46e5 0%, #06b6d4 100%);
  border-radius: var(--radius-lg);
  padding: 28px 32px;
  color: #fff;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
}
.welcome-banner::after {
  content: '';
  position: absolute;
  bottom: -60px;
  right: -40px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
  border-radius: 50%;
}
.welcome-banner h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.welcome-banner p { font-size: 14px; opacity: 0.9; max-width: 500px; }
.welcome-banner .greeting-emoji { font-size: 28px; margin-right: 8px; }

/* ========== Settings / Profile form ========== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 768px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ========== Scroll reveal ========== */
.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========== Typewriter ========== */
.typewriter {
  display: inline-block;
  overflow: hidden;
  border-right: 2px solid var(--brand-500);
  white-space: nowrap;
  animation: blink-caret 0.75s step-end infinite;
}
@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--brand-500); }
}

/* ========== Realtime metric card ========== */
.metric-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.metric-trend {
  width: 100%;
  height: 60px;
}

/* ========== User avatar group ========== */
.avatar-group { display: flex; }
.avatar-group .avatar {
  border: 2px solid #fff;
  margin-left: -8px;
  width: 28px;
  height: 28px;
  font-size: 11px;
}
.avatar-group .avatar:first-child { margin-left: 0; }

/* ========== Login page（极简企业级 SaaS） ========== */
.auth-wrap {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #ffffff;
  color: #111111;
  overflow-y: auto;
  -webkit-font-smoothing: antialiased;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}

/* ---- Header ---- */
.auth-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 32px;
  box-sizing: border-box;
}
.auth-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #111111;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  user-select: none;
}
.auth-logo svg { display: block; }
.auth-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* 语言选择器 */
.lang-wrap { position: relative; outline: none; }
.lang-selector {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: #111111;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.lang-selector:hover { background: #f5f5f5; }
.lang-selector svg { flex-shrink: 0; }
.lang-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 148px;
  padding: 6px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  z-index: 10;
}
.lang-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #111111;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s;
}
.lang-menu button:hover { background: #f5f5f5; }
.lang-menu button.active { background: #f0f6ff; color: #377df6; font-weight: 600; }

/* 注册按钮 */
.signup-btn {
  height: 35px;
  padding: 0 16px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 12px;
  color: #111111;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.signup-btn:hover { background: #f7f7f7; border-color: #d9d9d9; }

/* ---- 登录主体 ---- */
.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 56px 32px 32px;
  min-height: calc(100vh - 100px);
  box-sizing: border-box;
}
.auth-title {
  margin: 0;
  color: #111111;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
}

/* ---- 表单 ---- */
.auth-form {
  width: 100%;
  max-width: 440px;
  margin-top: 40px;
  display: flex;
  flex-direction: column;
}
.auth-field { display: flex; flex-direction: column; }
.auth-field + .auth-field { margin-top: 28px; }
.auth-label {
  margin-bottom: 10px;
  color: #111111;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.auth-input {
  width: 100%;
  height: 40px;
  padding: 0 24px;
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 18px;
  color: #111111;
  font-size: 18px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.auth-input::placeholder { color: #a3a3a3; }
.auth-input:hover { border-color: #c9c9c9; }
.auth-input:focus {
  border-color: #377df6;
  box-shadow: 0 0 0 4px rgba(55, 125, 246, 0.12);
}
.auth-input.has-error { border-color: #e5484d; }
.auth-input.has-error:focus {
  border-color: #e5484d;
  box-shadow: 0 0 0 4px rgba(229, 72, 77, 0.12);
}
.auth-input:disabled { background: #fafafa; color: #a3a3a3; }
.auth-password-wrap { position: relative; }
.auth-password-wrap .auth-input { padding-right: 56px; }
.auth-eye {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 12px;
  color: #777777;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.auth-eye:hover { color: #111111; background: #f5f5f5; }
.auth-field-error {
  margin: 8px 2px 0;
  color: #e5484d;
  font-size: 14px;
  font-weight: 500;
}

/* ---- 记住登录 ---- */
.auth-remember {
  margin-top: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: fit-content;
  cursor: pointer;
  user-select: none;
}
.auth-remember input { display: none; }
.auth-checkbox {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid #c9c9c9;
  border-radius: 8px;
  color: #ffffff;
  background: #ffffff;
  transition: background 0.15s, border-color 0.15s;
}
.auth-remember input:checked + .auth-checkbox {
  background: #111111;
  border-color: #111111;
}
.auth-remember input:focus-visible + .auth-checkbox {
  border-color: #377df6;
  box-shadow: 0 0 0 4px rgba(55, 125, 246, 0.12);
}
.auth-checkbox svg {
  width: 13px;
  height: 13px;
  opacity: 0;
  transition: opacity 0.15s;
}
.auth-remember input:checked + .auth-checkbox svg { opacity: 1; }
.auth-remember-text {
  color: #333333;
  font-size: 17px;
  line-height: 1.5;
}

/* ---- 登录按钮 ---- */
.auth-submit {
  margin-top: 30px;
  width: 100%;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #377df6;
  color: #ffffff;
  border: none;
  border-radius: 18px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.auth-submit:hover { background: #2e6fe4; }
.auth-submit:active { transform: scale(0.985); }
.auth-submit:disabled {
  background: #9dbdf8;
  cursor: not-allowed;
}
.auth-spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: authSpin 0.7s linear infinite;
}
@keyframes authSpin { to { transform: rotate(360deg); } }

/* ---- 底部链接 ---- */
.auth-register {
  margin-top: 28px;
  text-align: center;
  color: #777777;
  font-size: 16px;
}
.auth-register a {
  color: #315bc7;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(49, 91, 199, 0.4);
  transition: text-decoration-color 0.2s;
}
.auth-register a:hover { text-decoration-color: #315bc7; }
.auth-forgot {
  margin-top: 20px;
  text-align: center;
  color: #111111;
  font-size: 15px;
}
.auth-forgot a {
  color: #315bc7;
  font-weight: 500;
  text-decoration: none;
  transition: text-decoration 0.2s;
}
.auth-forgot a:hover { text-decoration: underline; }

/* ---- 响应式：PC ---- */
@media (min-width: 768px) {
  .auth-header { padding: 28px 48px; }
  .auth-main { padding: 72px 48px 40px; }
  .auth-title { font-size: 38px; }
}

/* ========== Floating widget ========== */
.floating-chat-btn {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-600), var(--accent-500));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(99,102,241,0.5);
  cursor: pointer;
  z-index: 90;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.floating-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(99,102,241,0.6);
}
.floating-chat-btn .pulse-ring {
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(99,102,241,0.4);
  animation: pulseRing 2s ease-out infinite;
}
@keyframes pulseRing {
  0% { transform: scale(0.9); opacity: 1; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ========== Utility ========== */
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.mt-8 { margin-top: 8px; }
.text-sm { font-size: 12px; }
.text-gray-500 { color: var(--gray-500); }
.text-gray-600 { color: var(--gray-600); }
.text-gray-900 { color: var(--gray-900); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
