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

:root {
  --sidebar-bg: #0f172a;
  --sidebar-text: #94a3b8;
  --sidebar-active: #6366f1;
  --sidebar-width: 240px;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-light: #eef2ff;
  --success: #16a34a;
  --success-light: #dcfce7;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --info: #0ea5e9;
  --info-light: #e0f2fe;
  --bg: #f8fafc;
  --bg2: #f1f5f9;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --text2: #475569;
  --text3: #94a3b8;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.07), 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.08), 0 2px 4px -1px rgba(0,0,0,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --font: 'DM Sans', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --transition: 0.15s ease;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --bg2: #1e293b;
  --card: #1e293b;
  --border: #334155;
  --text: #f1f5f9;
  --text2: #94a3b8;
  --text3: #64748b;
  --accent-light: #1e1b4b;
  --success-light: #14532d;
  --warning-light: #78350f;
  --danger-light: #7f1d1d;
  --info-light: #0c4a6e;
  --shadow: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 20px -4px rgba(0,0,0,0.5);
}

/* ── BLACK THEME — Pure black, maximum contrast ─────────── */
[data-theme="black"] {
  --bg: #000000;
  --bg2: #0d0d0d;
  --card: #121212;
  --border: #2a2a2a;
  --text: #ffffff;
  --text2: #a3a3a3;
  --text3: #525252;
  --accent: #818cf8;
  --accent-hover: #6366f1;
  --accent-light: #1a1a2e;
  --success: #4ade80;
  --success-light: #052e16;
  --danger: #f87171;
  --danger-light: #2d0a0a;
  --warning: #fbbf24;
  --warning-light: #1c1200;
  --info: #60a5fa;
  --info-light: #0c1e3c;
  --shadow: 0 1px 3px rgba(0,0,0,0.6);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.7);
  --shadow-lg: 0 10px 20px -4px rgba(0,0,0,0.8);
}

/* ── FOREST THEME — Deep green, easy on the eyes ────────── */
/* Low-contrast warm greens — designed for long shifts       */
[data-theme="forest"] {
  --bg: #0d1f17;
  --bg2: #132b1f;
  --card: #1a3326;
  --border: #2a4d38;
  --text: #cfe8d8;
  --text2: #86b898;
  --text3: #4a7a5c;
  --accent: #4ade80;
  --accent-hover: #22c55e;
  --accent-light: #0d2b1a;
  --success: #4ade80;
  --success-light: #0d2b1a;
  --danger: #f87171;
  --danger-light: #2d0f0f;
  --warning: #fbbf24;
  --warning-light: #2d1a00;
  --info: #60a5fa;
  --info-light: #0a1a30;
  --shadow: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.5);
  --shadow-lg: 0 10px 20px -4px rgba(0,0,0,0.6);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background var(--transition), color var(--transition);
}

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

/* ── APP SHELL ── */
#app { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow: hidden;
}

.sidebar-logo {
  padding: 20px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-logo-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; color: white;
  flex-shrink: 0;
}

.sidebar-logo-text { color: white; font-size: 15px; font-weight: 600; }
.sidebar-logo-sub { color: var(--sidebar-text); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 14px;
  font-weight: 400;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  margin-bottom: 1px;
  white-space: nowrap;
  position: relative;
}

.nav-item:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-item.active {
  background: rgba(99,102,241,0.18);
  color: white;
  font-weight: 500;
  border-left: 3px solid var(--accent);
  padding-left: 9px;
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }
.nav-item.active svg, .nav-item:hover svg { opacity: 1; }

.nav-item.pos-link {
  background: rgba(99,102,241,0.1);
  color: #a5b4fc;
}
.nav-item.pos-link:hover { background: rgba(99,102,241,0.2); color: white; }

.nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 99px;
  min-width: 18px;
  text-align: center;
}

.sidebar-bottom {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition);
  min-width: 0;
}

.sidebar-user:hover { background: rgba(255,255,255,0.06); }

.avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; color: white;
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img { width: 100%; height: 100%; object-fit: cover; }

.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { color: white; font-size: 13px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-role { font-size: 11px; color: var(--sidebar-text); text-transform: capitalize; }

.sidebar-actions { display: flex; gap: 4px; margin-top: 8px; }

.sidebar-action-btn {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: none;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  padding: 7px;
  cursor: pointer;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center; gap: 4px;
  transition: all var(--transition);
  font-family: var(--font);
}

.sidebar-action-btn:hover { background: rgba(255,255,255,0.12); color: white; }

/* ── MAIN CONTENT ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── TOP HEADER ── */
.top-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 0 var(--border);
}

