/* ═══════════════════════════════════════════════════════════
   SwiftStock POS — Custom Styles
   Extends Tailwind CSS with component-level styling,
   animations, receipt printing, and the Kinetic Enterprise
   design system.
   ═══════════════════════════════════════════════════════════ */

/* ── CSS Variables (Design Tokens) ──────────────────────── */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-container: #2563eb;
  --on-primary: #ffffff;
  --secondary: #565e74;
  --secondary-container: #dae2fd;
  --surface: #f8f9ff;
  --surface-container: #e5eeff;
  --surface-container-low: #eff4ff;
  --surface-card: #ffffff;
  --on-surface: #0b1c30;
  --on-surface-variant: #434655;
  --outline: #737686;
  --outline-variant: #c3c6d7;
  --inverse-surface: #1e293b;
  --inverse-on-surface: #eaf1ff;
  --error: #dc2626;
  --error-light: #fef2f2;
  --success: #059669;
  --success-light: #ecfdf5;
  --warning: #d97706;
  --warning-light: #fffbeb;
  --info: #2563eb;
  --info-light: #eff6ff;

  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --header-height: 64px;

  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,0.05);
  --shadow: 0 1px 3px rgba(15,23,42,0.08), 0 1px 2px rgba(15,23,42,0.04);
  --shadow-md: 0 4px 6px -1px rgba(15,23,42,0.07), 0 2px 4px -2px rgba(15,23,42,0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15,23,42,0.08), 0 4px 6px -4px rgba(15,23,42,0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15,23,42,0.1), 0 8px 10px -6px rgba(15,23,42,0.06);

  --transition: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Global Reset & Base ─────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; scroll-behavior: smooth; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--surface);
  color: var(--on-surface);
  line-height: 1.5;
  overflow: hidden;
  height: 100vh;
}
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--outline); }

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--inverse-surface);
  color: var(--inverse-on-surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width var(--transition);
  z-index: 40;
  overflow: hidden;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  min-height: 64px;
}
.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.sidebar-brand-icon span { color: #fff; font-size: 20px; }
.sidebar-brand-text h1 { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; color: #fff; line-height: 1.2; }
.sidebar-brand-text p { font-size: 11px; color: rgba(255,255,255,0.5); line-height: 1.3; }

.sidebar-nav { flex: 1; padding: 12px 10px; overflow-y: auto; }
.sidebar-section { margin-bottom: 8px; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.35);
  padding: 12px 12px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,0.65);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  position: relative;
  margin-bottom: 2px;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}
.nav-item .material-symbols-outlined { font-size: 20px; flex-shrink: 0; }
.nav-item-badge {
  margin-left: auto;
  background: var(--error);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 12px 10px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar-new-tx {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: all var(--transition);
  margin-bottom: 8px;
}
.sidebar-new-tx:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }

/* Main area */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Header */
.main-header {
  height: var(--header-height);
  background: var(--surface-card);
  border-bottom: 1px solid var(--outline-variant);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  flex-shrink: 0;
  z-index: 30;
}
.header-search {
  flex: 1;
  max-width: 400px;
  position: relative;
}
.header-search input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
  color: var(--on-surface);
  transition: all var(--transition);
}
.header-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.header-search .material-symbols-outlined {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--outline);
}
.header-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.header-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-variant);
  position: relative;
  transition: all var(--transition);
}
.header-btn:hover { background: var(--surface-container); }
.header-btn .dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--error);
  border-radius: 50%;
  border: 1.5px solid var(--surface-card);
}
.header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--success);
  padding: 4px 10px;
  background: var(--success-light);
  border-radius: var(--radius-full);
  font-weight: 500;
}
.header-status .dot-online { width: 6px; height: 6px; background: var(--success); border-radius: 50%; }
.header-lang-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--on-surface-variant);
  transition: all var(--transition);
}
.header-lang-toggle:hover { border-color: var(--primary); color: var(--primary); }
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 4px 4px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
}
.header-user:hover { background: var(--surface-container); }
.header-avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
}
.header-user-info { line-height: 1.3; }
.header-user-info .name { font-size: 13px; font-weight: 600; color: var(--on-surface); }
.header-user-info .role { font-size: 11px; color: var(--on-surface-variant); text-transform: capitalize; }

