/* ============================================================
   APP.CSS — Layout, Navigation, Login, Screen-specific Styles
   Premium Design — KazeX Sport Manager PWA
   ============================================================ */

/* ---------- LOGIN SCREEN ---------- */
.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: var(--space-24);
  background: linear-gradient(135deg, #0f766e 0%, #065f5b 50%, #134e4a 100%);
  position: relative;
  overflow: hidden;
}
.login-screen::before {
  content: '';
  position: absolute;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  top: -120px;
  right: -120px;
  border-radius: 50%;
}
.login-screen::after {
  content: '';
  position: absolute;
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
  bottom: -100px;
  left: -100px;
  border-radius: 50%;
}
.login-container {
  width: 100%;
  max-width: 380px;
  position: relative;
  z-index: 1;
  animation: fade-up 0.5s ease;
}
.login-logo {
  text-align: center;
  margin-bottom: var(--space-32);
}
.login-icon {
  width: 80px;
  height: 80px;
  margin-bottom: var(--space-16);
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.2));
}
.login-title {
  font-size: var(--text-2xl);
  font-weight: var(--weight-bold);
  color: #ffffff;
  margin-bottom: var(--space-4);
  letter-spacing: -0.5px;
}
.login-subtitle {
  font-size: var(--text-sm);
  color: rgba(255,255,255,0.7);
}
.login-form {
  background: rgba(255,255,255,0.97);
  border: none;
  border-radius: var(--radius-2xl);
  padding: var(--space-32);
  box-shadow: 0 20px 60px rgba(0,0,0,0.3), 0 0 0 1px rgba(255,255,255,0.1);
  backdrop-filter: blur(20px);
}
[data-theme='dark'] .login-form {
  background: rgba(26,35,50,0.95);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-footer {
  text-align: center;
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.5);
  margin-top: var(--space-24);
}

/* ---------- APP SHELL ---------- */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- HEADER ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
  padding: 0 var(--space-20);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  backdrop-filter: blur(12px);
}
.header-title {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
  letter-spacing: -0.3px;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

/* ---------- MAIN CONTENT ---------- */
.main-content {
  flex: 1;
  padding-bottom: calc(var(--bottom-nav-height) + var(--space-16));
  overflow-y: auto;
}

/* ---------- PAGE ---------- */
.page {
  padding: var(--space-16);
  max-width: var(--content-max-width);
  margin: 0 auto;
  width: 100%;
  animation: fade-up 0.25s ease;
}
.page[hidden] { display: none; }
.page-loading { padding: var(--space-16) 0; }

.page-toolbar {
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  margin-bottom: var(--space-16);
}

/* ---------- BOTTOM NAVIGATION (Mobile) ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: stretch;
  height: var(--bottom-nav-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  box-shadow: 0 -4px 20px rgba(0,0,0,0.05);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

/* Nav brand — ẩn trên mobile */
.nav-brand { display: none; }
.nav-divider { display: none; }
.nav-spacer { display: none; }
.nav-item-logout { display: none; }

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-6) 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted);
  font-size: 10px;
  font-family: var(--font-family);
  font-weight: var(--weight-medium);
  transition: color 0.2s ease, transform 0.15s ease;
  position: relative;
  min-height: 44px;
}
.nav-item:hover { color: var(--color-text-secondary); }
.nav-item:active { transform: scale(0.92); }
.nav-item.active {
  color: var(--color-primary);
}
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  background: var(--color-primary);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.nav-item-icon { width: 22px; height: 22px; }
.nav-item-label { line-height: 1; }

/* ---------- PRODUCT CARD ---------- */
.product-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  cursor: pointer;
  transition: all 0.2s ease;
}
.product-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 4px 16px rgba(15, 118, 110, 0.08);
  transform: translateY(-1px);
}
.product-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-8); }
.product-card-name { font-weight: var(--weight-semibold); font-size: var(--text-md); }
.product-card-meta { display: flex; align-items: center; gap: var(--space-8); margin-top: var(--space-6); flex-wrap: wrap; }
.product-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-12); padding-top: var(--space-12); border-top: 1px solid var(--color-border-light); }
.product-card-price { font-weight: var(--weight-bold); color: var(--color-primary); font-size: var(--text-md); }
.product-card-stock { font-size: var(--text-sm); }

