/* ==========================================================================
   VIP Supply Storefront — "Ledger" Design System (Shopinn Inspired)
   Warm paper + ink, 1px crisp rules, vermilion accent, Instrument Serif + Geist.
   ========================================================================== */

:root {
  --paper: #F4F1EA;
  --surface: #FCFBF8;
  --surface-2: #EFEBE2;
  --ink: #17191C;
  --ink-2: #4A4741;
  --ink-3: #7A766D;
  --rule: #DCD6C9;
  --rule-strong: #B9B2A2;

  --accent: #CF4A22;
  --accent-dark: #AE3A16;
  --accent-soft: #F6E4DC;

  --pos: #2E6B50;
  --pos-soft: #E1EDE6;
  --warn: #9B6B12;
  --warn-soft: #F4EAD2;
  --neg: #B3261E;
  --neg-soft: #F6DEDA;
  --side: #15171A;
  --side-ink: #E8E5DD;
  --side-mute: #8F8B82;

  /* Compatibility aliases */
  --bg: var(--paper);
  --header-bg: rgba(244, 241, 234, 0.94);
  --card-bg: var(--surface);
  --card-hover: var(--surface-2);
  --border: var(--rule);
  --border-accent: var(--rule-strong);
  --primary: var(--accent);
  --primary-hover: var(--accent-dark);
  --text-main: var(--ink);
  --text-muted: var(--ink-3);
  --input-bg: var(--surface);
  --input-border: var(--rule-strong);
  --modal-bg: var(--surface);
  --summary-bg: var(--surface-2);
  --green: var(--pos);
  --green-bg: var(--pos-soft);
  --red: var(--neg);
  --red-bg: var(--neg-soft);
  --yellow: var(--warn);
  --card-shadow: 0 1px 2px rgba(23, 25, 28, 0.05);
  --card-shadow-hover: 0 10px 24px rgba(23, 25, 28, 0.08);

  --r: 8px;
  --r-sm: 6px;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Instrument Serif', 'Times New Roman', serif;
  --font-mono: 'Geist Mono', ui-monospace, Consolas, monospace;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

[data-theme="dark"] {
  --paper: #121315;
  --surface: #1A1C1F;
  --surface-2: #23262A;
  --ink: #ECE9E2;
  --ink-2: #C4C0B6;
  --ink-3: #928E85;
  --rule: #2E3137;
  --rule-strong: #474B53;

  --accent: #E4653D;
  --accent-dark: #FF9470;
  --accent-soft: #3B241B;

  --pos: #6FC49A;
  --pos-soft: #1E3328;
  --warn: #E8B85A;
  --warn-soft: #352915;
  --neg: #F07B75;
  --neg-soft: #3A1F1E;
  --side: #0C0D0F;

  --bg: var(--paper);
  --header-bg: rgba(18, 19, 21, 0.94);
  --card-bg: var(--surface);
  --card-hover: var(--surface-2);
  --border: var(--rule);
  --border-accent: var(--rule-strong);
  --primary: var(--accent);
  --primary-hover: var(--accent-dark);
  --text-main: var(--ink);
  --text-muted: var(--ink-3);
  --input-bg: var(--surface-2);
  --input-border: var(--rule-strong);
  --modal-bg: var(--surface);
  --summary-bg: var(--surface-2);
  --card-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  --card-shadow-hover: 0 12px 28px rgba(0, 0, 0, 0.5);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

html { scroll-behavior: smooth; }

body {
  background: var(--paper);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.55;
  font-feature-settings: "tnum" 1;
}

::selection { background: var(--accent-soft); color: var(--ink); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Marquee */
.marquee-bar {
  display: none;
  background: var(--side);
  color: var(--side-ink);
  font-size: 12px;
  font-weight: 500;
  padding: 7px 0;
  overflow: hidden;
  white-space: nowrap;
  border-bottom: 1px solid var(--rule);
}
.marquee-track {
  display: inline-block;
  padding-left: 100%;
  animation: ledgerMarquee 28s linear infinite;
}
.marquee-bar:hover .marquee-track { animation-play-state: paused; }
@keyframes ledgerMarquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 68px;
  background: var(--header-bg);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
}
.header-inner {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.brand-icon {
  width: 34px;
  height: 34px;
  border-radius: var(--r);
  background: var(--primary);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.brand-title-row { display: flex; align-items: center; gap: 8px; }
.brand-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ink);
  line-height: 1.05;
}
.brand-short-badge {
  display: none;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  color: var(--ink-2);
}
.brand-subtitle {
  font-size: 11.5px;
  color: var(--ink-3);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 360px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.btn-track, .btn-wa, .theme-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 13px;
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.14s var(--ease-out), border-color 0.14s var(--ease-out), transform 0.12s var(--ease-out);
}
.btn-track, .theme-toggle-btn {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
}
.theme-toggle-btn { width: 36px; padding: 0; justify-content: center; }
.btn-track:hover, .theme-toggle-btn:hover {
  background: var(--surface-2);
  border-color: var(--rule-strong);
}
.btn-wa {
  background: var(--primary);
  color: #ffffff;
  border: 1px solid var(--primary);
}
.btn-wa:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-track:active, .btn-wa:active, .theme-toggle-btn:active { transform: scale(0.97); }

/* Hero */
.hero {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 36px 24px 26px;
  border-bottom: 1px solid var(--rule);
}
.hero-badge, .hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 10px;
}
.pulse-dot, .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pos);
  display: inline-block;
  animation: ledgerPulse 2.2s ease-in-out infinite;
}
@keyframes ledgerPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.82); }
}
.hero h1 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(34px, 4.6vw, 52px);
  line-height: 1.04;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin-bottom: 10px;
}
.hero-tagline {
  font-size: 15px;
  color: var(--ink-2);
  max-width: 620px;
  margin-bottom: 14px;
}
.hero-banner-wrap {
  display: none;
  margin-bottom: 18px;
  border-radius: var(--r);
  overflow: hidden;
  border: 1px solid var(--rule);
  max-height: 240px;
}
.hero-banner-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.contacts-bar {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}
.contact-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--rule);
  font-size: 12px;
  color: var(--ink-2);
  text-decoration: none;
}
.contact-chip:hover { border-color: var(--primary); color: var(--primary); }