/* Content */
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ── Page Header ─────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}
.page-header-text h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; color: var(--on-surface); }
.page-header-text p { font-size: 13px; color: var(--on-surface-variant); margin-top: 2px; }
.page-header-actions { display: flex; gap: 8px; align-items: center; }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .material-symbols-outlined { font-size: 18px; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--surface-card); color: var(--on-surface); border: 1px solid var(--outline-variant); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-container-low); border-color: var(--outline); }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover:not(:disabled) { background: #047857; }
.btn-ghost { background: transparent; color: var(--on-surface-variant); }
.btn-ghost:hover { background: var(--surface-container); }
.btn-icon { width: 36px; height: 36px; padding: 0; }
.btn-icon.btn-sm { width: 28px; height: 28px; }

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 20px;
  transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.card-title { font-size: 15px; font-weight: 600; color: var(--on-surface); }

/* Stats Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stats-card {
  background: var(--surface-card);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: all var(--transition);
}
.stats-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.stats-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stats-icon .material-symbols-outlined { font-size: 22px; }
.stats-info { flex: 1; min-width: 0; }
.stats-label { font-size: 12px; font-weight: 500; color: var(--on-surface-variant); display: block; }
.stats-value { font-size: 22px; font-weight: 700; color: var(--on-surface); letter-spacing: -0.02em; font-family: 'JetBrains Mono', monospace; display: block; margin-top: 2px; }
.stats-trend { display: flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; margin-top: 4px; }
.trend-up { color: var(--success); }
.trend-down { color: var(--error); }
.trend-label { color: var(--on-surface-variant); font-weight: 400; }

/* ── Data Table ──────────────────────────────────────── */
.data-table-wrapper { background: var(--surface-card); border: 1px solid var(--outline-variant); border-radius: var(--radius-lg); overflow: hidden; }
.table-responsive { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--on-surface-variant);
  padding: 12px 16px;
  background: var(--surface-container-low);
  border-bottom: 1px solid var(--outline-variant);
  white-space: nowrap;
  user-select: none;
}
.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--on-surface); }
.sort-icon { vertical-align: middle; margin-left: 2px; opacity: 0.5; }
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 13px;
  color: var(--on-surface);
  vertical-align: middle;
}
.data-table tbody tr { transition: background var(--transition); }
.data-table tbody tr:hover { background: var(--surface-container-low); }
.data-table tbody tr.clickable { cursor: pointer; }
.empty-row { text-align: center; padding: 40px 16px !important; color: var(--on-surface-variant); }
.text-right { text-align: right; }
.font-mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }
.table-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--outline-variant);
}
.table-info { font-size: 12px; color: var(--on-surface-variant); }
.table-pagination { display: flex; gap: 4px; }

/* ── Badges ──────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-success { background: #ecfdf5; color: #065f46; }
.badge-warning { background: #fffbeb; color: #92400e; }
.badge-danger { background: #fef2f2; color: #991b1b; }
.badge-info { background: #eff6ff; color: #1e40af; }
.badge-primary { background: var(--primary-light); color: var(--primary-dark); }
.badge-default { background: var(--surface-container); color: var(--on-surface-variant); }

/* ── Forms ───────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { grid-template-columns: repeat(3, 1fr); }
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--on-surface-variant); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.03em; }
.text-danger { color: var(--error); }
.form-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--on-surface);
  background: var(--surface-card);
  transition: all var(--transition);
  font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }
.form-input:read-only { background: var(--surface-container-low); color: var(--on-surface-variant); }
select.form-input { cursor: pointer; }

/* ── Modal ───────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  transition: background var(--transition-slow);
  padding: 24px;
}
.modal-backdrop.active { background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(4px); }
.modal-container {
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  transition: all var(--transition-slow);
}
.modal-backdrop.active .modal-container { transform: translateY(0) scale(1); opacity: 1; }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  border-bottom: 1px solid var(--outline-variant);
}
.modal-title { font-size: 16px; font-weight: 700; color: var(--on-surface); }
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface-variant);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--surface-container); color: var(--on-surface); }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--outline-variant);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── Toast ───────────────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--surface-card);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid;
  min-width: 300px;
  max-width: 420px;
  transform: translateX(120%);
  opacity: 0;
  transition: all var(--transition-slow);
}
.toast.active { transform: translateX(0); opacity: 1; }
.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--error); }
.toast-warning { border-color: var(--warning); }
.toast-info { border-color: var(--info); }
.toast-icon { font-size: 20px; flex-shrink: 0; }
.toast-success .toast-icon { color: var(--success); }
.toast-error .toast-icon { color: var(--error); }
.toast-warning .toast-icon { color: var(--warning); }
.toast-info .toast-icon { color: var(--info); }
.toast-message { flex: 1; font-size: 13px; font-weight: 500; color: var(--on-surface); }
.toast-close { background: none; border: none; cursor: pointer; color: var(--on-surface-variant); padding: 2px; flex-shrink: 0; }

/* ── Tabs ────────────────────────────────────────────── */
.tabs-container { display: flex; gap: 4px; padding: 4px; background: var(--surface-container-low); border-radius: var(--radius-md); margin-bottom: 20px; }
.tab-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: var(--on-surface-variant);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
}
.tab-btn:hover { color: var(--on-surface); background: rgba(255,255,255,0.5); }
.tab-btn.active { background: var(--surface-card); color: var(--primary); font-weight: 600; box-shadow: var(--shadow-sm); }

