/* ============================================
   EcoPro USA - Admin Panel Styles
   Polished, production-ready admin UI
   ============================================ */

:root {
  --color-navy: #0a1e3d;
  --color-navy-light: #132d54;
  --color-navy-dark: #06121f;
  --color-accent: #e8a530;
  --color-accent-hover: #d4922a;
  --color-accent-soft: rgba(232, 165, 48, 0.1);
  --color-white: #ffffff;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-400: #9ca3af;
  --color-gray-500: #6b7280;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-800: #1f2937;
  --color-success: #10b981;
  --color-success-bg: #ecfdf5;
  --color-success-border: #a7f3d0;
  --color-error: #ef4444;
  --color-error-bg: #fef2f2;
  --color-error-border: #fecaca;
  --color-warning: #f59e0b;
  --color-warning-bg: #fffbeb;
  --color-info: #3b82f6;
  --color-info-bg: #eff6ff;

  --sidebar-width: 240px;
  --header-height: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --radius-xs: 4px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.06), 0 2px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.08), 0 4px 6px rgba(0,0,0,0.04);
  --transition: 150ms ease;
  --transition-slow: 250ms ease;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--color-gray-50);
  color: var(--color-gray-800);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-accent); text-decoration: none; }
a:hover { color: var(--color-accent-hover); }

/* ---- Login Page ---- */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 50%, #1a3a5c 100%);
  position: relative;
  overflow: hidden;
}

.login-wrapper::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 70%, rgba(232, 165, 48, 0.06) 0%, transparent 50%),
              radial-gradient(circle at 70% 30%, rgba(232, 165, 48, 0.04) 0%, transparent 50%);
  animation: loginBgShift 20s ease-in-out infinite alternate;
}

@keyframes loginBgShift {
  from { transform: translate(0, 0); }
  to { transform: translate(2%, -2%); }
}

.login-card {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg), 0 0 60px rgba(0,0,0,0.15);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-navy);
  margin-top: 0;
  letter-spacing: -0.02em;
}

.login-logo span {
  display: block;
  font-size: 13px;
  color: var(--color-gray-400);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 500;
}

.login-error {
  background: var(--color-error-bg);
  color: var(--color-error);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 16px;
  display: none;
  border: 1px solid var(--color-error-border);
}

.login-error.visible { display: block; }

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-gray-700);
  margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--color-gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-gray-800);
  background: var(--color-white);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--color-gray-400);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(232, 165, 48, 0.12);
}

.form-group textarea { resize: vertical; min-height: 100px; }

.form-hint {
  font-size: 12px;
  color: var(--color-gray-400);
  margin-top: 4px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-navy);
}
.btn-primary:hover:not(:disabled) { background: var(--color-accent-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(232, 165, 48, 0.3); }

.btn-navy {
  background: var(--color-navy);
  color: var(--color-white);
}
.btn-navy:hover:not(:disabled) { background: var(--color-navy-light); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(10, 30, 61, 0.3); }

.btn-outline {
  background: transparent;
  color: var(--color-gray-700);
  border: 1.5px solid var(--color-gray-300);
}
.btn-outline:hover:not(:disabled) { background: var(--color-gray-100); border-color: var(--color-gray-400); }

.btn-success {
  background: var(--color-success);
  color: var(--color-white);
}
.btn-success:hover:not(:disabled) { background: #059669; }

.btn-danger {
  background: var(--color-error);
  color: var(--color-white);
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-block { width: 100%; }

.btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  display: none;
}

.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { opacity: 0.7; }

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

/* ---- Layout: Header ---- */
.admin-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--color-navy);
  color: var(--color-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-left img { height: 32px; }

.header-left h1 {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-accent);
  letter-spacing: -0.01em;
}

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

.header-right .user-email {
  font-size: 13px;
  color: var(--color-gray-300);
  background: rgba(255,255,255,0.08);
  padding: 5px 12px;
  border-radius: 20px;
}

.view-site-link {
  font-size: 13px;
  color: var(--color-gray-300);
  padding: 5px 12px;
  border-radius: var(--radius-xs);
  text-decoration: none;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
}

.view-site-link:hover {
  color: var(--color-white);
  background: rgba(255,255,255,0.1);
}

.header-right .btn-logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: var(--color-white);
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: all var(--transition);
}

