/* ═══════════════════════════════════════════════════════════════
   MARKET SYSTEM — Monochrome Pro Design System
   ═══════════════════════════════════════════════════════════════ */

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

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

/* ── Variables ──────────────────────────────────────────────── */
:root {
  /* Palette */
  --c0:   #000000;   /* deepest background */
  --c1:   #0A0A0A;   /* card / surface */
  --c2:   #111111;   /* elevated surface */
  --c3:   #191919;   /* hover */
  --c4:   #242424;   /* border */
  --c5:   #333333;   /* stronger border / dividers */
  --c6:   #555555;   /* muted elements */
  --c7:   #888888;   /* secondary text */
  --c8:   #BBBBBB;   /* secondary text - bright */
  --text: #FFFFFF;   /* primary text */

  /* Semantic */
  --green:  #22C55E;
  --yellow: #F59E0B;
  --red:    #EF4444;
  --blue:   #3B82F6;

  /* Dimensions */
  --sidebar-w: 232px;
  --topbar-h:  60px;
  --btn-h:     48px;
  --btn-h-lg:  56px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Transitions */
  --t-fast: 0.12s ease;
  --t-med:  0.2s ease;
  --t-slow: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Base ───────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--c0);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  animation: page-in 0.2s var(--t-slow);
}

input, textarea, select { user-select: auto; }

a { text-decoration: none; color: inherit; }

/* ── Page entrance animation ────────────────────────────────── */
@keyframes page-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Skeleton loader ────────────────────────────────────────── */
.skeleton {
  background: linear-gradient(90deg, var(--c2) 25%, var(--c3) 50%, var(--c2) 75%);
  background-size: 400% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: 4px;
  display: inline-block;
}

@keyframes shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: -100% 50%; }
}

/* ── Spinner ────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,0.2);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Layout ─────────────────────────────────────────────────── */
.layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--c1);
  border-right: 1px solid var(--c4);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--c4);
}

.logo-mark {
  width: 34px;
  height: 34px;
  background: var(--text);
  color: var(--c0);
  font-weight: 900;
  font-size: 15px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: -0.5px;
}

.logo-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.logo-sub {
  font-size: 11px;
  color: var(--c7);
  margin-top: 1px;
}

.sidebar-nav {
  flex: 1;
  padding: 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 42px;
  padding: 0 12px;
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--c7);
  font-size: 13.5px;
  font-weight: 500;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}

.nav-item svg { flex-shrink: 0; }

.nav-item:hover {
  background: var(--c3);
  color: var(--text);
}

.nav-item.active {
  background: var(--text);
  color: var(--c0);
}

.nav-item.active svg { stroke: var(--c0); }

.sidebar-bottom {
  padding: 10px;
  border-top: 1px solid var(--c4);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius);
  margin-bottom: 2px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--c4);
  color: var(--text);
  font-weight: 700;
  font-size: 13px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-name  { font-size: 13px; font-weight: 600; }
.user-role  { font-size: 11px; color: var(--c7); text-transform: capitalize; }

.nav-logout { color: var(--c6); }
.nav-logout:hover { color: var(--red); background: rgba(239,68,68,0.08); }

/* ── Main area ──────────────────────────────────────────────── */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--c1);
  border-bottom: 1px solid var(--c4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
}

.topbar h1 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Hidden on desktop; shown by media query on mobile */
.topbar-hamburger { display: none; }
.sidebar-overlay  { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 490; }

/* ── Notification bell ──────────────────────────────────────── */
#notifWrap {
  position: relative;
}

.notif-btn {
  width: 40px;
  height: 40px;
  background: var(--c2);
  border: 1px solid var(--c4);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--c7);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background var(--t-fast), color var(--t-fast);
}

.notif-btn:hover { background: var(--c3); color: var(--text); }

#notifBadge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 18px;
  height: 18px;
  background: var(--red);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  animation: pop 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

@keyframes pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

.notif-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  background: var(--c2);
  border: 1px solid var(--c4);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 40px rgba(0,0,0,0.6);
  overflow: hidden;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity var(--t-med), transform var(--t-med);
  z-index: 200;
}

.notif-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.notif-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--c4);
  font-size: 13px;
  font-weight: 600;
}

.notif-panel-header button {
  font-size: 11px;
  color: var(--c7);
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background var(--t-fast);
}

