:root {
  --bg: #0a0a0f;
  --bg2: #12121a;
  --bg3: #1a1a26;
  --card: #16161f;
  --border: #2a2a3a;
  --accent: #6c63ff;
  --accent2: #a855f7;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  --text: #e2e8f0;
  --text2: #94a3b8;
  --text3: #64748b;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { background: var(--bg); color: var(--text); font-family: 'Inter', system-ui, sans-serif; min-height: 100vh; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); }

/* Layout */
.app-layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
  width: 240px; background: var(--bg2); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; transition: width var(--transition);
}
.sidebar-brand {
  padding: 20px 18px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-brand .logo-icon {
  width: 36px; height: 36px; background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: #fff; flex-shrink: 0;
}
.sidebar-brand .brand-text { font-weight: 700; font-size: .95rem; color: var(--text); }
.sidebar-brand .brand-sub { font-size: .7rem; color: var(--text3); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 0; }
.nav-section-title {
  font-size: .65rem; font-weight: 600; text-transform: uppercase; letter-spacing: .08em;
  color: var(--text3); padding: 12px 18px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 9px 18px;
  color: var(--text2); font-size: .88rem; font-weight: 500; transition: all var(--transition);
  border-radius: 0; position: relative;
}
.nav-link:hover { color: var(--text); background: var(--bg3); }
.nav-link.active {
  color: var(--accent); background: rgba(108,99,255,.1);
}
.nav-link.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav-link svg { width: 17px; height: 17px; stroke-width: 2; flex-shrink: 0; }
.nav-link .badge {
  margin-left: auto; font-size: .65rem; padding: 2px 6px; background: var(--accent);
  color: #fff; border-radius: 20px; font-weight: 600;
}

.sidebar-footer { padding: 14px 18px; border-top: 1px solid var(--border); }
.shop-badge {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--bg3); border-radius: var(--radius-sm); cursor: pointer;
}
.shop-avatar {
  width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg,var(--accent),var(--accent2));
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .8rem; color: #fff; flex-shrink: 0;
}
.shop-name { font-size: .82rem; font-weight: 600; color: var(--text); }
.shop-role { font-size: .7rem; color: var(--text3); }

/* Main content */
.main-content { margin-left: 240px; flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 90; background: rgba(10,10,15,.8); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border); padding: 0 24px; height: 56px;
  display: flex; align-items: center; gap: 16px;
}
.topbar-title { font-weight: 700; font-size: 1rem; color: var(--text); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.page-body { padding: 24px; flex: 1; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-title { font-size: .95rem; font-weight: 700; color: var(--text); }

/* Stats */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; display: flex; align-items: center; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; }
.stat-icon.purple { background: rgba(108,99,255,.15); color: var(--accent); }
.stat-icon.green { background: rgba(34,197,94,.15); color: var(--success); }
.stat-icon.orange { background: rgba(245,158,11,.15); color: var(--warning); }
.stat-icon.blue { background: rgba(59,130,246,.15); color: var(--info); }
.stat-icon.pink { background: rgba(236,72,153,.15); color: #ec4899; }
.stat-value { font-size: 1.5rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: .75rem; color: var(--text3); margin-top: 3px; }
.stat-change { font-size: .72rem; margin-top: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text3); padding: 10px 14px; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid rgba(42,42,58,.5); font-size: .875rem; color: var(--text2); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(255,255,255,.02); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px;
  border-radius: var(--radius-sm); font-size: .85rem; font-weight: 600; border: none;
  cursor: pointer; transition: all var(--transition); white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #5b52e0; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(108,99,255,.4); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: var(--bg3); color: var(--text2); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--border); }
.btn-sm { padding: 5px 11px; font-size: .78rem; }
.btn-icon { padding: 7px; border-radius: var(--radius-sm); }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: .8rem; font-weight: 600; color: var(--text2); margin-bottom: 6px; }
.form-control {
  width: 100%; background: var(--bg3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: .875rem; padding: 9px 12px; transition: border var(--transition);
  outline: none;
}
.form-control:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,99,255,.15); }
.form-control::placeholder { color: var(--text3); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 90px; }

