@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Outfit:wght@400;600;700;800;900&display=swap');

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

/* ===== Design tokens ===== */
:root {
  --radius: 0.9rem;
  --background: oklch(0.985 0 0);
  --foreground: oklch(0.2 0 0);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.2 0 0);
  --primary: oklch(0.24 0 0);
  --primary-foreground: oklch(0.98 0 0);
  --secondary: oklch(0.95 0 0);
  --muted: oklch(0.95 0 0);
  --muted-foreground: oklch(0.5 0 0);
  --accent: oklch(0.24 0 0);
  --accent-foreground: oklch(0.98 0 0);
  --destructive: oklch(0.45 0 0);
  --success: oklch(0.3 0 0);
  --success-foreground: oklch(0.98 0 0);
  --border: oklch(0.2 0 0 / 12%);
  --input: oklch(0.2 0 0 / 14%);
  --ring: oklch(0.24 0 0);
  --glass-bg: oklch(1 0 0 / 70%);
  --glass-border: oklch(0.2 0 0 / 8%);
  --shadow-glow: 0 6px 24px -10px oklch(0.2 0 0 / 18%);
  --shadow-card: 0 6px 24px -16px oklch(0.2 0 0 / 22%);
  --sidebar: oklch(0.99 0 0);
  --sidebar-border: oklch(0.2 0 0 / 10%);
  --font-sans: 'Inter', ui-sans-serif, system-ui, sans-serif;
  --font-display: 'Outfit', 'Inter', sans-serif;
}

.dark {
  --background: oklch(0.16 0 0);
  --foreground: oklch(0.96 0 0);
  --card: oklch(0.21 0 0);
  --card-foreground: oklch(0.96 0 0);
  --primary: oklch(0.95 0 0);
  --primary-foreground: oklch(0.18 0 0);
  --secondary: oklch(0.26 0 0);
  --muted: oklch(0.26 0 0);
  --muted-foreground: oklch(0.68 0 0);
  --accent: oklch(0.95 0 0);
  --accent-foreground: oklch(0.18 0 0);
  --destructive: oklch(0.7 0 0);
  --success: oklch(0.85 0 0);
  --border: oklch(1 0 0 / 12%);
  --input: oklch(1 0 0 / 14%);
  --glass-bg: oklch(1 0 0 / 5%);
  --glass-border: oklch(1 0 0 / 10%);
  --shadow-card: 0 8px 30px -14px oklch(0 0 0 / 60%);
  --sidebar: oklch(0.14 0 0);
  --sidebar-border: oklch(1 0 0 / 10%);
}