/* ── Search Input ────────────────────────────────────── */
.search-input-wrapper { position: relative; }
.search-input-wrapper .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 18px;
  color: var(--outline);
}
.search-input {
  width: 100%;
  padding: 9px 12px 9px 38px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface-card);
  font-size: 13px;
  color: var(--on-surface);
  transition: all var(--transition);
}
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12); }

/* ── Chart ───────────────────────────────────────────── */
.chart-wrapper { position: relative; }
.chart-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  padding-top: 12px;
}
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--on-surface-variant); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Empty State ─────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-icon { font-size: 56px; color: var(--outline-variant); display: block; margin-bottom: 12px; }
.empty-title { font-size: 16px; font-weight: 600; color: var(--on-surface); margin-bottom: 4px; }
.empty-message { font-size: 13px; color: var(--on-surface-variant); margin-bottom: 16px; }

/* ── Spinner ─────────────────────────────────────────── */
.spinner {
  border: 3px solid var(--outline-variant);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Filter Bar ──────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-bar .search-input-wrapper { flex: 1; min-width: 200px; }
.filter-select {
  padding: 9px 12px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface-card);
  font-size: 13px;
  color: var(--on-surface);
  cursor: pointer;
  min-width: 140px;
}
.filter-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-pill {
  padding: 6px 14px;
  border-radius: var(--radius-full);
  border: 1px solid var(--outline-variant);
  background: var(--surface-card);
  font-size: 12px;
  font-weight: 500;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-pill:hover { border-color: var(--primary); color: var(--primary); }
.filter-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ═══════════════════════════════════════════════════════
   POS PAGE SPECIFIC STYLES
   ═══════════════════════════════════════════════════════ */
.pos-layout { display: flex; height: calc(100vh - var(--header-height)); }
.pos-products-panel {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  border-right: 1px solid var(--outline-variant);
}
.pos-cart-panel {
  width: 380px;
  display: flex;
  flex-direction: column;
  background: var(--surface-card);
  flex-shrink: 0;
}
.pos-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--outline-variant);
}
.pos-cart-items {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
}
.pos-cart-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.pos-cart-item-thumb {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--surface-container-low);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--on-surface-variant);
  overflow: hidden;
}
.pos-cart-item-info { flex: 1; min-width: 0; }
.pos-cart-item-name { font-size: 13px; font-weight: 500; color: var(--on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pos-cart-item-price { font-size: 12px; color: var(--on-surface-variant); font-family: 'JetBrains Mono', monospace; }
.pos-cart-qty {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  overflow: hidden;
}
.pos-cart-qty button {
  width: 28px;
  height: 28px;
  border: none;
  background: var(--surface-container-low);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--on-surface);
  transition: background var(--transition);
}
.pos-cart-qty button:hover { background: var(--surface-container); }
.pos-cart-qty span {
  width: 32px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
}
.pos-cart-item-total {
  font-size: 13px;
  font-weight: 600;
  font-family: 'JetBrains Mono', monospace;
  color: var(--on-surface);
  min-width: 70px;
  text-align: right;
}
.pos-cart-item-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--outline);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all var(--transition);
}
.pos-cart-item-remove:hover { background: var(--error-light); color: var(--error); }

