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

/* ===== DARK THEME (default) ===== */
[data-theme="dark"] {
  --body-bg: #111111;
  --surface-bg: #1a1a1a;
  --card-bg: #222222;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --border-accent: rgba(168, 85, 247, 0.35);
  --accent: #a855f7;
  --accent-hover: #c084fc;
  --accent-dim: rgba(168, 85, 247, 0.12);
  --accent-glow: 0 0 20px rgba(168, 85, 247, 0.25);
  --accent-glow-sm: 0 0 10px rgba(168, 85, 247, 0.15);
  --accent-ring: 0 0 0 2px rgba(168, 85, 247, 0.4);
  --text-primary: #f0f0f0;
  --text-secondary: #999999;
  --text-dim: #666666;
  --danger: #f87171;
  --danger-dim: rgba(248, 113, 113, 0.12);
  --success: #34d399;
  --success-dim: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-dim: rgba(251, 191, 36, 0.12);
  --input-bg: #1a1a1a;
  --input-border: rgba(255, 255, 255, 0.08);
  --table-row-hover: rgba(255, 255, 255, 0.03);
  --logo-color: #a855f7;
  --sidebar-bg: #181818;
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  --body-bg: #fafafa;
  --surface-bg: #ffffff;
  --card-bg: #ffffff;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-accent: rgba(230, 180, 20, 0.5);
  --accent: #d4a300;
  --accent-hover: #e6b400;
  --accent-dim: rgba(230, 180, 20, 0.1);
  --accent-glow: 0 0 20px rgba(230, 180, 20, 0.3);
  --accent-glow-sm: 0 0 6px rgba(230, 180, 20, 0.15);
  --accent-ring: 0 0 0 2px rgba(230, 180, 20, 0.4);
  --text-primary: #1a1a1a;
  --text-secondary: #666666;
  --text-dim: #999999;
  --danger: #dc2626;
  --danger-dim: rgba(220, 38, 38, 0.08);
  --success: #16a34a;
  --success-dim: rgba(22, 163, 74, 0.08);
  --warn: #d97706;
  --warn-dim: rgba(217, 119, 6, 0.08);
  --input-bg: #f5f5f5;
  --input-border: rgba(0, 0, 0, 0.1);
  --table-row-hover: rgba(230, 180, 20, 0.04);
  --logo-color: #d4a300;
  --sidebar-bg: #ffffff;
}

/* ===== COMMON VARS ===== */
:root {
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 999px;
  --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
  --transition-fast: 0.15s ease;
  --transition-base: 0.2s ease;
}

body {
  font-family: var(--font);
  background: var(--body-bg);
  color: var(--text-primary);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background var(--transition-base), color var(--transition-base);
}

#app { display: flex; min-height: 100vh; }

#loading {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  color: var(--text-dim);
  font-size: 1.1rem;
  letter-spacing: 0.5px;
}

.layout { display: flex; width: 100%; min-height: 100vh; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-subtle);
  padding: 28px 16px 20px;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
  transition: background var(--transition-base), border-color var(--transition-base);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--accent-dim); border-radius: var(--radius-full); }

.sidebar-logo {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--logo-color);
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 28px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: color var(--transition-base);
}

.sidebar-logo .logo-dot {
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: var(--accent-glow);
  transition: background var(--transition-base), box-shadow var(--transition-base);
}

.sidebar-section { margin-bottom: 20px; }

.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px 6px 12px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-md);
  transition: color var(--transition-fast);
}

.sidebar-section-header:hover { color: var(--text-secondary); }

.sidebar-section-header .section-arrow {
  font-size: 0.65rem;
  transition: transform var(--transition-base);
}

.sidebar-section-header.collapsed .section-arrow { transform: rotate(-90deg); }

.sidebar-section-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  max-height: 400px;
  transition: max-height 0.25s ease;
}

.sidebar-section-body.collapsed { max-height: 0; }

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
}

.sidebar-nav a:hover { background: var(--accent-dim); color: var(--accent-hover); }
.sidebar-nav a.active { background: var(--accent-dim); color: var(--accent); }

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  box-shadow: var(--accent-glow-sm);
}

.sidebar-nav-link-dashboard {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 8px;
  transition: all var(--transition-fast);
}