.header-right .btn-logout:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.3);
}

/* ---- Layout: Sidebar ---- */
.admin-sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-white);
  border-right: 1px solid var(--color-gray-200);
  padding: 20px 0;
  overflow-y: auto;
  z-index: 90;
}

.sidebar-nav { list-style: none; }

.sidebar-nav li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--color-gray-600);
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-nav li a:hover {
  background: var(--color-gray-50);
  color: var(--color-gray-800);
}

.sidebar-nav li a.active {
  background: var(--color-accent-soft);
  color: var(--color-navy);
  font-weight: 600;
  border-left-color: var(--color-accent);
}

.sidebar-nav li a .nav-icon {
  width: 20px;
  text-align: center;
  font-size: 16px;
  opacity: 0.7;
}

.sidebar-nav li a.active .nav-icon { opacity: 1; }

.sidebar-nav .nav-section {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-gray-400);
  padding: 24px 24px 8px;
}

.sidebar-nav .nav-section:first-child { padding-top: 4px; }

.nav-badge {
  font-size: 10px;
  background: var(--color-gray-200);
  color: var(--color-gray-500);
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: auto;
  font-weight: 600;
}

.sidebar-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 16px 24px;
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-white);
}

.sidebar-footer small {
  font-size: 11px;
  color: var(--color-gray-400);
}

/* ---- Layout: Main Content ---- */
.admin-main {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 32px;
  min-height: calc(100vh - var(--header-height));
}

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

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 0;
  letter-spacing: -0.02em;
}

.page-subtitle {
  font-size: 14px;
  color: var(--color-gray-500);
  margin-top: 4px;
}

/* ---- Welcome Banner ---- */
.welcome-banner {
  background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 100%);
  border-radius: var(--radius);
  padding: 28px 32px;
  color: var(--color-white);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.welcome-banner::after {
  content: '';
  position: absolute;
  top: -30%;
  right: -10%;
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(232, 165, 48, 0.15) 0%, transparent 70%);
  border-radius: 50%;
}

.welcome-banner h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
  position: relative;
  z-index: 1;
}

.welcome-banner p {
  font-size: 14px;
  color: rgba(255,255,255,0.7);
  position: relative;
  z-index: 1;
}

.welcome-banner .welcome-actions {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  position: relative;
  z-index: 1;
}

/* ---- Stats Cards ---- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
  border: 1px solid var(--color-gray-100);
}

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

.stat-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.stat-icon-wrap.blue { background: var(--color-info-bg); color: var(--color-info); }
.stat-icon-wrap.green { background: var(--color-success-bg); color: var(--color-success); }
.stat-icon-wrap.amber { background: var(--color-warning-bg); color: var(--color-warning); }
.stat-icon-wrap.navy { background: rgba(10,30,61,0.08); color: var(--color-navy); }

.stat-info { flex: 1; }

.stat-card .stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-gray-500);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--color-navy);
  line-height: 1.1;
}

/* ---- Cards ---- */
.card {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-gray-100);
  margin-bottom: 24px;
  overflow: hidden;
}

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

.card-header h3 {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-navy);
}

.card-body {
  padding: 24px;
}

.card-body-flush { padding: 0; }

/* ---- Quick Actions ---- */
.quick-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 20px 24px;
}

/* ---- Dashboard Grid ---- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

/* ---- Activity / Submissions List ---- */
.activity-list {
  list-style: none;
}

.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--color-gray-100);
  transition: background var(--transition);
}

.activity-item:last-child { border-bottom: none; }
.activity-item:hover { background: var(--color-gray-50); }

.activity-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--color-gray-100);
  color: var(--color-gray-600);
}

.activity-icon.form { background: var(--color-info-bg); color: var(--color-info); }
.activity-icon.product { background: var(--color-accent-soft); color: var(--color-accent); }
.activity-icon.deploy { background: var(--color-success-bg); color: var(--color-success); }