.notif-panel-header button:hover { background: var(--c3); color: var(--text); }

.notif-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--c4);
  cursor: pointer;
  transition: background var(--t-fast);
}

.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--c3); }
.notif-item.read { opacity: 0.5; }

.notif-dot {
  width: 7px;
  height: 7px;
  background: var(--blue);
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.notif-msg  { font-size: 12.5px; font-weight: 500; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--c7); margin-top: 3px; }
.notif-empty { padding: 24px; text-align: center; color: var(--c7); font-size: 13px; }

/* ── Content area ───────────────────────────────────────────── */
.content {
  flex: 1;
  overflow-y: auto;
  padding: 22px 24px;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: var(--btn-h);
  padding: 0 18px;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.1px;
  transition: opacity var(--t-fast), background var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
  white-space: nowrap;
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

/* Primary: white fill */
.btn-primary {
  background: var(--text);
  color: var(--c0);
}
.btn-primary:hover:not(:disabled) {
  background: #E0E0E0;
}

/* Ghost: outline only */
.btn-ghost {
  background: transparent;
  color: var(--c8);
  border: 1px solid var(--c4);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--c3);
  color: var(--text);
  border-color: var(--c5);
}

/* Danger */
.btn-danger {
  background: rgba(239,68,68,0.1);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.2);
}
.btn-danger:hover:not(:disabled) {
  background: rgba(239,68,68,0.2);
}

/* Success */
.btn-success {
  background: var(--green);
  color: #000;
}
.btn-success:hover:not(:disabled) {
  background: #1AAF51;
}

/* Warning */
.btn-warning {
  background: rgba(245,158,11,0.1);
  color: var(--yellow);
  border: 1px solid rgba(245,158,11,0.2);
}
.btn-warning:hover:not(:disabled) {
  background: rgba(245,158,11,0.2);
}

/* Dark */
.btn-dark {
  background: var(--c2);
  color: var(--text);
  border: 1px solid var(--c4);
}
.btn-dark:hover:not(:disabled) { background: var(--c3); }

/* Sizes */
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 6px; }
.btn-lg { height: var(--btn-h-lg); padding: 0 24px; font-size: 15px; border-radius: var(--radius-lg); }

.btn-icon {
  width: var(--btn-h);
  height: var(--btn-h);
  padding: 0;
}

.btn-icon.btn-sm { width: 34px; height: 34px; }

/* ── Inputs & Forms ─────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

label {
  font-size: 11.5px;
  color: var(--c7);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input, select, textarea {
  background: var(--c2);
  border: 1px solid var(--c4);
  border-radius: var(--radius);
  color: var(--text);
  padding: 0 14px;
  height: var(--btn-h);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
  width: 100%;
}

textarea {
  height: auto;
  padding: 12px 14px;
  resize: vertical;
  min-height: 80px;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--c6);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}

input::placeholder { color: var(--c6); }
select option      { background: var(--c2); }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--c1);
  border: 1px solid var(--c4);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.card-header h3 {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

/* ── Table ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }

th {
  text-align: left;
  padding: 10px 16px;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--c7);
  border-bottom: 1px solid var(--c4);
  white-space: nowrap;
  background: var(--c1);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--c4);
  font-size: 13.5px;
  vertical-align: middle;
}

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

tbody tr {
  transition: background var(--t-fast);
}
tbody tr:hover { background: rgba(255,255,255,0.025); }

/* Mono numbers */
.mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
}

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.badge-pending   { background: rgba(245,158,11,0.12); color: var(--yellow); }
.badge-completed { background: rgba(34,197,94,0.12);  color: var(--green); }
.badge-cancelled { background: rgba(239,68,68,0.12);  color: var(--red); }
.badge-sale      { background: rgba(255,255,255,0.08); color: var(--c8); border: 1px solid var(--c4); }
.badge-purchase  { background: rgba(59,130,246,0.12); color: var(--blue); }
.badge-admin     { background: rgba(239,68,68,0.12);  color: var(--red); }
.badge-manager   { background: rgba(245,158,11,0.12); color: var(--yellow); }
.badge-cashier   { background: rgba(255,255,255,0.06); color: var(--c7); border: 1px solid var(--c4); }
.badge-active    { background: rgba(34,197,94,0.12);  color: var(--green); }
.badge-inactive  { background: rgba(255,255,255,0.04); color: var(--c6); border: 1px solid var(--c4); }
.badge-offer     { background: rgba(34,197,94,0.12);  color: var(--green); font-size: 10px; padding: 2px 8px; }
.badge-low       { background: rgba(245,158,11,0.12); color: var(--yellow); }
.badge-out       { background: rgba(239,68,68,0.12);  color: var(--red); }