/* ---------- ORDER / STOCK-IN CARD ---------- */
.order-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-16);
  margin-bottom: var(--space-8);
  cursor: pointer;
  transition: all 0.2s ease;
}
.order-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.order-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-8); }
.order-card-id { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.order-card-date { font-size: var(--text-xs); color: var(--color-text-muted); }
.order-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-8); padding-top: var(--space-8); border-top: 1px solid var(--color-border-light); }

/* ---------- POS LAYOUT — Professional Redesign ---------- */
.pos-layout {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--header-height) - var(--bottom-nav-height));
  gap: 0;
}
.pos-left-panel {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.pos-right-panel {
  flex-shrink: 0;
  margin-top: auto;
}
.pos-search { padding: var(--space-8) 0 var(--space-12); }
.pos-search .search-bar .input {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  font-size: var(--text-md);
  height: 48px;
}
.pos-search .search-bar .input:focus {
  box-shadow: 0 0 0 3px rgba(var(--color-primary-rgb), 0.1), var(--shadow-sm);
}

/* Giỏ hàng */
.pos-cart {
  flex: 1;
  overflow-y: auto;
  padding: 0 var(--space-4);
  scroll-behavior: smooth;
}
.pos-cart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-8) var(--space-4);
  margin-bottom: var(--space-4);
}
.pos-cart-header-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: var(--space-6);
}
.pos-cart-count {
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  font-weight: var(--weight-bold);
  min-width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
}
.pos-cart-clear {
  font-size: var(--text-xs);
  color: var(--color-danger);
  cursor: pointer;
  background: none;
  border: none;
  font-family: var(--font-family);
  font-weight: var(--weight-medium);
  padding: var(--space-4) var(--space-8);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}
.pos-cart-clear:hover { background: var(--color-danger-light); }

/* Cart Item — Card style */
.pos-cart-item {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-12) var(--space-16);
  margin-bottom: var(--space-8);
  position: relative;
  transition: all 0.15s ease;
  animation: fade-up 0.2s ease;
}
.pos-cart-item:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-xs);
}
.pos-cart-item:last-child { margin-bottom: var(--space-4); }

.pos-cart-item-row {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}
.pos-cart-item-index {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-subtle);
  color: var(--color-primary);
  font-size: 11px;
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.pos-cart-item-info {
  flex: 1;
  min-width: 0;
}
.pos-cart-item-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text);
}
.pos-cart-item-meta {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  margin-top: var(--space-4);
}
.pos-cart-item-price {
  font-size: var(--text-xs);
  color: var(--color-text-muted);
  font-weight: var(--weight-medium);
}
.pos-cart-item-discount-tag {
  font-size: 10px;
  font-weight: var(--weight-bold);
  color: #fff;
  background: linear-gradient(135deg, #ef4444, #dc2626);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.3px;
  transition: transform 0.1s;
}
.pos-cart-item-discount-tag:hover { transform: scale(1.05); }
.pos-cart-item-add-discount {
  font-size: 11px;
  color: var(--color-primary);
  cursor: pointer;
  white-space: nowrap;
  font-weight: var(--weight-medium);
  opacity: 0.7;
  transition: opacity 0.15s;
}
.pos-cart-item-add-discount:hover { opacity: 1; }
.pos-cart-item-right {
  display: flex;
  align-items: center;
  gap: var(--space-8);
  flex-shrink: 0;
}
.pos-cart-item-total {
  font-weight: var(--weight-bold);
  font-size: var(--text-sm);
  white-space: nowrap;
  min-width: 80px;
  text-align: right;
  color: var(--color-primary);
}
.btn-remove {
  padding: 4px !important;
  opacity: 0.3;
  transition: all 0.15s;
  border-radius: var(--radius-sm);
}
.btn-remove:hover {
  opacity: 1;
  background: var(--color-danger-light);
  color: var(--color-danger);
}

/* ---------- POS CATEGORIES ---------- */
.pos-categories {
  padding: var(--space-4) 0 var(--space-8);
}
.pos-categories .chip-group {
  padding-bottom: var(--space-2);
}
.pos-categories .chip {
  font-size: var(--text-xs);
  padding: var(--space-4) var(--space-12);
  min-height: 32px;
}

/* ---------- POS PRODUCT GRID (Quick-add) ---------- */
.pos-product-section {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px dashed var(--color-border-light);
}
.pos-product-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-4);
  margin-bottom: var(--space-8);
}
.pos-product-section-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.pos-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-8);
}
.pos-product-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-12);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
}
.pos-product-card:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 12px rgba(var(--color-primary-rgb), 0.1);
  transform: translateY(-1px);
}
.pos-product-card:active { transform: scale(0.97); }
.pos-product-card.in-cart {
  border-color: var(--color-primary);
  background: var(--color-primary-subtle);
}
.pos-product-card-name {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1.3;
  color: var(--color-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: var(--space-4);
}
.pos-product-card-meta {
  display: flex;
  gap: var(--space-4);
  font-size: 10px;
  color: var(--color-text-muted);
  margin-bottom: var(--space-6);
}
.pos-product-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.pos-product-card-price {
  font-size: var(--text-xs);
  font-weight: var(--weight-bold);
  color: var(--color-primary);
}
.pos-product-card-stock {
  font-size: 10px;
  color: var(--color-text-placeholder);
}
.pos-product-card-qty {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  color: #fff;
  font-size: 10px;
  font-weight: var(--weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(var(--color-primary-rgb), 0.3);
}

/* Stepper nhỏ cho POS */
.stepper-sm { border-radius: var(--radius-md); }
.stepper-sm .stepper-btn {
  width: 30px;
  height: 30px;
  font-size: 15px;
  font-weight: var(--weight-bold);
}
.stepper-sm .stepper-value {
  width: 34px;
  height: 30px;
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
}

/* Summary — Professional */
.pos-summary {
  background: var(--color-surface);
  border-top: none;
  padding: var(--space-20) var(--space-16);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.08);
  position: relative;
}
.pos-summary::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--space-20);
  right: var(--space-20);
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary), #2dd4bf);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}