.sidebar-nav-link-dashboard:hover { background: var(--accent-dim); color: var(--accent-hover); }
.sidebar-nav-link-dashboard.active { background: var(--accent-dim); color: var(--accent); }

.sidebar-nav-link-dashboard.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  box-shadow: var(--accent-glow-sm);
}

.sidebar-nav a .nav-icon,
.sidebar-nav-link-dashboard .nav-icon {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-nav a .nav-icon svg,
.sidebar-nav-link-dashboard .nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

/* ===== THEME TOGGLE ===== */
.theme-toggle-section {
  margin-top: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border-subtle);
}

.theme-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
}

.theme-toggle-row span {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.theme-switch {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.theme-switch .slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--border-subtle);
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
  border: 1px solid var(--border-subtle);
}

.theme-switch .slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background: var(--accent);
  border-radius: 50%;
  transition: transform var(--transition-fast);
  box-shadow: var(--accent-glow-sm);
}

.theme-switch input:checked + .slider { background: var(--accent-dim); }
.theme-switch input:checked + .slider::before { transform: translateX(20px); }

/* ===== SIDEBAR FOOTER ===== */
.sidebar-footer {
  border-top: 1px solid var(--border-subtle);
  padding-top: 16px;
  margin-top: auto;
}

.sidebar-user {
  font-size: 0.8rem;
  color: var(--text-dim);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.sidebar-user .user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.7rem;
  color: var(--accent);
  flex-shrink: 0;
}

.sidebar-logout {
  width: 100%;
  padding: 8px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: var(--font);
  font-weight: 500;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.sidebar-logout:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }

/* ===== MAIN ===== */
.main-wrapper {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 10px 28px;
  border-bottom: 1px solid var(--border-subtle);
  background: var(--surface-bg);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background var(--transition-base);
}

.save-changes-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-dim);
  font-family: var(--font);
  transition: all var(--transition-fast);
  position: relative;
}

.save-changes-btn:hover {
  border-color: var(--border-accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.save-changes-btn.has-changes {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-dim);
  box-shadow: 0 0 12px rgba(251, 191, 36, 0.15);
}

.save-changes-btn.has-changes:hover {
  background: rgba(251, 191, 36, 0.2);
  box-shadow: 0 0 20px rgba(251, 191, 36, 0.25);
}

.save-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--warn);
  color: #111;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1;
}

.save-changes-btn:not(.has-changes) .save-badge { display: none; }

.main {
  flex: 1;
  padding: 36px 44px;
  max-width: 100%;
}

.page-header { margin-bottom: 36px; }

.page-header h1 {
  font-size: 1.7rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.page-header p { color: var(--text-secondary); font-size: 0.85rem; }
.page-header a { color: var(--accent); }

/* ===== STATS ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}

.stat-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
}

.stat-card:hover { border-color: var(--border-accent); box-shadow: var(--accent-glow-sm); }

.stat-card .stat-icon {
  margin-bottom: 14px;
  width: 24px;
  height: 24px;
  color: var(--accent);
}

.stat-card .stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.5px;
}

.stat-card .stat-label { font-size: 0.8rem; color: var(--text-secondary); margin-top: 6px; }

/* ===== CONTAINERS ===== */
.table-container {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.table-toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ===== VIEW TOGGLE ===== */
.view-toggle {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.view-toggle button {
  padding: 6px 10px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.8rem;
  font-weight: 600;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 4px;
}

.view-toggle button:not(:last-child) { border-right: 1px solid var(--border-subtle); }
.view-toggle button:hover { color: var(--text-secondary); background: var(--accent-dim); }
.view-toggle button.active { color: var(--accent); background: var(--accent-dim); }

/* ===== SEARCH / INPUTS ===== */
.search-input {
  padding: 8px 14px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-full);
  color: var(--text-primary);
  font-size: 0.83rem;
  font-family: var(--font);
  width: 240px;
  transition: all var(--transition-base);
}

.search-input::placeholder { color: var(--text-dim); }
.search-input:focus { outline: none; border-color: var(--accent); box-shadow: var(--accent-glow-sm); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: none;
  text-decoration: none;
  font-family: var(--font);
}

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); box-shadow: var(--accent-glow); }

