/* ================================
   Global Smith — Premium Corporate
   Clean, high-end, American capitalism aesthetic
   ================================ */

:root {
  --bg: #0b0d10;
  --bg-elevated: #12151a;
  --bg-card: #161a21;
  --bg-hover: #1c212b;
  --border: #2a3140;
  --border-light: #3a4356;

  --text: #f0f2f5;
  --text-secondary: #9aa3b5;
  --text-muted: #6b7385;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-soft: rgba(59, 130, 246, 0.12);

  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.4);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font-family: inherit;
}

/* ==================== AUTH SCREEN ==================== */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: 
    radial-gradient(ellipse at 20% 50%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.05) 0%, transparent 40%),
    var(--bg);
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: var(--shadow);
}

.auth-logo {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}

.logo-mark {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: white;
  letter-spacing: -0.5px;
}

.logo-mark.small {
  width: 32px;
  height: 32px;
  font-size: 13px;
  border-radius: 8px;
}

.logo-text h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.logo-text p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-elevated);
  padding: 4px;
  border-radius: 10px;
  margin-bottom: 28px;
}

.auth-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.auth-tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

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

.form-group input,
.form-group textarea,
.form-group select,
.select,
.search-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus,
.select:focus,
.search-input:focus {
  border-color: var(--primary);
}

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

.auth-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

/* ==================== BUTTONS ==================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

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

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

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

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

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

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--border-light);
}

.btn-full {
  width: 100%;
}

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

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

/* ==================== APP LAYOUT ==================== */

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 64px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

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

.brand {
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.2px;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav-item {
  padding: 8px 16px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

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

.nav-item.active {
  color: var(--primary);
  background: var(--primary-soft);
}

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

.balance-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 14px;
  border-radius: 20px;
}

.balance-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.balance-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

.main {
  flex: 1;
  padding: 32px 28px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
  overflow-x: hidden;
  box-sizing: border-box;
}

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

.view-header h2 {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.3px;
}

.view-actions {
  display: flex;
  gap: 10px;
}

.search-input {
  width: 240px;
}

.select {
  min-width: 180px;
}

/* ==================== PRODUCTS GRID ==================== */

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
}

.product-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}

.product-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg-elevated);
}

.product-image-placeholder {
  width: 100%;
  height: 160px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

.product-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 8px;
}

.product-category {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--primary);
}

.product-name {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.product-desc {
  font-size: 13px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

.product-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.product-price {
  font-size: 16px;
  font-weight: 600;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

.product-stock {
  font-size: 12px;
  color: var(--text-muted);
}

/* ==================== INVENTORY & ORDERS ==================== */

.inventory-list,
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.inventory-item,
.order-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.item-info h4 {
  font-size: 15px;
  font-weight: 550;
}

.item-info p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.item-meta {
  text-align: right;
  font-size: 13px;
  color: var(--text-muted);
}

/* ==================== PROFILE ==================== */

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 100%;
  width: 100%;
  min-width: 0;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

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

.profile-label {
  color: var(--text-secondary);
  font-size: 14px;
}

.profile-value {
  font-weight: 500;
  font-size: 14px;
}

/* ==================== ADMIN ==================== */

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}

.admin-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 18px;
}

.admin-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.text-muted {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ==================== EMPTY STATE ==================== */

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
  grid-column: 1 / -1;
}

/* ==================== TOAST ==================== */

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: var(--shadow);
  z-index: 1000;
  animation: slideIn 0.25s ease;
}

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

.toast.error {
  border-color: var(--danger);
}

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

/* ==================== UTILS ==================== */

.hidden {
  display: none !important;
}

/* ==================== RESPONSIVE ==================== */

@media (max-width: 768px) {
  .header {
    flex-wrap: wrap;
    height: auto;
    padding: 12px 16px;
    gap: 12px;
  }

  .nav {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .main {
    padding: 20px 16px;
  }

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

  .search-input {
    width: 100%;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}

/* ==================== HERO BANNER ==================== */

.hero-banner {
  position: relative;
  height: 320px;
  background-image: url('https://i.imgur.com/JaAa1GK.jpeg');
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(11, 13, 16, 0.75) 0%, rgba(11, 13, 16, 0.45) 50%, rgba(11, 13, 16, 0.6) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 640px;
  padding: 0 24px;
}

.hero-content h1 {
  font-size: 42px;
  font-weight: 700;
  letter-spacing: -0.8px;
  margin-bottom: 12px;
  color: #fff;
}

.hero-content p {
  font-size: 17px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 28px;
  line-height: 1.5;
}

@media (max-width: 768px) {
  .hero-banner {
    height: 240px;
  }
  .hero-content h1 {
    font-size: 28px;
  }
  .hero-content p {
    font-size: 15px;
  }
}

/* ==================== QoL POLISH & CART ==================== */

.select-hidden {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* Category chips */
.category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}

.cat-chip:hover {
  border-color: var(--border-light);
  color: var(--text);
  background: var(--bg-hover);
}

.cat-chip.active {
  background: var(--primary-soft);
  border-color: rgba(59, 130, 246, 0.45);
  color: #93c5fd;
}

.cat-count {
  font-size: 11px;
  font-weight: 600;
  background: rgba(255,255,255,0.06);
  padding: 1px 6px;
  border-radius: 999px;
  color: var(--text-muted);
}

.cat-chip.active .cat-count {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

/* Product card upgrades */
.product-card {
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}

.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.45);
  border-color: var(--border-light);
}

.product-card.out-of-stock {
  opacity: 0.72;
}

.product-card.out-of-stock:hover {
  transform: none;
  box-shadow: none;
}

.stock-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  letter-spacing: 0.2px;
}