.page-title { font-size: 18px; font-weight: 600; color: var(--text); flex-shrink: 0; }

.header-search {
  flex: 1;
  max-width: 360px;
  position: relative;
}

.header-search input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 12px 7px 34px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
  transition: border-color var(--transition);
}

.header-search input:focus { outline: none; border-color: var(--accent); }
.header-search svg {
  position: absolute;
  left: 10px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  width: 16px; height: 16px;
  pointer-events: none;
}

.header-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.header-btn {
  background: none;
  border: none;
  width: 36px; height: 36px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text2);
  position: relative;
  transition: all var(--transition);
}

.header-btn:hover { background: var(--bg2); color: var(--text); }
.header-btn svg { width: 20px; height: 20px; }

.notif-dot {
  position: absolute;
  top: 6px; right: 6px;
  width: 8px; height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--card);
}

.lang-toggle {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  display: flex; align-items: center; gap: 5px;
  transition: all var(--transition);
  font-family: var(--font);
}

.lang-toggle:hover { border-color: var(--accent); }

/* ── PAGE CONTENT ── */
.page-content {
  padding: 24px;
  flex: 1;
  transition: opacity 0.08s ease, transform 0.08s ease;
}

/* ── CARDS ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

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

.card-title { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ── METRIC CARDS ── */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  transition: border-color var(--transition);
}

.metric-label { font-size: 13px; color: var(--text2); margin-bottom: 8px; }
.metric-value { font-size: 28px; font-weight: 700; color: var(--text); line-height: 1; }
.metric-sub { font-size: 12px; color: var(--text3); margin-top: 6px; }

.metric-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 12px;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  font-family: var(--font);
  text-decoration: none;
  white-space: nowrap;
  min-height: 36px;
}

.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #15803d; }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.btn-ghost { background: transparent; color: var(--text2); }
.btn-ghost:hover:not(:disabled) { background: var(--bg2); color: var(--text); }

.btn-sm { padding: 5px 10px; font-size: 12px; min-height: 28px; }
.btn-lg { padding: 12px 24px; font-size: 15px; min-height: 46px; }
.btn-xl { padding: 16px 32px; font-size: 18px; min-height: 56px; border-radius: var(--radius); }

.btn-loading::after {
  content: '';
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 4px;
}

/* ── FORMS ── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text2); margin-bottom: 6px; }

.form-input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 40px;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,0.1);
}

textarea.form-input { min-height: 80px; resize: vertical; }

.form-input.error { border-color: var(--danger); }
.form-input.error:focus { box-shadow: 0 0 0 3px rgba(220,38,38,0.1); }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' 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: 32px;
}

.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; display: none; }
.form-error.show { display: block; }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ── TOGGLE ── */
.toggle-wrap { display: flex; align-items: center; gap: 10px; }
.toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; cursor: pointer; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: var(--border);
  border-radius: 99px;
  cursor: pointer;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: white;
  top: 3px; left: 3px;
  transition: transform var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ── BADGES ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-gray { background: var(--bg2); color: var(--text2); }
.badge-accent { background: var(--accent-light); color: var(--accent); }

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

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-overlay.show { opacity: 1; }

.modal {
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  transform: scale(0.96) translateY(10px);
  transition: transform 0.2s cubic-bezier(0.34,1.56,0.64,1);
}

.modal-overlay.show .modal { transform: scale(1) translateY(0); }
.modal.modal-lg { max-width: 720px; }

.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
}

.modal-title { font-size: 17px; font-weight: 600; }

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text3);
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  flex-shrink: 0;
}

.modal-close:hover { background: var(--bg2); color: var(--text); }
.modal-body { padding: 24px; }

/* ── TOAST ── */
.toast-container {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  box-shadow: var(--shadow-md);
  min-width: 280px;
  max-width: 380px;
  animation: slideInRight 0.25s ease;
  pointer-events: auto;
}

.toast-success { border-left: 3px solid var(--success); }
.toast-error { border-left: 3px solid var(--danger); }
.toast-warning { border-left: 3px solid var(--warning); }
.toast-info { border-left: 3px solid var(--accent); }

.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast-success svg { color: var(--success); }
.toast-error svg { color: var(--danger); }
.toast-warning svg { color: var(--warning); }
.toast-info svg { color: var(--accent); }