.activity-content { flex: 1; min-width: 0; }

.activity-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-gray-800);
  margin-bottom: 2px;
}

.activity-detail {
  font-size: 12px;
  color: var(--color-gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-time {
  font-size: 11px;
  color: var(--color-gray-400);
  white-space: nowrap;
  flex-shrink: 0;
  margin-top: 2px;
}

.empty-state {
  text-align: center;
  padding: 40px 24px;
  color: var(--color-gray-400);
}

.empty-state .empty-icon {
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* ---- Product List / Editor Layout ---- */
.products-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 24px;
  align-items: start;
}

.product-list-panel {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-gray-100);
  overflow: hidden;
}

.product-list-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.product-list-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-navy);
}

.product-count {
  font-size: 12px;
  color: var(--color-gray-400);
  background: var(--color-gray-100);
  padding: 2px 10px;
  border-radius: 10px;
  font-weight: 600;
}

.product-search {
  padding: 12px 16px;
  border-bottom: 1px solid var(--color-gray-200);
}

.product-search input {
  width: 100%;
  padding: 9px 14px 9px 36px;
  border: 1.5px solid var(--color-gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--color-gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%239ca3af' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.156a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") no-repeat 12px center;
  transition: all var(--transition);
}

.product-search input:focus {
  outline: none;
  border-color: var(--color-accent);
  background-color: var(--color-white);
  box-shadow: 0 0 0 3px rgba(232, 165, 48, 0.1);
}

.product-filter-bar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--color-gray-100);
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  border: 1px solid var(--color-gray-200);
  background: var(--color-white);
  color: var(--color-gray-600);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.filter-chip:hover { border-color: var(--color-gray-400); }

.filter-chip.active {
  background: var(--color-navy);
  color: var(--color-white);
  border-color: var(--color-navy);
}

.product-list {
  list-style: none;
  max-height: calc(100vh - 320px);
  overflow-y: auto;
}

.product-list::-webkit-scrollbar { width: 6px; }
.product-list::-webkit-scrollbar-track { background: transparent; }
.product-list::-webkit-scrollbar-thumb { background: var(--color-gray-300); border-radius: 3px; }

.product-list-item {
  padding: 12px 20px;
  border-bottom: 1px solid var(--color-gray-100);
  cursor: pointer;
  transition: all var(--transition);
  border-left: 3px solid transparent;
}

.product-list-item:hover { background: var(--color-gray-50); }

.product-list-item.active {
  background: var(--color-accent-soft);
  border-left-color: var(--color-accent);
}

.product-list-item .product-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-gray-800);
  margin-bottom: 3px;
  line-height: 1.3;
}

.product-list-item .product-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--color-gray-500);
}

.product-list-empty {
  padding: 48px 16px;
  text-align: center;
  color: var(--color-gray-400);
  font-size: 13px;
}

/* ---- Status Badges ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-active {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-inactive {
  background: var(--color-gray-100);
  color: var(--color-gray-500);
}

/* ---- Product Editor ---- */
.product-editor {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--color-gray-100);
  position: sticky;
  top: calc(var(--header-height) + 32px);
}

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

.editor-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-navy);
  letter-spacing: -0.01em;
}

.editor-header .editor-slug {
  font-size: 12px;
  color: var(--color-gray-400);
  font-family: 'SF Mono', 'Fira Code', monospace;
  background: var(--color-gray-50);
  padding: 3px 10px;
  border-radius: var(--radius-xs);
}

.editor-placeholder {
  padding: 100px 24px;
  text-align: center;
  color: var(--color-gray-400);
}

.editor-placeholder .icon {
  font-size: 56px;
  margin-bottom: 16px;
  opacity: 0.3;
}

.editor-placeholder p {
  font-size: 14px;
  max-width: 260px;
  margin: 0 auto;
  line-height: 1.6;
}

/* ---- Tabs ---- */
.editor-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-gray-200);
  padding: 0 24px;
  gap: 2px;
  background: var(--color-gray-50);
}

