@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;600;700;800&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&display=swap');

/* ═══════════════════════════════════════════════════════════════
   SUPASTOKU — Design Tokens
═══════════════════════════════════════════════════════════════ */
:root {
  --brand: #00C27B;
  --brand-dark: #009960;
  --brand-light: #E6FFF5;
  --brand-mid: rgba(0,194,123,.14);
  --brand-border: #99EDD0;

  --sidebar-bg: #0A0F1E;
  --sidebar-w: 258px;

  --bg: #EEF2EC;
  --surface: #FFFFFF;
  --surface-2: #F7FAF6;
  --border: #DFE8DA;

  --text: #0D1117;
  --text-2: #3A4E3E;
  --text-3: #899E8D;

  --amber: #F59E0B;
  --amber-bg: #FFFBEB;
  --red: #EF4444;
  --red-bg: #FEF2F2;
  --blue: #3B82F6;
  --blue-bg: #EFF6FF;

  --sh-1: 0 1px 3px rgba(0,40,20,.07), 0 1px 2px rgba(0,40,20,.04);
  --sh-2: 0 4px 16px rgba(0,40,20,.08), 0 2px 6px rgba(0,40,20,.04);
  --sh-3: 0 16px 48px rgba(0,40,20,.13);

  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --r-2xl: 34px;
  --r-full: 9999px;

  --topbar-h: 62px;
}

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

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14.5px;
  line-height: 1.55;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, select, textarea { font: inherit; }
img { display: block; max-width: 100%; }

/* ═══════════════════════════════════════════════════════════════
   LAYOUT SHELL
═══════════════════════════════════════════════════════════════ */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ─────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 0; }

.sb-brand {
  padding: 22px 22px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sb-logo {
  width: 38px; height: 38px;
  background: var(--brand);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 18px; font-weight: 800;
  color: white; flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(0,194,123,.4);
}
.sb-brand-name {
  font-family: 'Syne', sans-serif;
  font-size: 16px; font-weight: 700;
  color: white; letter-spacing: -.01em; line-height: 1.2;
}
.sb-brand-name span { color: var(--brand); }
.sb-brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,.3);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .07em;
  margin-top: 2px;
}

.sb-nav { padding: 14px 0; flex: 1; }

.sb-section {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: rgba(255,255,255,.2);
  padding: 14px 22px 6px;
}

.sb-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10.5px 22px;
  color: rgba(255,255,255,.52);
  font-size: 13.5px; font-weight: 500;
  transition: all .15s;
  position: relative;
}
.sb-link i { font-size: 17px; width: 20px; text-align: center; flex-shrink: 0; }
.sb-link:hover { color: rgba(255,255,255,.88); background: rgba(255,255,255,.04); }
.sb-link.active { color: var(--brand); background: rgba(0,194,123,.1); }
.sb-link.active::before {
  content: '';
  position: absolute; left: 0; top: 8px; bottom: 8px;
  width: 3px;
  background: var(--brand);
  border-radius: 0 3px 3px 0;
}

.sb-badge {
  margin-left: auto;
  background: var(--red);
  color: white; font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: var(--r-full);
  min-width: 18px; text-align: center;
  display: none;
}
.sb-badge.on { display: inline-block; }

.sb-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.06);
  flex-shrink: 0;
}
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.04);
}
.sb-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  color: white; flex-shrink: 0;
}
.sb-uname { font-size: 13px; font-weight: 600; color: white; line-height: 1.2; }
.sb-urole { font-size: 11px; color: rgba(255,255,255,.32); }
.sb-logout {
  color: rgba(255,255,255,.28);
  font-size: 16px;
  padding: 4px;
  border-radius: 5px;
  transition: all .15s;
  margin-left: auto;
}
.sb-logout:hover { color: var(--red); background: rgba(239,68,68,.1); }

/* ─── Main Wrapper ────────────────────────────────────────── */
.main-wrap {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .28s cubic-bezier(.4,0,.2,1);
}