.btn-outline { background: transparent; border: 1px solid var(--border-accent); color: var(--accent); }
.btn-outline:hover { background: var(--accent-dim); }

.btn-danger { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-dim); }

.btn-sm { padding: 5px 14px; font-size: 0.76rem; }

.btn-ghost { background: transparent; border: 1px solid var(--border-subtle); color: var(--text-secondary); }
.btn-ghost:hover { border-color: var(--border-accent); color: var(--accent); }

/* ===== TABLE ===== */
.product-table { width: 100%; border-collapse: collapse; }

.product-table th {
  text-align: left;
  padding: 11px 16px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  border-bottom: 1px solid var(--border-subtle);
  user-select: none;
}

.product-table th.sortable { cursor: pointer; }
.product-table th.sortable:hover { color: var(--text-secondary); }

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

.product-table tr:hover td { background: var(--table-row-hover); }

.product-table .product-thumb {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--input-bg);
  border: 1px solid var(--border-subtle);
}

.thumb-placeholder {
  width: 48px;
  height: 48px;
  background: var(--input-bg);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
  border: 1px solid var(--border-subtle);
}

.product-table .product-name {
  font-weight: 600;
  color: var(--text-primary);
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-table .product-category {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.product-table .product-price {
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.product-table .product-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-full);
  font-size: 0.7rem;
  font-weight: 700;
  background: var(--accent-dim);
  color: var(--accent);
}

.product-table .actions { display: flex; gap: 5px; }

.actions .action-btn {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.actions .action-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }
.actions .action-btn.delete:hover { border-color: var(--danger); color: var(--danger); background: var(--danger-dim); }

/* ===== CARD VIEW ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  padding: 18px 20px;
}

.product-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: all var(--transition-base);
}

.product-card:hover { border-color: var(--border-accent); box-shadow: var(--accent-glow-sm); }

.product-card .card-image {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--input-bg);
  border-bottom: 1px solid var(--border-subtle);
}

.product-card .card-image-placeholder {
  width: 100%;
  height: 200px;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  border-bottom: 1px solid var(--border-subtle);
}

.product-card .card-body { padding: 14px 16px; }

.product-card .card-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

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

.product-card .card-price { font-weight: 700; color: var(--accent); font-family: var(--font-mono); font-size: 0.9rem; }

.product-card .card-category {
  font-size: 0.72rem;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.product-card .card-actions { display: flex; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border-subtle); }

/* ===== LIST VIEW ===== */
.product-list-compact { display: flex; flex-direction: column; gap: 2px; padding: 10px 20px; }

.product-list-compact .list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  border: 1px solid transparent;
}

.product-list-compact .list-item:hover { background: var(--accent-dim); border-color: var(--border-subtle); }

.product-list-compact .list-thumb,
.product-list-compact .list-thumb-placeholder {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

.product-list-compact .list-thumb { object-fit: cover; background: var(--input-bg); }

.product-list-compact .list-thumb-placeholder {
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.product-list-compact .list-info { flex: 1; min-width: 0; }

.product-list-compact .list-name {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.product-list-compact .list-detail { display: flex; align-items: center; gap: 12px; margin-top: 3px; }

.product-list-compact .list-price {
  font-weight: 700;
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.product-list-compact .list-category {
  font-size: 0.7rem;
  color: var(--text-dim);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.product-list-compact .list-badge { margin-left: auto; }

/* ===== FORM ===== */
.form-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 820px;
}

.form-group { margin-bottom: 22px; }

.form-group label {
  display: block;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 7px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: var(--font);
  transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--accent-glow-sm);
}

.form-group textarea { min-height: 80px; resize: vertical; }
.form-group select { cursor: pointer; }
.form-group select option { background: var(--card-bg); color: var(--text-primary); }

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

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 32px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle);
}

/* ===== IMAGE UPLOADER ===== */
.image-uploader {
  border: 2px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 36px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--input-bg);
}

.image-uploader:hover { border-color: var(--border-accent); background: var(--accent-dim); }

.image-uploader .upload-icon {
  margin-bottom: 10px;
  color: var(--text-dim);
  width: 28px;
  height: 28px;
  margin-left: auto;
  margin-right: auto;
}

.image-uploader .upload-text { font-size: 0.85rem; color: var(--text-secondary); }

