:root {
  --ep-primary: #4f46e5;
  --ep-primary-dark: #4338ca;
  --ep-primary-light: #eef2ff;
  --ep-sidebar-width: 250px;
  --ep-sidebar-bg: #1e293b;
  --ep-sidebar-hover: #334155;
  --ep-topbar-h: 60px;
  --ep-radius: 10px;
  --ep-shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
  --ep-shadow-lg: 0 8px 24px rgba(15, 23, 42, .12);
}

* { box-sizing: border-box; }
body {
  background: #f1f5f9;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #1e293b;
  overflow-x: hidden;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--ep-sidebar-width);
  background: var(--ep-sidebar-bg);
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  z-index: 1040;
  transition: transform .25s ease;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 18px;
  background: rgba(0,0,0,.15);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.brand-logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--ep-primary), #7c3aed);
  color: #fff; font-weight: 700; font-size: 15px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { color: #fff; font-weight: 600; font-size: 15px; }
.brand-sub { font-size: 11px; color: #94a3b8; }
.sidebar-nav { flex: 1; padding: 10px 8px 20px; }
.nav-group-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .08em;
  color: #64748b; padding: 14px 12px 4px; font-weight: 600;
}
.sidebar .nav-link {
  color: #cbd5e1; border-radius: 8px; padding: 9px 12px;
  display: flex; align-items: center; gap: 11px;
  font-size: 14px; margin-bottom: 2px; white-space: nowrap;
}
.sidebar .nav-link i { font-size: 16px; width: 20px; text-align: center; }
.sidebar .nav-link:hover { background: var(--ep-sidebar-hover); color: #fff; }
.sidebar .nav-link.active {
  background: var(--ep-primary); color: #fff; font-weight: 500;
}
.sidebar-footer {
  padding: 12px 16px; font-size: 12px; color: #64748b;
  border-top: 1px solid rgba(255,255,255,.06);
}
.sidebar-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(15,23,42,.5); z-index: 1030;
}

/* ---------- Main area ---------- */
.main-content {
  margin-left: var(--ep-sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left .25s ease;
}
.topbar {
  height: var(--ep-topbar-h);
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 1020;
}
.page-container { padding: 18px 20px 40px; flex: 1; }
.breadcrumb { font-size: 13px; }
.page-title { font-weight: 600; color: #0f172a; }

/* ---------- Cards ---------- */
.card {
  border: none;
  border-radius: var(--ep-radius);
  box-shadow: var(--ep-shadow);
}
.card-header {
  background: #fff; border-bottom: 1px solid #eef2f7;
  font-weight: 600; border-radius: var(--ep-radius) var(--ep-radius) 0 0 !important;
}
.stat-card { border-radius: var(--ep-radius); padding: 18px; color: #fff; position: relative; overflow: hidden; }
.stat-card .stat-icon { position: absolute; right: 14px; top: 14px; font-size: 34px; opacity: .25; }
.stat-card .stat-value { font-size: 24px; font-weight: 700; }
.stat-card .stat-label { font-size: 13px; opacity: .9; }
.stat-blue { background: linear-gradient(135deg,#4f46e5,#6366f1); }
.stat-green { background: linear-gradient(135deg,#059669,#10b981); }
.stat-orange { background: linear-gradient(135deg,#ea580c,#f97316); }
.stat-red { background: linear-gradient(135deg,#dc2626,#ef4444); }
.stat-cyan { background: linear-gradient(135deg,#0891b2,#06b6d4); }
.stat-indigo { background: linear-gradient(135deg,#4f46e5,#8b5cf6); }
.stat-violet { background: linear-gradient(135deg,#7c3aed,#a855f7); }
.stat-slate { background: linear-gradient(135deg,#334155,#475569); }

/* ---------- Tables ---------- */
.table { font-size: 13.5px; }
.table thead th {
  background: #f8fafc; color: #475569;
  font-size: 12px; text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 2px solid #e2e8f0; white-space: nowrap;
}
.table-hover tbody tr:hover { background: #f8fafc; }
.dataTables_wrapper .dataTables_length, .dataTables_wrapper .dataTables_filter { margin-bottom: 10px; }
.dataTables_wrapper .dataTables_filter input { border: 1px solid #cbd5e1; border-radius: 6px; padding: 5px 10px; }

/* ---------- Forms ---------- */
.form-control, .form-select { border-radius: 8px; border-color: #cbd5e1; }
.form-control:focus, .form-select:focus {
  border-color: var(--ep-primary);
  box-shadow: 0 0 0 .2rem rgba(79,70,229,.12);
}
.form-label { font-size: 13px; font-weight: 500; color: #334155; }
.form-section-title {
  font-size: 13px; font-weight: 600; color: var(--ep-primary);
  text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid #eef2f7; padding-bottom: 8px; margin-bottom: 14px;
}

/* ---------- Buttons ---------- */
.btn-primary { background-color: var(--ep-primary); border-color: var(--ep-primary); }
.btn-primary:hover { background-color: var(--ep-primary-dark); border-color: var(--ep-primary-dark); }
.btn { border-radius: 8px; }

/* ---------- POS ---------- */
.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.pos-product-card {
  background: #fff; border-radius: 10px; padding: 10px;
  cursor: pointer; text-align: center; border: 1px solid #e2e8f0;
  transition: all .15s ease; box-shadow: var(--ep-shadow);
}
.pos-product-card:hover { border-color: var(--ep-primary); box-shadow: var(--ep-shadow-lg); transform: translateY(-2px); }
.pos-product-card .pp-img {
  height: 62px; margin: 0 auto 6px; display: flex; align-items: center; justify-content: center;
  border-radius: 8px; background: #f8fafc; overflow: hidden;
}
.pos-product-card .pp-img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pos-product-card .pp-name {
  font-size: 12px; font-weight: 600; line-height: 1.2;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 29px;
}
.pos-product-card .pp-price { font-size: 13px; color: var(--ep-primary); font-weight: 700; }
.pos-product-card .pp-stock { font-size: 11px; color: #64748b; }
.cart-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; }
.cart-item:hover { background: #f8fafc; }
.cart-item .ci-name { font-size: 13px; font-weight: 600; }
.cart-item .ci-sub { font-size: 12px; color: #64748b; }
.barcode-input { font-size: 16px; letter-spacing: 1px; }

/* ---------- Print ---------- */
@media print {
  .sidebar, .topbar, .no-print, .breadcrumb, .page-actions { display: none !important; }
  .main-content { margin-left: 0 !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: none; }
}

/* 80mm thermal invoice */
.invoice-thermal { width: 80mm; font-size: 11px; color: #000; }
.invoice-thermal .it-header { text-align: center; }
.invoice-thermal table { width: 100%; font-size: 10.5px; }
.invoice-thermal .it-items td, .invoice-thermal .it-items th { padding: 2px 0; }
.print-area-thermal { width: 80mm; }

/* ---------- Notifications ---------- */
.notif-menu { min-width: 300px; max-height: 400px; overflow-y: auto; }

/* ---------- Misc ---------- */
.avatar-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--ep-primary-light); color: var(--ep-primary);
  display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.empty-state { text-align: center; padding: 40px 20px; color: #94a3b8; }
.empty-state i { font-size: 44px; }
.sync-status-indicator {
  font-size: 12px; padding: 4px 10px; border-radius: 20px;
  background: #dcfce7; color: #166534; font-weight: 600;
}

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .sidebar-backdrop.show { display: block; }
  .main-content { margin-left: 0; }
}
@media (max-width: 767.98px) {
  .page-container { padding: 12px; }
  .stat-card .stat-value { font-size: 20px; }
}