/* ─── Topbar ──────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 22px; gap: 14px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--sh-1);
}
.topbar-toggle {
  display: none;
  color: var(--text-3);
  font-size: 20px;
  padding: 6px;
  border-radius: var(--r-xs);
  transition: all .15s;
}
.topbar-toggle:hover { background: var(--bg); color: var(--text); }

.topbar-heading {
  flex: 1;
  font-family: 'Syne', sans-serif;
  font-size: 17px; font-weight: 700;
  color: var(--text); letter-spacing: -.01em;
}
.topbar-heading small {
  font-family: 'DM Sans', sans-serif;
  display: block; font-size: 12px; font-weight: 400;
  color: var(--text-3); margin-top: 1px; letter-spacing: 0;
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.tb-btn {
  width: 36px; height: 36px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  position: relative;
  transition: all .15s;
}
.tb-btn:hover { background: var(--bg); color: var(--text); border-color: var(--text-3); }
.notif-dot {
  position: absolute; top: 6px; right: 6px;
  width: 7px; height: 7px;
  background: var(--red); border-radius: 50%;
  border: 1.5px solid var(--surface);
}

/* ─── Page Body ───────────────────────────────────────────── */
.page-body { flex: 1; padding: 24px; }

.page-hdr { margin-bottom: 22px; }
.page-hdr h1 {
  font-family: 'Syne', sans-serif;
  font-size: 21px; font-weight: 800;
  color: var(--text); line-height: 1.2; letter-spacing: -.02em;
}
.page-hdr p { font-size: 13.5px; color: var(--text-3); margin-top: 5px; }

/* ═══════════════════════════════════════════════════════════════
   STAT CARDS
═══════════════════════════════════════════════════════════════ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  padding: 18px 20px;
  box-shadow: var(--sh-1);
  display: flex; align-items: flex-start; gap: 14px;
  transition: transform .2s, box-shadow .2s;
  cursor: default;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--sh-2); }
.stat-ic {
  width: 46px; height: 46px;
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-ic.g { background: var(--brand-light); color: var(--brand-dark); }
.stat-ic.b { background: var(--blue-bg); color: #2563EB; }
.stat-ic.a { background: var(--amber-bg); color: var(--amber); }
.stat-ic.r { background: var(--red-bg); color: var(--red); }
.stat-ic.p { background: #F5F3FF; color: #7C3AED; }

.stat-val {
  font-family: 'Syne', sans-serif;
  font-size: 25px; font-weight: 800;
  line-height: 1; color: var(--text); letter-spacing: -.02em;
  margin-bottom: 3px;
}
.stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.stat-delta {
  font-size: 11.5px; margin-top: 7px;
  display: flex; align-items: center; gap: 3px;
  font-weight: 600;
}
.stat-delta.up { color: var(--brand); }
.stat-delta.dn { color: var(--red); }

/* ═══════════════════════════════════════════════════════════════
   CARDS
═══════════════════════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  box-shadow: var(--sh-1);
  overflow: hidden;
}
.card-hdr {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 14.5px; font-weight: 700;
  color: var(--text); letter-spacing: -.01em;
  display: flex; align-items: center; gap: 8px;
}
.card-title i { color: var(--brand); font-size: 16px; }
.card-body { padding: 20px; }

/* ═══════════════════════════════════════════════════════════════
   QUICK ACTIONS
═══════════════════════════════════════════════════════════════ */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}
.qa-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 12px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  transition: all .2s;
  color: var(--text);
}
.qa-btn:hover {
  border-color: var(--brand);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,194,123,.14);
  color: var(--brand-dark);
}
.qa-ic {
  width: 46px; height: 46px;
  background: var(--brand-light);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 21px;
  color: var(--brand);
  transition: all .2s;
}
.qa-btn:hover .qa-ic { background: var(--brand); color: white; }
.qa-label { font-size: 12px; font-weight: 600; line-height: 1.3; }

