/* ============================================================
   KrenX StoreOS - Design System
   ============================================================ */

:root {
  /* Brand palette */
  --primary:        #1a56db;
  --primary-dark:   #1340a8;
  --primary-light:  #ebf0ff;
  --accent:         #f97316;
  --accent-light:   #fff7ed;
  --success:        #059669;
  --success-light:  #ecfdf5;
  --warning:        #d97706;
  --warning-light:  #fffbeb;
  --danger:         #dc2626;
  --danger-light:   #fef2f2;
  --info:           #0891b2;
  --info-light:     #ecfeff;

  /* Neutrals */
  --gray-50:   #f9fafb;
  --gray-100:  #f3f4f6;
  --gray-200:  #e5e7eb;
  --gray-300:  #d1d5db;
  --gray-400:  #9ca3af;
  --gray-500:  #6b7280;
  --gray-600:  #4b5563;
  --gray-700:  #374151;
  --gray-800:  #1f2937;
  --gray-900:  #111827;

  /* Layout */
  --sidebar-w:  250px;
  --topbar-h:   60px;
  --radius:     10px;
  --radius-sm:  6px;
  --radius-lg:  16px;

  /* Theme tokens (light) */
  --bg:         #f0f2f7;
  --surface:    #ffffff;
  --surface-2:  #f9fafb;
  --border:     #e5e7eb;
  --text:       #111827;
  --text-2:     #4b5563;
  --text-3:     #9ca3af;
  --sidebar-bg: #111827;
  --sidebar-text: rgba(255,255,255,0.75);
  --sidebar-active: rgba(255,255,255,0.12);
  --topbar-bg:  #ffffff;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.08);
  --shadow:     0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg:  0 12px 32px rgba(0,0,0,0.14);

  /* Transitions */
  --trans:      all 0.18s ease;
}

[data-theme="dark"] {
  --bg:         #0f1117;
  --surface:    #1a1d2e;
  --surface-2:  #232640;
  --border:     #2d3250;
  --text:       #f0f2f7;
  --text-2:     #9ca3af;
  --text-3:     #6b7280;
  --sidebar-bg: #0c0e1a;
  --topbar-bg:  #1a1d2e;
}

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

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  left: 0; top: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--trans);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: 70px;
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--primary);
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 16px;
  flex-shrink: 0;
}

.brand-logo {
  width: 36px; height: 36px;
  border-radius: 9px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text { flex: 1; min-width: 0; }
.brand-name { display: block; font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-plan { display: block; font-size: 10px; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .5px; }

.sidebar-toggle-btn {
  background: none; border: none; color: rgba(255,255,255,.5);
  cursor: pointer; font-size: 14px; display: none;
}

.sidebar-nav { flex: 1; padding: 10px 0; }

.nav-section-label {
  padding: 14px 16px 4px;
  font-size: 9.5px;
  font-weight: 600;
  color: rgba(255,255,255,.3);
  text-transform: uppercase;
  letter-spacing: .8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: 0;
  transition: var(--trans);
  position: relative;
  font-size: 13px;
  font-weight: 450;
}

.nav-item:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.nav-item.active {
  background: rgba(26, 86, 219, 0.35);
  color: #fff;
  font-weight: 500;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--primary);
  border-radius: 0 3px 3px 0;
}

.nav-item i { width: 18px; text-align: center; font-size: 13px; flex-shrink: 0; opacity: .8; }
.nav-item span { flex: 1; }
.nav-badge {
  background: var(--accent);
  color: #fff;
  font-size: 9px;
  padding: 1px 6px;
  border-radius: 20px;
  font-weight: 600;
}

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: 10px;
}

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

.user-name { font-size: 12px; font-weight: 600; color: #fff; }
.user-role { font-size: 10px; color: rgba(255,255,255,.45); text-transform: capitalize; }
.user-info { flex: 1; display: flex; align-items: center; gap: 8px; }

.btn-logout {
  color: rgba(255,255,255,.4);
  text-decoration: none;
  font-size: 14px;
  padding: 4px;
  transition: var(--trans);
}
.btn-logout:hover { color: var(--danger); }

/* ============================================================
   TOPBAR
   ============================================================ */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: var(--trans);
}

.topbar {
  height: var(--topbar-h);
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 50;
  gap: 12px;
}

.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 8px; }

.sidebar-hamburger {
  background: none; border: none; font-size: 18px; color: var(--text);
  cursor: pointer; display: none; padding: 4px;
}