.editor-tab {
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-gray-500);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--transition);
  font-family: inherit;
  position: relative;
}

.editor-tab:hover { color: var(--color-gray-700); }

.editor-tab.active {
  color: var(--color-navy);
  border-bottom-color: var(--color-accent);
  background: var(--color-white);
}

.tab-content {
  padding: 24px;
  display: none;
}

.tab-content.active { display: block; }

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

.form-divider {
  border: none;
  border-top: 1px solid var(--color-gray-100);
  margin: 20px 0;
}

.editor-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--color-gray-100);
  background: var(--color-gray-50);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 0 0 var(--radius) var(--radius);
}

.editor-footer .save-status {
  font-size: 12px;
  color: var(--color-gray-400);
}

/* ---- Submissions Page ---- */
.submissions-table {
  width: 100%;
  border-collapse: collapse;
}

.submissions-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-gray-500);
  padding: 12px 16px;
  border-bottom: 2px solid var(--color-gray-200);
  background: var(--color-gray-50);
}

.submissions-table td {
  padding: 14px 16px;
  font-size: 13px;
  color: var(--color-gray-700);
  border-bottom: 1px solid var(--color-gray-100);
  vertical-align: top;
}

.submissions-table tr:hover td {
  background: var(--color-gray-50);
}

.submissions-table .sub-name {
  font-weight: 600;
  color: var(--color-gray-800);
}

.submissions-table .sub-company {
  font-size: 12px;
  color: var(--color-gray-500);
}

.submissions-table .sub-date {
  font-size: 12px;
  color: var(--color-gray-400);
  white-space: nowrap;
}

/* ---- Submission Detail Modal ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.visible { display: flex; }

.modal {
  background: var(--color-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 80vh;
  overflow-y: auto;
}

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

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-navy);
}

.modal-close {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--color-gray-100);
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-gray-500);
  transition: all var(--transition);
}

.modal-close:hover {
  background: var(--color-gray-200);
  color: var(--color-gray-700);
}

.modal-body {
  padding: 24px;
}

.detail-row {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-gray-100);
  font-size: 13px;
}

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

.detail-label {
  font-weight: 600;
  color: var(--color-gray-500);
}

.detail-value {
  color: var(--color-gray-800);
  word-break: break-word;
}

/* ---- Toast Notifications ---- */
.toast-container {
  position: fixed;
  top: 76px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  animation: toastIn 0.3s ease;
  min-width: 300px;
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.toast-error {
  background: var(--color-error);
  color: var(--color-white);
}

.toast-warning {
  background: var(--color-warning);
  color: var(--color-navy);
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to { opacity: 1; transform: translateX(0); }
}

.toast-exit {
  animation: toastOut 0.25s ease forwards;
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(40px); }
}

/* ---- Loading Skeleton ---- */
.skeleton {
  background: linear-gradient(90deg, var(--color-gray-100) 25%, var(--color-gray-50) 50%, var(--color-gray-100) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-xs);
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton-text { height: 14px; width: 80%; margin-bottom: 8px; }
.skeleton-title { height: 28px; width: 40%; margin-bottom: 12px; }

/* ---- Chat Page ---- */
.chat-main {
  padding: 0 !important;
  display: flex;
  flex-direction: column;
}

.chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height));
  background: var(--color-white);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  border-bottom: 1px solid var(--color-gray-200);
  flex-shrink: 0;
  background: var(--color-white);
}

.chat-header-info h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 2px;
}

.chat-header-sub {
  font-size: 12px;
  color: var(--color-gray-400);
}

/* Messages Area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: var(--color-gray-50);
}

.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: var(--color-gray-300); border-radius: 3px; }

/* Welcome state */
.chat-welcome {
  margin: auto;
  text-align: center;
  padding: 40px 20px;
  max-width: 480px;
}

.chat-welcome-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.6;
}

.chat-welcome h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-navy);
  margin-bottom: 8px;
}

.chat-welcome p {
  font-size: 14px;
  color: var(--color-gray-500);
  margin-bottom: 24px;
  line-height: 1.6;
}

.chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.suggestion-chip {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-navy);
  background: var(--color-white);
  border: 1.5px solid var(--color-gray-200);
  border-radius: 20px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.suggestion-chip:hover {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

/* Message Bubbles */
.chat-msg {
  display: flex;
  gap: 12px;
  max-width: 85%;
  animation: msgIn 0.2s ease;
}

@keyframes msgIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.chat-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  font-weight: 700;
}

.chat-msg.assistant .chat-msg-avatar {
  background: var(--color-navy);
  color: var(--color-accent);
}

.chat-msg.user .chat-msg-avatar {
  background: var(--color-accent);
  color: var(--color-navy);
}

.chat-msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.6;
  position: relative;
}

.chat-msg.assistant .chat-msg-bubble {
  background: var(--color-white);
  color: var(--color-gray-800);
  border: 1px solid var(--color-gray-200);
  border-top-left-radius: var(--radius-xs);
}

.chat-msg.user .chat-msg-bubble {
  background: var(--color-navy);
  color: var(--color-white);
  border-top-right-radius: var(--radius-xs);
}

.chat-msg-bubble p { margin: 0 0 8px; }
.chat-msg-bubble p:last-child { margin-bottom: 0; }

.chat-msg-bubble strong { font-weight: 600; }

.chat-msg-bubble ul, .chat-msg-bubble ol {
  margin: 4px 0 8px;
  padding-left: 20px;
}

.chat-msg-bubble li { margin-bottom: 2px; }

.chat-msg-bubble code {
  background: rgba(0,0,0,0.06);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.chat-msg.user .chat-msg-bubble code {
  background: rgba(255,255,255,0.15);
}

/* Tool use indicator */
.chat-tool-indicator {
  font-size: 11px;
  color: var(--color-gray-400);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.chat-tool-indicator .tool-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-success);
}

/* Typing indicator */
.chat-typing {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  max-width: 85%;
}

.chat-typing .chat-msg-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-navy);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
}

.typing-dots {
  display: flex;
  gap: 4px;
  padding: 16px 20px;
  background: var(--color-white);
  border-radius: var(--radius);
  border: 1px solid var(--color-gray-200);
  border-top-left-radius: var(--radius-xs);
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-gray-400);
  animation: typingBounce 1.4s infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Input Area */
.chat-input-area {
  padding: 16px 28px 20px;
  border-top: 1px solid var(--color-gray-200);
  background: var(--color-white);
  flex-shrink: 0;
}

.chat-form {
  max-width: 100%;
}

.chat-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  background: var(--color-gray-50);
  border: 1.5px solid var(--color-gray-300);
  border-radius: var(--radius);
  padding: 6px 6px 6px 16px;
  transition: border-color var(--transition), box-shadow var(--transition);
}

.chat-input-wrap:focus-within {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(232, 165, 48, 0.1);
  background: var(--color-white);
}

.chat-input-wrap textarea {
  flex: 1;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  font-family: inherit;
  line-height: 1.5;
  padding: 8px 0;
  background: transparent;
  color: var(--color-gray-800);
  max-height: 120px;
}

.chat-input-wrap textarea::placeholder {
  color: var(--color-gray-400);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--color-accent);
  color: var(--color-navy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition);
}

.chat-send-btn:hover { background: var(--color-accent-hover); }
.chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.chat-input-hint {
  font-size: 11px;
  color: var(--color-gray-400);
  margin-top: 6px;
  padding: 0 4px;
}

/* Error state in chat */
.chat-error {
  padding: 12px 16px;
  background: var(--color-error-bg);
  border: 1px solid var(--color-error-border);
  border-radius: var(--radius-sm);
  color: var(--color-error);
  font-size: 13px;
  max-width: 85%;
}

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

@media (max-width: 1024px) {
  .products-layout {
    grid-template-columns: 1fr;
  }
  .product-list { max-height: 300px; }
  .product-editor { position: static; }
}

@media (max-width: 768px) {
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr; }
}