/* Filter & Search */
.filter-section {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.search-bar {
  position: relative;
  max-width: 480px;
  width: 100%;
}
.search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.search-input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 13.5px;
  transition: border-color 0.14s var(--ease-out);
}
.search-input:focus { border-color: var(--primary); outline: none; }
.master-tabs, .pills-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.pills-wrap {
  overflow-x: auto;
  flex-wrap: nowrap;
  padding-bottom: 4px;
  scrollbar-width: thin;
}
.master-tab, .pill {
  padding: 7px 13px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
  background: var(--surface);
  color: var(--ink-2);
  border: 1px solid var(--rule);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.14s var(--ease-out);
}
.master-tab:hover, .pill:hover {
  border-color: var(--rule-strong);
  color: var(--ink);
}
.master-tab.active, .pill.active {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

/* Catalog Grid */
.catalog-wrap {
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
  padding: 6px 24px 64px;
  flex: 1;
}
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(238px, 1fr));
  gap: 14px;
}
.product-card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--card-shadow);
  transition: transform 0.18s var(--ease-out), border-color 0.18s var(--ease-out), box-shadow 0.18s var(--ease-out);
}
.product-card:hover {
  transform: translateY(-2px);
  border-color: var(--rule-strong);
  box-shadow: var(--card-shadow-hover);
}
.card-thumb-wrap {
  height: 92px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  border: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.card-thumb-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.card-thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 10px;
}
.card-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.card-badges-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.service-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--rule);
}
.badge-flash { background: var(--neg-soft); color: var(--neg); border-color: transparent; }
.badge-grosir { background: var(--pos-soft); color: var(--pos); border-color: transparent; }
.card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}
.card-desc {
  font-size: 12px;
  color: var(--ink-3);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-bottom {
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.price-val {
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.stock-badge {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--pos-soft);
  color: var(--pos);
}
.stock-empty { background: var(--neg-soft); color: var(--neg); }

.btn-buy {
  width: 100%;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  background: var(--primary);
  color: #ffffff;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s var(--ease-out), transform 0.12s var(--ease-out);
}
.btn-buy:hover { background: var(--primary-hover); }
.btn-buy:active { transform: scale(0.985); }
.btn-buy:disabled {
  background: var(--surface-2);
  color: var(--ink-3);
  cursor: not-allowed;
}

.load-more-wrap {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  padding: 18px 0 6px;
}
.btn-load-more {
  padding: 9px 20px;
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule-strong);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}
.btn-load-more:hover { background: var(--surface-2); }

/* Maintenance & Modals */
.maintenance-screen {
  display: none;
  max-width: 540px;
  margin: 48px auto;
  text-align: center;
  padding: 40px 24px;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--r);
  color: var(--ink-2);
}
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 17, 20, 0.62);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-overlay.open { display: flex; }
.modal-card {
  width: 100%;
  max-width: 470px;
  max-height: 90vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--rule-strong);
  border-radius: 10px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 20px 44px rgba(0, 0, 0, 0.24);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
}
.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 400;
  color: var(--ink);
}
.btn-close {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.input-group { display: flex; flex-direction: column; gap: 5px; }
.input-label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.modal-input {
  width: 100%;
  padding: 10px 12px;
  background: var(--paper);
  border: 1px solid var(--rule-strong);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: 13.5px;
}
.modal-input:focus { border-color: var(--primary); outline: none; }
.qty-row { display: flex; align-items: center; gap: 8px; }
.qty-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  border: 1px solid var(--rule-strong);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 16px;
  cursor: pointer;
}
.qty-val { min-width: 32px; text-align: center; font-family: var(--font-mono); font-weight: 600; }
.tiers-box { display: none; flex-wrap: wrap; gap: 6px; }
.tier-chip { padding: 4px 9px; border-radius: 4px; border: 1px solid var(--rule); background: var(--surface-2); font-size: 11px; color: var(--ink-2); }
.summary-box {
  background: var(--surface-2);
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.summary-row { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--ink-2); }
.summary-row.total { padding-top: 8px; border-top: 1px solid var(--rule); font-weight: 700; color: var(--ink); font-size: 14px; }
.qris-img {
  display: block;
  width: 220px;
  height: 220px;
  margin: 10px auto;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--rule);
  border-radius: var(--r);
  object-fit: contain;
}
.credentials-box {
  background: var(--side);
  color: var(--side-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 12px;
  border-radius: var(--r-sm);
  white-space: pre-wrap;
  word-break: break-all;
  border: 1px solid var(--rule-strong);
}

/* Footer */
footer {
  border-top: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink-3);
  font-size: 12.5px;
  padding: 24px;
}
.footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

