@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600&display=swap');

/* ============================================================
   Design tokens
   One accent. One radius. One border colour. Cool grey family.
   ============================================================ */
:root {
  /* Accent — a vibrant blue. */
  --accent:        hsl(221, 90%, 56%);
  --accent-hover:  hsl(221, 90%, 50%);
  --accent-subtle: hsl(221, 90%, 95%);
  --accent-text:   hsl(221, 90%, 42%);

  /* Semantic colours */
  --success:       hsl(152, 70%, 40%);
  --success-subtle:hsl(152, 60%, 92%);
  --warning:       hsl(38,  95%, 50%);
  --warning-subtle:hsl(38,  80%, 92%);
  --danger:        hsl(354, 80%, 55%);
  --danger-hover:  hsl(354, 80%, 45%);
  --danger-subtle: hsl(354, 70%, 95%);

  /* Cool grey scale */
  --gray-50:   hsl(210, 20%, 98%);
  --gray-100:  hsl(210, 16%, 95%);
  --gray-200:  hsl(210, 14%, 89%);
  --gray-300:  hsl(210, 12%, 80%);
  --gray-400:  hsl(210, 10%, 65%);
  --gray-500:  hsl(210,  9%, 50%);
  --gray-600:  hsl(210,  9%, 38%);
  --gray-700:  hsl(210, 10%, 28%);
  --gray-800:  hsl(210, 12%, 18%);
  --gray-900:  hsl(210, 14%, 11%);

  /* Surfaces */
  --bg:           hsl(210, 25%, 97%);
  --surface:      rgba(255, 255, 255, 0.85); /* For glassmorphism */
  --surface-raised: rgba(255, 255, 255, 0.95);

  /* Text */
  --text-primary:   var(--gray-900);
  --text-secondary: var(--gray-500);
  --text-tertiary:  var(--gray-400);
  --text-on-accent: hsl(0, 0%, 100%);

  /* Borders */
  --border:  hsl(210, 14%, 89%);
  --radius:  12px; /* Smoother radius */

  /* Shadows — premium look */
  --shadow-sm:  0 2px 4px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.02);
  --shadow-md:  0 4px 12px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.03);
  --shadow-lg:  0 12px 32px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);

  /* Type scale */
  --text-xs:   12px;
  --text-sm:   14px;
  --text-base: 15px;
  --text-lg:   18px;
  --text-xl:   22px;
  --text-2xl:  30px;

  /* Spacing scale (4px base) */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;

  /* Layout */
  --sidebar-w: 240px;
  --header-h:  64px;

  /* Transitions */
  --t-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-enter: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode */
[data-theme="dark"] {
  --bg:           hsl(214, 20%, 9%);
  --surface:      rgba(30, 41, 59, 0.75); /* Glassmorphism dark */
  --surface-raised: rgba(30, 41, 59, 0.95);
  --border:       hsl(214, 15%, 20%);
  --text-primary:   hsl(210, 16%, 98%);
  --text-secondary: hsl(210, 10%, 65%);
  --text-tertiary:  hsl(210,  9%, 50%);
  --gray-50:   hsl(214, 15%, 15%);
  --gray-100:  hsl(214, 15%, 20%);
  --gray-200:  hsl(214, 15%, 25%);
  
  --accent:        hsl(221, 95%, 60%);
  --accent-hover:  hsl(221, 95%, 65%);
  --accent-subtle: hsl(221, 40%, 18%);
  --accent-text:   hsl(221, 100%, 75%);
  
  --success:       hsl(152, 70%, 45%);
  --success-subtle: hsl(152, 40%, 15%);
  --warning:       hsl(38,  95%, 55%);
  --warning-subtle: hsl(38,  40%, 15%);
  --danger:        hsl(354, 80%, 60%);
  --danger-subtle:  hsl(354, 40%, 15%);
  
  --shadow-sm:  0 2px 4px rgba(0,0,0,.4);
  --shadow-md:  0 4px 12px rgba(0,0,0,.5);
  --shadow-lg:  0 12px 32px rgba(0,0,0,.6);
}

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

