:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --border: #e7e5e4;
  --border-strong: #d6d3d1;
  --text: #1c1917;
  --text-muted: #57534e;
  --text-subtle: #78716c;
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #b45309;
  --accent-soft: #fef3c7;
  --success: #166534;
  --success-soft: #dcfce7;
  --warning: #92400e;
  --warning-soft: #fef3c7;
  --danger: #991b1b;
  --danger-soft: #fee2e2;
}

* {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

.font-display {
  font-family: 'Fraunces', Georgia, serif;
  font-feature-settings: 'ss01';
  letter-spacing: -0.02em;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Subtle card */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.card-hover {
  transition: all 0.2s ease;
}
.card-hover:hover {
  border-color: var(--border-strong);
  box-shadow: 0 4px 16px -4px rgba(0,0,0,0.08);
  transform: translateY(-2px);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 8px;
  transition: all 0.15s ease;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

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

.btn-secondary {
  background: white;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg); }

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

.btn-danger {
  background: white;
  color: var(--danger);
  border-color: #fecaca;
}
.btn-danger:hover { background: var(--danger-soft); }

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 0.875rem 1.5rem;
  font-size: 0.9375rem;
}

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  background: white;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  color: var(--text);
  transition: all 0.15s ease;
  font-family: inherit;
}

.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.input::placeholder { color: var(--text-subtle); }

.label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.375rem;
}

.label-hint {
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-weight: 400;
  margin-left: 0.5rem;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 999px;
  letter-spacing: 0.01em;
}

.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-neutral { background: #f1f5f9; color: #475569; }
.badge-accent { background: var(--accent-soft); color: var(--accent); }

/* Nav */
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  border-radius: 8px;
  transition: all 0.15s ease;
  font-weight: 500;
}

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

.nav-link.active {
  background: var(--primary);
  color: white;
}

.nav-link.active:hover {
  background: var(--primary-hover);
}

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

.table th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-subtle);
  padding: 0.875rem 1rem;
  border-bottom: 1px solid var(--border);
  background: #fafaf9;
}

.table td {
  padding: 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.table tbody tr:hover {
  background: #fafaf9;
}

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

/* Product image placeholder */
.product-image {
  background: linear-gradient(135deg, #f5f5f4 0%, #e7e5e4 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.product-image::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.4) 0%, transparent 50%);
  pointer-events: none;
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d6d3d1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #a8a29e; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--primary);
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,0.25);
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.25s ease;
  pointer-events: none;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

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

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 1rem;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  background: white;
  border-radius: 16px;
  max-width: 32rem;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 48px -12px rgba(0,0,0,0.25);
}

/* Quantity stepper */
.qty-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  overflow: hidden;
}

.qty-stepper button {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.qty-stepper button:hover { background: var(--bg); color: var(--text); }
.qty-stepper button:disabled { opacity: 0.4; cursor: not-allowed; }

.qty-stepper input {
  width: 44px;
  height: 32px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 0.875rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.qty-stepper input:focus { outline: none; background: var(--bg); }

/* Top bar shadow */
.elevated {
  box-shadow: 0 1px 0 var(--border);
}

/* Empty states */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-subtle);
}

/* Stat cards */
.stat-value {
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-subtle);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Tier price chip */
.tier-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.tier-chip-active {
  background: var(--accent-soft);
  border-color: #fcd34d;
  color: var(--accent);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.3s ease; }

/* Hero gradient */
.hero-gradient {
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(180, 83, 9, 0.08), transparent),
    radial-gradient(ellipse 60% 60% at 90% 100%, rgba(15, 23, 42, 0.05), transparent),
    var(--bg);
}

/* Divider with text */
.divider-text {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-subtle);
  font-size: 0.8125rem;
}

.divider-text::before,
.divider-text::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* Sidebar */
.sidebar {
  background: white;
  border-right: 1px solid var(--border);
}