/* ── PHOTO UPLOAD ── */
.photo-upload {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition);
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.photo-upload:hover { border-color: var(--accent); background: var(--accent-light); }

/* ── OFFLINE BANNER ── */
.offline-banner {
  background: var(--warning);
  color: white;
  text-align: center;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  z-index: 200;
}
.offline-banner.show { display: flex; }

/* ── LOGIN PAGE ── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
  padding: 20px;
  position: relative;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 70%, rgba(99,102,241,0.15) 0%, transparent 60%),
              radial-gradient(ellipse at 70% 20%, rgba(14,165,233,0.1) 0%, transparent 50%);
}

.login-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
  position: relative;
}

[data-theme="dark"] .login-card { background: #1e293b; }
[data-theme="black"] .login-card { background: #111111; border: 1px solid #222; }
[data-theme="forest"] .login-card { background: #1a3326; border: 1px solid #264d38; }

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

.login-logo-icon {
  width: 56px; height: 56px;
  background: var(--accent);
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700; color: white;
  margin: 0 auto 12px;
  box-shadow: 0 8px 24px rgba(99,102,241,0.4);
}

.login-logo h1 { font-size: 24px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 14px; color: var(--text2); margin-top: 4px; }

/* ── POS SCREEN ── */
/* ═══════════════════════════════════════════════════════════
   POS LAYOUT — Full-screen, zero-waste design
   Left: max product grid   Right: slim cart panel
════════════════════════════════════════════════════════════ */

.pos-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  height: calc(100vh - 60px);
  overflow: hidden;
  background: var(--bg);
}

/* ── LEFT: Product browser ─────────────────────────────── */
.pos-left {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border-right: 1px solid var(--border);
}

/* Top bar */
.pos-topbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pos-search-wrap {
  position: relative;
  flex: 1;
}
.pos-search-wrap svg {
  position: absolute;
  left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  width: 15px; height: 15px;
  pointer-events: none;
}
.pos-search-input {
  width: 100%;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  padding: 9px 36px 9px 34px;
  font-size: 14px;
  color: var(--text);
  font-family: var(--font);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pos-search-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.pos-search-kbd {
  position: absolute;
  right: 10px; top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  color: var(--text3);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  pointer-events: none;
  font-family: var(--font-mono);
}
.pos-topbar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.pos-action-btn {
  width: 36px; height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text2);
  transition: all 0.15s;
}
.pos-action-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.pos-hw-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 0 10px;
  height: 36px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  color: var(--text2);
  font-family: var(--font);
  transition: all 0.15s;
}
.pos-hw-btn:hover { border-color: var(--accent); color: var(--accent); }
.hw-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.hw-dot-ok  { background: var(--success); }
.hw-dot-warn{ background: var(--warning); }
.hw-dot-err { background: var(--danger); }

/* Category pills */
.pos-cats {
  display: flex;
  gap: 5px;
  padding: 8px 12px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.pos-cats::-webkit-scrollbar { display: none; }

.cat-tab {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid var(--border);
  background: var(--bg);
  color: var(--text2);
  white-space: nowrap;
  transition: all 0.15s;
  flex-shrink: 0;
  user-select: none;
}
.cat-tab:hover { border-color: var(--accent); color: var(--accent); }
.cat-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  font-weight: 600;
}
.cat-tab-count {
  font-size: 10px;
  background: rgba(255,255,255,0.25);
  padding: 1px 5px;
  border-radius: 99px;
  font-weight: 700;
}
.cat-tab:not(.active) .cat-tab-count {
  background: var(--bg2);
  color: var(--text3);
}

/* Product grid — as many cards as possible */
.product-grid {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
  align-content: start;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}
.product-grid::-webkit-scrollbar { width: 4px; }
.product-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Product card */
.product-card {
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  position: relative;
  user-select: none;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.12);
}
.product-card:active { transform: scale(0.97); box-shadow: none; }
.product-card.out-of-stock { opacity: 0.45; cursor: not-allowed; }
.product-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Left-side colored accent bar */
.product-card::before {
  content: '';
  position: absolute;
  left: 0; top: 20%; bottom: 20%;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--cat-color, var(--accent));
  opacity: 0;
  transition: opacity 0.15s;
}
.product-card:hover::before { opacity: 1; }

