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

:root {
  --sidebar-bg: #0f172a;
  --sidebar-hover: #1e293b;
  --sidebar-active: #3b82f6;
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-width: 240px;

  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #eff6ff;
  --success: #10b981;
  --success-light: #ecfdf5;
  --warning: #f59e0b;
  --warning-light: #fffbeb;
  --danger: #ef4444;
  --danger-light: #fef2f2;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --orange: #f97316;
  --orange-light: #fff7ed;

  --bg: #f1f5f9;
  --card-bg: #ffffff;
  --border: #e2e8f0;
  --border-dark: #cbd5e1;
  --text: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;

  --header-h: 60px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -2px rgba(0,0,0,.05);
}

html, body { height: 100%; font-family: 'Inter', sans-serif; font-size: 14px; color: var(--text); background: var(--bg); }
#app { height: 100%; }

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ===== LOGIN ===== */
.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}
.login-card {
  background: white; border-radius: 16px; padding: 40px; width: 400px;
  box-shadow: 0 25px 50px rgba(0,0,0,0.3);
}
.login-logo { text-align: center; margin-bottom: 32px; }
.login-logo .logo-icon {
  width: 56px; height: 56px; background: var(--primary); border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 24px; color: white; margin-bottom: 12px;
}
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); }
.login-logo p { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.login-form .form-group { margin-bottom: 18px; }
.login-form label { display: block; font-size: 13px; font-weight: 500; color: var(--text); margin-bottom: 6px; }
.login-form .input-icon { position: relative; }
.login-form .input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-muted); }
.login-form input {
  width: 100%; padding: 10px 12px 10px 36px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: inherit;
  transition: border-color .2s;
}
.login-form input:focus { outline: none; border-color: var(--primary); }
.btn-login {
  width: 100%; padding: 12px; background: var(--primary); color: white;
  border: none; border-radius: var(--radius-sm); font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background .2s; margin-top: 8px;
}
.btn-login:hover { background: var(--primary-dark); }
.login-hint { text-align: center; margin-top: 20px; font-size: 12px; color: var(--text-muted); background: #f8fafc; border-radius: 8px; padding: 12px; }
.login-error { background: var(--danger-light); color: var(--danger); border-radius: 6px; padding: 10px 14px; font-size: 13px; margin-bottom: 16px; display: none; }
.login-error.show { display: block; }

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

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width); background: var(--sidebar-bg); display: flex; flex-direction: column;
  flex-shrink: 0; overflow-y: auto; overflow-x: hidden;
}
.sidebar-header {
  padding: 20px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-header .logo-icon {
  width: 36px; height: 36px; background: var(--primary); border-radius: 8px;
  display: flex; align-items: center; justify-content: center; color: white; font-size: 16px; flex-shrink: 0;
}
.sidebar-header .logo-text h2 { font-size: 15px; font-weight: 700; color: white; }
.sidebar-header .logo-text span { font-size: 11px; color: var(--sidebar-text); }
.sidebar-user {
  padding: 14px 16px; border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex; align-items: center; gap: 10px;
}
.user-avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--primary);
  display: flex; align-items: center; justify-content: center; color: white;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
}
.user-info .user-name { font-size: 13px; font-weight: 500; color: white; }
.user-info .user-role { font-size: 11px; color: var(--sidebar-text); text-transform: capitalize; }
.sidebar-nav { flex: 1; padding: 10px 0; }
.nav-section { padding: 16px 16px 6px; font-size: 10px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: .08em; }
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  color: var(--sidebar-text); cursor: pointer; transition: all .15s; border-left: 3px solid transparent;
  font-size: 13.5px; font-weight: 500; user-select: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: white; }
.nav-item.active { background: rgba(59,130,246,.15); color: white; border-left-color: var(--primary); }
.nav-item i { width: 18px; text-align: center; font-size: 14px; }
.sidebar-footer { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.06); }
.btn-logout {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: rgba(239,68,68,.1); color: #fca5a5; border: none; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; font-weight: 500; font-family: inherit; transition: background .15s;
}
.btn-logout:hover { background: rgba(239,68,68,.2); }