/* ── Stat cards ─────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--c1);
  border: 1px solid var(--c4);
  border-radius: var(--radius-lg);
  padding: 22px 22px 18px;
  transition: border-color var(--t-fast);
}

.stat-card:hover { border-color: var(--c5); }

.stat-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--c7);
  text-transform: uppercase;
  letter-spacing: 0.7px;
  margin-bottom: 10px;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -1px;
  font-family: 'JetBrains Mono', monospace;
}

.stat-sub {
  font-size: 11.5px;
  color: var(--c7);
  margin-top: 4px;
}

/* ── Modal ──────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 400;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: overlay-in 0.15s ease;
}

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-overlay.hidden { display: none; }

.modal {
  background: var(--c1);
  border: 1px solid var(--c4);
  border-radius: var(--radius-xl);
  width: 580px;
  max-width: 95vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 32px 64px rgba(0,0,0,0.6);
  animation: modal-in 0.2s cubic-bezier(0.34,1.2,0.64,1);
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(12px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--c4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 24px;
  border-top: 1px solid var(--c4);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Toolbar ─────────────────────────────────────────────────── */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  align-items: center;
}

.toolbar input, .toolbar select {
  width: auto;
  flex: 1;
  min-width: 160px;
}

/* ── Alerts ──────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 13.5px;
  margin-bottom: 14px;
  animation: slide-down 0.2s ease;
}

@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.alert-danger  { background: rgba(239,68,68,0.08); border: 1px solid rgba(239,68,68,0.2); color: var(--red); }
.alert-success { background: rgba(34,197,94,0.08); border: 1px solid rgba(34,197,94,0.2); color: var(--green); }
.alert-warning { background: rgba(245,158,11,0.08); border: 1px solid rgba(245,158,11,0.2); color: var(--yellow); }

/* ── Empty state ─────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  color: var(--c6);
  gap: 12px;
}

.empty-icon { font-size: 40px; opacity: 0.4; }
.empty-state p { font-size: 14px; }

/* ── Row actions ─────────────────────────────────────────────── */
.row-actions { display: flex; gap: 6px; align-items: center; }

/* ── Grid helpers ────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }

/* ══════════════════════════════════════════════════════════════
   LOGIN PAGE
   ══════════════════════════════════════════════════════════════ */
.login-page {
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c0);
  background-image: radial-gradient(ellipse at 60% 50%, rgba(255,255,255,0.02) 0%, transparent 70%);
}

.login-box {
  width: 400px;
  background: var(--c1);
  border: 1px solid var(--c4);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: 0 24px 48px rgba(0,0,0,0.5);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo .logo-mark {
  width: 48px;
  height: 48px;
  font-size: 20px;
  margin: 0 auto 14px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.login-logo p {
  font-size: 13px;
  color: var(--c7);
  margin-top: 4px;
}

/* ═══════════════════════════════════��══════════════════════════
   POS LAYOUT
   ══════════════════════════════════════════════���═══════════════ */
.pos-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Left panel: scan + product grid — fixed width, cart gets remaining space */
.pos-left {
  flex: 0 0 380px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--c4);
}

.pos-topbar {
  height: var(--topbar-h);
  background: var(--c1);
  border-bottom: 1px solid var(--c4);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  flex-shrink: 0;
  gap: 12px;
}

.pos-logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pos-logo .logo-mark { width: 28px; height: 28px; font-size: 12px; }
.pos-logo span { font-size: 14px; font-weight: 700; }

/* Scanner bar */
.scanner-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  background: var(--c0);
  border-bottom: 1px solid var(--c4);
  flex-shrink: 0;
}

.scanner-bar input {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  height: 46px;
  background: var(--c2);
}

.scanner-bar input:focus {
  border-color: var(--text);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.06);
}

/* Product grid */
.product-grid {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
  align-content: start;
}