.pos-cart-summary { padding: 16px 20px; border-top: 1px solid var(--outline-variant); }
.pos-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
  color: var(--on-surface-variant);
}
.pos-summary-row.total {
  padding-top: 10px;
  margin-top: 6px;
  border-top: 2px solid var(--on-surface);
  font-size: 18px;
  font-weight: 700;
  color: var(--on-surface);
  font-family: 'JetBrains Mono', monospace;
}
.pos-payment-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 20px 8px;
}
.pos-pay-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface-card);
  cursor: pointer;
  transition: all var(--transition);
  font-size: 11px;
  font-weight: 600;
  color: var(--on-surface-variant);
}
.pos-pay-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }
.pos-pay-btn .material-symbols-outlined { font-size: 20px; }
.pos-pay-btn .shortcut { font-size: 9px; font-weight: 400; color: var(--outline); }

.pos-checkout-btn {
  margin: 10px 20px 16px;
  padding: 14px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all var(--transition);
}
.pos-checkout-btn:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3); }
.pos-checkout-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 12px;
}
.pos-product-card {
  background: var(--surface-card);
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius-md);
  padding: 12px;
  cursor: pointer;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
}
.pos-product-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pos-product-card.out-of-stock { opacity: 0.5; cursor: not-allowed; }
.pos-product-thumb {
  width: 100%;
  height: 80px;
  border-radius: var(--radius-sm);
  background: var(--surface-container-low);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  overflow: hidden;
}
.pos-product-thumb .material-symbols-outlined { font-size: 28px; color: var(--outline-variant); }
.pos-product-name { font-size: 12px; font-weight: 500; color: var(--on-surface); line-height: 1.3; margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pos-product-price { font-size: 14px; font-weight: 700; color: var(--primary); font-family: 'JetBrains Mono', monospace; }
.pos-product-stock {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}
.pos-stock-ok { background: #ecfdf5; color: #065f46; }
.pos-stock-low { background: #fffbeb; color: #92400e; }
.pos-stock-out { background: #fef2f2; color: #991b1b; }

.pos-status-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 20px;
  background: var(--inverse-surface);
  color: rgba(255,255,255,0.7);
  font-size: 11px;
}
.pos-status-bar .status-dot { width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; display: inline-block; }
.pos-status-bar .status-ok { background: #4ade80; }
.pos-status-bar .clock { margin-left: auto; font-family: 'JetBrains Mono', monospace; color: rgba(255,255,255,0.9); }

/* Quick nominal buttons */
.quick-nominal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.quick-nominal-btn {
  padding: 12px 8px;
  border: 1px solid var(--outline-variant);
  border-radius: var(--radius);
  background: var(--surface-card);
  cursor: pointer;
  text-align: center;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--on-surface);
  transition: all var(--transition);
}
.quick-nominal-btn:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

/* Shift indicator */
.shift-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
}
.shift-active { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.shift-closed { background: var(--surface-container-low); color: var(--on-surface-variant); border: 1px solid var(--outline-variant); }

/* ═══════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════ */
.login-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  overflow: auto;
}
.login-left {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 48px;
  position: relative;
}
.login-left::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 30% 50%, rgba(37, 99, 235, 0.15), transparent 60%);
  pointer-events: none;
}
.login-branding { text-align: center; z-index: 1; }
.login-branding-icon {
  width: 64px;
  height: 64px;
  background: var(--primary);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  box-shadow: 0 8px 32px rgba(37, 99, 235, 0.3);
}
.login-branding-icon span { color: #fff; font-size: 32px; }
.login-branding h1 { font-size: 32px; font-weight: 800; color: #fff; letter-spacing: -0.03em; }
.login-branding p { font-size: 14px; color: rgba(255,255,255,0.5); margin-top: 8px; max-width: 320px; }
.login-features {
  margin-top: 48px;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.login-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
}
.login-feature .material-symbols-outlined { font-size: 20px; color: var(--primary); }

.login-right {
  width: 480px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  flex-shrink: 0;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface-card);
  border-radius: var(--radius-xl);
  padding: 36px;
  box-shadow: var(--shadow-xl);
}
.login-card h2 { font-size: 22px; font-weight: 700; color: var(--on-surface); margin-bottom: 4px; }
.login-card p.subtitle { font-size: 13px; color: var(--on-surface-variant); margin-bottom: 28px; }
.login-card .form-group { margin-bottom: 18px; }
.login-card .btn-primary { width: 100%; padding: 12px; font-size: 14px; margin-top: 8px; }
.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--on-surface-variant);
  cursor: pointer;
}
.login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}
.login-error-msg {
  background: var(--error-light);
  color: var(--error);
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
  align-items: center;
  gap: 8px;
}
.login-error-msg.show { display: flex; }
.login-demo-info {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--outline-variant);
}
.login-demo-info p { font-size: 11px; color: var(--on-surface-variant); margin-bottom: 8px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.demo-account {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  font-size: 12px;
  color: var(--on-surface-variant);
  cursor: pointer;
  transition: color var(--transition);
}
.demo-account:hover { color: var(--primary); }
.demo-account code { font-family: 'JetBrains Mono', monospace; font-size: 11px; background: var(--surface-container-low); padding: 2px 6px; border-radius: 4px; }

/* ═══════════════════════════════════════════════════════
   RECEIPT PRINT STYLES
   ═══════════════════════════════════════════════════════ */
.receipt-preview { display: flex; justify-content: center; padding: 8px; }
.receipt-paper {
  width: 300px;
  background: #fff;
  padding: 20px 16px;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 11px;
  color: #000;
  line-height: 1.5;
  border: 1px dashed #ccc;
  border-radius: 4px;
}
.receipt-header { text-align: center; margin-bottom: 8px; }
.receipt-store-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.receipt-store-info { font-size: 10px; color: #555; margin: 0; }
.receipt-divider { border-top: 1px dashed #999; margin: 8px 0; }
.receipt-meta-row { display: flex; justify-content: space-between; font-size: 10px; }
.receipt-items { width: 100%; border-collapse: collapse; }
.receipt-items th { font-size: 10px; text-align: left; border-bottom: 1px solid #ccc; padding: 4px 0; }
.receipt-items td { padding: 3px 0; font-size: 10px; vertical-align: top; }
.receipt-item-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-item-qty { text-align: center; }
.receipt-item-price, .receipt-item-total { text-align: right; }
.receipt-totals { }
.receipt-total-row { display: flex; justify-content: space-between; padding: 2px 0; font-size: 11px; }
.receipt-grand-total { font-size: 14px; font-weight: 700; padding: 6px 0; }
.receipt-payment { }
.receipt-footer { text-align: center; font-size: 10px; color: #555; }
.receipt-barcode { text-align: center; margin-top: 12px; }
.receipt-receipt-no { font-size: 9px; color: #888; margin-top: 4px; }
.receipt-discount-row td { color: var(--error); }

/* ── Print Media ─────────────────────────────────────── */
@media print {
  body * { visibility: hidden; }
  #receipt-print-area, #receipt-print-area * { visibility: visible; }
  #receipt-print-area {
    position: fixed;
    left: 0;
    top: 0;
    width: 80mm;
    padding: 0;
    margin: 0;
  }
  .receipt-paper { border: none; padding: 4mm; }
  .modal-backdrop, .modal-header, .modal-footer { display: none !important; }
}

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════ */
@media (max-width: 1280px) {
  .pos-cart-panel { width: 340px; }
}
@media (max-width: 1024px) {
  .sidebar { position: fixed; left: -280px; z-index: 50; height: 100vh; }
  .sidebar.open { left: 0; box-shadow: var(--shadow-xl); }
  .main-content { padding: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { width: 100%; }
  .pos-cart-panel { width: 300px; }
}
@media (max-width: 768px) {
  .pos-layout { flex-direction: column; }
  .pos-products-panel { border-right: none; border-bottom: 1px solid var(--outline-variant); }
  .pos-cart-panel { width: 100%; height: 50vh; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; gap: 12px; }
  .page-header-actions { width: 100%; }
  .filter-bar { flex-direction: column; }
  .pos-product-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ── Utility Classes ─────────────────────────────────── */
.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; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--on-surface-variant); }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-mono { font-family: 'JetBrains Mono', monospace; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
