:root {
  --bg-page-light: #f5f7fb;
  --bg-page-dark: #050609;

  --bg-card-light: #ffffff;
  --bg-card-dark: #12141b;

  --bg-sidebar-light: #101214;
  --bg-sidebar-dark: #07080a;

  --accent: #3be477;
  --accent-soft: rgba(59, 228, 119, 0.15);

  --text-main-light: #101215;
  --text-main-dark: #f8f9ff;

  --text-muted-light: #8e95a3;
  --text-muted-dark: #7d8397;

  --border-subtle-light: #e1e4ee;
  --border-subtle-dark: #222432;

  --danger: #ff4d6a;

  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-soft: 0 18px 45px rgba(15, 23, 42, 0.18);
  --shadow-small: 0 8px 20px rgba(15, 23, 42, 0.12);

  --sidebar-width: 260px;
  --topbar-height: 70px;
  --transition-fast: 0.18s ease-out;
  --transition-med: 0.25s ease-out;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", Roboto, sans-serif;
}

/* THEME */

body[data-theme="light"] {
  color: var(--text-main-light);
  background: var(--bg-page-light);
}

body[data-theme="dark"] {
  color: var(--text-main-dark);
  background: radial-gradient(circle at top, #202331 0, #050609 55%);
}

/* LAYOUT */

.layout {
  min-height: 100vh;
  padding-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

.main {
  flex: 1;
  padding: 18px 24px 32px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

/* SIDEBAR */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, #0d1014 0%, #060708 100%);
  color: #f3f5ff;
  display: flex;
  flex-direction: column;
  padding: 18px 16px 16px;
  z-index: 40;
  border-right: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 16px;
}

.sidebar-logo {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  background: radial-gradient(circle at 0 0, #3be477, #1abc73);
  color: #050809;
  box-shadow: 0 0 0 3px rgba(59, 228, 119, 0.25);
  font-size: 15px;
}

.sidebar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-app {
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 14px;
}

.sidebar-sub {
  font-size: 11px;
  color: rgba(201, 208, 234, 0.7);
}

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

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

.nav-group-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: rgba(180, 188, 220, 0.65);
  padding: 0 8px 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 10px;
  font-size: 13px;
  color: rgba(225, 229, 255, 0.9);
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
  cursor: pointer;
}

.nav-link .nav-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
}

.nav-link.active {
  background: rgba(59, 228, 119, 0.15);
  color: #faffff;
}

.nav-link.active .nav-dot {
  background: #3be477;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-meta {
  margin-top: 8px;
  text-align: center;
}

/* SIDEBAR MOBILE */

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-med);
}

body.sidebar-open .sidebar-overlay {
  opacity: 1;
  pointer-events: auto;
}

@media (max-width: 900px) {
  .layout {
    padding-left: 0;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform var(--transition-med);
  }

  body.sidebar-open .sidebar {
    transform: translateX(0);
  }
}

/* TOPBAR */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

body[data-theme="dark"] .topbar {
  background: rgba(8, 10, 16, 0.9);
  border-bottom-color: rgba(148, 163, 184, 0.06);
}

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

.topbar-greeting {
  display: flex;
  flex-direction: column;
}

.top-title {
  font-weight: 600;
  font-size: 18px;
}

.top-sub {
  font-size: 12px;
  color: var(--text-muted-light);
}

body[data-theme="dark"] .top-sub {
  color: var(--text-muted-dark);
}

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

.icon-btn {
  border: none;
  background: transparent;
  font-size: 18px;
  cursor: pointer;
  padding: 6px 9px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition-fast), transform var(--transition-fast);
  color: inherit;
}