/* Brand mark */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  font-family: 'Fraunces', Georgia, serif;
}

/* ===== AI Assistant chatbot ===== */
.pb-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px 12px 14px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 999px;
  font-family: 'Inter', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 28px -8px rgba(15, 23, 42, 0.4);
  transition: all 0.2s ease;
}
.pb-chat-launcher:hover { transform: translateY(-2px); box-shadow: 0 14px 32px -8px rgba(15, 23, 42, 0.5); }
.pb-chat-launcher .pb-spark {
  width: 30px; height: 30px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.pb-chat-launcher.hidden { display: none; }

.pb-chat-panel {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 61;
  width: 384px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 48px);
  background: white;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 24px 60px -16px rgba(15, 23, 42, 0.35);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
}
.pb-chat-panel.open { display: flex; animation: fadeIn 0.22s ease; }

.pb-chat-header {
  background: var(--primary);
  color: white;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.pb-chat-avatar {
  width: 38px; height: 38px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.pb-chat-title { font-weight: 600; font-size: 0.95rem; line-height: 1.2; }
.pb-chat-title small { display: flex; align-items: center; gap: 5px; font-weight: 400; font-size: 0.72rem; color: #cbd5e1; margin-top: 2px; }
.pb-chat-status-dot { width: 7px; height: 7px; border-radius: 50%; background: #34d399; display: inline-block; }
.pb-chat-close { margin-left: auto; background: rgba(255,255,255,0.12); border: none; color: white; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background 0.15s ease; }
.pb-chat-close:hover { background: rgba(255,255,255,0.22); }

.pb-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.pb-msg { max-width: 85%; font-size: 0.85rem; line-height: 1.5; }
.pb-msg-bot {
  align-self: flex-start;
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 13px;
  border-radius: 4px 14px 14px 14px;
}
.pb-msg-user {
  align-self: flex-end;
  background: var(--primary);
  color: white;
  padding: 10px 13px;
  border-radius: 14px 14px 4px 14px;
}
.pb-msg-bot strong { color: var(--text); }
.pb-msg-bot .pb-amount { font-variant-numeric: tabular-nums; font-weight: 600; }

.pb-prod-card {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  background: var(--bg);
  display: flex;
  align-items: center;
  gap: 10px;
}
.pb-prod-card .pb-prod-name { font-weight: 600; font-size: 0.8rem; }
.pb-prod-card .pb-prod-price { font-size: 0.72rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.pb-chat-actions { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 7px; }
.pb-chat-action {
  font-size: 0.78rem;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid var(--primary);
  background: var(--primary);
  color: white;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s ease;
}
.pb-chat-action:hover { background: var(--primary-hover); }
.pb-chat-action.secondary { background: white; color: var(--text); border-color: var(--border-strong); }
.pb-chat-action.secondary:hover { background: var(--bg); }

.pb-chat-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.pb-chip {
  font-size: 0.78rem;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: white;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.pb-chip:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.pb-typing { display: inline-flex; gap: 4px; padding: 12px 14px; }
.pb-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--text-subtle); opacity: 0.5; animation: pbBounce 1.1s infinite; }
.pb-typing span:nth-child(2) { animation-delay: 0.15s; }
.pb-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes pbBounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.4; } 30% { transform: translateY(-4px); opacity: 1; } }

.pb-chat-footer { border-top: 1px solid var(--border); background: white; padding: 12px 14px; }
.pb-chat-input-row { display: flex; align-items: center; gap: 8px; }
.pb-chat-input {
  flex: 1;
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.85rem;
  font-family: inherit;
  outline: none;
}
.pb-chat-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,23,42,0.08); }
.pb-chat-send {
  width: 38px; height: 38px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s ease;
}
.pb-chat-send:hover { background: var(--primary-hover); }
.pb-chat-disclaimer { font-size: 0.66rem; color: var(--text-subtle); text-align: center; margin-top: 8px; }