/* ===== MAIN CONTENT ===== */
.main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.main-header {
  height: var(--header-h); background: var(--card-bg); 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);
}
.main-header h1 { font-size: 18px; font-weight: 700; color: var(--text); }
.header-actions { display: flex; align-items: center; gap: 10px; }
.page-content { flex: 1; overflow-y: auto; padding: 24px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px;
  border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 500; font-family: inherit;
  cursor: pointer; border: none; transition: all .15s; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-warning:hover { background: #d97706; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-outline:hover { background: var(--bg); border-color: var(--border-dark); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-icon { padding: 8px; }

/* ===== CARDS ===== */
.card {
  background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card-header {
  padding: 16px 20px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--text); }
.card-body { padding: 20px; }

/* ===== STAT CARDS ===== */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--card-bg); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); border: 1px solid var(--border); display: flex; align-items: flex-start; gap: 14px;
}
.stat-icon {
  width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center;
  justify-content: center; font-size: 18px; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); color: var(--primary); }
.stat-icon.green { background: var(--success-light); color: var(--success); }
.stat-icon.orange { background: var(--orange-light); color: var(--orange); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.red { background: var(--danger-light); color: var(--danger); }
.stat-info .label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.stat-info .value { font-size: 22px; font-weight: 700; color: var(--text); }
.stat-info .change { font-size: 12px; margin-top: 2px; }
.change.up { color: var(--success); }
.change.down { color: var(--danger); }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #f8fafc; }
th { padding: 11px 14px; text-align: left; font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafafa; }
.table-empty { text-align: center; padding: 48px; color: var(--text-muted); }
.table-empty i { font-size: 36px; display: block; margin-bottom: 12px; color: var(--text-light); }

/* ===== FORMS ===== */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span-2 { grid-column: span 2; }
label { font-size: 13px; font-weight: 500; color: var(--text); }
input[type=text], input[type=email], input[type=number], input[type=password], input[type=date],
select, textarea {
  padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13.5px; font-family: inherit; color: var(--text); background: white;
  transition: border-color .15s; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
input::placeholder { color: var(--text-light); }
textarea { resize: vertical; min-height: 80px; }
.input-with-prefix { display: flex; }
.input-prefix {
  padding: 9px 10px; background: #f8fafc; border: 1.5px solid var(--border); border-right: none;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm); color: var(--text-muted); font-size: 13px; white-space: nowrap;
}
.input-with-prefix input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.form-hint { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
  border-radius: 20px; font-size: 11.5px; font-weight: 600;
}
.badge-success { background: var(--success-light); color: var(--success); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-purple { background: var(--purple-light); color: var(--purple); }
.badge-gray { background: #f1f5f9; color: var(--text-muted); }
.badge-orange { background: var(--orange-light); color: var(--orange); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadeIn .15s ease;
}
.modal {
  background: white; border-radius: 12px; width: 100%; max-height: 90vh;
  overflow-y: auto; box-shadow: var(--shadow-lg); animation: slideUp .2s ease;
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }
.modal-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: white;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 18px; color: var(--text-muted); cursor: pointer; padding: 4px; border-radius: 4px; }
.modal-close:hover { color: var(--text); background: var(--bg); }
.modal-body { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* ===== SEARCH & FILTER BAR ===== */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.search-box { position: relative; flex: 1; min-width: 200px; }
.search-box i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 13px; }
.search-box input { padding-left: 32px; }
.filter-select { padding: 9px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; font-family: inherit; background: white; color: var(--text); min-width: 140px; }
.filter-select:focus { outline: none; border-color: var(--primary); }

/* ===== POS ===== */
.pos-layout { display: grid; grid-template-columns: 1fr 380px; gap: 16px; height: calc(100vh - var(--header-h) - 48px); }
.pos-left { display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.pos-search-bar { display: flex; gap: 10px; flex-shrink: 0; }
.pos-cats { display: flex; gap: 8px; overflow-x: auto; flex-shrink: 0; padding-bottom: 2px; }
.pos-cats::-webkit-scrollbar { height: 3px; }
.cat-btn {
  padding: 7px 14px; border-radius: 20px; border: 1.5px solid var(--border);
  background: white; color: var(--text-muted); font-size: 13px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: all .15s;
}
.cat-btn:hover { border-color: var(--primary); color: var(--primary); }
.cat-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.pos-products { flex: 1; overflow-y: auto; }
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.product-card {
  background: white; border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 14px 12px; cursor: pointer; transition: all .15s; text-align: center; user-select: none;
}
.product-card:hover { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.1); transform: translateY(-1px); }
.product-card.out-of-stock { opacity: .5; cursor: not-allowed; }
.product-card .prod-icon { font-size: 28px; margin-bottom: 8px; }
.product-card .prod-name { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 4px; line-height: 1.3; }
.product-card .prod-price { font-size: 15px; font-weight: 700; color: var(--primary); }
.product-card .prod-stock { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.product-card .prod-stock.low { color: var(--warning); }
.product-card .prod-stock.out { color: var(--danger); }

/* Cart */
.cart-panel { background: white; border-radius: var(--radius); border: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
.cart-header { padding: 14px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.cart-header h3 { font-size: 15px; font-weight: 700; }
.cart-items { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cart-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--text-muted); gap: 10px; }
.cart-empty i { font-size: 40px; color: var(--text-light); }
.cart-item {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px; background: #f8fafc;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
}
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 13px; 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; }
.qty-btn {
  width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--border); background: white;
  cursor: pointer; font-size: 14px; font-weight: 700; color: var(--primary);
  display: flex; align-items: center; justify-content: center; transition: all .1s;
}
.qty-btn:hover { background: var(--primary); border-color: var(--primary); color: white; }
.qty-display { font-size: 14px; font-weight: 700; min-width: 24px; text-align: center; }
.cart-item-total { font-size: 14px; font-weight: 700; color: var(--text); }
.cart-remove { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 13px; padding: 2px; }

.cart-footer { border-top: 1px solid var(--border); padding: 14px; }
.cart-summary { margin-bottom: 12px; }
.summary-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; }
.summary-row.discount input { width: 80px; text-align: right; padding: 4px 8px; }
.summary-total { font-size: 17px; font-weight: 800; color: var(--text); padding-top: 8px; border-top: 2px solid var(--border); margin-top: 4px; }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; margin-bottom: 12px; }
.pay-btn {
  padding: 9px 6px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: white; cursor: pointer; font-size: 12px; font-weight: 600;
  color: var(--text-muted); transition: all .15s; text-align: center;
}
.pay-btn.active { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.pay-btn:hover:not(.active) { border-color: var(--border-dark); color: var(--text); }
.pay-btn i { display: block; font-size: 16px; margin-bottom: 3px; }

/* ===== RECEIPT MODAL ===== */
.receipt { font-family: 'Courier New', monospace; padding: 4px; }
.receipt-header { text-align: center; margin-bottom: 16px; }
.receipt-header h3 { font-size: 18px; font-weight: 700; }
.receipt-divider { border: none; border-top: 1px dashed #ccc; margin: 12px 0; }
.receipt-row { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0; }
.receipt-total { font-size: 16px; font-weight: 700; }
.receipt-footer { text-align: center; margin-top: 16px; font-size: 12px; color: var(--text-muted); }

/* ===== DASHBOARD ===== */
.charts-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
.recent-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
.alert-item { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 8px; background: var(--warning-light); border: 1px solid rgba(245,158,11,.2); margin-bottom: 8px; }
.alert-item i { color: var(--warning); }
.alert-item .alert-text { flex: 1; font-size: 13px; }
.alert-item .alert-text strong { display: block; font-weight: 600; }

/* ===== ACCOUNTING ===== */
.pl-card { border-radius: var(--radius); overflow: hidden; }
.pl-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; border-bottom: 1px solid var(--border); font-size: 14px; }
.pl-row:last-child { border-bottom: none; }
.pl-row.section-header { background: #f8fafc; font-weight: 700; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.pl-row.total { background: var(--primary-light); font-weight: 700; font-size: 15px; }
.pl-row.subtotal { font-weight: 600; background: #fafbff; }
.pl-row.net-profit { background: var(--success-light); font-weight: 800; font-size: 16px; color: var(--success); }
.pl-row.net-loss { background: var(--danger-light); font-weight: 800; font-size: 16px; color: var(--danger); }
.pl-positive { color: var(--success); font-weight: 600; }
.pl-negative { color: var(--danger); font-weight: 600; }
.pl-label { color: var(--text-muted); font-size: 12px; display: block; }

/* ===== STOCK MOVEMENT ===== */
.movement-in { color: var(--success); font-weight: 600; }
.movement-out { color: var(--danger); font-weight: 600; }
.movement-adj { color: var(--warning); font-weight: 600; }

/* ===== PROGRESS BAR ===== */
.progress-bar-wrap { height: 6px; background: var(--border); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 3px; background: var(--primary); }
.progress-bar.warning { background: var(--warning); }
.progress-bar.danger { background: var(--danger); }

/* ===== MISC ===== */
.page-title { font-size: 18px; font-weight: 700; color: var(--text); }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.font-bold { font-weight: 700; }
.font-medium { font-weight: 500; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.mt-16 { margin-top: 16px; }
.p-16 { padding: 16px; }
.w-full { width: 100%; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px;
  border-radius: 20px; font-size: 12px; font-weight: 500; background: var(--bg); color: var(--text-muted);
}

/* Avatar color classes */
.avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; flex-shrink: 0; color: white; }
.avatar-blue { background: #3b82f6; }
.avatar-green { background: #10b981; }
.avatar-purple { background: #8b5cf6; }
.avatar-orange { background: #f97316; }
.avatar-red { background: #ef4444; }

/* Inline edit number */
.qty-input { width: 50px; padding: 4px 6px; text-align: center; border: 1.5px solid var(--border); border-radius: 4px; }

/* Toast */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #1e293b; color: white; padding: 12px 18px; border-radius: 8px;
  font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px; min-width: 250px; max-width: 380px;
  animation: slideInRight .25s ease;
}
.toast.success { background: #064e3b; border-left: 4px solid var(--success); }
.toast.error { background: #7f1d1d; border-left: 4px solid var(--danger); }
.toast.warning { background: #78350f; border-left: 4px solid var(--warning); }
@keyframes slideInRight { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Number display */
.num-green { color: var(--success); font-weight: 600; }
.num-red { color: var(--danger); font-weight: 600; }
.num-blue { color: var(--primary); font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab-btn {
  padding: 10px 18px; background: none; border: none; font-size: 13.5px; font-weight: 500;
  color: var(--text-muted); cursor: pointer; border-bottom: 2px solid transparent;
  margin-bottom: -2px; transition: all .15s; font-family: inherit;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover:not(.active) { color: var(--text); }

/* Pagination */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.page-btns { display: flex; gap: 4px; }
.page-btn { padding: 5px 10px; border: 1px solid var(--border); border-radius: 4px; background: white; cursor: pointer; font-size: 12.5px; }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: white; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ===== HAMBURGER BUTTON ===== */
.hamburger-btn {
  display: none; background: none; border: none; padding: 8px 10px;
  cursor: pointer; color: var(--text); font-size: 19px;
  border-radius: var(--radius-sm); line-height: 1;
  align-items: center; justify-content: center;
}
.hamburger-btn:hover { background: var(--bg); }

/* ===== SIDEBAR OVERLAY (mobile backdrop) ===== */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 998;
}
.sidebar-overlay.show { display: block; }

/* ===== MOBILE POS TABS ===== */
.pos-mobile-tabs {
  display: none; flex-shrink: 0;
  background: white; border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 10px;
}
.pos-tab-btn {
  flex: 1; padding: 13px 8px; border: none; background: transparent;
  font-size: 14px; font-weight: 600; font-family: inherit;
  cursor: pointer; color: var(--text-muted);
  display: flex; align-items: center; justify-content: center; gap: 7px;
  transition: all .15s; border-bottom: 3px solid transparent;
}
.pos-tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); background: var(--primary-light); }
.pos-tab-btn:not(.active):hover { background: var(--bg); color: var(--text); }
.pos-tab-badge {
  background: var(--primary); color: white; border-radius: 999px;
  min-width: 20px; height: 20px; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
}
.pos-tab-badge.hidden { display: none; }

/* ===== RESPONSIVE — TABLET (≤1024px) ===== */
@media (max-width: 1024px) {
  :root { --sidebar-width: 220px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .recent-grid { grid-template-columns: 1fr; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}

/* ===== RESPONSIVE — MOBILE (≤768px) ===== */
@media (max-width: 768px) {

  /* Hamburger */
  .hamburger-btn { display: inline-flex; }

  /* Sidebar: slide in from left */
  .sidebar {
    position: fixed; left: calc(-1 * var(--sidebar-width) - 10px);
    top: 0; bottom: 0; z-index: 999;
    transition: left .25s cubic-bezier(.4,0,.2,1);
    box-shadow: none;
  }
  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 24px rgba(0,0,0,.35);
  }

  /* Header */
  .main-header { padding: 0 12px; gap: 8px; }
  .main-header h1 { font-size: 15px; flex: 1; }
  .header-actions { gap: 6px; }

  /* Page padding */
  .page-content { padding: 10px; }

  /* Stat grids */
  .stat-grid { grid-template-columns: 1fr 1fr !important; gap: 8px; margin-bottom: 12px; }
  .stat-card { padding: 14px 10px; gap: 10px; }
  .stat-icon { width: 38px; height: 38px; font-size: 15px; }
  .stat-info .value { font-size: 18px; }
  .stat-info .label { font-size: 11px; }

  /* Charts & grids */
  .charts-grid { grid-template-columns: 1fr !important; }
  .recent-grid { grid-template-columns: 1fr !important; }

  /* Forms */
  .form-grid { grid-template-columns: 1fr !important; }
  .form-grid-3 { grid-template-columns: 1fr !important; }
  .form-group.span-2 { grid-column: span 1 !important; }

  /* Modals: bottom sheet */
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal {
    border-radius: 18px 18px 0 0; max-height: 92vh;
    width: 100%;
  }
  .modal-sm, .modal-md, .modal-lg, .modal-xl { max-width: 100%; }
  .modal-header { border-radius: 18px 18px 0 0; }

  /* Tables */
  .table-wrap { -webkit-overflow-scrolling: touch; }
  td, th { padding: 10px 10px; font-size: 12.5px; }

  /* Tabs bar */
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 0; -webkit-overflow-scrolling: touch; }
  .tab-btn { white-space: nowrap; padding: 10px 12px; font-size: 12.5px; }
  .tabs::-webkit-scrollbar { display: none; }

  /* Toolbar */
  .toolbar { gap: 6px; }
  .search-box { min-width: 0; flex: 1; }
  .filter-select { min-width: 100px; font-size: 12px; padding: 8px 8px; }

  /* Pagination */
  .pagination { flex-direction: column; gap: 8px; align-items: stretch; text-align: center; }
  .page-btns { justify-content: center; }

  /* Toast */
  .toast-container { bottom: 12px; right: 8px; left: 8px; }
  .toast { min-width: unset; max-width: 100%; }

  /* Login */
  .login-card { width: calc(100% - 32px); margin: 16px; padding: 28px 20px; }

  /* Product grid */
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important; gap: 8px !important; }
  .product-card { padding: 12px 8px; }
  .product-card .prod-icon { font-size: 24px; margin-bottom: 6px; }
  .product-card .prod-name { font-size: 12px; }
  .product-card .prod-price { font-size: 14px; }
  .product-card .prod-stock { font-size: 10px; }

  /* POS LAYOUT on mobile */
  .pos-mobile-tabs { display: flex; }

  #pos-view { height: auto !important; }

  .pos-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
    gap: 0 !important;
  }

  .pos-left {
    display: flex;
    height: calc(100dvh - var(--header-h) - 48px - 52px);
  }

  .pos-layout .cart-panel {
    display: none;
    height: calc(100dvh - var(--header-h) - 48px - 52px);
  }

  /* Show cart, hide products */
  .pos-layout.show-cart .pos-left { display: none; }
  .pos-layout.show-cart .cart-panel { display: flex; flex-direction: column; }

  /* Cart items area fills remaining space */
  .cart-panel .cart-items { flex: 1; }

  /* Pay methods: 3-col still works fine on mobile */
  .pay-methods { gap: 6px; }
  .pay-btn { padding: 10px 4px; font-size: 11.5px; }

  /* Settings: override inline grids */
  [style*="grid-template-columns:1fr 320px"],
  [style*="grid-template-columns: 1fr 320px"],
  [style*="grid-template-columns:1fr 380px"],
  [style*="grid-template-columns: 1fr 380px"] {
    grid-template-columns: 1fr !important;
  }

  /* Dashboard charts: fix height for small screens */
  .charts-grid canvas { max-height: 220px; }
}

/* ===== RESPONSIVE — SMALL MOBILE (≤480px) ===== */
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr 1fr !important; gap: 6px; }
  .product-grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)) !important; }
  .btn-lg { padding: 11px 14px; font-size: 14px; }
  .cart-item { gap: 6px; padding: 8px; }
}

/* ===== INVOICES / QUOTES / DOCUMENT STYLES ===== */
.doc-totals {
  margin-left: auto; margin-top: 16px;
  width: 300px; border: 1.5px solid var(--border); border-radius: var(--radius); overflow: hidden;
}
.totals-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted);
}
.totals-row:last-child { border-bottom: none; }
.totals-grand {
  font-size: 16px; font-weight: 700; color: var(--primary);
  background: var(--primary-light); padding: 10px 14px;
}

/* badge extras */
.badge-info   { background: #dbeafe; color: #1d4ed8; }
.badge-danger { background: var(--danger-light); color: var(--danger); }

/* item-row responsive */
@media (max-width: 600px) {
  .item-row { grid-template-columns: 1fr 60px 90px 90px 28px !important; }
}

/* ===== SAFE AREA (notch/home bar on iOS) ===== */
@supports (padding: env(safe-area-inset-bottom)) {
  .page-content { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .cart-footer  { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-footer { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
}