/* Grid */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.badge-success { background: rgba(34,197,94,.15); color: var(--success); }
.badge-danger { background: rgba(239,68,68,.15); color: var(--danger); }
.badge-warning { background: rgba(245,158,11,.15); color: var(--warning); }
.badge-info { background: rgba(59,130,246,.15); color: var(--info); }
.badge-purple { background: rgba(108,99,255,.15); color: var(--accent); }
.badge-gray { background: rgba(100,116,139,.15); color: var(--text3); }

/* Modal */
.modal-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(4px);
  z-index: 1000; align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow); animation: modal-in .2s ease;
}
.modal-lg { max-width: 780px; }
@keyframes modal-in { from { opacity:0; transform:translateY(-12px); } to { opacity:1; transform:none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.modal-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.modal-close { background: none; border: none; color: var(--text3); cursor: pointer; padding: 4px; border-radius: 6px; }
.modal-close:hover { color: var(--text); background: var(--bg3); }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--bg2); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px; font-size: .85rem; color: var(--text); display: flex; align-items: center; gap: 10px;
  animation: toast-in .3s ease; min-width: 220px; box-shadow: var(--shadow);
}
.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }
@keyframes toast-in { from { opacity:0; transform:translateX(20px); } to { opacity:1; transform:none; } }

/* Search bar */
.search-bar {
  position: relative; display: flex; align-items: center;
}
.search-bar svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--text3); }
.search-bar input { padding-left: 34px; }

/* Empty state */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text3); }
.empty-state svg { width: 48px; height: 48px; margin-bottom: 12px; opacity: .4; }
.empty-state p { font-size: .875rem; }

/* Locked feature */
.feature-locked {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 60px 20px; text-align: center; color: var(--text3); gap: 12px;
}
.feature-locked svg { width: 48px; height: 48px; opacity: .4; }
.feature-locked h3 { color: var(--text2); font-size: 1rem; }

/* Pagination */
.pagination { display: flex; align-items: center; gap: 6px; margin-top: 16px; }
.page-btn {
  padding: 5px 10px; border-radius: var(--radius-sm); font-size: .8rem; font-weight: 600;
  background: var(--bg3); border: 1px solid var(--border); color: var(--text2); cursor: pointer;
}
.page-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.page-btn:hover:not(.active) { background: var(--border); }

/* Alert */
.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: .85rem; margin-bottom: 16px; display: flex; gap: 8px; align-items: flex-start; }
.alert-success { background: rgba(34,197,94,.1); border: 1px solid rgba(34,197,94,.3); color: #4ade80; }
.alert-error { background: rgba(239,68,68,.1); border: 1px solid rgba(239,68,68,.3); color: #f87171; }
.alert-warning { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.3); color: #fbbf24; }
.alert-info { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.3); color: #60a5fa; }

/* POS specific */
.pos-layout { display: grid; grid-template-columns: 1fr 360px; gap: 16px; height: calc(100vh - 120px); }
.pos-products { overflow-y: auto; }
.pos-cart { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); display: flex; flex-direction: column; overflow: hidden; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.product-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; cursor: pointer; transition: all var(--transition); text-align: center;
}
.product-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.product-card .price { color: var(--accent); font-weight: 700; font-size: .95rem; }
.product-card .pname { font-size: .8rem; color: var(--text2); margin-top: 4px; font-weight: 600; }
.product-card .stock { font-size: .7rem; color: var(--text3); }

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: none; }
  .main-content { margin-left: 0; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .pos-layout { grid-template-columns: 1fr; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text3); }

/* 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-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.ml-auto { margin-left: auto; }
.text-sm { font-size: .8rem; }
.text-xs { font-size: .72rem; }
.text-muted { color: var(--text3); }
.font-bold { font-weight: 700; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-accent { color: var(--accent); }
.w-full { width: 100%; }
.hidden { display: none; }
