@import url('https://fonts.googleapis.com/css2?family=Fahkwang:wght@300;400;500;600&family=Montserrat:wght@300;400;500;600;700&display=swap');

/* ─── TOKENS ───────────────────────────────────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-base:      #faf8f6;
  --bg-surface:   #fffcfa;
  --bg-muted:     #f3eeeb;
  --bg-overlay:   rgba(250,248,246,0.92);

  /* Brand */
  --rose:         rgb(215,186,189);
  --rose-light:   rgb(235,215,218);
  --rose-dark:    rgb(185,152,157);
  --rose-bg:      rgba(215,186,189,0.12);
  --rose-ring:    rgba(215,186,189,0.5);

  /* Text */
  --text-primary:   #1a1520;
  --text-secondary: #8a7f87;
  --text-muted:     #b8adb5;
  --text-on-rose:   #5a3e42;

  /* Borders */
  --border:         rgba(180,160,155,0.2);
  --border-strong:  rgba(180,160,155,0.4);

  /* Status */
  --green:        #b8ddc8;
  --green-text:   #2d6b4a;
  --green-bg:     #eef7f2;
  --amber:        #f0d9a8;
  --amber-text:   #7a5c1e;
  --amber-bg:     #fdf6e8;
  --red:          #f0b8b8;
  --red-text:     #7a2d2d;
  --red-bg:       #fdf0f0;

  /* Shadows */
  --shadow-xs:    0 1px 3px rgba(80,50,45,0.06);
  --shadow-sm:    0 2px 8px rgba(80,50,45,0.08), 0 1px 2px rgba(80,50,45,0.04);
  --shadow-md:    0 4px 16px rgba(80,50,45,0.10), 0 2px 4px rgba(80,50,45,0.06);
  --shadow-lg:    0 8px 32px rgba(80,50,45,0.12), 0 4px 8px rgba(80,50,45,0.06);

  /* Spacing */
  --radius-sm:    6px;
  --radius-md:    10px;
  --radius-lg:    16px;
  --radius-xl:    24px;
  --radius-pill:  999px;

  /* Typography */
  --font-brand:   'Fahkwang', serif;
  --font-ui:      'Montserrat', sans-serif;

  /* Transitions */
  --t-fast:       120ms ease;
  --t-base:       200ms ease;
  --t-slow:       350ms ease;
}

