:root {
  --primary: #635bff;
  --secondary: #20c997;
  --dark: #101828;
  --text: #667085;
  --light: #f5f7fb;
  --white: #ffffff;
  --border: #eaecf0;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.08);
}

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

body {
  background: var(--light);
  color: var(--text);
  font-family: "Segoe UI", sans-serif;
}

.dashboard-wrapper { display: flex; min-height: 100vh; }

.sidebar {
  width: 280px;
  background: var(--dark);
  color: var(--white);
  padding: 24px;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1000;
  transition: 0.3s ease;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar { width: 5px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 20px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 30px;
}

.brand i { color: var(--secondary); }

.sidebar-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-menu li { margin-bottom: 8px; }

.sidebar-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #cfd4dc;
  text-decoration: none;
  padding: 13px 14px;
  border-radius: 14px;
  font-weight: 600;
  transition: 0.25s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
  background: linear-gradient(135deg, var(--primary), #857fff);
  color: var(--white);
}

.sidebar-card {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 18px;
  border-radius: 18px;
  margin-top: 22px;
  flex-shrink: 0;
}

.sidebar-card h6 {
  color: var(--white);
  font-weight: 800;
}

.sidebar-card p {
  font-size: 13px;
  color: #cfd4dc;
}

.sidebar-card button {
  width: 100%;
  border: none;
  background: var(--secondary);
  color: var(--dark);
  font-weight: 800;
  padding: 10px;
  border-radius: 12px;
}

.main-content {
  margin-left: 280px;
  width: calc(100% - 280px);
  padding: 24px;
}

.topbar {
  background: var(--white);
  border-radius: 24px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.topbar h4 {
  color: var(--dark);
  font-weight: 800;
  margin: 0;
}

.topbar p { margin: 0; font-size: 14px; }

.menu-btn {
  display: none;
  border: none;
  background: var(--primary);
  color: var(--white);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.search-box {
  background: var(--light);
  padding: 10px 14px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  width: 230px;
}

.icon-btn {
  border: none;
  width: 42px;
  height: 42px;
  background: var(--light);
  border-radius: 14px;
  color: var(--dark);
}

.admin-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-profile strong,
.admin-profile small { display: block; }

.admin-profile strong {
  color: var(--dark);
  line-height: 1;
}

.avatar {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: var(--white);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  flex-shrink: 0;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}

.stat-card,
.panel,
.product-card {
  background: var(--white);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.stat-card {
  padding: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-card p { margin: 0 0 6px; font-weight: 600; }
.stat-card h3 { color: var(--dark); font-weight: 900; margin-bottom: 8px; }

.stat-card i {
  width: 58px;
  height: 58px;
  background: rgba(99, 91, 255, 0.1);
  color: var(--primary);
  display: grid;
  place-items: center;
  border-radius: 18px;
  font-size: 28px;
}

.up { color: #12b76a; font-weight: 800; }
.down { color: #f04438; font-weight: 800; }

.panel { padding: 24px; }

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.panel-header h5 {
  color: var(--dark);
  font-weight: 900;
  margin: 0;
}

.panel-header p { margin: 3px 0 0; font-size: 14px; }
.panel-header .form-select { width: 140px; border-radius: 12px; }

.chart-bars {
  height: 280px;
  display: flex;
  align-items: end;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 30px;
}

.chart-bars.big { height: 360px; }

.chart-bars div {
  flex: 1;
  background: linear-gradient(180deg, var(--primary), #b6b2ff);
  border-radius: 14px 14px 0 0;
  position: relative;
  min-height: 35px;
}

.chart-bars span {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  font-weight: 700;
  color: var(--text);
  font-size: 13px;
}

.category-list div {
  display: flex;
  justify-content: space-between;
  background: var(--light);
  padding: 16px;
  border-radius: 16px;
  margin-bottom: 14px;
}

.category-list span { color: var(--dark); font-weight: 700; }
.category-list strong { color: var(--primary); }

.btn-main,
.action-btn {
  border: none;
  text-decoration: none;
  background: var(--primary);
  color: var(--white);
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 800;
  display: inline-block;
}

.action-btn {
  background: rgba(99,91,255,.12);
  color: var(--primary);
  padding: 8px 14px;
}

.table { margin: 0; }

.table thead th {
  color: var(--dark);
  font-size: 14px;
  background: var(--light);
  border: none;
}

.table td {
  color: var(--text);
  font-weight: 600;
  padding: 16px 10px;
}

.product-card { padding: 22px; height: 100%; }

.product-image {
  height: 150px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(99,91,255,.14), rgba(32,201,151,.18));
  display: grid;
  place-items: center;
  margin-bottom: 18px;
}

.product-image i {
  font-size: 58px;
  color: var(--primary);
}

.product-card h5 {
  color: var(--dark);
  font-weight: 900;
}

.message-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 0;
  border-bottom: 1px solid var(--border);
}

.message-item:last-child { border-bottom: none; }

.message-item div:nth-child(2) { flex: 1; }

.message-item h6 {
  margin: 0;
  color: var(--dark);
  font-weight: 800;
}

.message-item p { margin: 3px 0 0; }

.settings-form {
  max-width: 650px;
}

.settings-form label {
  color: var(--dark);
  font-weight: 800;
  margin-top: 15px;
  margin-bottom: 8px;
}

.settings-form .form-control,
.settings-form .form-select {
  padding: 12px 14px;
  border-radius: 12px;
}

.overlay { display: none; }

@media (max-width: 1200px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .search-box input { width: 170px; }
}

@media (max-width: 991px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .menu-btn { display: block; }

  .topbar {
    gap: 15px;
    align-items: flex-start;
  }

  .topbar-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(16, 24, 40, 0.55);
    z-index: 999;
  }
}

@media (max-width: 767px) {
  .main-content { padding: 16px; }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .search-box { width: 100%; }
  .search-box input { width: 100%; }

  .stats-grid { grid-template-columns: 1fr; }

  .panel-header {
    align-items: flex-start;
    gap: 12px;
    flex-direction: column;
  }

  .chart-bars { gap: 8px; }

  .admin-profile { display: none; }

  .sidebar {
    width: 265px;
    padding: 18px;
  }
}