/* ═══════════════════════════════════════════════════════════════
   TABLES
═══════════════════════════════════════════════════════════════ */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl thead th {
  background: var(--surface-2);
  padding: 10px 16px;
  text-align: left;
  font-size: 10.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.tbl tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid #EEF3EC;
  vertical-align: middle;
  font-size: 14px;
}
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl-search-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.search-wrap { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-wrap .s-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 15px; pointer-events: none; }
.search-wrap input { padding-left: 34px; }

/* ═══════════════════════════════════════════════════════════════
   BADGES
═══════════════════════════════════════════════════════════════ */
.badge {
  display: inline-flex; align-items: center;
  padding: 3px 10px;
  border-radius: var(--r-full);
  font-size: 11.5px; font-weight: 600;
}
.badge-g { background: var(--brand-light); color: #065f46; }
.badge-a { background: var(--amber-bg); color: #92400e; }
.badge-r { background: var(--red-bg); color: #991b1b; }
.badge-b { background: var(--blue-bg); color: #1e40af; }
.badge-s { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--border); }

/* ═══════════════════════════════════════════════════════════════
   BUTTONS
═══════════════════════════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600;
  transition: all .15s;
  white-space: nowrap;
  border: none; cursor: pointer;
}
.btn-brand {
  background: var(--brand); color: white;
  box-shadow: 0 2px 8px rgba(0,194,123,.25);
}
.btn-brand:hover { background: var(--brand-dark); box-shadow: 0 4px 16px rgba(0,194,123,.35); transform: translateY(-1px); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { border-color: var(--text-3); background: var(--bg); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--bg); }
.btn-red { background: var(--red); color: white; }
.btn-red:hover { background: #dc2626; color: white; }
.btn-amber { background: var(--amber); color: white; }
.btn-amber:hover { background: #d97706; color: white; }
.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: var(--r-xs); }
.btn-lg { padding: 12px 24px; font-size: 15px; border-radius: var(--r-md); }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: var(--r-xs); }
.btn-icon.sm { width: 30px; height: 30px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════
   FORMS
═══════════════════════════════════════════════════════════════ */
.form-grp { margin-bottom: 16px; }
.form-label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
}
.form-ctrl {
  width: 100%; padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text); background: white;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-ctrl:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,194,123,.12); }
.form-ctrl::placeholder { color: var(--text-3); }
.form-ctrl.sm { padding: 7px 11px; font-size: 13px; }
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23899E8D' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center;
  padding-right: 36px; cursor: pointer;
}
.input-grp { position: relative; }
.input-ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 15px; pointer-events: none; }
.input-ic-r { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 15px; cursor: pointer; }
.input-grp .form-ctrl { padding-left: 36px; }
.input-grp .has-r { padding-right: 36px; }

/* ═══════════════════════════════════════════════════════════════
   AI CHAT INTERFACE
═══════════════════════════════════════════════════════════════ */
.chat-shell {
  display: flex; flex-direction: column;
  height: calc(100vh - var(--topbar-h) - 48px);
  max-height: 820px;
}
.chat-msgs {
  flex: 1; overflow-y: auto;
  padding: 20px 16px;
  display: flex; flex-direction: column; gap: 16px;
  scroll-behavior: smooth;
}
.chat-msgs::-webkit-scrollbar { width: 4px; }
.chat-msgs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.msg-wrap { display: flex; align-items: flex-end; gap: 8px; }
.msg-wrap.ai { align-self: flex-start; max-width: 84%; }
.msg-wrap.u  { align-self: flex-end;   max-width: 84%; flex-direction: row-reverse; }

.msg-av {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0; font-weight: 700;
}
.msg-av.ai { background: var(--brand-light); color: var(--brand); }
.msg-av.u  { background: #E2E8F0; color: var(--text-3); }

.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14.5px; line-height: 1.5;
}
.msg-wrap.u  .msg-bubble { background: var(--brand); color: white; border-bottom-right-radius: 4px; }
.msg-wrap.ai .msg-bubble {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-bottom-left-radius: 4px;
  box-shadow: var(--sh-1);
}
.msg-time { font-size: 10.5px; color: var(--text-3); margin-top: 4px; }
.msg-wrap.u .msg-time { text-align: right; }

