@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

/* ─── Reset & Base ──────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:     #0f1117;
  --bg-surface:  #161b27;
  --bg-card:     #1c2333;
  --bg-hover:    #212840;
  --border:      rgba(255,255,255,0.07);
  --border-hover:rgba(108,92,231,0.5);

  --accent:      #6C5CE7;
  --accent-light:#8b7cf8;
  --accent-glow: rgba(108,92,231,0.25);

  --green:  #00cec9;
  --red:    #ff6b81;
  --orange: #fdcb6e;
  --blue:   #74b9ff;

  --text-primary:   #e8eaf0;
  --text-secondary: #8892a4;
  --text-muted:     #545e72;

  --sidebar-w: 240px;
  --header-h:  64px;
  --radius:    12px;
  --radius-sm: 8px;

  --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--bg-base); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ─── Sidebar ───────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.logo-icon {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 9px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3px;
  padding: 6px;
  flex-shrink: 0;
  box-shadow: 0 0 18px var(--accent-glow);
}

.logo-icon span {
  background: white;
  border-radius: 2px;
  opacity: 0.9;
}

.logo-icon span:nth-child(2),
.logo-icon span:nth-child(3) { opacity: 0.55; }

.logo-text {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
}

.logo-text em {
  font-style: normal;
  color: var(--accent-light);
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 18px 20px 6px;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
  text-decoration: none;
  margin-bottom: 2px;
  user-select: none;
}

.nav-item svg { flex-shrink: 0; opacity: 0.7; transition: opacity var(--transition); }

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item:hover svg { opacity: 1; }

.nav-item.active {
  background: var(--accent-glow);
  color: var(--accent-light);
  border: 1px solid rgba(108,92,231,0.2);
}

.nav-item.active svg { opacity: 1; color: var(--accent-light); }

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

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

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
}

.sidebar-user:hover { background: var(--bg-hover); }

.user-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6C5CE7, #a29bfe);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: white;
  flex-shrink: 0;
  box-shadow: 0 0 12px var(--accent-glow);
}

.user-info { min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 11px; color: var(--text-muted); }

/* ─── Overlay (mobile) ──────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 90;
  backdrop-filter: blur(2px);
}

/* ─── Main Layout ───────────────────────────────────────────── */
.main-wrapper {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ─── Header ────────────────────────────────────────────────── */
.header {
  position: sticky; top: 0; z-index: 80;
  height: var(--header-h);
  background: rgba(22,27,39,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  transition: background var(--transition);
}

.menu-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }

.header-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}

.header-search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.header-search input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 14px 9px 38px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.header-search input::placeholder { color: var(--text-muted); }

.header-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

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

.header-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all var(--transition);
  position: relative;
}

.header-btn:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }

.notif-dot {
  position: absolute;
  top: 6px; right: 7px;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,100% { transform: scale(1); opacity: 1; }
  50%      { transform: scale(1.3); opacity: 0.7; }
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px 5px 5px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all var(--transition);
}

.header-profile:hover { border-color: var(--border-hover); background: var(--bg-hover); }

.profile-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6C5CE7, #a29bfe);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: white;
}

.profile-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }

/* ─── Page Shell (persistent title row) ────────────────────── */
.page-shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 28px 28px 0;
  flex-shrink: 0;
}

.page-title h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text-primary);
}

.page-title p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

.page-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* ─── Page Content ──────────────────────────────────────────── */
.page-content {
  flex: 1;
  padding: 24px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 6px 22px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-hover);
}

/* ─── Stat Cards ────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--transition);
  cursor: default;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--card-accent, var(--accent));
  border-radius: var(--radius) var(--radius) 0 0;
  opacity: 0;
  transition: opacity var(--transition);
}

.stat-card:hover {
  border-color: rgba(108,92,231,0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.3);
}

.stat-card:hover::before { opacity: 1; }

.stat-card[data-color="green"] { --card-accent: var(--green); }
.stat-card[data-color="red"]   { --card-accent: var(--red); }
.stat-card[data-color="orange"]{ --card-accent: var(--orange); }

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

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.stat-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  background: var(--icon-bg, rgba(108,92,231,0.15));
  color: var(--icon-color, var(--accent-light));
}

.stat-card[data-color="green"] .stat-icon { --icon-bg: rgba(0,206,201,0.12); --icon-color: var(--green); }
.stat-card[data-color="red"]   .stat-icon { --icon-bg: rgba(255,107,129,0.12); --icon-color: var(--red); }
.stat-card[data-color="orange"].stat-icon { --icon-bg: rgba(253,203,110,0.12); --icon-color: var(--orange); }

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -1px;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

.stat-change {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.stat-change.up   { background: rgba(0,206,201,0.12); color: var(--green); }
.stat-change.down { background: rgba(255,107,129,0.12); color: var(--red); }

.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ─── Grid Row (chart + table) ──────────────────────────────── */
.content-row {
  display: grid;
  gap: 20px;
}