html {
  font-size: var(--text-base);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

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

img, svg { display: block; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; }
ul, ol { list-style: none; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================================
   App shell layout
   ============================================================ */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: var(--header-h) 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  grid-row: 1 / 3;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-5);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.sidebar-brand-name span {
  color: var(--accent);
}

.sidebar-nav {
  flex: 1;
  padding: var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.sidebar-section-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: var(--sp-3) var(--sp-2) var(--sp-1);
  margin-top: var(--sp-4);
}

.sidebar-section-label:first-child {
  margin-top: 0;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  transition: background var(--t-fast), color var(--t-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.nav-link svg { flex-shrink: 0; color: currentColor; }

.nav-link:hover {
  background: var(--gray-100);
  color: var(--text-primary);
  text-decoration: none;
}

.nav-link.active {
  background: var(--accent-subtle);
  color: var(--accent);
  font-weight: 500;
}

.sidebar-footer {
  padding: var(--sp-4) var(--sp-3);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}

/* Top header */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 var(--sp-6);
  gap: var(--sp-4);
}

.topbar-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Main content area */
.main-content {
  overflow-y: auto;
  padding: var(--sp-6);
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  height: 36px;
  padding: 0 var(--sp-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 500;
  border: 1px solid transparent;
  transition: background var(--t-fast), border-color var(--t-fast), color var(--t-fast);
  white-space: nowrap;
  line-height: 1;
}

.btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--accent);
  color: var(--text-on-accent);
  border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border);
}
.btn-secondary:hover { background: var(--gray-100); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--gray-100); color: var(--text-primary); }

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

.btn-sm {
  height: 30px;
  padding: 0 var(--sp-3);
  font-size: var(--text-xs);
}

.btn-lg {
  height: 44px;
  padding: 0 var(--sp-6);
  font-size: var(--text-base);
}

.btn[disabled], .btn:disabled {
  opacity: 0.45;
  pointer-events: none;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ============================================================
   Inputs
   ============================================================ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
}

.input, .select {
  height: 36px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  font-size: var(--text-sm);
  width: 100%;
  transition: border-color var(--t-fast);
}

textarea.input {
  height: auto;
  padding: var(--sp-2) var(--sp-3);
  resize: vertical;
  min-height: 80px;
}

.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
}

.input::placeholder { color: var(--text-tertiary); }

.input-error { border-color: var(--danger) !important; }

.field-error {
  font-size: var(--text-xs);
  color: var(--danger);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* Input with icon/addon */
.input-group {
  position: relative;
  display: flex;
  align-items: center;
}
.input-group .input { padding-left: 36px; }
.input-group-icon {
  position: absolute;
  left: var(--sp-3);
  color: var(--text-tertiary);
  pointer-events: none;
  display: flex;
}

/* ============================================================
   Cards — no shadow on static cards
   ============================================================ */
.card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--t-base), box-shadow var(--t-base);
}

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

.card-header {
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.card-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
}

.card-body {
  padding: var(--sp-5);
}

.card-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--border);
}

/* ============================================================
   Stat cards (dashboard)
   ============================================================ */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-5);
}

.stat-label {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--sp-1);
}

.stat-value {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.stat-sub {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

/* ============================================================
   Tables
   ============================================================ */
.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-secondary);
  text-align: left;
  padding: var(--sp-2) var(--sp-3);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

td {
  font-size: var(--text-sm);
  color: var(--text-primary);
  padding: var(--sp-3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }

tbody tr { transition: background var(--t-fast); }
tbody tr:hover { background: var(--gray-50); }

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 var(--sp-2);
  border-radius: 10px;
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
}

.badge-neutral { background: var(--gray-100); color: var(--gray-600); }
.badge-accent  { background: var(--accent-subtle); color: var(--accent); }
.badge-success { background: var(--success-subtle); color: var(--success); }
.badge-warning { background: var(--warning-subtle); color: var(--warning); }
.badge-danger  { background: var(--danger-subtle); color: var(--danger); }

/* ============================================================
   Modal — shadow allowed (floating overlay)
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 900;
  opacity: 0;
  transition: opacity var(--t-enter);
  padding: var(--sp-6);
}

.modal-backdrop.visible { opacity: 1; }

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  transform: translateY(8px);
  transition: transform var(--t-enter);
}

.modal-backdrop.visible .modal { transform: translateY(0); }

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

.modal-title {
  font-size: var(--text-base);
  font-weight: 600;
}

.modal-body { padding: var(--sp-5) var(--sp-6); }

.modal-footer {
  padding: var(--sp-4) var(--sp-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--sp-3);
}

/* ============================================================
   Toast — shadow allowed (floating)
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  pointer-events: none;
}

.toast {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: var(--sp-3) var(--sp-4);
  font-size: var(--text-sm);
  min-width: 240px;
  max-width: 360px;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--t-enter), transform var(--t-enter);
  pointer-events: auto;
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.toast-success { border-left: 3px solid var(--success); }
.toast.toast-error   { border-left: 3px solid var(--danger); }
.toast.toast-warning { border-left: 3px solid var(--warning); }

/* ============================================================
   Dropdown — shadow allowed (floating)
   ============================================================ */
.dropdown-menu {
  position: absolute;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  min-width: 160px;
  padding: var(--sp-1);
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity var(--t-fast), transform var(--t-fast);
  pointer-events: none;
}

.dropdown-menu.open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  font-size: var(--text-sm);
  color: var(--text-primary);
  border-radius: calc(var(--radius) - 2px);
  transition: background var(--t-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.dropdown-item:hover { background: var(--gray-100); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-subtle); }
.dropdown-divider { height: 1px; background: var(--border); margin: var(--sp-1) 0; }

/* ============================================================
   Page sections
   ============================================================ */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.page-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-top: var(--sp-1);
}