/* Confirmation card */
.confirm-card {
  background: var(--surface);
  border: 1.5px solid var(--brand-border);
  border-radius: var(--r-md);
  padding: 14px;
  margin-top: 10px;
  box-shadow: 0 4px 16px rgba(0,194,123,.08);
}
.confirm-title {
  font-size: 11.5px; font-weight: 700;
  color: var(--brand-dark);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 10px;
  text-transform: uppercase; letter-spacing: .05em;
}
.confirm-row {
  display: flex; align-items: baseline;
  padding: 5px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13.5px;
}
.confirm-row:last-of-type { border-bottom: none; }
.confirm-k { color: var(--text-3); min-width: 120px; }
.confirm-v { font-weight: 600; color: var(--text); flex: 1; }
.confirm-actions { display: flex; gap: 8px; margin-top: 12px; }

/* Typing dots */
.typing-dots {
  display: flex; gap: 4px;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px; border-bottom-left-radius: 3px;
  box-shadow: var(--sh-1);
  width: fit-content;
}
.typing-dots span {
  width: 7px; height: 7px;
  background: var(--text-3); border-radius: 50%;
  animation: dot-pulse 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .18s; }
.typing-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes dot-pulse {
  0%, 60%, 100% { transform: translateY(0); opacity: .6; }
  30% { transform: translateY(-6px); opacity: 1; }
}

/* Chat input */
.chat-input-zone {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 16px;
}
.chat-input-box {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  padding: 8px 8px 8px 14px;
  transition: border-color .15s;
}
.chat-input-box:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0,194,123,.09); }
.chat-ta {
  flex: 1; border: none; background: transparent;
  resize: none; outline: none;
  font-size: 14.5px; color: var(--text);
  max-height: 100px; min-height: 22px;
  line-height: 1.45;
}
.chat-ta::placeholder { color: var(--text-3); }
.chat-btns { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.chat-ic-btn {
  width: 34px; height: 34px;
  border-radius: 50%;
  color: var(--text-3);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  transition: all .15s;
}
.chat-ic-btn:hover { background: var(--border); color: var(--text); }
.chat-ic-btn.send { background: var(--brand); color: white; }
.chat-ic-btn.send:hover { background: var(--brand-dark); transform: scale(1.06); }
.chat-ic-btn.rec { background: var(--red); color: white; animation: pulse-rec 1.5s infinite; }
@keyframes pulse-rec {
  0% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  70% { box-shadow: 0 0 0 7px rgba(239,68,68,0); }
  100% { box-shadow: 0 0 0 0 rgba(239,68,68,0); }
}
.chat-hint { font-size: 11.5px; color: var(--text-3); margin-top: 8px; text-align: center; }
.chat-hint strong { color: var(--brand); }

/* ═══════════════════════════════════════════════════════════════
   BARCODE SCANNER
═══════════════════════════════════════════════════════════════ */
.scanner-wrap {
  background: #000;
  border-radius: var(--r-lg);
  overflow: hidden;
  position: relative;
  max-width: 480px; margin: 0 auto;
  aspect-ratio: 4/3;
}
#reader { width: 100% !important; border: none !important; }
#reader video { width: 100% !important; height: 100% !important; object-fit: cover; }
#reader img { display: none; }
#reader #qr-shaded-region { display: none; }

.scan-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; z-index: 2;
}
.scan-frame {
  width: 68%; aspect-ratio: 16/9;
  position: relative;
  box-shadow: 0 0 0 9999px rgba(0,0,0,.52);
  border-radius: 10px;
}
.scan-corner {
  position: absolute; width: 18px; height: 18px;
  border-color: var(--brand); border-style: solid; border-width: 0;
}
.scan-corner.tl { top: -1px; left: -1px; border-top-width: 3px; border-left-width: 3px; border-radius: 4px 0 0 0; }
.scan-corner.tr { top: -1px; right: -1px; border-top-width: 3px; border-right-width: 3px; border-radius: 0 4px 0 0; }
.scan-corner.bl { bottom: -1px; left: -1px; border-bottom-width: 3px; border-left-width: 3px; border-radius: 0 0 0 4px; }
.scan-corner.br { bottom: -1px; right: -1px; border-bottom-width: 3px; border-right-width: 3px; border-radius: 0 0 4px 0; }
.scan-line {
  position: absolute; left: 5%; right: 5%;
  height: 2px;
  background: linear-gradient(90deg, transparent 0%, var(--brand) 50%, transparent 100%);
  border-radius: 1px;
  animation: scan-anim 2s ease-in-out infinite;
  box-shadow: 0 0 8px rgba(0,194,123,.7);
}
@keyframes scan-anim { 0%, 100% { top: 10%; } 50% { top: 88%; } }
.scan-status {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.72);
  color: white; padding: 5px 14px;
  border-radius: var(--r-full);
  font-size: 12.5px; font-weight: 500;
  white-space: nowrap; z-index: 3;
  backdrop-filter: blur(8px);
}