.pos-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-6) 0;
  font-size: var(--text-sm);
}
.pos-summary-row.clickable {
  cursor: pointer;
  padding: var(--space-6) var(--space-8);
  margin: 0 calc(var(--space-8) * -1);
  border-radius: var(--radius-md);
  transition: background 0.15s;
}
.pos-summary-row.clickable:hover { background: var(--color-surface-hover); }
.pos-summary-row.total {
  font-size: var(--text-xl);
  font-weight: var(--weight-bold);
  padding-top: var(--space-12);
  border-top: 2px solid var(--color-border);
  margin-top: var(--space-8);
  color: var(--color-primary);
  letter-spacing: -0.3px;
}

/* Kênh + thanh toán: inline layout */
.pos-actions-row {
  display: flex;
  gap: var(--space-8);
  align-items: stretch;
  margin-top: var(--space-12);
}
.pos-actions-row .select {
  flex: 1;
  min-height: 40px;
  font-size: var(--text-xs);
}

/* ---------- PAYMENT METHOD TOGGLE ---------- */
.payment-method-toggle {
  display: flex;
  gap: var(--space-6);
  flex-shrink: 0;
}
.payment-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
  padding: var(--space-8) var(--space-12);
  border: 2px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.payment-btn:hover { border-color: var(--color-primary-light); }
.payment-btn.active {
  border-color: var(--color-primary);
  background: linear-gradient(135deg, rgba(15,118,110,0.08), rgba(45,212,191,0.06));
  color: var(--color-primary);
  font-weight: var(--weight-semibold);
}

/* Checkout button */
.pos-checkout-btn {
  width: 100%;
  margin-top: var(--space-12);
  padding: var(--space-16);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
  border: none;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, var(--color-primary) 0%, #0d9488 50%, #14b8a6 100%);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  min-height: 52px;
  box-shadow: 0 4px 16px rgba(15,118,110,0.3);
  transition: all 0.2s ease;
  font-family: var(--font-family);
  letter-spacing: 0.3px;
  position: relative;
  overflow: hidden;
}
.pos-checkout-btn:hover {
  box-shadow: 0 6px 24px rgba(15,118,110,0.4);
  transform: translateY(-1px);
}
.pos-checkout-btn:active { transform: scale(0.98); }
.pos-checkout-btn .checkout-amount {
  font-size: var(--text-lg);
  font-weight: var(--weight-bold);
}

