﻿:root {
  --bg-primary: #f0f7ff;
  --bg-card: #ffffff;
  --bg-sidebar: #0f172a;
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #38bdf8;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --text-white: #f8fafc;
  --accent: #38bdf8;
  --accent-light: #e0f2fe;
  --success: #10b981;
  --success-light: #d1fae5;
  --warning: #fbbf24;
  --warning-light: #fef3c7;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --border: #e0f2fe;
  --shadow: 0 1px 4px rgba(56, 189, 248, 0.08);
  --shadow-md: 0 4px 16px rgba(56, 189, 248, 0.12);
  --radius: 14px;
  --radius-sm: 10px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

/* --- Layout --- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  padding: 24px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}

.sidebar-brand h1 {
  color: var(--text-white);
  font-size: 18px;
  font-weight: 700;
}

.sidebar-brand p {
  color: var(--text-muted);
  font-size: 12px;
  margin-top: 2px;
}

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

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s;
  cursor: pointer;
  margin-bottom: 2px;
}

.sidebar-nav a:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-white);
}

.sidebar-nav a.active {
  background: var(--bg-sidebar-active);
  color: #fff;
  box-shadow: 0 2px 8px rgba(56, 189, 248, 0.3);
}

.sidebar-nav a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-user {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user .user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.sidebar-user .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.sidebar-user .name {
  color: var(--text-white);
  font-size: 13px;
  font-weight: 600;
}

.sidebar-user .email {
  color: #94a3b8;
  font-size: 11px;
}

.logout-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #fff;
  border-color: rgba(239, 68, 68, 0.5);
}

.logout-btn svg {
  width: 16px;
  height: 16px;
}

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
  min-height: 100vh;
}

/* --- Login Page (Stitch-based Premium Design) --- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

.login-page {
  min-height: 100vh;
  display: flex;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* Left Panel - Visual/Branding */
.login-visual {
  width: 50%;
  background: linear-gradient(135deg, #0f172a 0%, #0ea5e9 50%, #38bdf8 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 48px;
}

.login-visual::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 600"><defs><radialGradient id="g" cx="50%25" cy="50%25" r="60%25"><stop offset="0%25" stop-color="%23ffffff" stop-opacity="0.05"/><stop offset="100%25" stop-color="%23ffffff" stop-opacity="0"/></radialGradient></defs><circle cx="200" cy="150" r="300" fill="url(%23g)"/><circle cx="600" cy="450" r="250" fill="url(%23g)"/></svg>');
  background-size: cover;
}

/* Floating Glass Elements */
.glass-element {
  position: absolute;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: 32px;
}

.glass-element.card-1 {
  width: 120px;
  height: 120px;
  border-radius: 16px;
  top: 20%;
  left: 15%;
  transform: rotate(-12deg);
  animation: float1 6s ease-in-out infinite;
}

.glass-element.card-2 {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  bottom: 25%;
  right: 15%;
  animation: float2 8s ease-in-out infinite;
}

.glass-element.card-3 {
  width: 90px;
  height: 90px;
  border-radius: 12px;
  top: 50%;
  right: 25%;
  transform: rotate(45deg);
  background: rgba(59, 130, 246, 0.3);
  animation: float3 7s ease-in-out infinite;
}

.glass-element.card-4 {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  bottom: 15%;
  left: 25%;
  background: rgba(16, 185, 129, 0.2);
  animation: float1 5s ease-in-out infinite reverse;
}

.glass-element.card-5 {
  width: 100px;
  height: 100px;
  border-radius: 20px;
  top: 15%;
  right: 10%;
  transform: rotate(20deg);
  background: rgba(245, 158, 11, 0.15);
  animation: float2 9s ease-in-out infinite reverse;
}

@keyframes float1 {

  0%,
  100% {
    transform: rotate(-12deg) translateY(0);
  }

  50% {
    transform: rotate(-12deg) translateY(-20px);
  }
}

@keyframes float2 {

  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  50% {
    transform: translateY(-15px) scale(1.05);
  }
}

@keyframes float3 {

  0%,
  100% {
    transform: rotate(45deg) translateX(0);
  }

  50% {
    transform: rotate(45deg) translateX(-10px);
  }
}

.login-visual-content {
  position: relative;
  z-index: 10;
  text-align: center;
  max-width: 420px;
}

.login-visual-content h1 {
  color: #fff;
  font-size: 42px;
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.login-visual-content p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 18px;
  font-weight: 500;
  line-height: 1.6;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.login-visual-features {
  display: flex;
  gap: 16px;
  margin-top: 40px;
}

.login-visual-features .feature-item {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
  flex: 1;
  color: #fff;
}

.login-visual-features .feature-item .feature-icon {
  font-size: 28px;
  margin-bottom: 8px;
}

.login-visual-features .feature-item .feature-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.9;
}

/* Right Panel - Login Form */
.login-form-panel {
  width: 50%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 80px;
  background: #fff;
}

.login-form-container {
  max-width: 440px;
  width: 100%;
  margin: 0 auto;
}

.login-logo {
  margin-bottom: 40px;
  text-align: left;
}

.login-logo .logo-text {
  font-size: 28px;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.login-logo .logo-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  background: rgba(59, 130, 246, 0.1);
  color: #3b82f6;
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
  vertical-align: middle;
}

.login-logo .logo-sub {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 4px;
}

.login-card {
  background: transparent;
  border-radius: 0;
  padding: 0;
  width: 100%;
  box-shadow: none;
}

.login-card h1,
.login-card .subtitle {
  display: none;
}

.login-card .tab-switch {
  display: flex;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 28px;
  gap: 0;
  background: transparent;
  padding: 0;
  border-radius: 0;
}

.login-card .tab-switch button {
  flex: 1;
  padding: 14px 0;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  color: #94a3b8;
  transition: all 0.2s;
  margin-bottom: -2px;
}

.login-card .tab-switch button.active {
  color: #0f172a;
  border-bottom-color: #3b82f6;
  box-shadow: none;
  background: transparent;
}

.login-card .tab-switch button:hover:not(.active) {
  color: #64748b;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 8px;
}

.form-group .input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-group .input-icon {
  position: absolute;
  left: 16px;
  color: #94a3b8;
  font-size: 18px;
  pointer-events: none;
}

.form-group input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s;
  outline: none;
  color: #0f172a;
}