.product-tile {
  background: var(--c1);
  border: 1px solid var(--c4);
  border-radius: var(--radius-lg);
  padding: 12px 10px 10px;
  transition: background var(--t-fast), border-color var(--t-fast);
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: relative;
}

.product-tile:hover { background: var(--c2); border-color: var(--c5); }

.product-tile .p-name {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-tile .p-cat {
  font-size: 10.5px;
  color: var(--c7);
}

.product-tile .p-price {
  font-size: 16px;
  font-weight: 800;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.5px;
}

.product-tile .offer-ribbon {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--green);
  color: #000;
  font-size: 9px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.tile-img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 4px;
  display: block;
}

/* Right panel: cart — takes all remaining space */
.pos-right {
  flex: 1;
  min-width: 340px;
  display: flex;
  flex-direction: column;
  background: var(--c0);
}

.cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--c4);
  flex-shrink: 0;
}

.cart-header h2 {
  font-size: 15px;
  font-weight: 700;
}

.cart-items {
  flex: 1;
  overflow-y: auto;
}

.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--c6);
  gap: 8px;
}

.cart-empty svg { opacity: 0.2; }
.cart-empty p { font-size: 13px; }

.cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--c4);
  animation: item-in 0.15s ease;
}

@keyframes item-in {
  from { opacity: 0; transform: translateX(10px); }
  to   { opacity: 1; transform: translateX(0); }
}

.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-meta {
  font-size: 11.5px;
  color: var(--c7);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
}

.cart-item-meta .offer-tag {
  color: var(--green);
  font-weight: 700;
}

.price-edit {
  width: 60px;
  height: 20px;
  text-align: right;
  font-size: 11.5px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  background: var(--c2);
  border: 1px solid var(--c4);
  border-radius: 4px;
  color: var(--text);
  padding: 0 3px;
  -moz-appearance: textfield;
}
.price-edit::-webkit-inner-spin-button,
.price-edit::-webkit-outer-spin-button { -webkit-appearance: none; }
.price-edit:focus { border-color: var(--c6); outline: none; background: var(--c3); }

.qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.qty-btn {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--c4);
  background: var(--c2);
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast);
  line-height: 1;
}

.qty-btn:active { background: var(--c4); }

/* qty-val is now an <input> in the cart */
.qty-val {
  width: 48px;
  height: 28px;
  text-align: center;
  font-size: 14px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: var(--c2);
  border: 1px solid var(--c4);
  border-radius: 6px;
  color: var(--text);
  padding: 0;
  -moz-appearance: textfield;
}
.qty-val::-webkit-inner-spin-button,
.qty-val::-webkit-outer-spin-button { -webkit-appearance: none; }
.qty-val:focus { border-color: var(--c6); outline: none; }

/* ── Tile qty controls ──────────────────────────────────────── */
.tile-controls {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--c4);
}

.tile-qty-inp {
  width: 40px;
  height: 30px;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  background: var(--c2);
  border: 1px solid var(--c4);
  border-radius: 6px;
  color: var(--text);
  padding: 0;
  flex-shrink: 0;
  -moz-appearance: textfield;
}
.tile-qty-inp::-webkit-inner-spin-button,
.tile-qty-inp::-webkit-outer-spin-button { -webkit-appearance: none; }

.tile-add-btn {
  flex: 1;
  height: 30px;
  background: var(--text);
  color: var(--c0);
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
}
.tile-add-btn:hover   { background: #E0E0E0; }
.tile-add-btn:active  { transform: scale(0.96); }

.tile-pack-note {
  font-size: 10px;
  color: var(--green);
  font-weight: 600;
  white-space: nowrap;
}

.cart-item-total {
  font-size: 13px;
  font-weight: 700;
  width: 72px;
  text-align: right;
  font-family: 'JetBrains Mono', monospace;
  flex-shrink: 0;
}

.cart-remove {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--c6);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--t-fast), color var(--t-fast);
  flex-shrink: 0;
}

.cart-remove:hover { background: rgba(239,68,68,0.1); color: var(--red); }

/* Cart footer */
.cart-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--c4);
  flex-shrink: 0;
}

.cart-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}

