:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --sidebar-bg: #111827;
  --sidebar-bg-active: #1f2937;
  --sidebar-text: #9ca3af;
  --sidebar-text-active: #ffffff;
  --page-bg: #f3f4f6;
  --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.06);
  --radius: 0.75rem;
}

body {
  background: var(--page-bg);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  color: #1f2937;
}

a { text-decoration: none; }

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

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 1rem 0;
}

.sidebar-brand {
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  padding: 0.5rem 1.25rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.75rem;
}

.sidebar-nav a {
  color: var(--sidebar-text);
  padding: 0.55rem 0.85rem;
  border-radius: 0.5rem;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.sidebar-nav a:hover {
  background: var(--sidebar-bg-active);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--primary);
  color: #fff;
}

.sidebar-heading {
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  color: #6b7280;
  margin: 0.85rem 0.85rem 0.25rem;
}

.main-column {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  font-size: 1.1rem;
  font-weight: 600;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.content {
  padding: 1.5rem;
  flex-grow: 1;
}

/* ---- Shared card / stat components ---- */
.stat-card, .card, .surface-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid #eef0f3;
}

.stat-card {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.stat-card .stat-value {
  font-size: 1.6rem;
  font-weight: 700;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
}

.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

/* ---- POS page ---- */
.pos-page .content {
  padding: 1rem;
}

.pos-layout {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.pos-catalog {
  flex: 1 1 auto;
  min-width: 0;
}

.pos-toolbar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.category-pills {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.category-pill {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid #d1d5db;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  color: #374151;
}

.category-pill.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.85rem;
}

.product-card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid #eef0f3;
  padding: 0.85rem;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.1);
}

.product-card .product-thumb {
  height: 70px;
  border-radius: 0.5rem;
  background: #eef2ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 1.6rem;
  overflow: hidden;
}

.product-card .product-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.product-card .product-name {
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
}

.product-card .product-price {
  color: var(--primary);
  font-weight: 700;
}

.product-card .product-stock {
  font-size: 0.75rem;
  color: #9ca3af;
}

.product-card.out-of-stock {
  opacity: 0.5;
  cursor: not-allowed;
}

.pos-cart {
  width: 380px;
  flex-shrink: 0;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid #eef0f3;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 6rem);
}

.pos-cart-header {
  padding: 1rem;
  border-bottom: 1px solid #eef0f3;
  font-weight: 700;
}

.pos-cart-items {
  flex-grow: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem;
}

.cart-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid #f3f4f6;
}

.cart-line .cart-line-name {
  flex-grow: 1;
  font-size: 0.88rem;
  font-weight: 600;
}

.cart-line .cart-line-price {
  font-size: 0.78rem;
  color: #6b7280;
}

.cart-qty {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.cart-qty button {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid #d1d5db;
  background: #fff;
  line-height: 1;
}

.pos-cart-summary {
  padding: 1rem;
  border-top: 1px solid #eef0f3;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.summary-row.total {
  font-size: 1.15rem;
  font-weight: 700;
  border-top: 1px dashed #d1d5db;
  padding-top: 0.5rem;
  margin-top: 0.35rem;
}

/* ---- Receipt / print ---- */
.receipt {
  max-width: 380px;
  margin: 0 auto;
  background: #fff;
  padding: 1.5rem;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  font-family: "Courier New", monospace;
}

.receipt hr {
  border-top: 1px dashed #9ca3af;
}

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .main-column, .content { padding: 0 !important; margin: 0 !important; }
  body { background: #fff; }
}

@media (max-width: 900px) {
  .sidebar { display: none; }
  .pos-layout { flex-direction: column; }
  .pos-cart { width: 100%; position: static; max-height: none; }
}