.breadcrumb { font-size: 13px; color: var(--text-2); }
.breadcrumb a { color: var(--text-2); text-decoration: none; }
.breadcrumb a:hover { color: var(--primary); }

.search-global {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--gray-100);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  transition: var(--trans);
  min-width: 260px;
}

[data-theme="dark"] .search-global {
  background: var(--surface-2);
}

.search-global i { color: var(--text-3); font-size: 13px; }
.search-global input {
  border: none; background: none; outline: none;
  font-size: 13px; color: var(--text); flex: 1;
  font-family: inherit;
}
.search-global kbd {
  background: var(--gray-200);
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  color: var(--text-3);
  font-family: 'JetBrains Mono', monospace;
}

.topbar-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  cursor: pointer;
  transition: var(--trans);
  position: relative;
}

.topbar-btn:hover { background: var(--surface-2); color: var(--text); }
.topbar-notification { position: relative; }
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--danger);
  color: #fff;
  font-size: 9px;
  width: 16px; height: 16px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.btn-pos-quick {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  transition: var(--trans);
}
.btn-pos-quick:hover { background: var(--primary-dark); }

/* ============================================================
   PAGE CONTENT
   ============================================================ */
.page-content {
  flex: 1;
  padding: 20px;
  overflow-x: hidden;
}

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

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

.card-title {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body { padding: 20px; }
.card-body.p-0 { padding: 0; }

/* ============================================================
   STAT CARDS
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  transition: var(--trans);
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat-content {}
.stat-label { font-size: 12px; color: var(--text-3); margin-bottom: 6px; font-weight: 500; }
.stat-value { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1; }
.stat-sub { font-size: 11.5px; margin-top: 4px; }
.stat-sub.up { color: var(--success); }
.stat-sub.down { color: var(--danger); }

.stat-icon {
  width: 42px; height: 42px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data-table th {
  background: var(--gray-50);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--text-2);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .4px;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] table.data-table th {
  background: var(--surface-2);
}

table.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

table.data-table tr:last-child td { border-bottom: none; }
table.data-table tr:hover td { background: var(--surface-2); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.form-label .req { color: var(--danger); }

.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: var(--trans);
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 219, 0.12);
}

.form-control::placeholder { color: var(--text-3); }

select.form-control { cursor: pointer; }

textarea.form-control { min-height: 90px; resize: vertical; }

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

.form-hint { font-size: 11px; color: var(--text-3); margin-top: 4px; }

.input-group {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: var(--trans);
}
.input-group:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,86,219,.12); }
.input-group-prefix, .input-group-suffix {
  background: var(--gray-100);
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-2);
  font-weight: 500;
  white-space: nowrap;
}
.input-group .form-control { border: none; box-shadow: none; border-radius: 0; }
.input-group .form-control:focus { box-shadow: none; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: var(--trans);
  text-decoration: none;
  white-space: nowrap;
  font-family: inherit;
  line-height: 1;
}

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }
.btn-sm.btn-icon { width: 28px; height: 28px; padding: 4px; }

.btn-primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }
.btn-success:hover { filter: brightness(0.9); }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { filter: brightness(0.9); }
.btn-warning { background: var(--warning); color: #fff; border-color: var(--warning); }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-outline-primary { background: transparent; color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary-light); }

.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============================================================
   BADGES / TAGS
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger  { background: var(--danger-light);  color: var(--danger);  }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-info    { background: var(--info-light);    color: var(--info);    }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-gray    { background: var(--gray-100);      color: var(--gray-600);}
.badge-accent  { background: var(--accent-light);  color: var(--accent);  }

/* ============================================================
   ALERTS
   ============================================================ */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  font-size: 13px;
}