html { scroll-behavior: smooth; scroll-padding-top: 6rem; }

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ===== Utilities ===== */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
}
.glass-strong {
  background: color-mix(in oklab, var(--card) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
}
.glow { box-shadow: var(--shadow-card); }
.gradient-text { color: var(--foreground); }
.bg-grad-primary { background-color: var(--primary); }
.font-display { font-family: var(--font-display); }
.scrollbar-hide { scrollbar-width: none; -ms-overflow-style: none; }
.scrollbar-hide::-webkit-scrollbar { display: none; }

/* ===== Navbar ===== */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in oklab, var(--card) 88%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--glass-border);
}
.navbar-inner {
  max-width: 1280px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  height: 64px; padding: 0 16px;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  text-decoration: none; color: var(--foreground); flex-shrink: 0;
}
.nav-logo-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px; background: var(--primary);
  box-shadow: var(--shadow-card);
}
.nav-logo-icon svg { color: var(--primary-foreground); }
.nav-logo-text { font-family: var(--font-display); font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; }
.nav-search {
  flex: 1; max-width: 400px; margin: 0 auto;
  position: relative; display: none;
}
.nav-search input {
  width: 100%; height: 40px; padding: 0 16px 0 36px;
  border-radius: 9999px; border: 1px solid var(--border);
  background: color-mix(in oklab, var(--background) 40%, transparent);
  color: var(--foreground); font-size: 0.875rem;
  outline: none; transition: border-color .2s;
}
.nav-search input:focus { border-color: var(--ring); }
.nav-search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nav-links { display: none; align-items: center; gap: 4px; }
.nav-link {
  padding: 8px 12px; border-radius: 9999px;
  font-size: 0.875rem; font-weight: 500; color: var(--muted-foreground);
  text-decoration: none; transition: color .2s, background .2s;
  white-space: nowrap;
}
.nav-link:hover, .nav-link.active { color: var(--foreground); }
.nav-balance {
  display: none; padding: 6px 12px; border-radius: 9999px;
  background: var(--primary); color: var(--primary-foreground);
  font-size: 0.75rem; font-weight: 700;
}
.btn-icon {
  width: 36px; height: 36px; border-radius: 9999px;
  display: flex; align-items: center; justify-content: center;
  background: transparent; border: none; cursor: pointer; color: var(--foreground);
  transition: background .2s;
}
.btn-icon:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.avatar-btn {
  width: 36px; height: 36px; border-radius: 9999px;
  background: var(--primary); color: var(--primary-foreground);
  font-size: 0.75rem; font-weight: 700; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.mobile-menu-btn { display: flex; }

@media (min-width: 768px) {
  .nav-search { display: block; }
  .nav-links { display: flex; }
  .nav-balance { display: inline-flex; }
  .mobile-menu-btn { display: none; }
}

/* Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  display: none; position: absolute; right: 0; top: calc(100% + 8px);
  min-width: 200px; border-radius: 16px; padding: 6px;
  background: color-mix(in oklab, var(--card) 88%, transparent);
  backdrop-filter: blur(18px); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card); z-index: 100;
}
.dropdown.open .dropdown-menu { display: block; }
.dropdown-label { padding: 8px 10px; font-size: 0.8125rem; font-weight: 600; color: var(--muted-foreground); }
.dropdown-sep { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-item {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 10px; border-radius: 10px;
  font-size: 0.875rem; color: var(--foreground);
  text-decoration: none; cursor: pointer; background: none; border: none; width: 100%;
  transition: background .15s;
}
.dropdown-item:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.dropdown-item svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Mobile drawer */
.drawer-overlay {
  display: none; position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.5);
}
.drawer-overlay.open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 288px; z-index: 201;
  background: color-mix(in oklab, var(--card) 88%, transparent);
  backdrop-filter: blur(18px); border-left: 1px solid var(--glass-border);
  padding: 20px; display: flex; flex-direction: column; gap: 0;
  transform: translateX(100%); transition: transform .3s ease;
}
.drawer-overlay.open .drawer { transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.drawer-search { position: relative; margin-bottom: 16px; }
.drawer-search input {
  width: 100%; height: 40px; padding: 0 16px 0 36px; border-radius: 9999px;
  border: 1px solid var(--border); background: color-mix(in oklab, var(--background) 40%, transparent);
  color: var(--foreground); font-size: 0.875rem; outline: none;
}
.drawer-nav { display: flex; flex-direction: column; gap: 4px; }
.drawer-link {
  display: flex; align-items: center; gap: 12px; padding: 12px;
  border-radius: 12px; font-size: 0.875rem; font-weight: 500;
  color: var(--foreground); text-decoration: none; transition: background .15s;
}
.drawer-link:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.drawer-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.drawer-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 9999px; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; border: none; transition: opacity .2s, background .2s;
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: var(--primary-foreground); }
.btn-primary:hover:not(:disabled) { opacity: .88; }
.btn-outline {
  background: transparent; color: var(--foreground);
  border: 1px solid var(--border);
}
.btn-outline:hover:not(:disabled) { background: color-mix(in oklab, var(--muted) 60%, transparent); }
.btn-ghost { background: transparent; color: var(--foreground); }
.btn-ghost:hover:not(:disabled) { background: color-mix(in oklab, var(--muted) 60%, transparent); }
.btn-sm { padding: 5px 12px; font-size: 0.75rem; border-radius: 9999px; }
.btn-icon-sm {
  width: 32px; height: 32px; padding: 0; border-radius: 9999px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; background: transparent; border: 1px solid var(--border);
  color: var(--foreground); transition: background .15s;
}
.btn-icon-sm:hover { background: var(--muted); }
.btn-danger { background: transparent; border: none; color: var(--destructive); cursor: pointer; padding: 6px; border-radius: 8px; }
.btn-danger:hover { background: color-mix(in oklab, var(--destructive) 12%, transparent); }