.cart-row.total {
  font-size: 20px;
  font-weight: 800;
  padding: 10px 0 12px;
  border-top: 1px solid var(--c4);
  margin-top: 6px;
  font-family: 'JetBrains Mono', monospace;
  letter-spacing: -0.5px;
}

.cart-row .label { color: var(--c7); }

.cart-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

/* ── Numpad ──────────────────────────────────────────────────── */
.numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 14px;
}

.numpad-btn {
  height: 56px;
  background: var(--c2);
  border: 1px solid var(--c4);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
  cursor: pointer;
  transition: background var(--t-fast), transform var(--t-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.numpad-btn:active { background: var(--c4); transform: scale(0.96); }
.numpad-btn.wide   { grid-column: span 2; font-size: 14px; }
.numpad-btn.white  { background: var(--text); color: var(--c0); border-color: var(--text); }
.numpad-btn.white:active { background: #DDD; }

/* ── Payment method selector ───────────────────────────────── */
.pay-methods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}
.pay-opt {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 2px solid var(--c4);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
  text-align: center;
}
.pay-opt.active { border-color: var(--text); background: var(--c2); }
.pay-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid var(--c5);
  transition: border-color var(--t-fast), background var(--t-fast);
  flex-shrink: 0;
}
.pay-opt.active .pay-circle {
  border-color: var(--text);
  background: var(--text);
  box-shadow: inset 0 0 0 4px var(--c0);
}
.pay-label { font-size: 11px; font-weight: 600; }

/* ── Delivery toggle ───────────────────────────────────────── */
.delivery-opts { display: flex; gap: 12px; margin-top: 8px; }
.delivery-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 2px solid var(--c4);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color var(--t-fast), background var(--t-fast);
  font-size: 13px;
  font-weight: 600;
}
.delivery-opt.active { border-color: var(--text); background: var(--c2); }
.deli-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--c5);
  flex-shrink: 0;
  transition: border-color var(--t-fast), background var(--t-fast);
}
.delivery-opt.active .deli-circle {
  border-color: var(--text);
  background: var(--text);
  box-shadow: inset 0 0 0 4px var(--c0);
}

/* ══════════════════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--c4); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--c5); }

/* ══════════════════════════════════════════════════════════════
   UTILITIES
   ══════════════════════════════════════════════════════════════ */
.hidden          { display: none !important; }
.text-right      { text-align: right; }
.text-center     { text-align: center; }
.text-muted      { color: var(--c7); }
.text-success    { color: var(--green); }
.text-danger     { color: var(--red); }
.text-warning    { color: var(--yellow); }
.fw-bold         { font-weight: 700; }
.flex            { display: flex; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8           { gap: 8px; }
.gap-12          { gap: 12px; }
.mt-8            { margin-top: 8px; }
.mt-14           { margin-top: 14px; }
.mb-14           { margin-bottom: 14px; }
.mb-20           { margin-bottom: 20px; }
.w-full          { width: 100%; }

/* ══════════════════════════════════════════════════════════════
   MOBILE RESPONSIVE  (≤ 768px)
   ══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* ── Sidebar: slide in from left as overlay ─────────────── */
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100%;
    z-index: 500;
    transform: translateX(-100%);
    transition: transform var(--t-slow);
    width: 240px;
  }

  .sidebar.open { transform: translateX(0); }

  /* Dim overlay when sidebar is open */
  .sidebar-overlay.open { display: block; }

  .main { width: 100%; }

  /* ── Topbar: add hamburger ──────────────────────────────── */
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar h1 { font-size: 15px; }

  .topbar-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: var(--c2);
    border: 1px solid var(--c4);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--c7);
    flex-shrink: 0;
  }

  /* ── Content area ───────────────────────────────────────── */
  .content { padding: 14px; }

  /* ── Stat cards: 2 columns ──────────────────────────────── */
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card  { padding: 14px 14px 12px; }
  .stat-value { font-size: 22px; }

  /* ── Cards ──────────────────────────────────────────────── */
  .card { padding: 14px; }

  /* ── Grid helpers collapse ──────────────────────────────── */
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }

  /* ── Modal: full screen on mobile ──────────────────────── */
  .modal {
    width: 100% !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    margin: 0;
  }

  .modal-overlay {
    align-items: flex-end;
  }

  /* ── Tables: allow horizontal scroll ───────────────────── */
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* ── Toolbar: wrap nicely ───────────────────────────────── */
  .toolbar { gap: 6px; }
  .toolbar input { min-width: 0; }

  /* ── POS: stack vertically ──────────────────────────────── */
  .pos-layout { flex-direction: column; }

  .pos-left {
    flex: none;
    height: 50vh;
    border-right: none;
    border-bottom: 1px solid var(--c4);
  }

  .pos-right {
    flex: 1;
    min-width: 0;
    min-height: 50vh;
  }

  /* ── Revenue chart row: stack ───────────────────────────── */
  #chartRow { grid-template-columns: 1fr !important; }
  #payCard   { min-width: 0 !important; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar-right .btn-primary { display: none; } /* hide Open POS btn on very small screens */
  .pay-methods { grid-template-columns: repeat(2, 1fr); }
}