.icon-btn:hover {
  background: rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

body[data-theme="dark"] .icon-btn:hover {
  background: rgba(148, 163, 184, 0.15);
}

.top-user {
  display: flex;
  align-items: center;
  gap: 8px;
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #111827;
  color: #f9fafb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  background-size: cover;
  background-position: center;
}

.top-user-info {
  display: flex;
  flex-direction: column;
}

.top-user-name {
  font-size: 13px;
  font-weight: 500;
}

.top-user-email {
  font-size: 11px;
  color: var(--text-muted-light);
}

body[data-theme="dark"] .top-user-email {
  color: var(--text-muted-dark);
}

/* BUTTONS */

.btn {
  border-radius: 999px;
  border: none;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  background: linear-gradient(135deg, #3be477, #19c66a);
  color: #031107;
  box-shadow: 0 10px 22px rgba(59, 228, 119, 0.4);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    background var(--transition-fast), opacity var(--transition-fast);
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 30px rgba(59, 228, 119, 0.4);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 6px 18px rgba(59, 228, 119, 0.3);
}

.btn.secondary {
  background: transparent;
  color: inherit;
  box-shadow: none;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.btn.secondary:hover {
  background: rgba(148, 163, 184, 0.12);
}

.btn.ghost {
  background: rgba(148, 163, 184, 0.12);
  color: inherit;
  box-shadow: none;
}

.btn.ghost:hover {
  background: rgba(148, 163, 184, 0.2);
}

.btn.danger {
  background: #ff4d6a;
  color: #fff;
  box-shadow: 0 12px 24px rgba(255, 77, 106, 0.35);
}

.btn.tiny {
  padding: 4px 10px;
  font-size: 11px;
  box-shadow: none;
}

.btn.full {
  width: 100%;
}

/* TEXT UTILS */

.muted {
  color: var(--text-muted-light);
}

body[data-theme="dark"] .muted {
  color: var(--text-muted-dark);
}

.small {
  font-size: 13px;
}

.tiny {
  font-size: 11px;
}

.tiny-mt {
  margin-top: 8px;
}

/* CARDS */

.card {
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  background: var(--bg-card-light);
  box-shadow: var(--shadow-soft);
  border: 1px solid var(--border-subtle-light);
}

body[data-theme="dark"] .card {
  background: radial-gradient(circle at 0 -40%, #1d2230 0, #10131f 40%, #080a12 100%);
  border-color: var(--border-subtle-dark);
  box-shadow: var(--shadow-soft);
}

.card.flat {
  box-shadow: var(--shadow-small);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-header h1 {
  font-size: 20px;
  margin: 0;
}

.section-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* GRID */

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: 1.1fr 1fr;
}

@media (max-width: 960px) {
  .grid.two {
    grid-template-columns: 1fr;
  }
}

.stats-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

/* STAT CARDS */

.stat-card {
  border-radius: var(--radius-lg);
  padding: 14px 14px 14px;
  background: var(--bg-card-light);
  border: 1px solid rgba(15, 23, 42, 0.06);
}

body[data-theme="dark"] .stat-card {
  background: radial-gradient(circle at 0 -40%, #212532 0, #111521 50%, #050711 100%);
  border-color: rgba(148, 163, 184, 0.25);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted-light);
}

body[data-theme="dark"] .stat-label {
  color: var(--text-muted-dark);
}

.stat-value {
  font-size: 22px;
  font-weight: 600;
  margin: 4px 0;
}

.stat-value.small {
  font-size: 14px;
  line-height: 1.4;
}

.stat-sub {
  font-size: 11px;
}

/* CHART */

.chart-card {
  margin-top: 16px;
}

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

.chart-title {
  font-weight: 500;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
}

.chart-bar {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 10px;
}

.chart-bar-inner {
  width: 100%;
  border-radius: 999px;
  background: var(--accent-soft);
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
}

.chart-bar-inner::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, #3be477 0%, #19c66a 100%);
  opacity: 0.7;
}

.chart-bar-value {
  position: relative;
  z-index: 1;
  padding-bottom: 4px;
  font-weight: 500;
  font-size: 11px;
  color: #021209;
}

.chart-bar-label {
  margin-top: 4px;
}

/* PROFILE */

.profile-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-avatar {
  width: 48px;
  height: 48px;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-name-row h2 {
  margin: 0;
  font-size: 18px;
}

.pill {
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
}

.pill-admin {
  background: rgba(59, 228, 119, 0.08);
  border-color: rgba(59, 228, 119, 0.7);
  color: #22c55e;
}

.pill-user {
  background: rgba(148, 163, 184, 0.12);
}

.profile-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.9fr);
  gap: 14px;
}

@media (max-width: 800px) {
  .profile-grid {
    grid-template-columns: 1fr;
  }
}

.profile-brands {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brand-pill {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.08);
  font-size: 12px;
}

.brand-pill-main {
  display: flex;
  flex-direction: column;
}

.brand-name {
  font-weight: 500;
}

.brand-slug {
  font-size: 11px;
  opacity: 0.7;
}

/* TAGS */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.16);
}

.tag-approved {
  background: rgba(34, 197, 94, 0.12);
  color: #22c55e;
}

.tag-rejected {
  background: rgba(239, 68, 68, 0.12);
  color: #ef4444;
}

.tag-pending {
  background: rgba(250, 204, 21, 0.15);
  color: #eab308;
}

/* FORMS */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
  margin-top: 8px;
}

.form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}

.form-grid label span {
  color: var(--text-muted-light);
}

body[data-theme="dark"] .form-grid label span {
  color: var(--text-muted-dark);
}

.form-grid .full {
  grid-column: 1 / -1;
}

.form-footer {
  display: flex;
  align-items: center;
  gap: 10px;
}

input,
textarea,
select {
  border-radius: 10px;
  border: 1px solid var(--border-subtle-light);
  padding: 7px 9px;
  font: inherit;
  background: rgba(255, 255, 255, 0.96);
}

body[data-theme="dark"] input,
body[data-theme="dark"] textarea,
body[data-theme="dark"] select {
  background: rgba(15, 23, 42, 0.7);
  border-color: var(--border-subtle-dark);
  color: var(--text-main-dark);
}

textarea {
  resize: vertical;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.inline-form input {
  flex: 1;
}

.search-input {
  min-width: 220px;
}

/* STACK LISTS */

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* PRODUCTS */

.product-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.product-main {
  flex: 1;
}

.product-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.product-name {
  font-weight: 500;
  font-size: 14px;
}

.product-name.small {
  font-size: 13px;
}

.product-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted-light);
}

body[data-theme="dark"] .product-meta-row {
  color: var(--text-muted-dark);
}

.product-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* BATCHES */

.batch-card {
  padding: 14px 14px 10px;
}

.batch-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.batch-title {
  font-weight: 500;
}

.batch-sub {
  font-size: 11px;
}

.batch-details {
  margin-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.35);
  padding-top: 8px;
}

.batch-product-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
}

.tiny .batch-product-row {
  font-size: 11px;
}

/* MESSAGES */

.message-card {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.message-main {
  flex: 1;
}

.message-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.message-title {
  font-weight: 500;
}

.message-body {
  margin-top: 4px;
}

.message-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* DIVIDER */

.divider {
  margin: 12px 0;
  border: none;
  border-top: 1px dashed rgba(148, 163, 184, 0.4);
}

/* RESPONSIVE */

@media (max-width: 720px) {
  .topbar {
    padding: 8px 14px;
  }

  .main {
    padding: 14px;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .top-user-info {
    display: none;
  }
}