.form-group input::placeholder {
  color: #94a3b8;
}

.form-group input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
  background: #fff;
}

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

.login-meta .remember-me {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #64748b;
}

.login-meta .remember-me input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #3b82f6;
  border-radius: 4px;
}

.login-meta .forgot-link {
  font-size: 13px;
  color: #3b82f6;
  text-decoration: none;
  font-weight: 600;
}

.login-meta .forgot-link:hover {
  text-decoration: underline;
}

.btn-login {
  width: 100%;
  padding: 14px 20px;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(56, 189, 248, 0.3);
  font-family: inherit;
}

.btn-login:hover {
  background: linear-gradient(135deg, #0ea5e9, #0284c7);
  box-shadow: 0 6px 16px rgba(56, 189, 248, 0.4);
  transform: translateY(-1px);
}

.btn-login:active {
  transform: translateY(0);
}

.login-info-banner {
  margin-top: 28px;
  text-align: center;
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  padding: 12px;
  border-radius: 10px;
  font-size: 13px;
  color: #64748b;
}

.login-info-banner .info-icon {
  display: inline-block;
  margin-right: 6px;
  vertical-align: middle;
}

.login-mall-link {
  margin-top: 16px;
  text-align: center;
}

.login-mall-link a {
  font-size: 13px;
  color: #6366f1;
  text-decoration: none;
  font-weight: 600;
}

.login-mall-link a:hover {
  text-decoration: underline;
}

@media (max-width: 1024px) {
  .login-page {
    flex-direction: column;
  }

  .login-visual {
    width: 100%;
    padding: 40px 24px;
    min-height: 260px;
  }

  .login-visual-content h1 {
    font-size: 28px;
  }

  .glass-element {
    display: none;
  }

  .login-visual-features {
    display: none;
  }

  .login-form-panel {
    width: 100%;
    padding: 32px 24px;
  }
}

/* --- Form --- */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
}