.stock-badge.out {
  background: rgba(239, 68, 68, 0.9);
  color: #fff;
}

.stock-badge.low {
  background: rgba(245, 158, 11, 0.92);
  color: #111;
}

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

.btn-icon {
  position: relative;
  padding: 6px 8px !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.in-cart-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.text-danger {
  color: var(--danger) !important;
}

/* Empty states */
.empty-state-lg {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-icon {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 8px;
  opacity: 0.85;
}

.empty-state-lg h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.empty-state-lg p {
  color: var(--text-secondary);
  font-size: 14px;
  max-width: 320px;
  margin-bottom: 8px;
}

/* Inventory / Orders thumbs */
.inv-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

.inv-thumb.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 16px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.item-price {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.item-price.success,
.success {
  color: var(--success);
}

.item-date {
  font-size: 12px;
  color: var(--text-muted);
}

.qty-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
}

.order-cat {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--primary);
}

.order-status {
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  background: rgba(34, 197, 94, 0.12);
  padding: 2px 8px;
  border-radius: 999px;
  margin-top: 4px;
  display: inline-block;
}

.inventory-item,
.order-item {
  transition: border-color 0.15s ease, background 0.15s ease;
}

.inventory-item:hover,
.order-item:hover {
  border-color: var(--border-light);
  background: var(--bg-hover);
}

/* ==================== CART BUTTON ==================== */

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

.cart-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

.cart-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.45);
}

.cart-badge.hidden {
  display: none;
}

/* ==================== CART DRAWER ==================== */

.cart-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  z-index: 90;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.cart-overlay.open {
  opacity: 1;
  visibility: visible;
}

.cart-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 100%;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  box-shadow: -12px 0 40px rgba(0,0,0,0.4);
}

.cart-drawer.open {
  transform: translateX(0);
}

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

.cart-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  padding: 40px 16px;
}

.cart-empty-icon {
  font-size: 48px;
  margin-bottom: 8px;
  opacity: 0.8;
}

.cart-empty h3 {
  font-size: 17px;
  font-weight: 600;
}

.cart-empty p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 12px;
}

.cart-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  align-items: flex-start;
}

.cart-item-img {
  width: 56px;
  height: 56px;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-elevated);
}

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

.cart-item-placeholder {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 18px;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-radius: 8px;
}

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

.cart-item-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
}

.cart-item-cat {
  font-size: 11px;
  color: var(--primary);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  margin-bottom: 4px;
}

.cart-item-price {
  font-size: 13px;
  color: var(--success);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.cart-line-total {
  color: var(--text-muted);
  font-weight: 500;
}

.cart-item-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-elevated);
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}

.qty-btn:hover {
  background: var(--bg-hover);
}

.qty-input {
  width: 36px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--text);
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}

.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.cart-remove {
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.12s, background 0.12s;
}

.cart-remove:hover {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
}

.cart-footer {
  padding: 16px 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex-shrink: 0;
  background: var(--bg-card);
}

.cart-footer.hidden {
  display: none;
}

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

.cart-summary #cart-count-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-right: auto;
}

.cart-total-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.cart-total-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--success);
  font-variant-numeric: tabular-nums;
}

/* Toast polish */
.toast {
  z-index: 200;
}

/* Responsive cart */
@media (max-width: 480px) {
  .cart-drawer {
    max-width: 100%;
  }
}

/* Header spacing fix for cart btn */
.header-right {
  gap: 10px;
}

/* Smooth view transitions */
.view {
  animation: fadeIn 0.22s ease;
}

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

/* ==================== DELIVERY / STATUS ==================== */