/* ─── RESET ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-ui); border: none; background: none; }
input, select, textarea { font-family: var(--font-ui); }
ul { list-style: none; }
img { display: block; max-width: 100%; }

/* ─── TYPOGRAPHY ─────────────────────────────────────────────────────────────── */
.wordmark {
  font-family: var(--font-brand);
  font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--text-primary);
}
.label-xs  { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; }
.label-sm  { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; }
.label-md  { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

/* ─── BUTTONS ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  font-size: 13px; font-weight: 600; letter-spacing: 0.03em;
  border-radius: var(--radius-md);
  transition: all var(--t-base);
  white-space: nowrap;
}
.btn-primary {
  background: var(--text-primary);
  color: #fffcfa;
}
.btn-primary:hover { background: #2d2535; box-shadow: var(--shadow-sm); }
.btn-rose {
  background: var(--rose);
  color: var(--text-on-rose);
}
.btn-rose:hover { background: var(--rose-dark); color: #fff; box-shadow: var(--shadow-sm); }
.btn-outline {
  border: 1.5px solid var(--border-strong);
  color: var(--text-secondary);
  background: var(--bg-surface);
}
.btn-outline:hover { border-color: var(--rose-dark); color: var(--text-primary); background: var(--rose-bg); }
.btn-ghost {
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-muted); color: var(--text-primary); }
.btn-danger {
  background: var(--red-bg);
  color: var(--red-text);
  border: 1.5px solid var(--red);
}
.btn-danger:hover { background: var(--red); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-lg { padding: 13px 28px; font-size: 15px; border-radius: var(--radius-lg); }
.btn-icon { padding: 8px; border-radius: var(--radius-md); }
.btn-full { width: 100%; justify-content: center; }

/* ─── INPUTS ─────────────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--text-secondary); letter-spacing: 0.04em; text-transform: uppercase; }
.input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-primary);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  outline: none;
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  border-color: var(--rose-dark);
  box-shadow: 0 0 0 3px var(--rose-ring);
}
.input-search {
  padding-left: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a7f87' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a7f87' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

/* ─── CARD ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card-body { padding: 20px 24px; }
.card-header { padding: 20px 24px 0; border-bottom: 1px solid var(--border); padding-bottom: 16px; }
.card-footer { padding: 16px 24px 20px; border-top: 1px solid var(--border); }

/* ─── BADGE ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
}
.badge-green  { background: var(--green-bg);  color: var(--green-text); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber-text); }
.badge-red    { background: var(--red-bg);    color: var(--red-text); }
.badge-rose   { background: var(--rose-bg);   color: var(--text-on-rose); }
.badge-muted  { background: var(--bg-muted);  color: var(--text-secondary); }

/* ─── TABLE ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead th {
  padding: 10px 16px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  text-align: left; white-space: nowrap;
}
tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background var(--t-fast);
}
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--rose-bg); }
tbody td { padding: 12px 16px; font-size: 13px; color: var(--text-primary); }

/* ─── STAT CARD ─────────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(215,186,189,0.08) 0%, transparent 60%);
  pointer-events: none;
}
.stat-card .stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 8px; }
.stat-card .stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); line-height: 1.1; }
.stat-card .stat-sub { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.stat-card .stat-icon { position: absolute; top: 20px; right: 20px; opacity: 0.18; font-size: 36px; }

/* ─── TOAST ─────────────────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 28px; right: 28px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 9999; pointer-events: none;
}
.toast {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 14px 18px;
  background: var(--text-primary);
  color: #fffcfa;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-size: 13px; font-weight: 500;
  min-width: 260px; max-width: 360px;
  pointer-events: all;
  animation: toast-in var(--t-slow) cubic-bezier(.34,1.56,.64,1) both;
}
.toast.toast-success { border-left: 3px solid var(--green); }
.toast.toast-error   { border-left: 3px solid var(--red-dark, #e57373); }
.toast.toast-warning { border-left: 3px solid var(--amber); }
.toast.removing { animation: toast-out 250ms ease forwards; }
@keyframes toast-in  { from { transform: translateX(120%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { from { transform: none; opacity: 1; } to { transform: translateX(120%); opacity: 0; } }

/* ─── SHIMMER ─────────────────────────────────────────────────────────────────── */
.shimmer {
  background: linear-gradient(90deg, var(--bg-muted) 25%, var(--bg-surface) 50%, var(--bg-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ─── PILL TABS ─────────────────────────────────────────────────────────────── */
.pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.pill-tab {
  padding: 7px 16px;
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; letter-spacing: 0.03em;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: 1.5px solid transparent;
  transition: all var(--t-fast);
  cursor: pointer;
}
.pill-tab:hover { color: var(--text-primary); background: var(--rose-light); border-color: var(--rose); }
.pill-tab.active {
  background: var(--rose); color: var(--text-on-rose);
  border-color: var(--rose-dark);
  box-shadow: var(--shadow-xs);
}

/* ─── UNDERLINE TABS ────────────────────────────────────────────────────────── */
.tab-bar {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
}
.tab-item {
  padding: 12px 20px;
  font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
}
.tab-item:hover { color: var(--text-primary); }
.tab-item.active { color: var(--text-primary); border-bottom-color: var(--rose-dark); }

/* ─── SIDEBAR ─────────────────────────────────────────────────────────────────── */
.sidebar {
  width: 220px; min-height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  transition: width var(--t-slow);
  position: relative; flex-shrink: 0;
}
.sidebar.collapsed { width: 64px; }
.sidebar-logo {
  padding: 24px 20px 20px;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid var(--border);
}
.sidebar-logo .wordmark { font-size: 14px; white-space: nowrap; overflow: hidden; transition: opacity var(--t-slow); }
.sidebar.collapsed .sidebar-logo .wordmark { opacity: 0; width: 0; }
.sidebar-nav { padding: 12px 8px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  font-size: 13px; font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap; overflow: hidden;
  position: relative;
}
.nav-item:hover { background: var(--bg-muted); color: var(--text-primary); }
.nav-item.active { background: var(--rose-bg); color: var(--text-on-rose); }
.nav-item.active .nav-icon { color: var(--rose-dark); }
.nav-icon { flex-shrink: 0; width: 18px; height: 18px; }
.nav-label { transition: opacity var(--t-slow); }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; }
.sidebar-collapse-btn {
  position: absolute; top: 24px; right: -12px;
  width: 24px; height: 24px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: all var(--t-fast);
  z-index: 10;
}
.sidebar-collapse-btn:hover { background: var(--rose-bg); border-color: var(--rose-dark); }
.sidebar-footer { padding: 12px 8px 20px; border-top: 1px solid var(--border); }

/* ─── CATEGORY FILTER ────────────────────────────────────────────────────────── */
.category-filter { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; }
.category-filter::-webkit-scrollbar { height: 0; }
.cat-btn {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-muted);
  border: 1.5px solid transparent;
  cursor: pointer; transition: all var(--t-fast);
}
.cat-btn:hover { color: var(--text-primary); border-color: var(--border-strong); }
.cat-btn.active { background: var(--rose); color: var(--text-on-rose); border-color: var(--rose-dark); }

/* ─── PRODUCT CARD ────────────────────────────────────────────────────────────── */
.product-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  cursor: pointer;
  transition: all var(--t-base);
}
.product-card:hover { box-shadow: var(--shadow-md); border-color: var(--rose); transform: translateY(-1px); }
.product-card:active { transform: translateY(0); }
.product-thumb {
  width: 100%; aspect-ratio: 1;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-muted); letter-spacing: 0.04em; text-align: center; font-family: monospace;
  overflow: hidden;
}
.product-name { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.product-price { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.product-stock { font-size: 11px; color: var(--text-muted); }

/* ─── CART ITEM ───────────────────────────────────────────────────────────────── */
.cart-item {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.cart-item:last-child { border-bottom: none; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { font-size: 12px; color: var(--text-secondary); }
.qty-control { display: flex; align-items: center; gap: 6px; }
.qty-btn {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--bg-muted);
  color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; line-height: 1;
  transition: all var(--t-fast);
}
.qty-btn:hover { background: var(--rose-light); color: var(--text-on-rose); }
.qty-value { font-size: 13px; font-weight: 600; min-width: 20px; text-align: center; }

/* ─── ACCESS CODE ─────────────────────────────────────────────────────────────── */
.access-code-display {
  font-family: 'Courier New', Courier, monospace;
  font-size: 22px; font-weight: 700;
  letter-spacing: 0.3em;
  background: var(--bg-muted);
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  text-align: center;
  color: var(--text-primary);
  user-select: all;
}

/* ─── RECEIPT ─────────────────────────────────────────────────────────────────── */
.receipt {
  font-family: 'Courier New', monospace;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px 24px;
  max-width: 320px;
  margin: 0 auto;
  border-top: 4px solid var(--text-primary);
}
.receipt-header { text-align: center; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px dashed var(--border-strong); }
.receipt-row { display: flex; justify-content: space-between; font-size: 12px; padding: 3px 0; }
.receipt-total { font-size: 14px; font-weight: 700; border-top: 1px dashed var(--border-strong); padding-top: 8px; margin-top: 6px; }
.receipt-footer { text-align: center; margin-top: 16px; padding-top: 16px; border-top: 1px dashed var(--border-strong); font-size: 11px; color: var(--text-secondary); }

/* ─── UTILITIES ──────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-secondary); }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* ─── SCROLLBAR ──────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--rose-dark); }