.content-row.two-col { grid-template-columns: 1fr 360px; }
.content-row.two-col-equal { grid-template-columns: 1fr 1fr; }

/* ─── Card ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}

.card:hover { border-color: rgba(108,92,231,0.18); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-title svg { color: var(--accent-light); }

.card-meta { font-size: 12px; color: var(--text-muted); font-weight: 400; }

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

.chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition);
  color: var(--text-secondary);
  background: transparent;
  font-family: inherit;
}

.chip:hover,
.chip.active { background: var(--accent); border-color: var(--accent); color: white; }

/* ─── Bar Chart ─────────────────────────────────────────────── */
.chart-wrap { padding: 20px; }

.chart-legend {
  display: flex;
  gap: 18px;
  margin-bottom: 18px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.legend-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
}

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 180px;
  padding-bottom: 28px;
  position: relative;
}

.bar-chart::before {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 28px;
  border-top: 1px dashed rgba(255,255,255,0.06);
  box-shadow: 0 -60px 0 0 rgba(255,255,255,0.04), 0 -120px 0 0 rgba(255,255,255,0.04);
}

.bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.bar-bars {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  flex: 1;
  width: 100%;
  justify-content: center;
}

.bar {
  width: 12px;
  border-radius: 4px 4px 0 0;
  transition: height 1.2s cubic-bezier(.4,0,.2,1), opacity var(--transition);
  transform-origin: bottom;
  cursor: pointer;
  position: relative;
}

.bar:hover { opacity: 0.8; }

.bar.revenue { background: linear-gradient(180deg, var(--accent-light), var(--accent)); }
.bar.orders  { background: linear-gradient(180deg, #74b9ff, #0984e3); }

.bar-tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%; transform: translateX(-50%);
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
  z-index: 10;
}

.bar:hover .bar-tooltip { opacity: 1; }

.bar-label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  font-weight: 500;
}

/* ─── Line Chart (trend) ────────────────────────────────────── */
.line-chart-wrap { padding: 16px 20px 20px; }

.sparkline {
  width: 100%;
  height: 80px;
  display: block;
}

/* ─── Orders Table ──────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--transition);
}

tbody tr:last-child { border-bottom: none; }

tbody tr:hover { background: var(--bg-hover); }

td {
  padding: 12px 16px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.order-id { font-weight: 600; color: var(--text-primary); font-family: 'SF Mono', monospace; font-size: 12px; }
.customer-name { font-weight: 500; color: var(--text-primary); }
.amount { font-weight: 700; color: var(--text-primary); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.badge-shipping  { background: rgba(116,185,255,0.12); color: var(--blue); }
.badge-complete  { background: rgba(0,206,201,0.12);   color: var(--green); }
.badge-cancel    { background: rgba(255,107,129,0.12); color: var(--red); }
.badge-pending   { background: rgba(253,203,110,0.12); color: var(--orange); }

/* ─── Products List ─────────────────────────────────────────── */
.product-list { padding: 8px 0; }

.product-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  transition: background var(--transition);
  cursor: pointer;
}

.product-item:hover { background: var(--bg-hover); }

.product-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.product-icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.product-info { flex: 1; min-width: 0; }
.product-name { font-size: 13px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.product-category { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.product-stats { text-align: right; flex-shrink: 0; }
.product-revenue { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.product-sales { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.product-bar-wrap { width: 80px; flex-shrink: 0; }
.product-bar-bg { height: 4px; background: var(--bg-hover); border-radius: 2px; overflow: hidden; }
.product-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  transition: width 1s cubic-bezier(.4,0,.2,1);
}

/* ─── Mini Stats Row ────────────────────────────────────────── */
.mini-stats {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 1px;
  background: var(--border);
  border-top: 1px solid var(--border);
}

.mini-stat {
  background: var(--bg-card);
  padding: 14px 16px;
  text-align: center;
}

.mini-stat-val { font-size: 16px; font-weight: 800; color: var(--text-primary); }
.mini-stat-lbl { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2,1fr); }
  .content-row.two-col { grid-template-columns: 1fr; }
}

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

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,0.5);
  }

  .sidebar-overlay.open { display: block; }

  .main-wrapper { margin-left: 0; }
  .menu-toggle { display: flex; }

  .page-shell  { padding: 20px 16px 0; }
  .page-content { padding: 20px 16px 32px; }
  .header { padding: 0 16px; }
  .bar-chart { height: 140px; }
}

@media (max-width: 640px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .content-row.two-col-equal { grid-template-columns: 1fr; }
  .header-search { display: none; }
  .page-title h1 { font-size: 18px; }
  .stat-value { font-size: 22px; }
  .product-bar-wrap { display: none; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr; }
  .page-actions .btn span { display: none; }
}

/* ─── Loading shimmer ───────────────────────────────────────── */
@keyframes shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