/* Floating CS AI Widget (uses exact .cs-ai-window & .cs-ai-header from index.html!) */
.cs-ai-fab {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--side);
  color: var(--side-ink);
  border: 1px solid var(--rule-strong);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.22);
}
.cs-ai-window {
  position: fixed;
  right: 20px;
  bottom: 74px;
  z-index: 95;
  width: 350px;
  max-width: calc(100vw - 24px);
  height: 470px;
  max-height: calc(100vh - 100px);
  background: var(--side);
  color: var(--side-ink);
  border: 1px solid #2E3137;
  border-radius: 10px;
  display: none;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}
.cs-ai-window.open { display: flex; }
.cs-ai-header {
  padding: 12px 14px;
  border-bottom: 1px solid #2E3137;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cs-ai-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cs-ai-title { font-size: 13.5px; font-weight: 600; color: var(--side-ink); }
.cs-ai-subtitle { font-size: 11px; color: #6FC49A; display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.cs-ai-messages { flex: 1; padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.cs-msg { max-width: 86%; padding: 9px 12px; font-size: 12.5px; line-height: 1.5; word-break: break-word; }
.cs-msg-user { align-self: flex-end; background: var(--primary); color: #ffffff; border-radius: 10px 10px 2px 10px; }
.cs-msg-ai { align-self: flex-start; background: #1F2227; color: #E8E5DD; border: 1px solid #2E3137; border-radius: 10px 10px 10px 2px; }
.cs-chips-container { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.cs-chip { background: #23262A; border: 1px solid #353941; color: #C4C0B6; padding: 5px 10px; border-radius: 999px; font-size: 11px; cursor: pointer; }
.cs-chip:hover { color: #ffffff; border-color: var(--primary); }
.cs-ai-footer { padding: 10px 12px; background: #0C0D0F; border-top: 1px solid #2E3137; display: flex; align-items: center; gap: 8px; }
.cs-ai-input { flex: 1; background: #1A1C1F; border: 1px solid #2E3137; border-radius: 999px; padding: 8px 13px; color: #ECE9E2; font-size: 12.5px; outline: none; }
.cs-ai-send-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--primary); border: none; color: #fff; display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; }

/* Toast Notification Stack */
.toast-stack {
  position: fixed;
  top: 78px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast-item {
  pointer-events: auto;
  background: var(--side);
  color: var(--side-ink);
  border: 1px solid var(--rule-strong);
  border-left: 3px solid var(--primary);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 500;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
}

@media (max-width: 768px) {
  header { height: 58px; }
  .header-inner { padding: 0 14px; gap: 8px; }
  .brand-subtitle { display: none !important; }
  .brand-title { font-size: 20px; }
  .btn-track, .btn-wa { padding: 0 10px; font-size: 12px; height: 32px; }
  .theme-toggle-btn { width: 32px; height: 32px; }
  .hero { padding: 24px 14px 18px; }
  .filter-section { padding: 14px 14px 10px; }
  .catalog-wrap { padding: 6px 14px 64px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .product-card { padding: 11px; gap: 8px; }
  .card-thumb-wrap { height: 70px; }
}