.product-result {
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--sh-3);
  animation: slide-up .32s ease;
  margin-top: 18px;
}
@keyframes slide-up { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

.pr-banner {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
  padding: 16px 20px;
  display: flex; align-items: center; gap: 12px;
}
.pr-icon {
  width: 42px; height: 42px;
  background: rgba(255,255,255,.2);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white;
}
.pr-name { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: white; }
.pr-code { font-size: 12px; color: rgba(255,255,255,.65); margin-top: 2px; font-family: monospace; }

.pr-body { padding: 18px 20px; }
.pr-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.pr-item { background: var(--surface-2); border-radius: var(--r-sm); padding: 10px 12px; }
.pr-item-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); margin-bottom: 3px; }
.pr-item-val { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 700; color: var(--text); }
.pr-item-val.warn { color: var(--amber); }
.pr-item-val.crit { color: var(--red); }

.stock-bar-wrap { margin-bottom: 16px; }
.stock-bar-lbl { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 12px; color: var(--text-3); font-weight: 600; }
.stock-bar { background: var(--bg); height: 7px; border-radius: 4px; overflow: hidden; }
.stock-bar-fill { height: 100%; border-radius: 4px; transition: width .6s ease; }
.stock-bar-fill.ok   { background: var(--brand); }
.stock-bar-fill.warn { background: var(--amber); }
.stock-bar-fill.crit { background: var(--red); }