.product-img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  margin-bottom: 8px;
  background: var(--bg2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: white;
  overflow: hidden;
  flex-shrink: 0;
}
.product-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 5px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.3;
  flex: 1;
}
.product-price {
  font-size: 15px;
  font-weight: 800;
  color: var(--accent);
  letter-spacing: -0.3px;
}
.product-stock-badge {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 99px;
}

/* ── RIGHT: Cart panel ──────────────────────────────────── */
.cart-panel {
  display: flex;
  flex-direction: column;
  background: var(--card);
  overflow: hidden;
  border-left: 1px solid var(--border);
}

/* Multi-cart tabs */
.cart-tabs-bar {
  display: flex;
  align-items: flex-end;
  padding: 5px 8px 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  min-height: 34px;
  scrollbar-width: none;
  flex-shrink: 0;
}
.cart-tabs-bar::-webkit-scrollbar { display: none; }
.cart-tab {
  transition: background 0.15s, color 0.15s;
  user-select: none;
  flex-shrink: 0;
}
.cart-tab:hover { background: var(--card) !important; color: var(--text) !important; }
.cart-tab.active { box-shadow: 0 -2px 0 var(--accent) inset; }

/* Cart header */
.cart-header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--card);
}
.cart-title { font-size: 14px; font-weight: 700; letter-spacing: -0.2px; }
.cart-count {
  background: var(--accent);
  color: white;
  min-width: 20px; height: 20px;
  border-radius: 99px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  padding: 0 4px;
}
.cart-actions { display: flex; gap: 2px; align-items: center; }
.cart-icon-btn {
  display: flex; align-items: center; gap: 4px;
  padding: 5px 7px;
  border-radius: 7px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text3);
  font-family: var(--font);
  transition: all 0.15s;
  position: relative;
}
.cart-icon-btn:hover { background: var(--bg2); color: var(--text); }

/* Cart items area */
.cart-empty {
  flex: 1;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text3);
  padding: 30px 20px;
  gap: 8px;
  text-align: center;
}

.cart-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.cart-item:hover { background: var(--bg); }
.cart-item:last-child { border-bottom: none; }

.cart-item-img {
  width: 34px; height: 34px;
  border-radius: 7px;
  background: var(--bg2);
  flex-shrink: 0;
  overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: white;
}
.cart-item-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name {
  font-size: 12.5px; font-weight: 600; color: var(--text);
  line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cart-item-price { font-size: 11px; color: var(--text3); margin-top: 2px; }

.qty-controls { display: flex; align-items: center; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.qty-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: var(--text);
  transition: all 0.12s;
  line-height: 1; flex-shrink: 0;
}
.qty-btn:hover { background: var(--accent); border-color: var(--accent); color: white; }
.qty-num { font-size: 13px; font-weight: 800; min-width: 20px; text-align: center; }
.cart-item-total {
  font-size: 13px; font-weight: 800; color: var(--text);
  flex-shrink: 0; white-space: nowrap; padding-top: 2px;
}
.cart-item-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text3); padding: 3px;
  transition: color 0.12s; border-radius: 4px;
}
.cart-item-remove:hover { color: var(--danger); background: var(--danger-light); }

/* Cart totals */
.cart-totals {
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--card);
  flex-shrink: 0;
}

}

/* ── TOTAL ROWS ── */
.total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  padding: 3px 0;
  color: var(--text2);
}
.total-row.grand {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  padding-top: 6px;
  margin-top: 4px;
  border-top: 1.5px solid var(--border);
}
.total-row.discount { color: var(--danger); }

/* ── PAYMENT BUTTONS — big, prominent, easy to tap ── */
.payment-btns {
  display: grid;
  gap: 0;
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.pay-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 16px 8px;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  transition: all 0.15s;
  position: relative;
  letter-spacing: -0.2px;
}
.pay-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.pay-btn:not(:disabled):hover { filter: brightness(1.1); }
.pay-btn:not(:disabled):active { transform: scale(0.98); }
.pay-cash {
  background: var(--success);
  color: white;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.pay-card {
  background: var(--accent);
  color: white;
}

/* ── SUCCESS OVERLAY ── */
.success-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.success-card {
  background: var(--card);
  border-radius: 20px;
  padding: 28px 24px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 24px 80px rgba(0,0,0,0.4);
  animation: slideUp 0.25s cubic-bezier(0.34,1.56,0.64,1);
}
.success-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--success);
  color: white;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 14px;
}