.btn-primary:hover {
  background: #2563eb;
}

.btn-secondary {
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--border);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-danger {
  background: var(--danger);
  color: white;
}

/* --- Page Header --- */
.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}

.page-header p {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: 4px;
}

/* --- Cards & Grid --- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}

.stat-card .icon-box {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card .icon-box.blue {
  background: var(--accent-light);
  color: var(--accent);
}

.stat-card .icon-box.green {
  background: var(--success-light);
  color: var(--success);
}

.stat-card .icon-box.amber {
  background: var(--warning-light);
  color: var(--warning);
}

.stat-card .icon-box.red {
  background: var(--danger-light);
  color: var(--danger);
}

.stat-card .value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.stat-card .label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  flex: 1;
}

.card-body {
  padding: 20px;
}

/* --- Product Grid --- */
.product-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* --- Category Filter --- */
.catalog-cat-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
  padding: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.catalog-cat-filter select {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: white;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
  min-width: 120px;
}

.catalog-cat-filter select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.cat-filter-arrow {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 600;
}

.btn-reset-filter {
  padding: 6px 12px;
  border: none;
  background: var(--bg-primary);
  color: var(--text-muted);
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-reset-filter:hover {
  background: var(--danger);
  color: white;
}

.pagination .dots {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  color: var(--text-muted);
  font-size: 13px;
}

.product-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.product-card .thumb {
  width: 100%;
  height: 180px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}

.product-card .thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  padding: 8px;
}

.product-card .info {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.product-card .name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  margin-bottom: 8px;
  min-height: 36px;
  color: var(--text-primary);
}

.product-card .meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
}

.product-card .price {
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
}