/* Note input */
.pos-note-input {
  width: 100%;
  margin-top: var(--space-8);
  padding: var(--space-8) var(--space-12);
  font-size: var(--text-xs);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-text-muted);
  font-family: var(--font-family);
  resize: none;
  height: 32px;
  transition: all 0.15s;
}
.pos-note-input:focus {
  border-color: var(--color-primary);
  border-style: solid;
  outline: none;
  color: var(--color-text);
  height: 56px;
}

/* ---------- DISCOUNT POPOVER ---------- */
.discount-popover {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 100;
  width: 280px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  padding: var(--space-16);
  animation: fade-up 0.15s ease;
}
.discount-popover-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  margin-bottom: var(--space-10);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.discount-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-6);
  margin-bottom: var(--space-10);
}
.discount-preset-btn {
  padding: var(--space-10) var(--space-4);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  font-size: var(--text-sm);
  font-weight: var(--weight-bold);
  color: var(--color-text);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}
.discount-preset-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: var(--color-primary-subtle);
}
.discount-preset-btn.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.discount-custom {
  display: flex;
  gap: var(--space-6);
  margin-bottom: var(--space-6);
}
.discount-custom .input {
  flex: 1;
  min-width: 0;
  padding: var(--space-8) var(--space-10);
  font-size: var(--text-sm);
}

/* Nút % trên giỏ hàng */
.pos-discount-btn.active {
  color: var(--color-danger) !important;
}

/* ---------- REPORT CHARTS ---------- */
.chart-container {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-20);
  margin-bottom: var(--space-16);
  transition: box-shadow 0.2s ease;
}
.chart-container:hover { box-shadow: var(--shadow-sm); }
.chart-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); margin-bottom: var(--space-16); color: var(--color-text-secondary); }
.chart-wrapper { position: relative; width: 100%; }

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-12);
}
.kpi-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-xl);
  padding: var(--space-16) var(--space-20);
  transition: all 0.2s ease;
}
.kpi-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.kpi-label { font-size: var(--text-xs); color: var(--color-text-muted); margin-bottom: var(--space-6); text-transform: uppercase; letter-spacing: 0.3px; }
.kpi-value { font-size: var(--text-xl); font-weight: var(--weight-bold); letter-spacing: -0.5px; }

/* ---------- SETTINGS ---------- */
.settings-group { margin-bottom: var(--space-24); }
.settings-group-title {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: var(--space-12);
  padding-left: var(--space-4);
}
.settings-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-14, 14px) var(--space-16);
  background: var(--color-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-8);
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 52px;
}
.settings-item:hover { background: var(--color-surface-hover); transform: translateX(2px); }
.settings-item-label { display: flex; align-items: center; gap: var(--space-12); }

/* Toggle switch */
.toggle { position: relative; width: 48px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--color-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background 0.3s ease;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: white;
  border-radius: 50%;
  transition: transform 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-track { background: var(--color-primary); }
.toggle input:checked + .toggle-track::after { transform: translateX(22px); }

/* ---------- FAB ---------- */
.fab {
  position: fixed;
  right: var(--space-20);
  bottom: calc(var(--bottom-nav-height) + var(--space-20));
  width: 56px;
  height: 56px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary) 0%, #0d6d66 100%);
  color: var(--color-text-inverse);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 20px rgba(15, 118, 110, 0.35);
  z-index: var(--z-base);
  transition: all 0.2s ease;
}
.fab:hover { box-shadow: 0 8px 28px rgba(15, 118, 110, 0.45); transform: translateY(-2px); }
.fab:active { transform: scale(0.92); }

/* ---------- SEARCH BAR ---------- */
.search-bar { position: relative; }
.search-bar-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--color-text-placeholder);
  pointer-events: none;
}
.search-bar .input { padding-left: 42px; }

/* ---------- LIST ITEM ---------- */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-12);
  padding: var(--space-12) var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: background 0.15s ease;
  border-radius: var(--radius-md);
}
.list-item:hover { background: var(--color-surface-hover); }
.list-item:last-child { border-bottom: none; }
.list-item-content { flex: 1; min-width: 0; }
.list-item-title { font-weight: var(--weight-medium); }
.list-item-subtitle { font-size: var(--text-xs); color: var(--color-text-muted); margin-top: 2px; }

/* ---------- SCANNER ---------- */
.scanner-container {
  width: 100%;
  max-width: 400px;
  margin: 0 auto;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: #000;
  aspect-ratio: 4/3;
}