/* ══════════════════════════════════════════════════════════════
   RTL (Arabic) overrides
   ══════════════════════════════════════════════════════════════ */

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

[dir="rtl"] {
  font-family: 'Cairo', 'Segoe UI', 'Arial', sans-serif;
  text-align: right;
}

/* Keep sidebar on the LEFT in RTL (cancel flex reversal so layout mirrors LTR) */
[dir="rtl"] .layout  { flex-direction: row-reverse; }
[dir="rtl"] .sidebar { border-right: 1px solid var(--c4); border-left: none; }
[dir="rtl"] .main    { border-right: none; }

/* Topbar: keep same order as LTR (title left, buttons right) */
[dir="rtl"] .topbar { flex-direction: row-reverse; }

/* Tables */
[dir="rtl"] th,
[dir="rtl"] td { text-align: right; }

/* Form inputs */
[dir="rtl"] input,
[dir="rtl"] textarea,
[dir="rtl"] select { text-align: right; }

/* Mono / number columns keep LTR */
[dir="rtl"] .mono { direction: ltr; unicode-bidi: isolate; }

/* Nav items */
[dir="rtl"] .nav-item { flex-direction: row-reverse; text-align: right; }
[dir="rtl"] .nav-item svg { margin-left: 0; margin-right: 0; }

/* User chip */
[dir="rtl"] .user-chip { flex-direction: row-reverse; }

/* Sidebar logo */
[dir="rtl"] .sidebar-logo { flex-direction: row-reverse; }

/* Badges inline */
[dir="rtl"] .badge { margin-left: 0; margin-right: 4px; }

/* Notification panel */
[dir="rtl"] .notif-item { flex-direction: row-reverse; text-align: right; }

/* Modal */
[dir="rtl"] .modal-header { flex-direction: row-reverse; }

/* Buttons with icons */
[dir="rtl"] .btn svg { margin-left: 0; margin-right: 0; }

/* Stat cards */
[dir="rtl"] .stat-label,
[dir="rtl"] .stat-value { text-align: right; }

/* POS layout */
[dir="rtl"] .pos-left,
[dir="rtl"] .pos-right { text-align: right; }

/* Search / toolbar */
[dir="rtl"] .toolbar { flex-direction: row-reverse; flex-wrap: wrap; }

/* Pagination */
[dir="rtl"] .pagination { flex-direction: row-reverse; }

/* Fix icon-only buttons (don't reverse those) */
[dir="rtl"] .btn-icon { flex-direction: row; }

/* ── Permission toggles ─────────────────────────────────────── */
.perm-grid { display: grid; grid-template-columns: 1fr auto auto; gap: 0; }
.perm-row { display: contents; }
.perm-row > * { padding: 8px 12px; border-bottom: 1px solid var(--c3); display: flex; align-items: center; }
.perm-resource-name { font-size: 13px; color: var(--text); }
.perm-check { justify-content: center; }
.perm-toggle { width: 38px; height: 22px; background: var(--c4); border-radius: 11px; position: relative; cursor: pointer; border: none; transition: background var(--t-fast); flex-shrink: 0; }
.perm-toggle.on { background: var(--green); }
.perm-toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; background: white; border-radius: 50%; transition: transform var(--t-fast); }
.perm-toggle.on::after { transform: translateX(16px); }
.perm-toggle:disabled { opacity: 0.4; cursor: not-allowed; }
.perm-section-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--c6); padding: 12px 12px 4px; grid-column: 1 / -1; }

