:root {
  --background: #f5f6fa;
  --foreground: #1a1a2e;
  --card: #ffffff;
  --card-foreground: #1a1a2e;
  --primary: #EA5717;
  --primary-foreground: #ffffff;
  --primary-light: #fef3ee;
  --secondary: #f0f1f5;
  --secondary-foreground: #1a1a2e;
  --muted: #f5f6fa;
  --muted-foreground: #8c8c9a;
  --accent: #f0f1f5;
  --accent-foreground: #1a1a2e;
  --destructive: #e7000b;
  --destructive-foreground: #ffffff;
  --border: #e5e6eb;
  --input: #e5e6eb;
  --ring: #EA5717;
  --gold: #DAB866;
  --success: #10b981;
  --warning: #f59e0b;
  --info: #3b82f6;
  --sidebar-width: 240px;
  --header-height: 60px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --radius: 8px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -1px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -2px rgba(0,0,0,0.05);
}

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

body {
  font-family: var(--font-sans);
  color: var(--foreground);
  background: var(--background);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* Sidebar */
.admin-sidebar {
  position: fixed; left: 0; top: 0; bottom: 0;
  width: var(--sidebar-width); background: var(--card);
  border-right: 1px solid var(--border);
  z-index: 30; display: flex; flex-direction: column;
}

.sidebar-logo {
  height: var(--header-height); padding: 0 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  font-size: 16px; font-weight: 700; color: var(--primary);
  white-space: nowrap; flex-shrink: 0;
}

.sidebar-logo .logo-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; flex-shrink: 0;
}

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

.nav-group { margin-bottom: 4px; }

.nav-group-title {
  padding: 8px 12px 4px; font-size: 11px;
  color: var(--muted-foreground); text-transform: uppercase;
  letter-spacing: 0.05em; font-weight: 600;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 6px;
  color: #555; font-size: 13px; cursor: pointer;
  transition: all 0.15s; text-decoration: none;
  position: relative;
}

.nav-item:hover { background: var(--secondary); color: var(--foreground); }

.nav-item.active {
  background: var(--primary-light); color: var(--primary);
  font-weight: 600;
}

.nav-item .nav-icon { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item .nav-badge {
  margin-left: auto; font-size: 11px; padding: 1px 6px;
  border-radius: 10px; background: var(--primary);
  color: #fff; font-weight: 600;
}

/* Header */
.admin-header {
  position: fixed; top: 0; right: 0;
  left: var(--sidebar-width); height: var(--header-height);
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; z-index: 20;
}

.header-left { display: flex; align-items: center; gap: 16px; }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted-foreground);
}

.breadcrumb a { color: var(--muted-foreground); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .current { color: var(--foreground); font-weight: 500; }

.header-right { display: flex; align-items: center; gap: 16px; }

.header-btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer;
  color: var(--muted-foreground); position: relative;
}

.header-btn:hover { background: var(--secondary); color: var(--foreground); }

.header-btn .dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--destructive); border: 2px solid var(--card);
}

.admin-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; cursor: pointer;
}

/* Main Content */
.admin-main {
  margin-left: var(--sidebar-width);
  padding-top: var(--header-height);
  min-height: 100vh;
}

.page-content { padding: 24px; }

.page-title {
  font-size: 20px; font-weight: 700;
  margin-bottom: 4px; color: var(--foreground);
}

.page-desc {
  font-size: 13px; color: var(--muted-foreground);
  margin-bottom: 24px;
}

/* Cards */
.stat-card {
  background: var(--card); border-radius: var(--radius);
  padding: 20px; border: 1px solid var(--border);
  transition: box-shadow 0.2s;
}

.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-label { font-size: 13px; color: var(--muted-foreground); margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-change { font-size: 12px; margin-top: 6px; display: flex; align-items: center; gap: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--destructive); }

/* Table */
.data-table {
  width: 100%; border-collapse: collapse;
  background: var(--card); border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
}