/* ─── Fade-in animations ────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-up { animation: fadeUp 0.5s ease both; }
.stat-card:nth-child(1) { animation-delay: 0.05s; }
.stat-card:nth-child(2) { animation-delay: 0.10s; }
.stat-card:nth-child(3) { animation-delay: 0.15s; }
.stat-card:nth-child(4) { animation-delay: 0.20s; }

/* ─── Table count label ─────────────────────────────────────── */
.table-count {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ─── Toast ─────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 28px;
  right: 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 9999;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: white;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transform: translateX(120%);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(.4,0,.2,1), opacity 0.3s ease;
  pointer-events: auto;
  max-width: 340px;
  backdrop-filter: blur(8px);
}

.toast.show {
  transform: translateX(0);
  opacity: 1;
}

.toast-success { background: rgba(0,206,201,0.92); }
.toast-error   { background: rgba(255,107,129,0.92); }
.toast-info    { background: rgba(108,92,231,0.92); }

/* ─── Modal ─────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

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

.modal-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
}

.modal-overlay.open .modal-box {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
}

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

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.modal-close-btn:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-section:last-child { border-bottom: none; }

.modal-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.modal-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.info-key { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.info-val { font-size: 13px; font-weight: 500; color: var(--text-primary); }

.order-item-list { display: flex; flex-direction: column; gap: 2px; }

.order-item-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 13px;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.order-total-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.status-change-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-select {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 12px;
  outline: none;
  cursor: pointer;
  transition: border-color var(--transition);
}

.status-select:focus { border-color: var(--accent); }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

/* ─── Form elements ─────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.form-input {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 13.5px;
  padding: 9px 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  width: 100%;
}

.form-input::placeholder { color: var(--text-muted); }
.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

/* ─── Filter Bar ────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
}

.search-field {
  position: relative;
  min-width: 220px;
}

.search-field svg {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px 8px 34px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.search-field input::placeholder { color: var(--text-muted); }
.search-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.status-filters { display: flex; gap: 6px; flex-wrap: wrap; }

/* ─── Icon button ───────────────────────────────────────────── */
.btn-icon {
  width: 30px; height: 30px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
  transition: all var(--transition);
}

.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); border-color: var(--border-hover); }
.btn-delete:hover { background: rgba(255,107,129,0.1); color: var(--red); border-color: rgba(255,107,129,0.3); }

/* ─── Empty row ─────────────────────────────────────────────── */
.empty-row {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px !important;
  font-size: 14px;
}

/* ─── Grade badges ──────────────────────────────────────────── */
.badge-vvip   { background: rgba(108,92,231,0.18); color: var(--accent-light); }
.badge-vip    { background: rgba(253,203,110,0.14); color: var(--orange); }
.badge-normal { background: rgba(136,146,164,0.14); color: var(--text-secondary); }

/* ─── Notification dropdown ─────────────────────────────────── */
.notif-wrap { position: relative; }

.notif-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 320px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  z-index: 300;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.notif-dropdown.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
}

.notif-unread-count {
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  color: white;
  border-radius: 20px;
  padding: 2px 8px;
}

.notif-list { max-height: 300px; overflow-y: auto; }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
  position: relative;
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: rgba(108,92,231,0.05); }
.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}

.notif-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent-light);
  background: var(--accent-glow);
}

.notif-icon-order  { background: rgba(116,185,255,0.12); color: var(--blue); }
.notif-icon-member { background: rgba(0,206,201,0.12);   color: var(--green); }
.notif-icon-stock  { background: rgba(253,203,110,0.12); color: var(--orange); }
.notif-icon-system { background: rgba(136,146,164,0.12); color: var(--text-secondary); }

.notif-content { flex: 1; min-width: 0; }
.notif-msg  { font-size: 12.5px; color: var(--text-primary); line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

.notif-footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.notif-footer button {
  background: none;
  border: none;
  color: var(--accent-light);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: color var(--transition);
}

.notif-footer button:hover { color: var(--accent); }

/* ─── Settings ──────────────────────────────────────────────── */
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.settings-body { padding: 20px; }

.profile-preview {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.profile-avatar-lg {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6C5CE7, #a29bfe);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: white;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.toggle-row:last-child { border-bottom: none; }

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 24px;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.2s ease, background 0.2s ease;
}

.toggle-switch input:checked + .toggle-slider { background: var(--accent-glow); border-color: var(--accent); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); background: var(--accent); }

/* ─── Responsive additions ───────────────────────────────────── */
@media (max-width: 1100px) {
  .settings-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .page-content { padding: 16px 16px 32px; }
  .form-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .notif-dropdown { width: 290px; right: -60px; }
  .filter-bar { flex-direction: column; align-items: stretch; }
  .search-field { min-width: unset; }
  .modal-info-grid { grid-template-columns: 1fr; }
}