/* ===== Form controls ===== */
.input {
  width: 100%; height: 44px; padding: 0 12px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--background); color: var(--foreground);
  font-size: 0.875rem; outline: none; transition: border-color .2s;
  font-family: var(--font-sans);
}
.input:focus { border-color: var(--ring); }
.input-icon { position: relative; }
.input-icon .input { padding-left: 36px; }
.input-icon svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-foreground); pointer-events: none; }
.textarea {
  width: 100%; padding: 10px 12px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--background); color: var(--foreground);
  font-size: 0.875rem; outline: none; resize: vertical;
  font-family: var(--font-sans); transition: border-color .2s;
}
.textarea:focus { border-color: var(--ring); }
.label { display: block; font-size: 0.75rem; color: var(--muted-foreground); margin-bottom: 6px; }
.select {
  width: 100%; height: 40px; padding: 0 10px;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--background); color: var(--foreground);
  font-size: 0.875rem; outline: none; cursor: pointer;
}
.checkbox { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.switch {
  width: 44px; height: 24px; background: var(--border);
  border-radius: 9999px; border: none; cursor: pointer;
  position: relative; transition: background .2s; flex-shrink: 0;
}
.switch.on { background: var(--primary); }
.switch::after {
  content: ''; position: absolute; width: 18px; height: 18px;
  border-radius: 50%; background: white; top: 3px; left: 3px;
  transition: transform .2s;
}
.switch.on::after { transform: translateX(20px); }

/* ===== Cards / layout ===== */
.card { border-radius: 16px; padding: 20px; }
.card-glass { border-radius: 16px; padding: 20px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 9999px; font-size: 0.625rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
}
.badge-success { background: color-mix(in oklab, var(--success) 15%, transparent); color: var(--success); }
.badge-muted { background: var(--muted); color: var(--muted-foreground); }
.badge-destructive { background: color-mix(in oklab, var(--destructive) 12%, transparent); color: var(--destructive); }

/* ===== Page container ===== */
.page-container { max-width: 1280px; margin: 0 auto; padding: 24px 16px; }

/* ===== Hero section ===== */
.hero {
  border-radius: 24px; padding: 24px;
  background: color-mix(in oklab, var(--card) 88%, transparent);
  backdrop-filter: blur(18px); border: 1px solid var(--glass-border);
  margin-bottom: 32px;
}
@media (min-width: 768px) { .hero { padding: 40px; } }
.hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 9999px;
  background: color-mix(in oklab, var(--primary) 15%, transparent);
  font-size: 0.75rem; font-weight: 700; color: var(--primary);
  margin-bottom: 16px;
}
.hero h1 { font-family: var(--font-display); font-size: 1.875rem; font-weight: 900; line-height: 1.2; margin-bottom: 12px; }
@media (min-width: 768px) { .hero h1 { font-size: 3rem; } }
.hero p { font-size: 0.875rem; color: var(--muted-foreground); max-width: 520px; }
@media (min-width: 768px) { .hero p { font-size: 1rem; } }

/* ===== Category grid ===== */
.section-title { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; margin-bottom: 12px; }
.category-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); gap: 10px;
  margin-bottom: 32px;
}
@media (min-width: 480px) { .category-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px) { .category-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1024px) { .category-grid { grid-template-columns: repeat(5, 1fr); } }

.cat-card {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); cursor: pointer;
  transition: background .2s, border-color .2s;
  background: var(--glass-bg); backdrop-filter: blur(14px);
  text-align: left; width: 100%;
}
.cat-card:hover { background: var(--muted); }
.cat-card.active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.cat-icon {
  width: 36px; height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; border-radius: 8px;
  background: var(--muted); color: var(--foreground);
}
.cat-card.active .cat-icon { background: rgba(255,255,255,.15); color: var(--primary-foreground); }
.cat-name { font-size: 0.8125rem; font-weight: 700; line-height: 1.2; color: var(--foreground); }
.cat-card.active .cat-name { color: var(--primary-foreground); }

/* ===== Section heading ===== */
.section-heading { margin-bottom: 32px; scroll-margin-top: 80px; }
.section-heading-inner {
  display: flex; align-items: center; gap: 10px; margin-bottom: 16px; position: relative;
}
.section-heading h2 { font-family: var(--font-display); font-size: 1.25rem; font-weight: 700; }
.section-count {
  padding: 2px 8px; border-radius: 9999px; background: var(--muted);
  font-size: 0.6875rem; font-weight: 700; color: var(--muted-foreground);
}
.section-underline {
  height: 2px; width: 0; background: var(--primary); border-radius: 9999px;
  transition: width .7s ease .1s;
}