.alert button { background: none; border: none; cursor: pointer; margin-left: auto; opacity: .6; }
.alert-success { background: var(--success-light); color: var(--success); border: 1px solid #a7f3d0; }
.alert-danger  { background: var(--danger-light);  color: var(--danger);  border: 1px solid #fecaca; }
.alert-warning { background: var(--warning-light); color: var(--warning); border: 1px solid #fde68a; }
.alert-info    { background: var(--info-light);    color: var(--info);    border: 1px solid #a5f3fc; }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(3px);
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn .2s ease;
}

.modal-lg { max-width: 860px; }
.modal-xl { max-width: 1100px; }
.modal-sm { max-width: 400px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

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

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

.modal-close {
  background: none; border: none; font-size: 16px;
  color: var(--text-2); cursor: pointer;
  width: 28px; height: 28px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  transition: var(--trans);
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* ============================================================
   TABS
   ============================================================ */
.tab-nav {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}

.tab-btn {
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--trans);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
  color: var(--text-2);
}

.pagination-btns { display: flex; gap: 4px; }
.pagination-btns button {
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-2);
  transition: var(--trans);
}
.pagination-btns button.active, .pagination-btns button:hover {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.pagination-btns button:disabled { opacity: .4; cursor: not-allowed; }

/* ============================================================
   FILTERS BAR
   ============================================================ */
.filters-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  flex-wrap: wrap;
}

.filter-search {
  position: relative;
  flex: 1;
  min-width: 200px;
}
.filter-search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-3); font-size: 13px; }
.filter-search input { padding-left: 32px; }

/* ============================================================
   SEARCH MODAL
   ============================================================ */
.search-modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 640px;
  overflow: hidden;
}

.search-modal-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.search-modal-input i { color: var(--text-3); font-size: 16px; }
.search-modal-input input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  color: var(--text);
  background: none;
  font-family: inherit;
}

.search-results { max-height: 400px; overflow-y: auto; }
.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: var(--trans);
}
.search-result-item:hover { background: var(--surface-2); }
.search-result-item:last-child { border-bottom: none; }

/* ============================================================
   POS SPECIFIC
   ============================================================ */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 40px);
}

.pos-products {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pos-cart {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.pos-search-bar {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 8px;
  align-items: center;
}

.barcode-scan-input {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--primary-light);
  border: 2px solid var(--primary);
  border-radius: 8px;
  padding: 8px 12px;
  gap: 8px;
}
.barcode-scan-input input {
  border: none; background: none; outline: none;
  font-size: 13px; color: var(--text); flex: 1;
  font-family: 'JetBrains Mono', monospace;
}

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  padding: 12px;
  overflow-y: auto;
  flex: 1;
}

.pos-product-card {
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 10px 8px;
  cursor: pointer;
  text-align: center;
  transition: var(--trans);
}
.pos-product-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-1px);
}
.pos-product-card img { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; margin-bottom: 6px; }
.pos-product-card .prod-name { font-size: 11px; font-weight: 500; color: var(--text); line-height: 1.3; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-product-card .prod-price { font-size: 12.5px; font-weight: 700; color: var(--primary); }
.pos-product-card .prod-stock { font-size: 10px; color: var(--text-3); }

.cart-header { padding: 12px 16px; border-bottom: 1px solid var(--border); }
.cart-customer { margin-bottom: 8px; }

.cart-items { flex: 1; overflow-y: auto; }
.cart-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  align-items: start;
}
.cart-item-name { font-size: 12.5px; font-weight: 500; }
.cart-item-meta { font-size: 11px; color: var(--text-3); }
.cart-item-price { font-size: 13px; font-weight: 600; text-align: right; }
.cart-qty-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
}
.qty-btn {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  transition: var(--trans);
}
.qty-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.qty-input {
  width: 40px;
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 12px;
  padding: 2px;
}

.cart-totals { padding: 12px 16px; border-top: 1px solid var(--border); }
.cart-totals table { width: 100%; font-size: 12.5px; }
.cart-totals td { padding: 3px 0; }
.cart-totals td:last-child { text-align: right; font-weight: 500; }
.cart-grand-total { font-size: 18px; font-weight: 700; color: var(--primary); }

.cart-actions { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }

