:root {
  --sidebar-width: 260px;
  --admin-header-height: 64px;
}

/* ===== LOGIN ===== */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 999999;
  background: var(--black);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-overlay.hidden { display: none; }
.login-box {
  background: var(--white);
  padding: 40px;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.login-logo {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--black);
  text-align: center;
  margin-bottom: 8px;
}
.login-logo span { color: var(--orange); }

/* ===== LAYOUT ===== */
.admin-wrapper { display: flex; min-height: 100vh; background: var(--off-white); }
.admin-sidebar {
  width: var(--sidebar-width);
  background: var(--black);
  color: var(--white);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}
.admin-logo {
  font-size: 1.4rem;
  font-weight: 900;
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  letter-spacing: -0.5px;
}
.admin-logo span { color: var(--orange); }
.admin-nav { flex: 1; padding: 16px 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.admin-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.5);
  font-size: 0.88rem;
  font-weight: 500;
  transition: var(--transition);
}
.admin-nav a:hover { background: rgba(255,255,255,0.05); color: var(--white); }
.admin-nav a.active { background: rgba(255,107,0,0.15); color: var(--orange); }
.admin-nav a span { font-size: 1.1rem; }
.admin-sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-sidebar-footer a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.4);
  font-size: 0.85rem;
  transition: var(--transition);
}
.admin-sidebar-footer a:hover { color: var(--white); background: rgba(255,255,255,0.05); }

.admin-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}
.admin-header {
  height: var(--admin-header-height);
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 99;
}
.admin-toggle {
  display: none;
  background: none;
  font-size: 1.3rem;
  color: var(--gray-600);
  padding: 4px;
}
.admin-header h2 { font-size: 1.2rem; font-weight: 700; flex: 1; }
.admin-user { display: flex; align-items: center; gap: 10px; }
.admin-name { font-size: 0.9rem; font-weight: 600; color: var(--gray-600); }
.admin-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gradient-orange);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--white);
}

.admin-content { padding: 24px; }

/* ===== DASHBOARD CARDS ===== */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-bottom: 32px; }
.dash-card {
  background: var(--white);
  border-radius: var(--radius-md);
  padding: 24px;
  border: 1px solid var(--gray-100);
  box-shadow: var(--shadow-sm);
}
.dash-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.dash-card-header .icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
}
.dash-card-header .icon.orange { background: rgba(255,107,0,0.1); color: var(--orange); }
.dash-card-header .icon.green { background: rgba(37,211,102,0.1); color: #25D366; }
.dash-card-header .icon.blue { background: rgba(0,122,255,0.1); color: #007AFF; }
.dash-card-header .icon.purple { background: rgba(175,82,222,0.1); color: #AF52DE; }
.dash-number { font-size: 2rem; font-weight: 800; line-height: 1; }
.dash-label { font-size: 0.85rem; color: var(--gray-400); margin-top: 4px; }
.dash-change { font-size: 0.8rem; font-weight: 600; margin-top: 8px; display: inline-block; }
.dash-change.up { color: #25D366; }
.dash-change.down { color: #FF3B30; }

/* ===== TABLES ===== */
.admin-table-wrap {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-100);
  overflow-x: auto;
  box-shadow: var(--shadow-sm);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.admin-table th {
  text-align: left;
  padding: 14px 16px;
  font-weight: 600;
  color: var(--gray-600);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: var(--off-white);
  border-bottom: 1px solid var(--gray-200);
}
.admin-table td { padding: 14px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
.admin-table tr:hover td { background: rgba(255,107,0,0.03); }
.admin-table .status {
  display: inline-flex;
  padding: 4px 12px;
  border-radius: 50px;
  font-size: 0.78rem;
  font-weight: 600;
}
.status.new { background: rgba(0,122,255,0.1); color: #007AFF; }
.status.contacted { background: rgba(255,107,0,0.1); color: var(--orange); }
.status.closed { background: rgba(37,211,102,0.1); color: #25D366; }

/* ===== ADMIN TOOLBAR ===== */
.admin-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}
.admin-toolbar h3 { font-size: 1.2rem; font-weight: 700; }
.admin-toolbar .btn { padding: 8px 20px; font-size: 0.85rem; }

/* ===== FORMS ===== */
.admin-form { background: var(--white); padding: 28px; border-radius: var(--radius-md); border: 1px solid var(--gray-100); max-width: 700px; }

/* ===== RECENT ACTIVITY ===== */
.recent-list { display: flex; flex-direction: column; }
.recent-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}
.recent-item:last-child { border-bottom: none; }
.recent-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  flex-shrink: 0;
}
.recent-text { font-size: 0.9rem; color: var(--gray-700); flex: 1; }
.recent-time { font-size: 0.82rem; color: var(--gray-400); white-space: nowrap; }

/* ===== CHARTS ===== */
.chart-placeholder {
  background: var(--white);
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-100);
  padding: 24px;
  text-align: center;
  color: var(--gray-400);
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== STATUS SELECT ===== */
.status-select {
  padding: 4px 8px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--white);
}
.status-select.new { color: #007AFF; }
.status-select.contacted { color: var(--orange); }
.status-select.won { color: #25D366; }
.status-select.qualified { color: #AF52DE; }
.status-select.lost { color: #FF3B30; }
.status-select.archived { color: var(--gray-400); }

/* ===== TOASTS ===== */
#toastArea {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 999999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  color: var(--white);
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.25s ease;
}
.toast.ok { background: #25D366; }
.toast.err { background: #FF3B30; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
  }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-toggle { display: block; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; }
  .admin-content { padding: 16px; }
}
@media (max-width: 480px) {
  .dashboard-grid { grid-template-columns: 1fr; }
}