/* Flash animation on category click */
@keyframes section-flash {
  0% { opacity: .4; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}
.section-active { animation: section-flash .5s ease both; }
.section-active .section-underline { width: 100%; }

/* ===== Product grid ===== */
.product-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
@media (min-width: 768px) { .product-grid { grid-template-columns: repeat(3, 1fr); gap: 14px; } }
@media (min-width: 1280px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

.product-card {
  border-radius: 12px; padding: 12px;
  background: var(--glass-bg); backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  display: flex; flex-direction: column; gap: 0;
  transition: background .2s;
}
.product-card:hover { background: var(--muted); }
.product-name { font-family: var(--font-display); font-size: 0.875rem; font-weight: 700; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; }
.product-desc { font-size: 0.75rem; color: var(--muted-foreground); margin-top: 4px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.product-meta { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 8px; }
.product-price { font-size: 1rem; font-weight: 900; }
.product-stock { display: flex; align-items: center; gap: 3px; font-size: 0.625rem; font-weight: 700; }
.product-stock.in { color: var(--foreground); }
.product-stock.out { color: var(--muted-foreground); }
.product-actions { display: flex; gap: 6px; margin-top: 10px; }
.product-actions .btn { flex: 1; font-size: 0.75rem; padding: 6px 8px; }

/* ===== Modals ===== */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.6); align-items: center; justify-content: center; padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal {
  border-radius: 20px; padding: 0; width: 100%; max-width: 480px;
  background: color-mix(in oklab, var(--card) 88%, transparent);
  backdrop-filter: blur(18px); border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-card); max-height: 92vh; overflow-y: auto;
}
.modal-header { padding: 20px 20px 0; border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.modal-header h3 { font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; }
.modal-header .close-btn {
  float: right; background: none; border: none; cursor: pointer;
  color: var(--muted-foreground); padding: 4px;
}
.modal-body { padding: 20px; }
.modal-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 12px;
  border: 1px solid var(--border); background: color-mix(in oklab, var(--background) 40%, transparent);
  font-size: 0.875rem; margin-bottom: 10px;
}
.modal-row span:first-child { color: var(--muted-foreground); }
.modal-row span:last-child { font-weight: 700; }
.modal-total {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; border-radius: 12px;
  background: color-mix(in oklab, var(--primary) 15%, transparent);
  margin-bottom: 10px;
}
.modal-total .label-t { font-size: 0.875rem; font-weight: 600; }
.modal-total .value-t { font-size: 1.125rem; font-weight: 900; }
.qty-control { display: flex; align-items: center; gap: 12px; }
.qty-num { min-width: 32px; text-align: center; font-weight: 700; font-size: 1rem; }
.modal-actions { display: flex; gap: 8px; margin-top: 4px; }
.modal-actions .btn { flex: 1; }

/* Delivery modal */
.modal-lg { max-width: 540px; }
.modal-lg .modal-header { display: flex; align-items: center; gap: 8px; }
.modal-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.info-box { padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: color-mix(in oklab, var(--background) 40%, transparent); }
.info-box .info-label { font-size: 0.625rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-foreground); margin-bottom: 2px; }
.info-box .info-val { font-size: 0.875rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.info-box .info-val.mono { font-family: monospace; }
.cred-box {
  padding: 12px; border-radius: 12px;
  border: 1px solid var(--border); background: color-mix(in oklab, var(--background) 50%, transparent);
  font-size: 0.75rem; font-family: monospace; white-space: pre-wrap; max-height: 220px; overflow-y: auto;
  word-break: break-all;
}
.cred-actions { display: flex; gap: 8px; margin: 12px 0; }
.cred-actions .btn { flex: 1; }

/* ===== Toast ===== */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 12px 16px; border-radius: 12px; font-size: 0.875rem; font-weight: 600;
  min-width: 240px; max-width: 340px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: var(--shadow-card); animation: toast-in .3s ease;
  display: flex; align-items: center; gap: 8px;
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--destructive); }
.toast.info { border-left: 3px solid var(--primary); }
@keyframes toast-in { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform: translateX(0); } }

/* ===== Auth page ===== */
.auth-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 40px 16px;
}
.auth-card { width: 100%; max-width: 440px; }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 32px; text-decoration: none; color: var(--foreground); }
.auth-logo-icon { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 14px; background: var(--primary); box-shadow: var(--shadow-card); }
.auth-logo-text { font-family: var(--font-display); font-size: 1.5rem; font-weight: 900; }
.auth-box { border-radius: 20px; padding: 24px; background: color-mix(in oklab, var(--card) 88%, transparent); backdrop-filter: blur(18px); border: 1px solid var(--glass-border); box-shadow: var(--shadow-card); }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; background: var(--muted); padding: 4px; border-radius: 9999px; margin-bottom: 4px; }
.tab-btn { padding: 7px; border-radius: 9999px; border: none; cursor: pointer; font-size: 0.875rem; font-weight: 600; background: transparent; color: var(--muted-foreground); transition: background .2s, color .2s; }
.tab-btn.active { background: var(--card); color: var(--foreground); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.form-group { margin-bottom: 14px; }
.demo-box { border-radius: 12px; border: 1px solid var(--border); background: color-mix(in oklab, var(--muted) 40%, transparent); padding: 12px; margin: 14px 0; font-size: 0.75rem; }
.demo-box-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-weight: 700; }
.demo-item { width: 100%; text-align: left; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: color-mix(in oklab, var(--background) 50%, transparent); cursor: pointer; font-size: 0.75rem; margin-bottom: 4px; transition: background .15s; }
.demo-item:hover { background: var(--muted); }