/* ═══════════════════════════════════════════════════════════════
   ALERTS
═══════════════════════════════════════════════════════════════ */
.alert-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--r-md);
  border: 1px solid;
  margin-bottom: 8px;
}
.alert-item.warn { background: var(--amber-bg); border-color: #FDE68A; }
.alert-item.crit { background: var(--red-bg);   border-color: #FECACA; }
.alert-item-ic { font-size: 18px; flex-shrink: 0; }
.alert-item.warn .alert-item-ic { color: var(--amber); }
.alert-item.crit .alert-item-ic { color: var(--red); }
.alert-item-name { font-size: 14px; font-weight: 600; color: var(--text); }
.alert-item-stock { font-size: 12px; color: var(--text-3); }
.alert-item-btn { margin-left: auto; flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════════════
   REPORTS / CHARTS
═══════════════════════════════════════════════════════════════ */
.chart-box { position: relative; height: 260px; }
.filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 20px;
}
.filter-group { display: flex; gap: 4px; }
.filter-btn {
  padding: 6px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600;
  color: var(--text-2);
  transition: all .15s;
  background: var(--surface);
}
.filter-btn.active, .filter-btn:hover {
  background: var(--brand); color: white; border-color: var(--brand);
}

/* ═══════════════════════════════════════════════════════════════
   PRODUCTS
═══════════════════════════════════════════════════════════════ */
.product-thumb {
  width: 42px; height: 42px;
  border-radius: var(--r-sm);
  background: var(--brand-light);
  color: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
   PURCHASES
═══════════════════════════════════════════════════════════════ */
.item-row {
  display: grid;
  grid-template-columns: 1fr 80px 100px 34px;
  gap: 8px; align-items: center;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  margin-bottom: 6px;
  animation: fade-up .2s ease;
}
.purchase-total {
  background: linear-gradient(135deg, var(--brand-dark) 0%, var(--brand) 100%);
  border-radius: var(--r-lg);
  padding: 20px;
  color: white;
  text-align: center;
  margin-top: 16px;
}
.purchase-total-label { font-size: 11px; opacity: .7; text-transform: uppercase; letter-spacing: .07em; margin-bottom: 4px; }
.purchase-total-val { font-family: 'Syne', sans-serif; font-size: 30px; font-weight: 800; }

/* ═══════════════════════════════════════════════════════════════
   LOGIN PAGE
═══════════════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: grid; place-items: center;
  padding: 20px;
  position: relative; overflow: hidden;
}
.login-bg {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 20% 20%, rgba(0,194,123,.09) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 80% 80%, rgba(0,194,123,.07) 0%, transparent 60%);
}
.login-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 44px 44px;
  pointer-events: none;
}
.login-card {
  background: white;
  border-radius: var(--r-2xl);
  width: 100%; max-width: 420px;
  padding: 44px 40px;
  box-shadow: var(--sh-3), 0 0 80px rgba(0,194,123,.07);
  position: relative; z-index: 1;
  animation: fade-up .45s ease;
}
.login-logo-wrap { text-align: center; margin-bottom: 28px; }
.login-logo {
  width: 62px; height: 62px;
  background: var(--brand);
  border-radius: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 26px; font-weight: 800; color: white;
  box-shadow: 0 6px 22px rgba(0,194,123,.42);
  margin-bottom: 14px;
}
.login-title {
  font-family: 'Syne', sans-serif;
  font-size: 25px; font-weight: 800;
  color: var(--text); letter-spacing: -.02em;
}
.login-sub { font-size: 14px; color: var(--text-3); margin-top: 5px; }
.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0;
  color: var(--text-3); font-size: 12px;
}
.login-divider::before, .login-divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-footer { text-align: center; margin-top: 18px; font-size: 12.5px; color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════
   TOASTS
═══════════════════════════════════════════════════════════════ */
#toast-zone {
  position: fixed; top: 20px; right: 20px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast-item {
  background: var(--surface);
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  box-shadow: var(--sh-3);
  padding: 12px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 270px; max-width: 340px;
  pointer-events: auto;
  animation: toast-in .3s ease;
}
.toast-item.success { border-left: 4px solid var(--brand); }
.toast-item.error   { border-left: 4px solid var(--red); }
.toast-item.warning { border-left: 4px solid var(--amber); }
.toast-item.info    { border-left: 4px solid var(--blue); }
.toast-ic { font-size: 17px; flex-shrink: 0; margin-top: 1px; }
.toast-item.success .toast-ic { color: var(--brand); }
.toast-item.error   .toast-ic { color: var(--red); }
.toast-item.warning .toast-ic { color: var(--amber); }
.toast-item.info    .toast-ic { color: var(--blue); }
.toast-msg { font-size: 13.5px; color: var(--text); flex: 1; line-height: 1.4; }
.toast-close { color: var(--text-3); font-size: 15px; }
.toast-close:hover { color: var(--text); }
@keyframes toast-in  { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-out { animation: toast-out .25s ease forwards; }
@keyframes toast-out { to { transform: translateX(110%); opacity: 0; } }

/* ═══════════════════════════════════════════════════════════════
   LOADING / EMPTY / SKELETON
═══════════════════════════════════════════════════════════════ */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .65s linear infinite;
  display: inline-block; flex-shrink: 0;
}
.spinner.lg { width: 32px; height: 32px; border-width: 3px; }
@keyframes spin { to { transform: rotate(360deg); } }

.skel {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: skel-anim .9s infinite;
  border-radius: var(--r-xs);
}
@keyframes skel-anim { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty-box { text-align: center; padding: 48px 24px; }
.empty-ic { font-size: 44px; color: var(--border); margin-bottom: 12px; }
.empty-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--text-3); margin-bottom: 7px; }
.empty-sub { font-size: 13.5px; color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR OVERLAY
═══════════════════════════════════════════════════════════════ */
.sb-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
  backdrop-filter: blur(2px);
}
.sb-overlay.on { display: block; }

/* ═══════════════════════════════════════════════════════════════
   BOOTSTRAP MODAL OVERRIDES
═══════════════════════════════════════════════════════════════ */
.modal-content { border-radius: var(--r-xl); border: 1px solid var(--border); box-shadow: var(--sh-3); }
.modal-header { background: var(--surface-2); border-bottom: 1px solid var(--border); border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 16px 22px; }
.modal-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; color: var(--text); }
.modal-footer { border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); gap: 8px; }
.modal-body { padding: 20px 22px; }

