:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #eff6ff;
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #2563eb;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --surface: #ffffff;
  --bg: #f1f5f9;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-muted: #64748b;
  --green: #059669;
  --green-light: #d1fae5;
  --red: #dc2626;
  --red-light: #fee2e2;
  --orange: #d97706;
  --orange-light: #fef3c7;
  --purple: #7c3aed;
  --purple-light: #ede9fe;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }

.hidden { display: none !important; }

/* ===== LOGIN ===== */
.login-screen {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 50%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-container {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 20px;
  padding: 48px 40px;
  width: 400px;
  text-align: center;
  box-shadow: 0 25px 50px rgba(0,0,0,0.5);
}
.login-logo { font-size: 56px; margin-bottom: 12px; animation: bounce 2s infinite; display:flex; justify-content:center; align-items:center; }
.login-logo img { animation: bounce 2s infinite; }
@keyframes bounce { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
.login-title { font-size: 24px; font-weight: 800; color: white; margin-bottom: 4px; }
.login-subtitle { color: rgba(255,255,255,0.5); font-size: 12px; margin-bottom: 28px; }
.login-role-tabs { display: flex; gap: 8px; margin-bottom: 28px; }
.role-tab {
  flex: 1; padding: 10px 8px; border: 1px solid rgba(255,255,255,0.2);
  background: transparent; color: rgba(255,255,255,0.6);
  border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; transition: all 0.2s;
}
.role-tab.active { background: var(--primary); border-color: var(--primary); color: white; }
.role-tab:hover:not(.active) { background: rgba(255,255,255,0.1); color: white; }
.pin-label { color: rgba(255,255,255,0.6); font-size: 12px; margin-bottom: 12px; }
.pin-display {
  font-size: 32px; letter-spacing: 12px; color: white; margin-bottom: 24px;
  font-weight: 700; min-height: 44px;
}
/* Placeholder state — no letter-spacing so Chinese/text renders normally */
.pin-display.pin-empty {
  font-size: 14px; letter-spacing: 0.5px; color: rgba(255,255,255,0.4);
  font-weight: 400; font-style: italic;
}
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.pin-btn {
  padding: 16px; background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 10px; color: white; font-size: 20px; font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.pin-btn:hover { background: rgba(255,255,255,0.2); transform: scale(1.05); }
.pin-btn:active { transform: scale(0.95); }
.pin-clear { color: #f87171; }
.pin-enter { background: var(--primary) !important; border-color: var(--primary) !important; color: white; }
.pin-enter:hover { background: var(--primary-dark) !important; }
.login-hint { color: rgba(255,255,255,0.35); font-size: 11px; margin-top: 8px; }

/* ===== APP LAYOUT ===== */
.app { display: flex; height: 100vh; overflow: hidden; }

/* ===== SIDEBAR ===== */
.sidebar {
  width: 240px; background: var(--sidebar-bg); display: flex; flex-direction: column;
  flex-shrink: 0; transition: width 0.3s; overflow: hidden; z-index: 50;
}
.sidebar.collapsed { width: 64px; }
.sidebar-header {
  padding: 16px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08); min-height: 64px;
}
.sidebar-logo { font-size: 28px; flex-shrink: 0; }
.sidebar-info { flex: 1; overflow: hidden; }
.sidebar-title { color: white; font-weight: 700; font-size: 14px; white-space: nowrap; }
.sidebar-user { color: var(--sidebar-text); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-toggle { background: none; border: none; color: var(--sidebar-text); cursor: pointer; font-size: 18px; flex-shrink: 0; padding: 4px; }
.sidebar.collapsed .sidebar-info { display: none; }
.sidebar.collapsed .sidebar-header { justify-content: center; padding: 16px 8px; }
.sidebar.collapsed .sidebar-logo { display: none; }
.sidebar.collapsed .sidebar-toggle { font-size: 20px; opacity: 0.8; }

.sidebar-nav { flex: 1; padding: 12px 8px; overflow-y: auto; overflow-x: hidden; }
.sidebar-nav::-webkit-scrollbar { width: 3px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.nav-section-label {
  color: rgba(255,255,255,0.4); font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; padding: 10px 8px 5px; white-space: nowrap; overflow: hidden;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none; transition: color 0.15s;
}
.nav-section-label:hover { color: rgba(255,255,255,0.75); }
.nav-section-label .nav-chevron {
  font-size: 9px; display: inline-block; width: 10px; text-align: center;
  transition: transform 0.2s ease; transform: rotate(0deg); opacity: 0.7;
}
.nav-section-label.collapsed .nav-chevron { transform: rotate(-90deg); }
.nav-section-label .nav-section-title { flex: 1; }
.nav-section-items { display: block; overflow: hidden; transition: max-height 0.25s ease; }
.nav-section-items.collapsed { display: none; }
.sidebar.collapsed .nav-section-label { display: none; }
.sidebar.collapsed .nav-section-items.collapsed { display: block; }

.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 8px; cursor: pointer; transition: all 0.15s; margin-bottom: 2px;
  color: var(--sidebar-text); white-space: nowrap; overflow: hidden; text-decoration: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: var(--sidebar-active); color: white; }
.nav-item .nav-icon { font-size: 18px; flex-shrink: 0; }
.nav-item .nav-label { font-size: 13px; font-weight: 500; flex: 1; }
.nav-item .nav-badge {
  background: var(--red); color: white; border-radius: 10px;
  font-size: 10px; font-weight: 700; padding: 1px 6px; min-width: 18px; text-align: center;
}
.sidebar.collapsed .nav-label, .sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer { padding: 12px 8px; border-top: 1px solid rgba(255,255,255,0.08); }
.sidebar-logout {
  width: 100%; padding: 10px 12px; background: none; border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px; color: var(--sidebar-text); cursor: pointer; font-size: 13px; transition: all 0.2s;
  white-space: nowrap; overflow: hidden; text-align: left; display: flex; align-items: center; gap: 8px;
}
.sidebar-logout:hover { background: rgba(220,38,38,0.2); color: #f87171; border-color: #f87171; }
.sidebar.collapsed .sidebar-logout span { display: none; }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: 64px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
  flex-shrink: 0; box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-title { font-size: 18px; font-weight: 700; }
.topbar-badge {
  background: var(--primary-light); color: var(--primary); border-radius: 12px;
  padding: 2px 10px; font-size: 11px; font-weight: 700;
}
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-time { color: var(--text-muted); font-size: 13px; }

/* Fullscreen toggle button in topbar — sits between lang switcher and time. */
.fullscreen-btn {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border: 0;
  border-radius: 8px;
  width: 38px; height: 38px;
  font-size: 18px; color: #fff;
  cursor: pointer; padding: 0;
  display: inline-flex !important; align-items: center; justify-content: center;
  transition: all 0.15s;
  box-shadow: 0 2px 6px rgba(37,99,235,0.3);
  flex-shrink: 0;
}
.fullscreen-btn:hover  { transform: scale(1.08); box-shadow: 0 4px 10px rgba(37,99,235,0.5); }
.fullscreen-btn:active { transform: scale(0.95); }
@media (max-width: 600px) {
  .fullscreen-btn { width: 34px; height: 34px; font-size: 16px; }
}
.topbar-user { font-size: 13px; font-weight: 600; background: var(--primary-light); color: var(--primary); padding: 6px 12px; border-radius: 20px; }

.content-area { flex: 1; overflow-y: auto; padding: 24px; }
.content-area::-webkit-scrollbar { width: 6px; }
.content-area::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ===== CARDS ===== */
.card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px;
}
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-actions { display: flex; gap: 8px; }

/* ===== KPI CARDS ===== */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
@media(max-width:1200px) { .kpi-grid { grid-template-columns: repeat(2,1fr); } }
.kpi-card {
  background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border);
  box-shadow: var(--shadow); padding: 20px; display: flex; align-items: flex-start; gap: 16px;
}
.kpi-icon { width: 48px; height: 48px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0; }
.kpi-data .kpi-value { font-size: 26px; font-weight: 800; line-height: 1; }
.kpi-data .kpi-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.kpi-data .kpi-change { font-size: 12px; font-weight: 600; margin-top: 6px; }
.kpi-change.up { color: var(--green); }
.kpi-change.down { color: var(--red); }

/* ===== GRIDS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }
@media(max-width:900px) { .grid-2,.grid-3,.grid-4 { grid-template-columns:1fr; } }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border-radius: 8px; border: none; cursor: pointer; font-size: 13px; font-weight: 600;
  transition: all 0.15s; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--green); color: white; }
.btn-success:hover { background: #047857; }
.btn-danger { background: var(--red); color: white; }
.btn-danger:hover { background: #b91c1c; }
.btn-warning { background: var(--orange); color: white; }
.btn-warning:hover { background: #b45309; }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

/* ===== TABLES ===== */
.table-container { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; }
thead th { background: #f8fafc; padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap; }
tbody td { padding: 12px 16px; border-top: 1px solid var(--border); vertical-align: middle; }
tbody tr:hover { background: #f8fafc; }
tbody tr:first-child td { border-top: none; }

/* ===== BADGES ===== */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-green { background: var(--green-light); color: #065f46; }
.badge-red { background: var(--red-light); color: #991b1b; }
.badge-orange { background: var(--orange-light); color: #92400e; }
.badge-blue { background: var(--primary-light); color: var(--primary-dark); }
.badge-purple { background: var(--purple-light); color: #5b21b6; }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }

/* ===== FORMS ===== */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.3px; }
.form-control {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; color: var(--text); background: var(--surface); transition: border-color 0.2s;
  font-family: inherit;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }
.form-control option { color: var(--text); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ===== POS SPECIFIC ===== */
.pos-layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; height: calc(100vh - 160px); }
.pos-products { display: flex; flex-direction: column; overflow: hidden; }
.pos-cart { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }

.category-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.cat-tab { padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--border); background: var(--surface); cursor: pointer; font-size: 12px; font-weight: 600; color: var(--text-muted); transition: all 0.15s; }
.cat-tab:hover { border-color: var(--primary); color: var(--primary); }
.cat-tab.active { background: var(--primary); border-color: var(--primary); color: white; }
.cat-tab-action { color: #fff !important; font-weight: 800; letter-spacing: 0.2px; text-shadow: 0 1px 2px rgba(0,0,0,0.22); }
.cat-tab-course-fee {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border-color: #5b21b6;
  box-shadow: 0 6px 16px rgba(91,33,182,0.24);
}
.cat-tab-course-fee:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
  border-color: #4c1d95;
  color: #fff !important;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(91,33,182,0.28);
}
.cat-tab-course-fee:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(91,33,182,0.22);
}

.product-search { position: relative; margin-bottom: 14px; }
.product-search input { width: 100%; padding: 9px 12px 9px 36px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; }
.product-search input:focus { outline: none; border-color: var(--primary); }
.product-search .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.products-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; align-content: start; }
.products-grid::-webkit-scrollbar { width: 4px; }
.products-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.product-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 10px;
  padding: 14px 10px; text-align: center; cursor: pointer; transition: all 0.15s;
  position: relative;
}
.product-card:hover { border-color: var(--primary); box-shadow: 0 4px 12px rgba(37,99,235,0.15); transform: translateY(-2px); }
.product-card:active { transform: scale(0.97); }
.product-card .p-emoji { font-size: 32px; margin-bottom: 6px; }
.product-card .p-name { font-size: 11px; font-weight: 600; color: var(--text); line-height: 1.3; margin-bottom: 4px; }
.product-card .p-price { font-size: 14px; font-weight: 800; color: var(--primary); }
.product-card .p-stock { position: absolute; top: 6px; right: 6px; background: var(--bg); border-radius: 4px; padding: 1px 5px; font-size: 10px; color: var(--text-muted); }
.product-card.out-of-stock { opacity: 0.4; cursor: not-allowed; }
.product-card.low-stock .p-stock { background: var(--orange-light); color: var(--orange); }

.cart-header { padding: 16px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.cart-header h3 { font-size: 15px; font-weight: 700; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px; }
.cart-items::-webkit-scrollbar { width: 3px; }
.cart-item { display: flex; align-items: center; gap: 10px; padding: 10px; background: var(--bg); border-radius: 8px; margin-bottom: 8px; }
.cart-item-emoji { font-size: 20px; flex-shrink: 0; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { font-size: 12px; color: var(--text-muted); }
.cart-item-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.qty-btn { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.qty-btn:hover { background: var(--primary); color: white; border-color: var(--primary); }
.qty-display { font-size: 13px; font-weight: 700; min-width: 20px; text-align: center; }
.cart-item-total { font-size: 13px; font-weight: 700; color: var(--primary); min-width: 52px; text-align: right; flex-shrink: 0; }

.cart-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); padding: 40px; }
.cart-empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }

.cart-footer { padding: 14px 18px; border-top: 1px solid var(--border); }
.cart-discount-row { display: flex; gap: 8px; margin-bottom: 12px; }
.cart-discount-row input { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; }
.cart-summary { background: var(--bg); border-radius: 8px; padding: 12px; margin-bottom: 12px; }
.cart-summary-row { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.cart-summary-row.total { font-weight: 800; font-size: 18px; color: var(--text); margin-top: 8px; padding-top: 8px; border-top: 1.5px solid var(--border); margin-bottom: 0; }
.payment-methods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.pay-method { padding: 8px; border: 1.5px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; font-size: 11px; font-weight: 600; text-align: center; transition: all 0.15s; }
.pay-method:hover { border-color: var(--primary); color: var(--primary); }
.pay-method.active { background: var(--primary); border-color: var(--primary); color: white; }

/* ===== INVENTORY ===== */
.stock-indicator { display: flex; align-items: center; gap: 8px; }
.stock-bar-wrap { flex: 1; height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.stock-bar { height: 100%; border-radius: 3px; transition: width 0.3s; }
.stock-ok .stock-bar { background: var(--green); }
.stock-low .stock-bar { background: var(--orange); }
.stock-out .stock-bar { background: var(--red); }

/* ===== DASHBOARD ===== */
.chart-container { position: relative; height: 240px; }

/* ===== MODAL ===== */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-overlay.hidden { display: none; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg); }
.modal-header { padding: 20px 24px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-header h3 { font-size: 17px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--text-muted); padding: 4px; border-radius: 6px; }
.modal-close:hover { background: var(--bg); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-lg { max-width: 740px; }
.modal-xl { max-width: 980px; }

/* ===== TOAST ===== */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1e293b; color: white; padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 360px;
  animation: slideIn 0.3s ease; border-left: 4px solid var(--primary);
}
.toast.success { border-color: var(--green); }
.toast.error { border-color: var(--red); }
.toast.warning { border-color: var(--orange); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ===== MISC ===== */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.page-title { font-size: 18px; font-weight: 700; }
.section-title { font-size: 14px; font-weight: 700; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.font-bold { font-weight: 700; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-primary { color: var(--primary); }
.text-orange { color: var(--orange); }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.mt-2 { margin-top: 8px; }
.mb-2 { margin-bottom: 8px; }

.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }

.search-bar { display: flex; gap: 10px; margin-bottom: 16px; }
.search-bar input { flex: 1; padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; }
.search-bar input:focus { outline: none; border-color: var(--primary); }
.search-bar select { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: 8px; font-size: 14px; background: var(--surface); color: var(--text); }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary-light); display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.avatar-sm { width: 28px; height: 28px; font-size: 14px; }

.progress-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--primary); }

/* Payment modal specific */
.payment-numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.numpad-btn { padding: 14px; background: var(--bg); border: 1px solid var(--border); border-radius: 8px; font-size: 18px; font-weight: 600; cursor: pointer; text-align: center; transition: all 0.15s; }
.numpad-btn:hover { background: var(--primary-light); color: var(--primary); }
.amount-display { background: var(--sidebar-bg); color: white; padding: 16px; border-radius: 8px; font-size: 28px; font-weight: 800; text-align: right; margin-bottom: 12px; letter-spacing: 1px; }

.receipt-modal { font-family: 'Courier New', monospace; }
.receipt-header { text-align: center; border-bottom: 2px dashed var(--border); padding-bottom: 16px; margin-bottom: 16px; }
.receipt-items { margin-bottom: 12px; }
.receipt-item { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.receipt-total { border-top: 2px dashed var(--border); padding-top: 12px; display: flex; justify-content: space-between; font-size: 16px; font-weight: 700; }
.receipt-footer { text-align: center; margin-top: 16px; font-size: 12px; color: var(--text-muted); }

.stat-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.stat-row:last-child { border-bottom: none; }
.stat-label { font-size: 13px; color: var(--text-muted); }
.stat-value { font-size: 14px; font-weight: 700; }

/* Top products list */
.top-product-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.top-product-item:last-child { border-bottom: none; }
.top-product-rank { width: 24px; height: 24px; border-radius: 50%; background: var(--bg); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.top-product-rank.gold { background: #fef3c7; color: #92400e; }
.top-product-rank.silver { background: #f1f5f9; color: var(--text-muted); }
.top-product-rank.bronze { background: #fff7ed; color: #9a3412; }
.top-product-info { flex: 1; }
.top-product-name { font-size: 13px; font-weight: 600; }
.top-product-qty { font-size: 11px; color: var(--text-muted); }
.top-product-revenue { font-size: 14px; font-weight: 700; color: var(--primary); }

/* Booking calendar */
.booking-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 10px; display: flex; gap: 14px; border-left: 4px solid var(--primary); }
.booking-card.coaching { border-color: var(--purple); }
.booking-card.sparring { border-color: var(--green); }
.booking-card.cancelled { border-color: var(--border); opacity: 0.6; }
.booking-time { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.booking-name { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.booking-detail { font-size: 12px; color: var(--text-muted); }

/* Alerts */
.alert { padding: 12px 16px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; display: flex; align-items: flex-start; gap: 10px; }
.alert-warning { background: var(--orange-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #bfdbfe; }
.alert-success { background: var(--green-light); color: #065f46; border: 1px solid #6ee7b7; }

/* ===== MUSIC PLAYER ===== */
#music-player {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9000;
  background: #0f172a; border-top: 1px solid #1e293b;
  display: flex; align-items: center; gap: 0;
  transition: transform 0.3s ease; height: 64px;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.3);
}
#music-player.minimized { transform: translateY(52px); }
#music-player.hidden-player { display: none; }

.mp-toggle { width: 64px; height: 64px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; cursor: pointer; background: #1e293b; border-right: 1px solid #334155; flex-shrink: 0; }
.mp-toggle .mp-icon { font-size: 20px; }
.mp-toggle .mp-label { font-size: 9px; color: #64748b; font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase; }

.mp-track-info { flex: 1; padding: 0 20px; min-width: 0; }
.mp-track-title { font-size: 13px; font-weight: 600; color: #f1f5f9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-track-sub { font-size: 11px; color: #64748b; margin-top: 2px; }

.mp-controls { display: flex; align-items: center; gap: 8px; padding: 0 16px; flex-shrink: 0; }
.mp-btn { background: transparent; border: none; color: #94a3b8; cursor: pointer; font-size: 18px; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; transition: all 0.15s; }
.mp-btn:hover { background: #1e293b; color: #f1f5f9; }
.mp-btn.play-btn { background: #16a34a; color: white; font-size: 20px; }
.mp-btn.play-btn:hover { background: #15803d; transform: scale(1.05); }

.mp-progress { flex: 1; max-width: 300px; padding: 0 16px; display: flex; align-items: center; gap: 8px; }
.mp-bar { flex: 1; height: 4px; background: #1e293b; border-radius: 2px; cursor: pointer; position: relative; }
.mp-bar-fill { height: 100%; background: #16a34a; border-radius: 2px; transition: width 0.5s linear; pointer-events: none; }
.mp-time { font-size: 10px; color: #64748b; font-variant-numeric: tabular-nums; white-space: nowrap; }

.mp-volume { display: flex; align-items: center; gap: 8px; padding: 0 16px; flex-shrink: 0; }
.mp-vol-icon { font-size: 16px; color: #64748b; cursor: pointer; }
.mp-vol-slider { width: 80px; height: 4px; appearance: none; background: #1e293b; border-radius: 2px; cursor: pointer; }
.mp-vol-slider::-webkit-slider-thumb { appearance: none; width: 14px; height: 14px; border-radius: 50%; background: #16a34a; cursor: pointer; }

.mp-source-btns { display: flex; gap: 4px; padding: 0 12px; flex-shrink: 0; border-left: 1px solid #1e293b; }
.mp-source-btn { background: #1e293b; border: 1px solid #334155; color: #64748b; border-radius: 6px; padding: 4px 10px; font-size: 11px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.mp-source-btn.active { background: #16a34a; border-color: #16a34a; color: white; }

.mp-url-input { background: #1e293b; border: 1px solid #334155; color: #f1f5f9; border-radius: 6px; padding: 4px 10px; font-size: 12px; width: 220px; }
.mp-url-input::placeholder { color: #475569; }
#yt-iframe-container { display: none; position: fixed; bottom: 64px; right: 16px; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* Push page content up when player visible */
.app.has-music .content-area { padding-bottom: 80px; }

/* Rental card */
.rental-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 14px; }
.rental-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.rental-status-dot.active { background: var(--green); box-shadow: 0 0 0 3px var(--green-light); }
.rental-status-dot.overdue { background: var(--red); box-shadow: 0 0 0 3px var(--red-light); }
.rental-status-dot.returned { background: var(--text-muted); }

/* ═══════════════════════════════════════════════════════
   TOUCH / TABLET / MOBILE — Global overrides
   ═══════════════════════════════════════════════════════ */

/* ── Touch-friendly base ─────────────────────────────── */
@media (pointer: coarse), (max-width: 1024px) {
  body { font-size: 15px; }

  /* All buttons: bigger tap targets */
  .btn        { padding: 11px 20px; font-size: 14px; min-height: 44px; border-radius: 10px; }
  .btn-sm     { padding: 9px 14px;  font-size: 13px; min-height: 40px; }
  .btn-lg     { padding: 14px 28px; font-size: 16px; min-height: 52px; }

  /* Nav items: taller */
  .nav-item { padding: 13px 14px; margin-bottom: 4px; }
  .nav-item .nav-icon { font-size: 20px; }
  .nav-item .nav-label { font-size: 14px; }

  /* Inputs: bigger */
  .form-control { padding: 13px 14px; font-size: 15px; min-height: 48px; border-radius: 10px; }
  .search-bar input, .product-search input { padding: 12px 14px; font-size: 15px; min-height: 48px; }

  /* Table cells: bigger */
  thead th   { padding: 14px 14px; font-size: 13px; }
  tbody td   { padding: 14px 14px; font-size: 14px; }

  /* Cart qty buttons */
  .qty-btn { width: 36px; height: 36px; font-size: 18px; border-radius: 8px; }
  .qty-display { font-size: 15px; }

  /* Category tabs */
  .cat-tab { padding: 9px 18px; font-size: 13px; min-height: 40px; }

  /* Product cards: bigger emoji & tap area */
  .product-card { padding: 18px 12px; border-radius: 12px; }
  .product-card .p-emoji { font-size: 38px; margin-bottom: 8px; }
  .product-card .p-name  { font-size: 12px; }
  .product-card .p-price { font-size: 16px; }

  /* Content padding */
  .content-area { padding: 16px; }
  .topbar       { padding: 0 16px; }

  /* Modal */
  .modal { border-radius: 18px; }
  .modal-body { padding: 20px 18px; }

  /* KPI grid: 2 cols on tablet */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }

  /* Stat cards */
  .stat-card { padding: 18px; border-radius: 14px; }
}

/* ── Phone (narrow) ──────────────────────────────────── */
@media (max-width: 640px) {
  .kpi-grid  { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topbar-time { display: none; }
  .page-header { flex-wrap: wrap; gap: 10px; }

  /* POS goes single column on phone */
  .pos-layout { grid-template-columns: 1fr; height: auto; }
  .pos-cart   { max-height: 420px; }

  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { border-bottom-left-radius: 0; border-bottom-right-radius: 0; max-height: 92vh; }
}

/* ── Sidebar: overlay on mobile/tablet ───────────────── */
/* Overlay backdrop */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 40; backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease;
}
.sidebar-overlay.visible { display: block; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

@media (max-width: 1024px) {
  /* Sidebar slides over content rather than pushing it */
  .sidebar {
    position: fixed; top: 0; left: 0; height: 100vh;
    transform: translateX(0);
    z-index: 50;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    width: 260px !important; /* always full width when open */
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  }
  .sidebar.collapsed {
    transform: translateX(-100%);
    width: 260px !important; /* don't collapse to 64px on mobile */
  }
  /* Always show all sidebar text on mobile (no icon-only mode) */
  .sidebar.collapsed .sidebar-info,
  .sidebar.collapsed .sidebar-logo,
  .sidebar.collapsed .sidebar-toggle,
  .sidebar.collapsed .nav-section-label,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .nav-badge,
  .sidebar.collapsed .sidebar-logout span { display: unset !important; }
  .sidebar.collapsed .sidebar-header { justify-content: unset; padding: 16px; }

  /* Main content fills full width */
  .main-content { width: 100%; }

  /* Hamburger button in topbar */
  .mobile-menu-btn { display: flex !important; }
}

@media (min-width: 1025px) {
  .mobile-menu-btn { display: none !important; }
  .sidebar-overlay { display: none !important; }
}

/* Hamburger button (hidden on desktop) */
.mobile-menu-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px;
  background: var(--bg); border: 1px solid var(--border);
  cursor: pointer; font-size: 20px; color: var(--text);
  margin-right: 8px; flex-shrink: 0;
  transition: background 0.15s;
}
.mobile-menu-btn:hover { background: var(--border); }

/* ══════════════════════════════════════════════════════
   STOCK CHECK — Webapp card layout (moved from inline)
   ══════════════════════════════════════════════════════ */

.sc-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px; margin-top: 16px;
}
.sc-hist-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 18px; cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}
.sc-hist-card:hover  { box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
.sc-hist-card:active { transform: scale(0.98); }
.sc-hist-card .sc-hc-no   { font-size: 13px; color: var(--text-muted); margin-bottom: 4px; }
.sc-hist-card .sc-hc-date { font-size: 12px; color: var(--text-muted); }
.sc-hist-card .sc-hc-by   { font-size: 14px; font-weight: 600; margin: 8px 0 10px; }
.sc-hist-card .sc-hc-bar  { height: 6px; border-radius: 99px; background: var(--border); overflow: hidden; margin-bottom: 8px; }
.sc-hist-card .sc-hc-fill { height: 100%; border-radius: 99px; background: #22c55e; }
.sc-hist-card .sc-hc-stats { display: flex; gap: 8px; font-size: 12px; }
.sc-hist-card .sc-hc-disc  { color: #ef4444; font-weight: 700; }

.sc-start-banner {
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  border-radius: 16px; padding: 28px 24px; margin-bottom: 20px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px;
}
.sc-start-banner h2 { color: white; font-size: 20px; margin: 0 0 4px; font-weight: 800; }
.sc-start-banner p  { color: rgba(255,255,255,0.75); font-size: 13px; margin: 0; }
.sc-start-btn {
  background: white; color: #2563eb; font-weight: 700;
  padding: 12px 24px; border-radius: 12px; border: none; cursor: pointer;
  font-size: 15px; white-space: nowrap; min-height: 48px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.sc-start-btn:hover  { box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.sc-start-btn:active { transform: scale(0.97); }

/* ─ Active check form ─ */
.sc-sticky-top {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg); padding: 12px 0 8px;
  border-bottom: 1px solid var(--border); margin-bottom: 16px;
}
.sc-progress-bar  { height: 10px; border-radius: 99px; background: var(--border); overflow: hidden; margin-top: 8px; }
.sc-progress-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, #2563eb, #7c3aed); transition: width 0.3s; }

.sc-search-filter { display: flex; gap: 8px; margin-top: 10px; }
.sc-search-filter input {
  flex: 1; padding: 10px 14px; font-size: 14px;
  border: 1.5px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); min-height: 44px;
}
.sc-search-filter input:focus { outline: none; border-color: var(--primary); }

/* Product count cards grid */
.sc-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 cols on phone */
  gap: 12px;
  padding-bottom: 100px; /* room for FAB */
}
@media (min-width: 600px)  { .sc-cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .sc-cards-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .sc-cards-grid { grid-template-columns: repeat(5, 1fr); } }

.sc-item-card {
  background: var(--surface); border: 2px solid var(--border); border-radius: 16px;
  padding: 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  transition: border-color 0.2s, background 0.2s;
}
.sc-item-card.counted { border-color: #22c55e; background: rgba(34,197,94,0.05); }
.sc-item-card .sc-ic-emoji { font-size: 36px; }
.sc-item-card .sc-ic-name  { font-size: 13px; font-weight: 700; text-align: center; color: var(--text); line-height: 1.3; }
.sc-item-card .sc-ic-unit  { font-size: 11px; color: var(--text-muted); }

/* Stepper */
.sc-stepper { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.sc-stepper button {
  width: 36px; height: 36px; border: none; border-radius: 10px;
  background: var(--bg); color: var(--text); font-size: 20px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; user-select: none; touch-action: manipulation;
}
.sc-stepper button:hover  { background: var(--primary); color: white; }
.sc-stepper button:active { transform: scale(0.92); }
.sc-stepper input {
  width: 52px; text-align: center; font-size: 17px; font-weight: 800;
  padding: 4px 2px; border: 2px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); min-height: 36px;
}
.sc-stepper input:focus { border-color: var(--primary); outline: none; }

/* Floating submit button */
.sc-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 100;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: white; border: none; border-radius: 16px;
  padding: 16px 32px; font-size: 16px; font-weight: 700;
  cursor: pointer; box-shadow: 0 8px 24px rgba(37,99,235,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}
.sc-fab:hover  { box-shadow: 0 12px 32px rgba(37,99,235,0.5); }
.sc-fab:active { transform: scale(0.97); }

/* Secondary fab for quick "fill 0" — sits to the LEFT of the main submit fab */
.sc-fab-zero {
  position: fixed; bottom: 24px; right: 200px; z-index: 100;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white; border: none; border-radius: 50%;
  width: 56px; height: 56px; font-size: 22px; font-weight: 700;
  cursor: pointer; box-shadow: 0 8px 24px rgba(245,158,11,0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  touch-action: manipulation;
}
.sc-fab-zero:hover  { box-shadow: 0 12px 32px rgba(245,158,11,0.5); }
.sc-fab-zero:active { transform: scale(0.92); }
@media (max-width: 600px) {
  .sc-fab { padding: 12px 20px; font-size: 14px; bottom: 16px; right: 16px; }
  .sc-fab-zero { right: 160px; bottom: 16px; width: 48px; height: 48px; font-size: 18px; }
}

/* Result cards */
.sc-result-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-top: 16px;
}
@media (min-width: 600px)  { .sc-result-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .sc-result-grid { grid-template-columns: repeat(4, 1fr); } }

.sc-res-card { border-radius: 14px; padding: 16px; border: 2px solid; }
.sc-res-card.ok   { border-color: #bbf7d0; background: #f0fdf4; }
.sc-res-card.low  { border-color: #fecaca; background: #fff5f5; }
.sc-res-card.high { border-color: #fed7aa; background: #fffbeb; }
.sc-res-card.skip { border-color: var(--border); background: var(--bg); opacity: 0.55; }
.sc-res-card .sc-rc-emoji { font-size: 30px; margin-bottom: 6px; }
.sc-res-card .sc-rc-name  { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 8px; line-height: 1.3; }
.sc-res-card .sc-rc-diff  { font-size: 22px; font-weight: 900; margin: 4px 0; }
.sc-res-card .sc-rc-nums  { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; gap: 2px; }

/* ─ Supplier tap-to-check cards ─ */
.sup-cards-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}
@media (min-width: 600px)  { .sup-cards-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .sup-cards-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .sup-cards-grid { grid-template-columns: repeat(5, 1fr); } }

.sup-item-card {
  background: var(--surface); border: 2px solid var(--border); border-radius: 16px;
  padding: 22px 14px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  cursor: pointer; transition: border-color 0.2s, background 0.2s, transform 0.1s;
  user-select: none; touch-action: manipulation;
}
.sup-item-card:active { transform: scale(0.96); }
.sup-item-card.checked { border-color: #22c55e; background: rgba(34,197,94,0.06); }
.sup-item-card .sup-ic-emoji { font-size: 40px; }
.sup-item-card .sup-ic-name  { font-size: 13px; font-weight: 700; text-align: center; line-height: 1.3; }
.sup-item-card .sup-ic-qty   { font-size: 26px; font-weight: 900; color: var(--primary); }
.sup-item-card .sup-ic-unit  { font-size: 11px; color: var(--text-muted); }
.sup-item-card .sup-ic-chk   { font-size: 28px; margin-top: 4px; }

/* ===================================================================== */
/* ===== 20260423c UI REDESIGN (POS + Suppliers)                    ===== */
/* ===================================================================== */

/* Extra palette tokens used by the redesigned components */
:root {
  --blue-light:   var(--primary-light);
  --purple:       #7c3aed;
  --purple-light: #ede9fe;
  --yellow-light: #fef9c3;
}

/* ===== POS: search bar with clear button ===== */
.product-search { position: relative; margin-bottom: 14px; }
.product-search input {
  width: 100%;
  padding: 14px 48px 14px 48px;
  border: 2px solid var(--border);
  border-radius: 12px;
  font-size: 15px; font-weight: 500;
  background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}
.product-search input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37,99,235,0.15);
}
.product-search .search-icon {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  font-size: 18px; color: var(--text-muted); pointer-events: none;
}
.product-search .clear-btn {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px; border-radius: 50%;
  border: none; background: var(--bg);
  cursor: pointer; display: none;
  align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px;
}
.product-search .clear-btn:hover { background: var(--border); color: var(--text); }
.product-search.has-value .clear-btn { display: flex; }

/* ===== POS: category tabs + supplier filter in one row ===== */
.filters-row {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.filters-row .category-tabs {
  display: flex; gap: 8px;
  /* 20260423e: stay on a single horizontally-scrolling row so a wide
     category list does not wrap to 2–3 lines and eat the POS grid's
     vertical space on low-res laptops. */
  flex-wrap: nowrap;
  flex: 1; min-width: 0;
  margin-bottom: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  scrollbar-width: thin;
}
.filters-row .category-tabs::-webkit-scrollbar { height: 4px; }
.filters-row .category-tabs::-webkit-scrollbar-thumb {
  background: var(--border-strong); border-radius: 2px;
}
.filters-row .cat-tab { flex-shrink: 0; }
.filters-row .cat-tab {
  padding: 9px 16px; border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text-muted); transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
  box-shadow: var(--shadow-sm);
}
.filters-row .cat-tab:hover { border-color: var(--primary); color: var(--primary); transform: translateY(-1px); }
.filters-row .cat-tab.active {
  background: var(--primary); border-color: var(--primary); color: white;
  box-shadow: 0 4px 10px rgba(37,99,235,0.3);
}
.cat-count {
  font-size: 11px; font-weight: 700;
  background: rgba(0,0,0,0.08);
  padding: 1px 7px; border-radius: 10px;
}
.cat-tab.active .cat-count { background: rgba(255,255,255,0.25); color: white; }

.supplier-filter { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.supplier-filter label {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.4px; text-transform: uppercase;
}
.supplier-filter select {
  padding: 9px 34px 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--text);
  cursor: pointer; box-shadow: var(--shadow-sm);
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%2364748b' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  min-width: 180px; transition: all 0.15s;
}
.supplier-filter select:hover { border-color: var(--border-strong); }
.supplier-filter select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.supplier-filter select.active-filter {
  border-color: var(--primary);
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

/* ===== POS: product card refresh ===== */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px; align-content: start;
  padding: 4px 4px 20px 4px;
}
.product-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 14px;
  padding: 16px 12px 14px;
  text-align: center; cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  min-height: 160px;
  box-shadow: var(--shadow-sm);
}
.product-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 22px -6px rgba(37,99,235,0.25);
  transform: translateY(-3px);
}
.product-card:active { transform: scale(0.98); }
.product-card .p-emoji { font-size: 44px; margin-bottom: 8px; line-height: 1; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.08)); }
.product-card .p-emoji img { width: 80px; height: 80px; object-fit: cover; border-radius: 12px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.product-card .p-id {
  position: absolute; top: 8px; left: 8px;
  background: var(--bg); color: var(--text-muted);
  border-radius: 6px; padding: 2px 7px;
  font-size: 10px; font-weight: 700;
  font-family: 'SF Mono','Menlo','Consolas',monospace;
  letter-spacing: 0.3px;
  border: 1px solid var(--border);
}
.product-card .p-name {
  font-size: 14px; font-weight: 700;
  color: var(--text); line-height: 1.25;
  margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; min-height: 36px;
}
.product-card .p-price {
  font-size: 17px; font-weight: 800;
  color: var(--primary); letter-spacing: -0.01em;
  margin-top: auto;
}
.product-card .p-stock {
  position: absolute; top: 8px; right: 8px;
  background: var(--green-light); color: var(--green);
  border-radius: 20px; padding: 2px 8px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.3px;
}
.product-card.out-of-stock { opacity: 0.45; cursor: not-allowed; }
.product-card.out-of-stock .p-stock { background: var(--red-light); color: var(--red); }
.product-card.low-stock .p-stock { background: var(--orange-light); color: var(--orange); }

/* ===== Suppliers page (admin) ===== */
.filters-bar {
  display: flex; gap: 12px; flex-wrap: wrap;
  margin-bottom: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow-sm);
}
.sup-search { position: relative; flex: 1; min-width: 240px; }
.sup-search input {
  width: 100%; padding: 12px 40px 12px 42px;
  border: 2px solid var(--border); border-radius: 10px;
  font-size: 14px; font-weight: 500;
  background: var(--surface); color: var(--text);
  transition: all 0.15s;
}
.sup-search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); }
.sup-search .search-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 16px; color: var(--text-muted); pointer-events: none; }
.sup-search .clear-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: var(--bg); cursor: pointer;
  display: none; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 13px;
}
.sup-search.has-value .clear-btn { display: flex; }

.type-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.type-tab {
  padding: 9px 14px; border-radius: 10px;
  border: 1.5px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text-muted); transition: all 0.15s;
  display: inline-flex; align-items: center; gap: 6px;
}
.type-tab:hover { border-color: var(--primary); color: var(--primary); }
.type-tab.active { background: var(--primary); border-color: var(--primary); color: white; box-shadow: 0 3px 8px rgba(37,99,235,0.3); }
.tab-count {
  font-size: 11px; font-weight: 700;
  background: rgba(0,0,0,0.08); padding: 1px 7px; border-radius: 10px;
}
.type-tab.active .tab-count { background: rgba(255,255,255,0.25); color: white; }

.supplier-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}
.supplier-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
  transition: all 0.15s;
}
.supplier-card:hover { border-color: var(--primary); box-shadow: 0 8px 22px -8px rgba(37,99,235,0.15); transform: translateY(-2px); }
.sup-card-header {
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, #fafbfc, var(--surface));
}
.sup-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 8px; }
.sup-name { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; min-width: 0; }
.sup-name .sup-icon {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.sup-name .sup-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.sup-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; flex-shrink: 0; }
.sup-contact-row { display: flex; gap: 14px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.sup-contact-item { display: flex; align-items: center; gap: 5px; }
.sup-contact-item .muted { color: var(--text-faint); }
.sup-body { padding: 14px 16px; flex: 1; }
.sup-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.sup-stat { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.sup-stat-label { font-size: 10px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.4px; text-transform: uppercase; }
.sup-stat-value { font-size: 15px; font-weight: 800; letter-spacing: -0.01em; margin-top: 2px; }
.sup-stat.highlight-red { background: var(--red-light); }
.sup-stat.highlight-red .sup-stat-value { color: var(--red); }
.sup-stat.highlight-green { background: var(--green-light); }
.sup-stat.highlight-green .sup-stat-value { color: var(--green); }
.sup-alerts { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.sup-alerts:empty { display: none; }
.sup-actions {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
}
.sup-actions .btn { flex: 1 1 auto; min-width: 0; }
.sup-actions .btn-icon { flex: 0 0 auto; }

/* Supplier summary strip (above filter bar) */
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: var(--shadow-sm);
}
.summary-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.summary-info { min-width: 0; }
.summary-label { font-size: 11px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.4px; text-transform: uppercase; }
.summary-value { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; margin-top: 2px; }
.icon-blue   { background: var(--primary-light); color: var(--primary-dark); }
.icon-green  { background: var(--green-light);   color: var(--green); }
.icon-red    { background: var(--red-light);     color: var(--red); }
.icon-purple { background: var(--purple-light);  color: var(--purple); }
@media (max-width: 900px) { .summary-strip { grid-template-columns: repeat(2, 1fr); } }


/* ===================================================================== */
/* ===== 20260423d RESPONSIVE POLISH for the new UI                 ===== */
/* ===================================================================== */

/* Tablet / small laptop: stack POS cart under products so both get full
   width. The existing 640px rule already handles phone; this fills the
   gap between tablet and desktop. */
@media (max-width: 1100px) {
  .pos-layout {
    grid-template-columns: 1fr;
    height: auto;
    gap: 14px;
  }
  .pos-cart {
    max-height: 560px;
  }
  /* Products grid: slightly tighter min-card on tablet */
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}

/* Tablet: let filters-row wrap and supplier filter grow to full width
   so it's still tappable. */
@media (max-width: 900px) {
  .filters-row { gap: 10px; }
  .supplier-filter {
    width: 100%;
    justify-content: flex-start;
  }
  .supplier-filter select {
    flex: 1;
    min-width: 0;
  }
}

/* Phone: summary strip goes single column; filters bar stacks; supplier
   cards go single-column explicitly (auto-fill's 340px min would overflow
   narrow viewports otherwise). */
@media (max-width: 560px) {
  .summary-strip  { grid-template-columns: 1fr; gap: 10px; }
  .supplier-grid  { grid-template-columns: 1fr; gap: 12px; }
  .filters-bar { flex-direction: column; padding: 12px; gap: 10px; }
  .sup-search { min-width: 0; width: 100%; }
  .type-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .type-tabs::-webkit-scrollbar { height: 4px; }
  .type-tab { flex-shrink: 0; }

  /* Supplier card: body and actions get slightly tighter padding */
  .sup-card-header { padding: 12px 14px 10px; }
  .sup-body        { padding: 12px 14px; }
  .sup-actions     { padding: 10px 14px; }
  .sup-stats       { gap: 8px; }
  .sup-stat        { padding: 9px 10px; }
  .sup-stat-value  { font-size: 14px; }

  /* POS: cart fills width under products */
  .pos-cart { max-height: 480px; }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 10px; }
  .product-card   { min-height: 140px; padding: 14px 10px 12px; }
  .product-card .p-emoji { font-size: 38px; }
  .product-card .p-emoji img { width: 68px; height: 68px; }
  .product-card .p-name  { font-size: 13px; min-height: 32px; }
  .product-card .p-price { font-size: 16px; }

  /* Cart footer: discount inputs stack */
  .cart-footer .form-row { grid-template-columns: 1fr; gap: 8px; }
}

/* Very narrow (< 400px): reduce padding further for cramped phones */
@media (max-width: 400px) {
  .content-area { padding: 12px; }
  .page-header  { gap: 8px; }
  .page-title   { font-size: 18px; }
  .summary-card { padding: 12px; gap: 10px; }
  .summary-icon { width: 36px; height: 36px; font-size: 18px; }
  .summary-value{ font-size: 17px; }
  .product-card .p-id { font-size: 9px; padding: 1px 5px; }
}

/* Topbar overflow: time + user chip drop when horizontal space tight */
@media (max-width: 520px) {
  .topbar-time { display: none; }
  .topbar-user > span:not(.avatar) { display: none; }
}


/* ===================================================================== */
/* ===== 20260423e LOW-RES LAPTOP POLISH                            ===== */
/* ===================================================================== */

/* Short laptops (e.g. 1366×768, 1440×900): the original search bar + wrapping
   filters easily ate 180–220 px of vertical space and pushed the product
   grid below the fold. Category tabs now scroll horizontally (see above);
   this block additionally slims padding on the search bar and filter
   controls so the product grid gets back ≈60 px of headroom. */
@media (max-height: 820px) and (min-width: 641px) {
  .product-search { margin-bottom: 10px; }
  .product-search input {
    padding: 10px 42px 10px 42px;
    font-size: 14px;
  }
  .product-search .search-icon { font-size: 16px; }
  .product-search .clear-btn { width: 26px; height: 26px; }

  .filters-row { margin-bottom: 12px; gap: 10px; }
  .filters-row .cat-tab { padding: 7px 14px; font-size: 12px; }
  .filters-row .cat-tab .cat-count { font-size: 10px; padding: 1px 6px; }

  .supplier-filter label { font-size: 10px; }
  .supplier-filter select {
    padding: 7px 30px 7px 10px;
    font-size: 12px;
    min-width: 160px;
  }

  /* Give the POS grid more usable height: top + bottom paddings of the
     parent layout subtract 160 px normally; at this screen height we can
     reclaim 30 px safely. */
  .pos-layout { height: calc(100vh - 130px); }

  /* Product card slightly more compact, too */
  .product-card { min-height: 150px; padding: 14px 10px 12px; }
  .product-card .p-emoji { font-size: 40px; margin-bottom: 6px; }
  .product-card .p-name  { font-size: 13px; min-height: 32px; }
  .product-card .p-price { font-size: 16px; }
}


/* ===================================================================== */
/* ===== 20260423f  bigger product images + defensive tab layout   ====== */
/* ===================================================================== */

/* Defensive: no matter what legacy rules are cached, the POS category
   tabs must always be a single horizontally-scrolling row. */
.filters-row .category-tabs {
  flex-wrap: nowrap !important;
  flex-direction: row !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}
.filters-row .cat-tab {
  flex: 0 0 auto !important;
  white-space: nowrap;
}

/* Bigger product images so staff can recognise items at a glance.
   Applies at desktop widths. Tablet / phone breakpoints above already
   override these with appropriate compact values. */
.product-card {
  min-height: 200px;
  padding: 20px 12px 16px;
}
.product-card .p-emoji {
  font-size: 64px;
  margin-bottom: 10px;
  line-height: 1;
}
.product-card .p-emoji img {
  width: 112px;
  height: 112px;
  border-radius: 14px;
}
.product-card .p-name { min-height: 36px; }

/* Re-apply compact sizes at low-height laptops so the taller card does
   not overflow the viewport. */
@media (max-height: 820px) and (min-width: 641px) {
  .product-card { min-height: 170px; padding: 14px 10px 12px; }
  .product-card .p-emoji { font-size: 48px; margin-bottom: 6px; }
  .product-card .p-emoji img { width: 88px; height: 88px; border-radius: 12px; }
  .product-card .p-name  { font-size: 13px; min-height: 32px; }
  .product-card .p-price { font-size: 16px; }
}

/* Phone: keep images usable without overflowing tiny viewports. */
@media (max-width: 560px) {
  .product-card { min-height: 160px; padding: 14px 10px 12px; }
  .product-card .p-emoji { font-size: 44px; }
  .product-card .p-emoji img { width: 80px; height: 80px; border-radius: 12px; }
}


/* ===================================================================== */
/* ===== 20260423g  Course Fee tab visibility fix                   ===== */
/* ===================================================================== */

/* The 20260423c filters-row override (.filters-row .cat-tab) has higher
   specificity than the standalone .cat-tab-course-fee rule, so it was
   clobbering the purple gradient with a white surface — leaving white
   text on a white background. Re-declare the gradient / border / shadow
   / text colour inside a filters-row-scoped selector so the Course Fee
   tab stays readable. */
.filters-row .cat-tab.cat-tab-course-fee {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
  border-color: #5b21b6;
  color: #fff;
  box-shadow: 0 6px 16px rgba(91,33,182,0.24);
}
.filters-row .cat-tab.cat-tab-course-fee:hover {
  background: linear-gradient(135deg, #6d28d9 0%, #4c1d95 100%);
  border-color: #4c1d95;
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(91,33,182,0.28);
}
.filters-row .cat-tab.cat-tab-course-fee:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(91,33,182,0.22);
}
.filters-row .cat-tab.cat-tab-course-fee .cat-count {
  /* count pill sits on the purple background — give it a translucent
     white tint instead of the default dark-on-light. */
  background: rgba(255,255,255,0.25);
  color: #fff;
}