/* ===== Wallet page ===== */
.wallet-balance-card { border-radius: 20px; padding: 24px; background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-card); }
.wallet-balance-label { font-size: 0.875rem; opacity: .9; display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.wallet-balance-amount { font-size: 2.5rem; font-weight: 900; font-family: var(--font-display); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.preset-btn { padding: 6px 12px; border-radius: 9999px; border: 1px solid var(--border); background: transparent; font-size: 0.875rem; cursor: pointer; color: var(--foreground); transition: background .15s; }
.preset-btn:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); }
.gateway-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gateway-btn { padding: 10px; border-radius: 12px; border: 1px solid var(--border); background: transparent; font-size: 0.875rem; font-weight: 700; cursor: pointer; color: var(--muted-foreground); text-transform: capitalize; transition: all .2s; }
.gateway-btn.active { border-color: var(--primary); background: color-mix(in oklab, var(--primary) 15%, transparent); color: var(--primary); }
.txn-row { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: color-mix(in oklab, var(--background) 40%, transparent); margin-bottom: 8px; }
.txn-icon { width: 36px; height: 36px; border-radius: 9999px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.txn-icon.credit { background: color-mix(in oklab, var(--success) 15%, transparent); color: var(--success); }
.txn-icon.debit { background: color-mix(in oklab, var(--destructive) 12%, transparent); color: var(--destructive); }
.txn-info { flex: 1; min-width: 0; }
.txn-name { font-size: 0.875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.txn-date { font-size: 0.75rem; color: var(--muted-foreground); }
.txn-amount { font-size: 0.875rem; font-weight: 700; }
.txn-amount.credit { color: var(--success); }
.txn-amount.debit { color: var(--destructive); }

/* ===== Orders page ===== */
.order-row { border-radius: 20px; padding: 16px; background: var(--glass-bg); backdrop-filter: blur(14px); border: 1px solid var(--glass-border); margin-bottom: 12px; }
.order-row-inner { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 640px) { .order-row-inner { flex-direction: row; align-items: center; justify-content: space-between; } }
.order-name { font-weight: 700; }
.order-id { font-family: monospace; font-size: 0.75rem; color: var(--muted-foreground); }
.order-date { font-size: 0.75rem; color: var(--muted-foreground); }
.order-right { display: flex; align-items: center; gap: 16px; }
.order-total { font-weight: 700; text-align: right; }
.order-qty { font-size: 0.75rem; color: var(--muted-foreground); }

/* ===== Admin layout ===== */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 256px; flex-shrink: 0;
  display: none; flex-direction: column;
  background: var(--sidebar); border-right: 1px solid var(--sidebar-border);
  padding: 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
@media (min-width: 768px) { .admin-sidebar { display: flex; } }
.admin-sidebar-logo { display: flex; align-items: center; gap: 8px; margin-bottom: 24px; text-decoration: none; color: var(--foreground); }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-link {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 12px; font-size: 0.875rem; font-weight: 600;
  color: var(--muted-foreground); text-decoration: none; transition: all .2s;
}
.sidebar-link:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); color: var(--foreground); }
.sidebar-link.active { background: var(--primary); color: var(--primary-foreground); box-shadow: var(--shadow-card); }
.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--sidebar-border); display: flex; flex-direction: column; gap: 6px; }
.admin-content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar {
  height: 56px; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in oklab, var(--card) 88%, transparent);
  backdrop-filter: blur(18px);
}
.admin-topbar h2 { font-family: var(--font-display); font-size: 1.125rem; font-weight: 700; }
.admin-main { flex: 1; padding: 16px; }
@media (min-width: 768px) { .admin-main { padding: 24px; } }