.product-card .supplier {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.product-card .actions {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-card .actions .btn {
  flex: 1;
  text-align: center;
  justify-content: center;
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success {
  background: var(--success-light);
  color: #059669;
}

.badge-warning {
  background: var(--warning-light);
  color: #d97706;
}

.badge-danger {
  background: var(--danger-light);
  color: #dc2626;
}

.badge-info {
  background: var(--accent-light);
  color: #2563eb;
}

.badge-default {
  background: #f1f5f9;
  color: var(--text-muted);
}

/* --- Table --- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 12px 16px;
  font-size: 14px;
  border-bottom: 1px solid #f1f5f9;
}

.data-table tr:hover td {
  background: #f8fafc;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  margin-bottom: 16px;
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-size: 13px;
}

.pagination button.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.pagination button:hover:not(.active) {
  background: var(--bg-primary);
}

/* --- Search --- */
.search-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.search-bar input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
}

.search-bar input:focus {
  border-color: var(--accent);
}

/* --- Checkbox --- */
.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.checkbox-wrapper input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

/* --- Error/Alert --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 16px;
}

.alert-error {
  background: var(--danger-light);
  color: #dc2626;
}

.alert-success {
  background: var(--success-light);
  color: #059669;
}

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: white;
  border-radius: var(--radius);
  width: 480px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.modal-body {
  padding: 24px;
}

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

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  animation: slideUp 0.3s ease;
  z-index: 9999;
  box-shadow: var(--shadow-md);
}

@keyframes slideUp {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

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

  .product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .main-content {
    margin-left: 0;
  }

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

  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Product Preview Modal --- */
.preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

.preview-modal {
  background: white;
  border-radius: 16px;
  width: 820px;
  max-width: 92vw;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
  animation: scaleIn 0.25s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: white;
  z-index: 10;
  border-radius: 16px 16px 0 0;
}

.preview-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
  margin-right: 16px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preview-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}

.preview-close:hover {
  background: var(--danger-light);
  color: var(--danger);
}

.preview-body {
  padding: 24px;
}

.preview-loading {
  padding: 60px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.preview-two-col {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.preview-img-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-img-side>img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.preview-thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.thumb-sm {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: border-color 0.2s;
}

.thumb-sm:hover,
.thumb-sm.active {
  border-color: var(--accent);
}

.preview-info-side {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-field {
  display: flex;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

.info-field .label {
  width: 90px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  flex-shrink: 0;
}

.info-field .value {
  font-size: 14px;
  color: var(--text-primary);
  font-weight: 500;
}

.info-field .value.price {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}

.info-field .value.highlight {
  color: var(--danger);
  font-weight: 600;
}

/* --- Category Display --- */
.cat-display-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.cat-display-section h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.cat-path-display {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.cat-crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
}

.cat-crumb .cat-level {
  font-size: 9px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-right: 2px;
}

.cat-arrow {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 600;
}

.cat-none {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
}

.preview-section {
  margin-bottom: 24px;
}

.preview-section h4 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.preview-section h4::before {
  content: '';
  display: block;
  width: 3px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

.preview-detail-images {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.preview-img-card {
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-primary);
  border: 1px solid var(--border);
}

.preview-img-card img {
  width: 100%;
  height: auto;
  object-fit: contain;
  display: block;
}

.img-error {
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

.no-images {
  color: var(--text-muted);
  font-size: 13px;
  font-style: italic;
  padding: 40px;
  text-align: center;
  background: var(--bg-primary);
  border-radius: var(--radius-sm);
}

/* --- Preview Badge on Product Card --- */
.product-card .thumb {
  position: relative;
}

.preview-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.65);
  color: white;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.product-card .thumb:hover .preview-badge {
  opacity: 1;
}

.product-card .name:hover {
  color: var(--accent);
}

/* --- Sold Out / Discontinued --- */
.product-card.sold-out {
  opacity: 0.55;
  pointer-events: auto;
}

.product-card.sold-out:hover {
  opacity: 0.75;
}

.stock-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: var(--danger);
  color: white;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  z-index: 2;
}

.stock-badge.disc {
  background: #64748b;
}

/* --- Modern Close Button --- */
.modal-close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-primary);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.modal-close-btn:hover {
  background: #fee2e2;
  color: #dc2626;
  transform: scale(1.05);
}

/* --- Register Modal --- */
.register-modal {
  background: var(--bg-card);
  border-radius: 16px;
  width: 680px;
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.25s ease;
}

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

.register-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.register-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

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

.register-footer .btn {
  min-width: 100px;
  justify-content: center;
}

.reg-section {
  margin-bottom: 18px;
}

.reg-section>label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.reg-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 10px;
}

.reg-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}

.reg-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.reg-readonly {
  padding: 10px 14px;
  background: var(--bg-primary);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.reg-row {
  display: flex;
  gap: 12px;
}

/* --- Crop Layout --- */
.reg-crop-layout {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reg-crop-thumbs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.reg-thumb {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  border: 2px solid var(--border);
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s;
}

.reg-thumb:hover {
  border-color: var(--accent);
  transform: scale(1.05);
}

.reg-thumb.active {
  border-color: var(--accent);
  border-width: 3px;
  box-shadow: 0 0 0 2px var(--accent-light);
}

.reg-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reg-crop-area {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.reg-crop-container {
  flex: 1;
  max-height: 320px;
  background: #f1f5f9;
  border-radius: 10px;
  overflow: hidden;
}

.reg-crop-container img {
  display: block;
  max-width: 100%;
}

.reg-crop-preview-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.reg-crop-preview-box label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.reg-crop-preview {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  overflow: hidden;
  border: 2px solid var(--border);
  background: #f1f5f9;
}

.reg-market-row {
  display: flex;
  gap: 12px;
}

.reg-market-check {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--bg-primary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s;
  flex: 1;
}

.reg-market-check:hover {
  background: var(--accent-light);
}

.reg-market-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.spinner-sm {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: -2px;
  margin-right: 4px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- AI Product Name Recommendation --- */
.reg-name-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.reg-name-row .reg-input {
  flex: 1;
  min-width: 0;
}

.btn-ai-recommend {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  flex-shrink: 0;
}

.btn-ai-recommend:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.45);
  background: linear-gradient(135deg, #5a6fd6 0%, #6a4293 100%);
}

.btn-ai-recommend:active {
  transform: translateY(0);
}

.btn-ai-recommend:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-ai-recommend svg {
  flex-shrink: 0;
}

/* AI Suggestions Area */
.ai-suggestions-area {
  margin-top: 10px;
}

.ai-suggestions-area:empty {
  display: none;
}

/* AI Loading */
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: linear-gradient(135deg, #f5f3ff 0%, #ede9fe 100%);
  border-radius: 10px;
  border: 1px solid #ddd6fe;
}

.ai-loading p {
  font-size: 13px;
  color: #6d28d9;
  margin: 0;
  font-weight: 500;
}

.ai-loading-dots {
  display: flex;
  gap: 6px;
}

.ai-loading-dots span {
  width: 8px;
  height: 8px;
  background: #7c3aed;
  border-radius: 50%;
  animation: aiDotBounce 1.4s ease-in-out infinite;
}

.ai-loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.ai-loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes aiDotBounce {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.4;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* AI Cards Grid */
.ai-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ai-card {
  background: white;
  border: 2px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}

.ai-card:hover {
  border-color: #818cf8;
  background: #faf5ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(129, 140, 248, 0.2);
}

.ai-card.selected {
  border-color: #7c3aed;
  background: #f5f3ff;
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.ai-card.selected::after {
  content: '✓';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  background: #7c3aed;
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.ai-card-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.ai-style-icon {
  font-size: 16px;
  line-height: 1;
}

.ai-style-label {
  font-size: 11px;
  font-weight: 700;
  color: #7c3aed;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.ai-card-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
  margin-bottom: 6px;
  line-height: 1.4;
  word-break: keep-all;
}

.ai-card-reason {
  font-size: 11px;
  color: #64748b;
  line-height: 1.4;
}

/* AI Error */
.ai-error {
  font-size: 13px;
  color: #dc2626;
  padding: 12px;
  margin: 0;
  background: #fef2f2;
  border-radius: 8px;
  border: 1px solid #fecaca;
}

/* Responsive for AI cards */
@media (max-width: 600px) {
  .ai-cards {
    grid-template-columns: 1fr;
  }

  .reg-name-row {
    flex-direction: column;
  }
}

/* AI Quota Bar */
.ai-quota-bar {
  margin-top: 8px;
  text-align: right;
}

.ai-quota {
  font-size: 11px;
  color: #64748b;
}

.ai-quota strong {
  color: #7c3aed;
}

.ai-quota.unlimited {
  color: #7c3aed;
  font-weight: 600;
}

/* AI Limit Reached */
.ai-limit-reached {
  text-align: center;
  padding: 20px;
  background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #f59e0b;
  border-radius: 10px;
}

.ai-limit-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.ai-limit-reached p {
  margin: 4px 0;
  font-size: 14px;
  color: #92400e;
}

.ai-limit-sub {
  font-size: 12px !important;
  color: #a16207 !important;
  line-height: 1.5;
}

/* ── Deposit Card ─────────────────────────────────── */
.deposit-card {
  border: 1px solid #e0e7ff;
  background: linear-gradient(135deg, #f0f4ff 0%, #e8eeff 100%);
}

.deposit-balance {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 8px;
}

.deposit-amount {
  font-size: 28px;
  font-weight: 700;
  color: #1e3a5f;
}

.deposit-unit {
  font-size: 14px;
  color: #64748b;
}

.deposit-tier {
  margin-bottom: 12px;
}

.deposit-history-mini {
  border-top: 1px solid #cbd5e1;
  padding-top: 10px;
  margin-top: 10px;
}

.deposit-history-title {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.deposit-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 12px;
}

.deposit-desc {
  color: #475569;
}

.deposit-val.plus {
  color: #059669;
  font-weight: 600;
}

.deposit-val.minus {
  color: #dc2626;
  font-weight: 600;
}

/* ── Order Filter Tabs ────────────────────────────── */
.order-filter-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  background: #f1f5f9;
  border-radius: 10px;
  width: fit-content;
}

.filter-tab {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-tab:hover {
  color: #334155;
  background: rgba(255, 255, 255, 0.5);
}

.filter-tab.active {
  background: white;
  color: #1e3a5f;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: 600;
}