/* Filter/toolbar bar */
.toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
  flex-wrap: wrap;
}

.toolbar-search { max-width: 280px; flex: 1; }

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
  padding: var(--sp-3) var(--sp-5);
  border-top: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.pagination-btn {
  height: 30px;
  min-width: 30px;
  padding: 0 var(--sp-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  transition: background var(--t-fast), color var(--t-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.pagination-btn:hover { background: var(--gray-100); color: var(--text-primary); }
.pagination-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.pagination-btn:disabled { opacity: 0.4; pointer-events: none; }

/* ============================================================
   Skeleton loader
   ============================================================ */
.skeleton {
  background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============================================================
   Empty state
   ============================================================ */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--text-secondary);
}

.empty-state-icon {
  color: var(--text-tertiary);
  margin: 0 auto var(--sp-3);
}

.empty-state-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-1);
}

.empty-state p {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--sp-4);
}

/* ============================================================
   Alert banners (inline)
   ============================================================ */
.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius);
  font-size: var(--text-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--sp-2);
  border: 1px solid transparent;
}

.alert-info    { background: var(--accent-subtle);  border-color: var(--accent);  color: var(--accent-text); }
.alert-success { background: var(--success-subtle); border-color: var(--success); color: var(--success); }
.alert-warning { background: var(--warning-subtle); border-color: var(--warning); color: var(--warning); }
.alert-danger  { background: var(--danger-subtle);  border-color: var(--danger);  color: var(--danger); }

/* ============================================================
   POS layout
   ============================================================ */
.pos-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--sp-4);
  height: calc(100vh - var(--header-h) - var(--sp-6) * 2);
}

.pos-left {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-height: 0;
}

.pos-right {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  min-height: 0;
}

.pos-cart {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.pos-search-result {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 320px;
  overflow-y: auto;
}

.pos-search-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--t-fast);
}

.pos-search-item:last-child { border-bottom: none; }
.pos-search-item:hover { background: var(--gray-50); }

.pos-cart-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--border);
}

.pos-cart-item:last-child { border-bottom: none; }

.pos-cart-item-info { flex: 1; min-width: 0; }

.pos-cart-item-name {
  font-size: var(--text-sm);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pos-cart-item-sub { font-size: var(--text-xs); color: var(--text-secondary); }

.qty-control {
  display: flex;
  align-items: center;
  gap: var(--sp-1);
}

.qty-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  transition: background var(--t-fast);
  cursor: pointer;
}
.qty-btn:hover { background: var(--gray-100); }

.qty-value {
  width: 36px;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 500;
}

.pos-totals {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-4);
}

.pos-total-row {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  padding: var(--sp-1) 0;
  color: var(--text-secondary);
}

.pos-total-row.final {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  padding-top: var(--sp-3);
  margin-top: var(--sp-2);
  border-top: 1px solid var(--border);
}

/* ============================================================
   Login page
   ============================================================ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--sp-6);
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--sp-8);
}

.login-logo {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--sp-8);
}

.login-logo span { color: var(--accent); }

.login-heading {
  font-size: var(--text-xl);
  font-weight: 600;
  margin-bottom: var(--sp-1);
}

.login-sub {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--sp-6);
}

.login-form { display: flex; flex-direction: column; gap: var(--sp-4); }

/* ============================================================
   Utility
   ============================================================ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.w-full { width: 100%; }
.mt-2 { margin-top: var(--sp-2); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-4 { margin-bottom: var(--sp-4); }
.text-sm  { font-size: var(--text-sm); }
.text-xs  { font-size: var(--text-xs); }
.text-secondary { color: var(--text-secondary); }
.text-danger    { color: var(--danger); }
.text-success   { color: var(--success); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
}

.hidden { display: none !important; }

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-4); }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--sp-4); }

/* Avatar styles */
.avatar {
  border-radius: 50%;
  object-fit: cover;
  background-color: var(--border);
  display: inline-block;
  box-shadow: 0 0 0 2px var(--surface);
}
.avatar-sm { width: 32px; height: 32px; }
.avatar-md { width: 40px; height: 40px; }
.avatar-lg { width: 48px; height: 48px; }

/* Chart container */
.chart-container {
  position: relative;
  width: 100%;
  height: 300px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: var(--header-h) 1fr;
  }

  .sidebar {
    display: none;
    grid-row: 1;
    position: fixed;
    inset: 0;
    z-index: 500;
    width: var(--sidebar-w);
  }

  .sidebar.open { display: flex; }

  .pos-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .stat-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .main-content { padding: var(--sp-4); }
}