/* ═══════════════════════════════════════════════════════════════
   UTILITY
═══════════════════════════════════════════════════════════════ */
.fade-up { animation: fade-up .3s ease; }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.flex       { display: flex; }
.fc         { align-items: center; }
.jb         { justify-content: space-between; }
.gap-6      { gap: 6px; }
.gap-8      { gap: 8px; }
.gap-12     { gap: 12px; }
.gap-16     { gap: 16px; }
.mb-4       { margin-bottom: 4px; }
.mb-8       { margin-bottom: 8px; }
.mb-12      { margin-bottom: 12px; }
.mb-16      { margin-bottom: 16px; }
.mb-20      { margin-bottom: 20px; }
.mb-24      { margin-bottom: 24px; }
.mt-8       { margin-top: 8px; }
.mt-12      { margin-top: 12px; }
.mt-16      { margin-top: 16px; }
.font-syne  { font-family: 'Syne', sans-serif; }
.text-brand { color: var(--brand); }
.text-red   { color: var(--red); }
.text-amber { color: var(--amber); }
.text-muted { color: var(--text-3); }
.text-sm    { font-size: 12.5px; }
.text-xs    { font-size: 11px; }
.fw-500     { font-weight: 500; }
.fw-600     { font-weight: 600; }
.fw-700     { font-weight: 700; }
.fw-800     { font-weight: 800; }
.w-full     { width: 100%; }
.divider    { height: 1px; background: var(--border); margin: 16px 0; }
.mono       { font-family: monospace; }

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrap { margin-left: 0; }
  .topbar-toggle { display: flex; }
  .page-body { padding: 16px; }
  .stats-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-val { font-size: 22px; }
  .qa-grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .chat-shell { height: calc(100vh - var(--topbar-h) - 32px); }
  .msg-wrap { max-width: 92%; }
  .scanner-wrap { max-width: 100%; border-radius: var(--r-md); }
  .pr-grid { grid-template-columns: 1fr 1fr; }
  .login-card { padding: 32px 24px; border-radius: var(--r-xl); }
  .g2 { grid-template-columns: 1fr; }
  .item-row { grid-template-columns: 1fr 70px 90px 30px; }
  .topbar-heading small { display: none; }
}
@media (max-width: 480px) {
  .stats-row { gap: 8px; }
  .qa-grid { grid-template-columns: repeat(2, 1fr); }
  .pr-grid { grid-template-columns: 1fr; }
  .tbl-search-row { flex-direction: column; align-items: stretch; }
}

/* Spin utility (for icon buttons during loading) */
.spin { animation: spin .65s linear infinite !important; display: inline-block; }

/* Scrollbars */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