.product-delivery {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cart-delivery {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.cart-delivery.instant {
  color: var(--success);
}

.status-pill {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.2px;
}

.status-delivered {
  background: rgba(34, 197, 94, 0.14);
  color: var(--success);
}

.status-transit {
  background: rgba(245, 158, 11, 0.14);
  color: var(--warning);
}

/* ==================== PRODUCT MODAL ==================== */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 110;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

.modal.open {
  opacity: 1;
  visibility: visible;
}

.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 720px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
  transform: translateY(12px);
  transition: transform 0.22s ease;
}

.modal.open .modal-dialog {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  z-index: 2;
}

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

.modal-product-layout {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 28px;
}

.modal-product-media {
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-elevated);
  min-height: 220px;
}

.modal-product-img {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  display: block;
}

.modal-product-img.placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 14px;
}

.modal-product-name {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  margin: 8px 0 12px;
}

.modal-product-price {
  font-size: 22px;
  font-weight: 700;
  color: var(--success);
  margin-bottom: 14px;
  font-variant-numeric: tabular-nums;
}

.modal-product-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@media (max-width: 640px) {
  .modal-product-layout {
    grid-template-columns: 1fr;
  }
}

/* ==================== ADMIN TABS & TABLE ==================== */

.admin-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin-tab {
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.admin-tab:hover {
  color: var(--text);
  border-color: var(--border-light);
}

.admin-tab.active {
  background: var(--primary-soft);
  border-color: rgba(59, 130, 246, 0.4);
  color: #93c5fd;
}

.admin-tab-panel.hidden {
  display: none;
}

.admin-split {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.admin-split > .admin-card {
  width: 100%;
  max-width: 560px; /* form não estica demais */
  min-width: 0;
  overflow: hidden;
}

.admin-split > .admin-card-wide {
  max-width: 100%;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.admin-card {
  min-width: 0;
  overflow: hidden;
}

.admin-card-wide {
  min-width: 0;
}

.admin-hint {
  font-size: 13px;
  margin-bottom: 14px;
}

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

.admin-table-wrap {
  overflow-x: auto;
}

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

.admin-table th {
  text-align: left;
  padding: 10px 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.admin-table td {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table tr:hover td {
  background: var(--bg-hover);
}

.admin-prod-name {
  font-weight: 600;
  color: var(--text);
}

.admin-prod-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.admin-actions-cell {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mono {
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

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

/* ==================== MOBILE NAV ==================== */

.mobile-menu-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: pointer;
  padding: 8px;
}

.mobile-menu-btn span {
  display: block;
  height: 2px;
  background: var(--text);
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

.mobile-menu-btn.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}
.mobile-menu-btn.open span:nth-child(2) {
  opacity: 0;
}
.mobile-menu-btn.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 860px) {
  .mobile-menu-btn {
    display: flex;
  }

  .nav {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 12px;
    gap: 4px;
    z-index: 50;
    display: none;
  }

  .nav.open {
    display: flex;
  }

  .nav-item {
    width: 100%;
    text-align: left;
    padding: 12px 14px;
  }

  .header-right .balance-label {
    display: none;
  }

  .view-actions {
    flex-wrap: wrap;
  }

  .search-input {
    min-width: 0;
    flex: 1;
  }
}

/* Product card cursor */
.product-card {
  cursor: pointer;
}

.product-footer {
  cursor: default;
}


/* ==================== PROFILE HISTORY ==================== */

.profile-layout {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

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

.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 0;
  overflow: hidden;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.profile-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  text-align: center;
}

.profile-stat-value {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  margin-bottom: 4px;
}

.profile-stat-value.success { color: var(--success); }
.profile-stat-value.warning { color: var(--warning); }

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

.profile-history-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  min-width: 0;
  overflow: hidden;
}

.profile-history-card h3 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 14px;
}

.profile-order-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.profile-order-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.profile-order-row:first-of-type {
  padding-top: 0;
}

.profile-order-info {
  flex: 1;
  min-width: 0;
}

.profile-order-info h4 {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.profile-order-meta {
  text-align: right;
  flex-shrink: 0;
}

/* ==================== AI GENERATE ==================== */

.ai-card {
  margin-bottom: 20px;
  border-color: rgba(59, 130, 246, 0.35);
  background:
    linear-gradient(135deg, rgba(59, 130, 246, 0.06), transparent 50%),
    var(--bg-card);
}

.ai-key-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ai-key-row input {
  flex: 1;
  min-width: 0;
}

.ai-key-help {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.ai-key-help a {
  color: #93c5fd;
  text-decoration: none;
}

.ai-key-help a:hover {
  text-decoration: underline;
}

.ai-status {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 18px;
}

.ai-status.loading {
  color: #93c5fd;
}

.ai-status.ok {
  color: var(--success);
}

.ai-status.error {
  color: var(--danger);
}

.ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.ai-actions .btn {
  min-width: 140px;
}