.data-table th {
  padding: 12px 16px; text-align: left;
  font-size: 12px; font-weight: 600;
  color: var(--muted-foreground); background: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px; font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #fafbfc; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all 0.15s; text-decoration: none;
  white-space: nowrap;
}

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; }
.btn-outline { background: var(--card); color: var(--foreground); border-color: var(--border); }
.btn-outline:hover { background: var(--secondary); }
.btn-ghost { background: transparent; color: var(--muted-foreground); }
.btn-ghost:hover { background: var(--secondary); color: var(--foreground); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--destructive); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }

/* Badge */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 4px;
  font-size: 12px; font-weight: 500;
}

.badge-success { background: #ecfdf5; color: #059669; }
.badge-warning { background: #fffbeb; color: #d97706; }
.badge-danger { background: #fef2f2; color: #dc2626; }
.badge-info { background: #eff6ff; color: #2563eb; }
.badge-default { background: var(--secondary); color: var(--muted-foreground); }

/* Tabs */
.tab-bar {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.tab-item {
  padding: 10px 20px; font-size: 13px; font-weight: 500;
  color: var(--muted-foreground); cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab-item:hover { color: var(--foreground); }
.tab-item.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Search & Filter Bar */
.toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}

.search-input {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card);
  min-width: 240px;
}

.search-input input {
  border: none; outline: none; font-size: 13px;
  background: transparent; flex: 1; color: var(--foreground);
}

.filter-select {
  padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--card);
  font-size: 13px; color: var(--foreground);
  cursor: pointer; outline: none;
}

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0; font-size: 13px; color: var(--muted-foreground);
}

.pagination-btns { display: flex; gap: 4px; }

.page-btn {
  width: 32px; height: 32px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border); background: var(--card);
  cursor: pointer; font-size: 13px; color: var(--foreground);
}

.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:hover:not(.active) { background: var(--secondary); }

/* Chart placeholder */
.chart-placeholder {
  background: var(--muted); border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted-foreground); font-size: 13px;
  min-height: 200px; border: 1px dashed var(--border);
}

/* Mini bar chart */
.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 40px; }
.mini-bar { width: 6px; border-radius: 2px; background: var(--primary); opacity: 0.7; }

/* Form */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.form-input {
  width: 100%; padding: 8px 12px; border-radius: 6px;
  border: 1px solid var(--border); font-size: 13px;
  outline: none; transition: border-color 0.15s;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(234,87,23,0.1); }

/* Animations */
.fade-in { animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Quick nav floating button */
.quick-nav-btn {
  position: fixed; bottom: 24px; right: 24px;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: var(--shadow-lg);
  z-index: 50; border: none; transition: transform 0.2s;
}
.quick-nav-btn:hover { transform: scale(1.08); }

.quick-nav-panel {
  position: fixed; bottom: 80px; right: 24px;
  background: var(--card); border-radius: 12px;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  padding: 16px; z-index: 50; width: 320px;
  display: none;
}
.quick-nav-panel.show { display: block; animation: fadeIn 0.2s ease; }
.quick-nav-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.quick-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 12px 8px; border-radius: 8px; cursor: pointer;
  text-decoration: none; color: var(--foreground);
  font-size: 11px; text-align: center; transition: background 0.15s;
}
.quick-nav-item:hover { background: var(--secondary); }
.quick-nav-item .qn-icon {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}

/* Sub-menu (two-level navigation) */
.nav-item.has-children { cursor: pointer; }
.nav-item.has-children .nav-chevron {
  width: 16px; height: 16px; margin-left: auto;
  transition: transform 0.2s; flex-shrink: 0;
}
.nav-item.has-children.expanded .nav-chevron { transform: rotate(90deg); }
.nav-item.has-children.parent-active {
  background: var(--primary-light); color: var(--primary); font-weight: 600;
}

.nav-children { display: none; padding: 2px 0 2px 0; }
.nav-children.show { display: block; }

.nav-child-item {
  display: block; padding: 7px 12px 7px 40px;
  font-size: 13px; color: #666; text-decoration: none;
  border-radius: 6px; transition: all 0.15s;
  line-height: 1.4;
}
.nav-child-item:hover { background: var(--secondary); color: var(--foreground); }
.nav-child-item.active { color: var(--primary); font-weight: 600; background: var(--primary-light); }