/* ── HARDWARE STATUS ── */
.hw-status-modal {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.hw-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--bg2);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .pos-layout { grid-template-columns: 1fr 320px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
@media (max-width: 768px) {
  .pos-layout { grid-template-columns: 1fr; grid-template-rows: 1fr auto; height: auto; min-height: calc(100vh - 60px); }
  .cart-panel { max-height: 50vh; border-top: 2px solid var(--border); }
  .pos-left { height: 50vh; }
  .pay-btn { padding: 14px 8px; font-size: 13px; }
}

/* ── POS BACKGROUND IMAGE ── */
.pos-left {
  position: relative;
}
.pos-left .pos-topbar,
.pos-left .pos-cats {
  position: relative;
  z-index: 1;
}
[data-theme="dark"] .pos-left .pos-topbar,
[data-theme="dark"] .pos-left .pos-cats,
[data-theme="black"] .pos-left .pos-topbar,
[data-theme="black"] .pos-left .pos-cats,
[data-theme="forest"] .pos-left .pos-topbar,
[data-theme="forest"] .pos-left .pos-cats {
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(8px);
}

/* ═══════════════════════════════════════════════════════════════
   TABS — used in Settings, Reports, and other pages
   ═══════════════════════════════════════════════════════════════ */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  flex-wrap: nowrap;
}
.tabs::-webkit-scrollbar { display: none; }

.tab-btn {
  padding: 10px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  font-family: var(--font);
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  border-radius: 6px 6px 0 0;
}
.tab-btn:hover { color: var(--text); background: var(--bg2); }
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* Tab content — hidden by default, shown when active */
.tab-content {
  display: none;
}
.tab-content.active {
  display: block;
}

/* ═══════════════════════════════════════════════════════════════
   SKELETON LOADING ANIMATION
   ═══════════════════════════════════════════════════════════════ */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, var(--border) 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 6px;
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ═══════════════════════════════════════════════════════════════
   HARDWARE SETTINGS — mode buttons, status chips
   ═══════════════════════════════════════════════════════════════ */
.hw-mode-btn {
  padding: 12px 6px;
  border-radius: var(--radius);
  border: 2px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-family: var(--font);
  text-align: center;
  transition: all 0.15s;
}
.hw-mode-btn:hover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.hw-mode-btn.active,
.hw-mode-btn[style*="var(--accent)"] {
  border-color: var(--accent);
  background: var(--accent-light);
}

.hw-status-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
}

.drawer-pin-btn {
  flex: 1;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg);
  cursor: pointer;
  font-family: var(--font);
  font-weight: 600;
  transition: all 0.15s;
}
.drawer-pin-btn:hover,
.drawer-pin-btn.active {
  border-color: var(--accent);
  background: var(--accent-light);
  color: var(--accent);
}

/* ═══════════════════════════════════════════════════════════════
   THEME CARDS — in Preferences tab
   ═══════════════════════════════════════════════════════════════ */
.theme-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
  background: var(--bg);
}
.theme-card:hover { border-color: var(--accent); }
.theme-card.active {
  border-color: var(--accent);
  background: var(--accent-light);
}
.theme-card-icon {
  font-size: 24px;
  margin-bottom: 6px;
}
.theme-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
}
.theme-card.active .theme-card-label { color: var(--accent); }

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text3);
  gap: 12px;
}
.empty-state h3 { color: var(--text2); font-size: 16px; margin: 0; }
.empty-state p  { margin: 0; font-size: 14px; }

/* ═══════════════════════════════════════════════════════════════
   SETTINGS PAGE — layout improvements
   ═══════════════════════════════════════════════════════════════ */

/* Prevent settings cards from being too wide on large screens */
#tab-shop .card,
#tab-receipt .card,
#tab-prefs .card { max-width: 640px; }

#tab-staff,
#tab-at,
#tab-hardware,
#tab-offline { max-width: 720px; }

/* Staff list */
#staff-list .card { margin-bottom: 12px; }

/* Hardware status row */
#hw-status-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

/* Offline tab */
#tab-offline .card { margin-bottom: 16px; }

/* Responsive: stack form rows on mobile */
@media (max-width: 600px) {
  .form-row {
    flex-direction: column;
  }
  .tabs {
    gap: 2px;
  }
  .tab-btn {
    padding: 8px 10px;
    font-size: 12px;
  }
  #hw-status-row {
    flex-direction: column;
  }
}