.image-preview { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.image-preview .preview-item {
  width: 120px;
  height: 120px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  border: 2px solid var(--border-subtle);
  transition: border-color var(--transition-fast);
}

.image-preview .preview-item:hover { border-color: var(--accent); }

.image-preview .preview-item img { width: 100%; height: 100%; object-fit: cover; }

.image-preview .preview-item .remove-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 22px;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  animation: slideIn 0.25s ease-out;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
  font-family: var(--font);
}

.toast.success { background: var(--success-dim); border: 1px solid var(--success); color: var(--success); }
.toast.error { background: var(--danger-dim); border: 1px solid var(--danger); color: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== PAGINATION ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 18px;
  border-top: 1px solid var(--border-subtle);
}

.pagination button {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.82rem;
  font-family: var(--font-mono);
  transition: all var(--transition-fast);
}

.pagination button:hover { border-color: var(--border-accent); color: var(--accent); }
.pagination button.active { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); box-shadow: var(--accent-glow-sm); }

/* ===== LOGIN ===== */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  background: var(--body-bg);
}

.login-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--accent-glow-sm);
}

.login-card .login-logo {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.login-card .login-subtitle { color: var(--text-secondary); margin-bottom: 36px; font-size: 0.88rem; }

.login-card .github-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 36px;
  background: #24292e;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--transition-base);
  font-family: var(--font);
}

.login-card .github-btn:hover { background: #2f363d; box-shadow: var(--accent-glow); }

/* ===== EMPTY STATE ===== */
.empty-state { text-align: center; padding: 64px 20px; color: var(--text-dim); }

.empty-state .empty-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  font-weight: 800;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.empty-state p { font-size: 0.85rem; }

/* ===== MEDIA LIBRARY ===== */
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }

.media-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
}

.media-card:hover { border-color: var(--border-accent); box-shadow: var(--accent-glow-sm); transform: translateY(-2px); }

.media-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--input-bg);
  border-bottom: 1px solid var(--border-subtle);
}

.media-card .media-placeholder {
  width: 100%;
  height: 160px;
  background: var(--input-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-subtle);
}

.media-card .media-name {
  padding: 8px 10px;
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.media-card .media-actions { padding: 0 10px 10px; display: flex; gap: 6px; }

/* ===== LIGHTBOX ===== */
.lightbox {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.92);
  z-index: 10000;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

[data-theme="light"] .lightbox { background: rgba(0, 0, 0, 0.85); }

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 2rem;
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--transition-fast);
  z-index: 10001;
  line-height: 1;
}

.lightbox-close:hover { color: var(--accent); }

.lightbox-img {
  max-width: 90%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  box-shadow: var(--accent-glow);
  border: 1px solid var(--border-subtle);
}

.lightbox-info {
  margin-top: 18px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

/* ===== IMAGE PATH ROW ===== */
.image-path-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
}

.image-path-row input {
  cursor: pointer;
  transition: all var(--transition-fast);
}

/* ===== IMAGE PICKER MODAL ===== */
.picker-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.picker-card {
  background: var(--card-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--accent-glow-sm);
}

.picker-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.picker-header h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.picker-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.picker-close:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.picker-grid {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.picker-grid::-webkit-scrollbar {
  width: 6px;
}

.picker-grid::-webkit-scrollbar-track {
  background: transparent;
}

.picker-grid::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: var(--radius-full);
}

/* ===== PICKER UPLOAD ROW ===== */
.picker-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-top: 1px solid var(--border-subtle);
  background: var(--input-bg);
  flex-wrap: wrap;
}

/* ===== IMAGE EDITOR ===== */
.editor-canvas-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--input-bg);
  border-top: 1px solid var(--border-subtle);
  min-height: 300px;
}

.editor-canvas-wrap canvas {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  max-width: 100%;
  background: #fff;
}

[data-theme="dark"] .editor-canvas-wrap canvas {
  background: #fff;
}

.editor-controls {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
}

.editor-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.editor-slider-row label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  width: 44px;
}

.editor-slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
}

.editor-slider-row span {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-secondary);
  width: 48px;
  text-align: right;
}

.editor-btn-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ===== EDIT IMAGE BUTTON ON PREVIEWS ===== */
.edit-img-btn {
  position: absolute;
  bottom: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  transition: all var(--transition-fast);
}