/* ---------- INSTALL BANNER ---------- */
.install-banner {
  position: fixed;
  bottom: calc(var(--bottom-nav-height) + var(--space-8));
  left: var(--space-16);
  right: var(--space-16);
  z-index: var(--z-sticky);
  animation: slide-up 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.install-banner-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-12);
  padding: var(--space-14, 14px) var(--space-16);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}
.install-banner-info { display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-sm); min-width: 0; }
.install-banner-actions { display: flex; gap: var(--space-8); flex-shrink: 0; }

/* ---------- DIVIDER HELPER ---------- */
.divider {
  height: 1px;
  background: var(--color-border-light);
  margin: var(--space-12) 0;
}

/* ---------- ANIMATIONS ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===================== RESPONSIVE DESKTOP ===================== */
@media (min-width: 768px) {
  .app-shell { flex-direction: row; }

  .app-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
  }
  [data-theme='dark'] .app-header {
    background: rgba(15,20,25,0.85);
  }

  /* ===== SIDEBAR ===== */
  .bottom-nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    height: 100vh;
    flex-direction: column;
    border-top: none;
    border-right: 1px solid var(--color-border-light);
    box-shadow: none;
    padding: 0;
    padding-bottom: var(--space-12);
    align-items: stretch;
    gap: 0;
    background: var(--color-surface);
    overflow-y: auto;
  }

  /* Logo/Brand */
  .nav-brand {
    display: flex !important;
    align-items: center;
    gap: var(--space-12);
    padding: var(--space-20) var(--space-20) var(--space-16);
  }
  .nav-brand-icon { width: 36px; height: 36px; flex-shrink: 0; }
  .nav-brand-text { display: flex; flex-direction: column; }
  .nav-brand-name { font-size: var(--text-md); font-weight: var(--weight-bold); letter-spacing: -0.3px; color: var(--color-text); }
  .nav-brand-role { font-size: 11px; color: var(--color-primary); font-weight: var(--weight-medium); margin-top: 1px; }

  .nav-divider {
    display: block !important;
    height: 1px;
    background: var(--color-border-light);
    margin: 0 var(--space-16) var(--space-8);
  }
  .nav-spacer { display: block !important; flex: 1; }

  /* Nav items */
  .nav-item {
    flex: initial;
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-12);
    padding: var(--space-10) var(--space-16);
    border-radius: var(--radius-lg);
    margin: var(--space-2) var(--space-10);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    min-height: 42px;
    transition: all 0.15s ease;
  }
  .nav-item:hover {
    background: var(--color-surface-hover);
    color: var(--color-text);
    transform: none;
  }
  .nav-item.active {
    background: var(--color-primary-subtle);
    color: var(--color-primary);
    font-weight: var(--weight-semibold);
  }
  .nav-item.active::before {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  }
  .nav-item-icon { width: 20px; height: 20px; }

  /* Logout ở sidebar */
  .nav-item-logout {
    display: flex !important;
    color: var(--color-danger) !important;
    opacity: 0.7;
  }
  .nav-item-logout:hover { opacity: 1; background: var(--color-danger-light) !important; }

  /* Main content */
  .main-content {
    margin-left: var(--sidebar-width);
    margin-top: var(--header-height);
    padding-bottom: var(--space-32);
  }

  .page { max-width: 780px; padding: var(--space-24) var(--space-32); }
  .page[data-page="sales"] { max-width: 1100px; }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }

  .fab { bottom: var(--space-24); right: var(--space-24); }

  .install-banner {
    bottom: var(--space-16);
    left: calc(var(--sidebar-width) + var(--space-16));
  }

  /* POS Desktop — Split panel */
  .pos-layout {
    height: calc(100vh - var(--header-height) - var(--space-32));
    flex-direction: row;
    gap: var(--space-20);
  }
  .pos-left-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .pos-right-panel {
    width: 340px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
  }
  .pos-right-panel .pos-summary {
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-md);
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
  }
  .pos-cart-item {
    background: var(--color-surface);
  }
  .pos-product-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Large desktop */
@media (min-width: 1200px) {
  :root { --sidebar-width: 260px; }
  .page { max-width: 900px; }
  .page[data-page="sales"] { max-width: 1200px; }
}