/* Admin dashboard stats */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 20px; }
@media (min-width: 768px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat-card { border-radius: 20px; padding: 20px; background: var(--glass-bg); backdrop-filter: blur(14px); border: 1px solid var(--glass-border); }
.stat-icon { width: 40px; height: 40px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: color-mix(in oklab, var(--primary) 15%, transparent); color: var(--primary); margin-bottom: 16px; }
.stat-value { font-size: 1.5rem; font-weight: 900; font-family: var(--font-display); }
.stat-label { font-size: 0.8125rem; color: var(--muted-foreground); margin-top: 2px; }

/* Admin tables */
.admin-table-wrap { border-radius: 16px; background: var(--glass-bg); backdrop-filter: blur(14px); border: 1px solid var(--glass-border); overflow-x: auto; }
.admin-table { width: 100%; min-width: 600px; border-collapse: collapse; font-size: 0.875rem; }
.admin-table thead tr { border-bottom: 1px solid var(--border); }
.admin-table th { padding: 10px 12px; text-align: left; font-size: 0.6875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-foreground); white-space: nowrap; }
.admin-table td { padding: 10px 12px; border-bottom: 1px solid color-mix(in oklab, var(--border) 50%, transparent); vertical-align: middle; }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: color-mix(in oklab, var(--muted) 30%, transparent); }
.actions-cell { display: flex; align-items: center; gap: 4px; justify-content: flex-end; }

/* Admin form/dialog */
.form-section { border-radius: 20px; padding: 20px; background: var(--glass-bg); backdrop-filter: blur(14px); border: 1px solid var(--glass-border); margin-bottom: 16px; }
.form-section h3 { font-family: var(--font-display); font-weight: 700; font-size: 1.125rem; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }

/* Icon picker */
.icon-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-option {
  width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: var(--muted-foreground); background: transparent; transition: all .15s;
}
.icon-option.selected { border-color: var(--primary); background: color-mix(in oklab, var(--primary) 15%, transparent); color: var(--primary); }
.icon-option svg { width: 16px; height: 16px; }

/* Credit stats badges */
.cred-stat { padding: 4px 12px; border-radius: 9999px; font-size: 0.875rem; font-weight: 700; }
.cred-stat.available { background: color-mix(in oklab, var(--success) 15%, transparent); color: var(--success); }
.cred-stat.used { background: var(--muted); color: var(--muted-foreground); }

/* Back to top */
#back-to-top {
  display: none;
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  width: 44px; height: 44px; border-radius: 9999px;
  background: var(--primary); color: var(--primary-foreground);
  border: none; cursor: pointer; box-shadow: var(--shadow-card);
  align-items: center; justify-content: center;
  opacity: 0; transition: opacity .3s;
}

/* Page heading */
.page-heading { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; margin-bottom: 20px; }
.page-subheading { font-size: 0.875rem; color: var(--muted-foreground); margin-bottom: 20px; margin-top: -14px; }
.empty-state { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 64px 20px; color: var(--muted-foreground); border-radius: 20px; background: var(--glass-bg); border: 1px solid var(--glass-border); }
.empty-state svg { width: 36px; height: 36px; }

/* Responsive grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr; gap: 20px; }
@media (min-width: 1024px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.flex-end { display: flex; justify-content: flex-end; margin-bottom: 14px; }
.space-y > * + * { margin-top: 12px; }
.space-y-sm > * + * { margin-top: 8px; }
.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-muted { color: var(--muted-foreground); }
.text-success { color: var(--success); }
.text-destructive { color: var(--destructive); }
.font-bold { font-weight: 700; }
.font-mono { font-family: monospace; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.w-full { width: 100%; }
.spinner { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { border-radius: 12px; padding: 12px 14px; font-size: 0.8125rem; margin-bottom: 12px; }
.alert-error { background: color-mix(in oklab, var(--destructive) 12%, transparent); color: var(--destructive); border: 1px solid color-mix(in oklab, var(--destructive) 20%, transparent); }
.alert-success { background: color-mix(in oklab, var(--success) 12%, transparent); color: var(--success); border: 1px solid color-mix(in oklab, var(--success) 20%, transparent); }


/* ===== Logo theme switching ===== */
/* Never use inline display:none on logo imgs — CSS handles visibility */
.site-logo { display: none !important; }

/* Dark mode: show white logo */
.dark .logo-dark  { display: block !important; }
.dark .logo-light { display: none !important; }

/* Light mode: show black logo */
html:not(.dark) .logo-dark  { display: none !important; }
html:not(.dark) .logo-light { display: block !important; }