.edit-img-btn:hover {
  background: var(--accent);
  color: #fff;
}

/* ===== PENDING CHANGES BADGE ===== */
.pending-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  margin: 8px 0 0 0;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: var(--radius-md);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--warn);
  animation: fadeInBadge 0.3s ease;
}

.pending-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--warn);
  display: inline-block;
  animation: pulseDot 1.5s infinite;
}

.pending-inline {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--warn);
  font-weight: 600;
  margin-left: auto;
}

@keyframes fadeInBadge {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ===== CHANGES PANEL ===== */
.changes-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 9999;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  padding: 0;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.changes-overlay.visible {
  opacity: 1;
}

.changes-panel {
  width: 480px;
  max-width: 100%;
  height: 100vh;
  background: var(--surface-bg);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  box-shadow: -8px 0 30px rgba(0, 0, 0, 0.2);
}

.changes-overlay.visible .changes-panel {
  transform: translateX(0);
}

.changes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-subtle);
}

.changes-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.changes-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.changes-close:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.changes-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
}

.changes-list::-webkit-scrollbar {
  width: 6px;
}

.changes-list::-webkit-scrollbar-track {
  background: transparent;
}

.changes-list::-webkit-scrollbar-thumb {
  background: var(--accent-dim);
  border-radius: var(--radius-full);
}

.changes-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}

.changes-empty-icon {
  font-size: 2rem;
  margin-bottom: 10px;
  color: var(--success);
}

.changes-empty p {
  font-size: 0.85rem;
}

.changes-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border-subtle);
  transition: background var(--transition-fast);
}

.changes-item:hover {
  background: var(--accent-dim);
}

.changes-item-check {
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-top: 2px;
  flex-shrink: 0;
}

.changes-item-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}

.changes-item-info {
  flex: 1;
  min-width: 0;
}

.changes-item-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.changes-item-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.changes-item-type {
  font-size: 0.68rem;
  color: var(--text-dim);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.changes-item-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 6px;
}

.change-field {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.change-field-label {
  color: var(--accent);
  font-weight: 600;
  min-width: 80px;
}

.change-field-from {
  color: var(--text-dim);
  text-decoration: line-through;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.change-field-arrow {
  color: var(--text-dim);
  font-size: 0.7rem;
}

.change-field-to {
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.changes-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-bg);
}

.changes-footer-actions {
  display: flex;
  gap: 8px;
}

/* ===== EDITED BADGE ===== */
.edited-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-full);
  font-size: 0.62rem;
  font-weight: 700;
  background: rgba(251, 191, 36, 0.15);
  color: var(--warn);
  border: 1px solid rgba(251, 191, 36, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
  margin-left: 4px;
  animation: fadeInBadge 0.3s ease;
}

.product-edited {
  border-color: rgba(251, 191, 36, 0.35) !important;
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.1);
}

.row-edited {
  background: rgba(251, 191, 36, 0.04) !important;
}

.list-edited {
  background: rgba(251, 191, 36, 0.04) !important;
  border-color: rgba(251, 191, 36, 0.2) !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { width: 64px; padding: 20px 8px; }
  .sidebar-logo { font-size: 0; gap: 0; }
  .sidebar-logo .logo-dot { width: 12px; height: 12px; }
  .sidebar-section-header { display: none; }
  .sidebar-nav a,
  .sidebar-nav-link-dashboard { justify-content: center; padding: 10px; }
  .sidebar-nav a span:not(.nav-icon),
  .sidebar-nav-link-dashboard span:not(.nav-icon) { display: none; }
  .sidebar-user { display: none; }
  .theme-toggle-row span { display: none; }
  .sidebar-footer { text-align: center; }
  .sidebar-logout { font-size: 0; padding: 10px; }
  .main-wrapper { margin-left: 64px; }
  .main { padding: 20px; max-width: calc(100vw - 64px); }
  .form-row { grid-template-columns: 1fr; }
  .table-toolbar { flex-direction: column; align-items: stretch; }
  .search-input { width: 100%; }
  .product-table .product-name { max-width: 120px; }
  .changes-panel { width: 100% !important; max-width: 100% !important; right: 0 !important; }
}