/* Invoice type toggle */
.invoice-type-toggle {
  display: flex;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 8px;
}
.invoice-type-toggle button {
  flex: 1;
  padding: 7px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  transition: var(--trans);
}
.invoice-type-toggle button.active.gst { background: var(--primary); color: #fff; }
.invoice-type-toggle button.active.nongst { background: var(--accent); color: #fff; }

/* ============================================================
   INVOICE PRINT
   ============================================================ */
@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .page-content { padding: 0 !important; }
  body { background: #fff; }
  .invoice-print { padding: 0; }
}

.invoice-print {
  max-width: 800px;
  margin: 0 auto;
  background: #fff;
  padding: 30px;
  font-size: 12px;
  color: #111;
}

.invoice-header {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 2px solid #111;
}

.invoice-gst-badge {
  display: inline-block;
  background: #1a56db;
  color: #fff;
  padding: 3px 12px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  margin-top: 4px;
}

.invoice-nongst-badge {
  background: #f97316;
}

.invoice-table { width: 100%; border-collapse: collapse; margin: 16px 0; }
.invoice-table th { background: #f3f4f6; padding: 8px; text-align: left; font-size: 11px; border: 1px solid #ddd; }
.invoice-table td { padding: 7px 8px; border: 1px solid #ddd; font-size: 11.5px; }
.invoice-totals-table { float: right; width: 260px; border-collapse: collapse; }
.invoice-totals-table td { padding: 4px 8px; font-size: 12px; }
.invoice-totals-table tr.total-row td { font-weight: 700; font-size: 14px; border-top: 2px solid #111; }

/* ============================================================
   BARCODE LABEL
   ============================================================ */
.barcode-label {
  display: inline-block;
  border: 1px solid #ddd;
  padding: 8px 12px;
  text-align: center;
  font-family: monospace;
  margin: 4px;
  background: #fff;
  cursor: pointer;
}
.barcode-label .label-name { font-size: 10px; font-weight: 600; max-width: 100px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barcode-label .label-price { font-size: 12px; font-weight: 700; }
.barcode-label canvas { display: block; }

/* ============================================================
   OFFLINE BANNER
   ============================================================ */
#offlineBanner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--warning);
  color: #fff;
  text-align: center;
  padding: 8px;
  font-size: 13px;
  font-weight: 500;
  z-index: 500;
  transform: translateY(100%);
  transition: var(--trans);
}
#offlineBanner.show { transform: translateY(0); }

/* ============================================================
   LANDING PAGE
   ============================================================ */
.landing-body {
  font-family: 'Inter', sans-serif;
  background: #fff;
  color: #111827;
}

.landing-nav {
  position: sticky;
  top: 0;
  background: rgba(255,255,255,.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e5e7eb;
  z-index: 100;
  padding: 0 5%;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.landing-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; text-decoration: none; color: #111; }
.landing-logo-icon { width: 36px; height: 36px; background: #1a56db; border-radius: 9px; display: flex; align-items: center; justify-content: center; color: #fff; }

.landing-nav-links { display: flex; align-items: center; gap: 28px; }
.landing-nav-links a { color: #4b5563; text-decoration: none; font-size: 14px; font-weight: 450; }
.landing-nav-links a:hover { color: #1a56db; }

.hero {
  padding: 80px 5% 60px;
  text-align: center;
  background: linear-gradient(180deg, #f0f4ff 0%, #fff 100%);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  color: #1a56db;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 20px;
}

.hero h1 {
  font-size: clamp(36px, 5vw, 58px);
  font-weight: 800;
  color: #111827;
  line-height: 1.15;
  margin-bottom: 18px;
  letter-spacing: -.5px;
}

.hero h1 span { color: #1a56db; }
.hero p { font-size: 17px; color: #4b5563; max-width: 620px; margin: 0 auto 30px; line-height: 1.7; }

.hero-btns { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 40px; }

.btn-hero-primary {
  background: #1a56db; color: #fff; padding: 14px 28px; border-radius: 10px; font-size: 15px; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; transition: all .2s;
}
.btn-hero-primary:hover { background: #1340a8; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(26,86,219,.3); }

.btn-hero-sec { background: #fff; color: #111; border: 1.5px solid #e5e7eb; padding: 14px 28px; border-radius: 10px; font-size: 15px; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; transition: all .2s; }
.btn-hero-sec:hover { border-color: #1a56db; color: #1a56db; }

.hero-demo-img {
  max-width: 960px;
  margin: 0 auto;
  border-radius: 16px;
  box-shadow: 0 24px 64px rgba(0,0,0,.12);
  border: 1px solid #e5e7eb;
  overflow: hidden;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 5% 80px;
}

.feature-card {
  padding: 24px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  transition: all .2s;
}
.feature-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); border-color: #1a56db; transform: translateY(-2px); }
.feature-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 14px; }
.feature-card h3 { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 13.5px; color: #4b5563; line-height: 1.6; }

.pricing-section { background: #f9fafb; padding: 80px 5%; text-align: center; }
.section-title { font-size: clamp(26px, 3vw, 36px); font-weight: 800; margin-bottom: 12px; }
.section-sub { font-size: 15px; color: #4b5563; margin-bottom: 48px; }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  max-width: 960px;
  margin: 0 auto;
}

.pricing-card {
  background: #fff;
  border: 2px solid #e5e7eb;
  border-radius: 16px;
  padding: 28px;
  text-align: left;
  transition: all .2s;
}
.pricing-card.popular {
  border-color: #1a56db;
  box-shadow: 0 0 0 4px rgba(26,86,219,.1);
  position: relative;
}
.popular-badge {
  position: absolute;
  top: -12px; left: 50%; transform: translateX(-50%);
  background: #1a56db; color: #fff;
  padding: 3px 16px; border-radius: 20px;
  font-size: 11px; font-weight: 700;
  white-space: nowrap;
}

.pricing-name { font-size: 13px; font-weight: 600; color: #6b7280; text-transform: uppercase; letter-spacing: .5px; margin-bottom: 8px; }
.pricing-price { font-size: 36px; font-weight: 800; color: #111; margin-bottom: 4px; }
.pricing-price span { font-size: 14px; font-weight: 400; color: #6b7280; }
.pricing-features { list-style: none; margin: 20px 0; display: flex; flex-direction: column; gap: 10px; }
.pricing-features li { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.pricing-features li i { color: #059669; width: 16px; }

.testimonials-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; max-width: 1000px; margin: 0 auto; }
.testimonial-card { background: #fff; border: 1px solid #e5e7eb; border-radius: 14px; padding: 22px; }
.testimonial-stars { color: #f59e0b; margin-bottom: 10px; }
.testimonial-text { font-size: 13.5px; color: #374151; line-height: 1.7; margin-bottom: 14px; }
.testimonial-author { display: flex; align-items: center; gap: 10px; }
.testimonial-avatar { width: 36px; height: 36px; border-radius: 50%; background: #1a56db; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.testimonial-name { font-weight: 600; font-size: 13px; }
.testimonial-biz { font-size: 11.5px; color: #6b7280; }

.landing-footer { background: #111827; color: #9ca3af; padding: 40px 5%; }
.footer-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 32px; margin-bottom: 32px; }
.footer-logo { color: #fff; font-weight: 800; font-size: 18px; margin-bottom: 10px; }
.footer-desc { font-size: 13px; line-height: 1.6; }
.footer-col h4 { color: #fff; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.footer-col a { display: block; color: #9ca3af; text-decoration: none; font-size: 13px; margin-bottom: 8px; }
.footer-col a:hover { color: #fff; }
.footer-bottom { border-top: 1px solid #374151; padding-top: 20px; text-align: center; font-size: 12.5px; }

/* ============================================================
   DASHBOARD
   ============================================================ */
.dashboard-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.chart-container { position: relative; height: 260px; }

/* ============================================================
   MISC UTILITIES
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--text-3); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.mono { font-family: 'JetBrains Mono', monospace; }

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}
.empty-state i { font-size: 48px; margin-bottom: 14px; opacity: .4; }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 8px; }
.empty-state p { font-size: 13.5px; }

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 12px;
  flex-wrap: wrap;
}

.page-title { font-size: 20px; font-weight: 700; }
.page-subtitle { font-size: 13px; color: var(--text-2); margin-top: 2px; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .pos-cart { order: -1; height: auto; max-height: 50vh; }
  .dashboard-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 260px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-toggle-btn { display: flex; }
  .sidebar-hamburger { display: flex; }
  .main-wrapper { margin-left: 0; }
  .search-global { display: none; }
  .form-row.cols-2, .form-row.cols-3, .form-row.cols-4 { grid-template-columns: 1fr; }
  .page-content { padding: 12px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .landing-nav-links { display: none; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .hero h1 { font-size: 28px; }
}

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

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

/* Smooth transitions */
.fade-in { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* Toggle switch */
.toggle {
  position: relative;
  display: inline-block;
  width: 36px; height: 20px;
}
.toggle input { display: none; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--gray-300);
  border-radius: 20px;
  transition: var(--trans);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: var(--trans);
}
.toggle input:checked + .toggle-slider { background: var(--primary); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* Tooltip */
[data-tip] { position: relative; cursor: help; }
[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 4px 8px;
  border-radius: 5px;
  font-size: 11px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: var(--trans);
  z-index: 1000;
}
[data-tip]:hover::after { opacity: 1; }

/* Number input no arrows */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }
input[type=number] { -moz-appearance: textfield; }
