/* ============================================================
   PC4MATIC POS + ERP — Complete Responsive Stylesheet
   Mobile-first design, works on all screen sizes
   ============================================================ */

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

:root {
  --primary:      #4f7ef8;
  --primary-dark: #3b65d4;
  --primary-light:#eff3ff;
  --success:      #22c55e;
  --danger:       #ef4444;
  --warning:      #f59e0b;
  --info:         #3b82f6;
  --dark:         #111827;
  --muted:        #6b7280;
  --border:       #e5e7eb;
  --bg:           #f3f4f6;
  --white:        #ffffff;
  --sidebar-w:    240px;
  --topbar-h:     56px;
  --radius:       10px;
  --shadow:       0 1px 4px rgba(0,0,0,.08);
  --shadow-md:    0 4px 16px rgba(0,0,0,.12);
}

html { font-size: 14px; }
body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: var(--dark); background: var(--bg);
  line-height: 1.6; -webkit-text-size-adjust: 100%;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ─── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-w); height: 100vh;
  background: #1e2533;
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  z-index: 300;
  transform: translateX(-100%);
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  -webkit-overflow-scrolling: touch;
}
.sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }

/* On desktop always show */
@media (min-width: 992px) {
  .sidebar { transform: translateX(0); }
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 16px; border-bottom: 1px solid rgba(255,255,255,.08);
  min-height: var(--topbar-h); flex-shrink: 0;
}
.brand-logo  { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.brand-icon  {
  width: 36px; height: 36px; background: var(--primary);
  color: #fff; border-radius: 8px; display: flex;
  align-items: center; justify-content: center;
  font-weight: 800; font-size: 13px; flex-shrink: 0; letter-spacing: -.5px;
}
.brand-text strong { display: block; color: #fff; font-size: 13px; line-height: 1.3; }
.brand-text span   { color: rgba(255,255,255,.45); font-size: 11px; }

/* Nav menu */
.nav-menu { list-style: none; padding: 8px 0; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; color: rgba(255,255,255,.65);
  font-size: 13.5px; cursor: pointer;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
  -webkit-tap-highlight-color: transparent;
}
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(79,126,248,.18); color: #fff; border-left-color: var(--primary); }
.nav-link svg { flex-shrink: 0; opacity: .7; }
.nav-link:hover svg, .nav-link.active svg { opacity: 1; }
.nav-link span { flex: 1; }

/* POS special link */
.nav-link.pos-link {
  background: rgba(79,126,248,.15); color: #93b4fd; font-weight: 600;
  border-left-color: transparent; margin: 4px 8px; border-radius: 8px;
  padding: 10px 12px;
}
.nav-link.pos-link:hover { background: rgba(79,126,248,.3); }
.nav-link.pos-link.active { background: rgba(79,126,248,.35); border-left-color: #93b4fd; }
.nav-link.pos-link svg { opacity: 1; }

/* Sub menus */
.has-sub .sub-menu { list-style: none; display: none; background: rgba(0,0,0,.15); }
.has-sub.open .sub-menu { display: block; }
.has-sub > .nav-parent svg:last-child { transition: transform .22s; }
.has-sub.open > .nav-parent svg:last-child { transform: rotate(90deg); }
.sub-menu a {
  display: block; padding: 9px 14px 9px 42px;
  color: rgba(255,255,255,.5); font-size: 13px;
  transition: color .15s;
}
.sub-menu a:hover { color: #fff; text-decoration: none; background: rgba(255,255,255,.05); }

/* Sidebar footer */
.sidebar-footer {
  padding: 10px; border-top: 1px solid rgba(255,255,255,.08);
  flex-shrink: 0;
}
.sidebar-logout {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; color: rgba(255,255,255,.45);
  border-radius: 8px; font-size: 13px;
  transition: background .15s, color .15s; cursor: pointer;
}
.sidebar-logout:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }

/* Overlay behind sidebar on mobile */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 290;
}
.sidebar-overlay.show { display: block; }

/* ─── MAIN WRAPPER ─────────────────────────────────────────── */
.main-wrapper {
  min-height: 100vh; display: flex; flex-direction: column;
  transition: margin-left .28s;
}
@media (min-width: 992px) {
  .main-wrapper { margin-left: var(--sidebar-w); }
}

/* ─── TOPBAR ───────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 16px; position: sticky; top: 0; z-index: 200;
}
.sidebar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--dark); padding: 6px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.sidebar-toggle:hover { background: var(--bg); }

/* Hide toggle on desktop */
@media (min-width: 992px) {
  .sidebar-toggle { display: none; }
}

.topbar-title { font-weight: 600; font-size: 15px; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* Hide "New Sale" text label on very small screens */
.btn-new-sale .btn-label { display: none; }
@media (min-width: 480px) {
  .btn-new-sale .btn-label { display: inline; }
}

/* User avatar / dropdown */
.user-menu { position: relative; }
.user-avatar {
  width: 34px; height: 34px; background: var(--primary);
  color: #fff; border-radius: 50%; display: flex;
  align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; cursor: pointer;
  flex-shrink: 0; user-select: none;
}
.user-dropdown {
  display: none; position: absolute; right: 0; top: 42px;
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 0;
  min-width: 170px; box-shadow: var(--shadow-md); z-index: 400;
}
.user-menu.open .user-dropdown { display: block; }
.user-dropdown span  { display: block; padding: 6px 14px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.user-dropdown a     { display: flex; align-items: center; gap: 8px; padding: 9px 14px; color: var(--dark); font-size: 13px; }
.user-dropdown a:hover { background: var(--bg); text-decoration: none; }

/* ─── MAIN CONTENT ─────────────────────────────────────────── */
.main-content { flex: 1; padding: 16px; }
@media (min-width: 768px) { .main-content { padding: 20px; } }

/* ─── ALERTS ───────────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 13.5px; }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #166534; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1e40af; }

/* ─── CARDS ────────────────────────────────────────────────── */
.card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 16px; overflow: hidden; }
.card-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; gap: 8px; }
.card-header h3 { font-size: 14px; font-weight: 600; margin: 0; }
.card-body { padding: 16px; }
.card-body.no-pad { padding: 0; }

/* ─── STAT CARDS ───────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px; margin-bottom: 16px;
}
@media (min-width: 600px)  { .stat-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 900px)  { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 1200px) { .stat-grid { grid-template-columns: repeat(5, 1fr); } }

.stat-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  display: flex; align-items: flex-start; gap: 10px;
}
.stat-icon { font-size: 20px; flex-shrink: 0; }
.stat-value { font-size: 18px; font-weight: 700; line-height: 1.2; }
@media (min-width: 768px) { .stat-value { font-size: 22px; } }
.stat-label { font-size: 11px; color: var(--muted); margin-top: 2px; }
.stat-sub   { font-size: 11px; color: var(--muted); }
.stat-card.blue   { border-left: 4px solid var(--primary); }
.stat-card.green  { border-left: 4px solid var(--success); }
.stat-card.red    { border-left: 4px solid var(--danger); }
.stat-card.orange { border-left: 4px solid var(--warning); }
.stat-card.purple { border-left: 4px solid #8b5cf6; }

/* ─── RESPONSIVE TABLE ─────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 480px; }
.table th {
  padding: 9px 12px; text-align: left; font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); background: #f9fafb;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #f9fafb; }
.table tfoot th, .table tfoot td { font-weight: 700; background: #f3f4f6; border-top: 2px solid var(--border); }

/* Card-table wrapper auto-wraps */
.card-body.no-pad .table, .card-body.no-pad .table-wrap { overflow-x: auto; }
.card > .table, .card > .table-wrap { width: 100%; overflow-x: auto; display: block; }

.row-danger  { background: #fef2f2 !important; }
.row-warning { background: #fffbf0 !important; }

/* ─── BADGES ───────────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-orange { background: #ffedd5; color: #9a3412; }
.badge-purple { background: #ede9fe; color: #5b21b6; }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* ─── BUTTONS ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; font-size: 13px;
  font-weight: 500; cursor: pointer; text-decoration: none;
  border: 1px solid var(--border); background: var(--white);
  color: var(--dark); transition: background .15s, border .15s, color .15s;
  white-space: nowrap; -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary  { background: var(--primary); color: #fff !important; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-secondary{ background: #f3f4f6; border-color: #e5e7eb; }
.btn-danger   { color: var(--danger) !important; border-color: #fecaca; }
.btn-danger:hover { background: #fee2e2; }
.btn-sm  { padding: 5px 10px; font-size: 12px; min-height: 30px; }
.btn-lg  { padding: 12px 24px; font-size: 15px; min-height: 44px; }
.btn-block { width: 100%; }
.btn-icon  { padding: 8px; }

/* ─── FORMS ────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; margin-bottom: 5px; font-weight: 500; font-size: 13px; }
.form-control {
  width: 100%; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: 8px;
  font-size: 14px; background: var(--white); color: var(--dark);
  transition: border .15s; -webkit-appearance: none;
  min-height: 40px;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,126,248,.1); }
select.form-control { cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%236b7280' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; }
textarea.form-control { resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
@media (min-width: 600px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 900px) { .form-grid { grid-template-columns: repeat(3, 1fr); } }
.form-actions { display: flex; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); margin-top: 16px; flex-wrap: wrap; }
.checkbox-label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 400 !important; min-height: 40px; }
.checkbox-label input[type=checkbox] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--primary); }

/* ─── PAGE LAYOUT ──────────────────────────────────────────── */
.page-actions {
  display: flex; justify-content: space-between;
  align-items: flex-start; gap: 10px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.page-actions .search-bar { display: flex; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.action-btns { display: flex; gap: 8px; flex-wrap: wrap; }

/* Two-column dashboard grid */
.dash-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 768px) { .dash-grid { grid-template-columns: 1fr 1fr; } }

.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-danger { color: var(--danger); }
.muted       { color: var(--muted); }
.actions     { white-space: nowrap; }

/* ─── PAGINATION ───────────────────────────────────────────── */
.pagination { display: flex; gap: 4px; padding: 12px 16px; flex-wrap: wrap; }
.pagination a { padding: 6px 11px; border: 1px solid var(--border); border-radius: 6px; color: var(--dark); font-size: 13px; min-height: 34px; display: flex; align-items: center; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ─── AUTH ─────────────────────────────────────────────────── */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg,#1e2533,#2d3748); padding: 20px; }
.auth-container { width: 100%; max-width: 420px; }
.auth-card { background: var(--white); border-radius: 16px; padding: 28px 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
@media (min-width: 480px) { .auth-card { padding: 36px; } }
.auth-header { text-align: center; margin-bottom: 28px; }
.auth-logo { font-size: 26px; font-weight: 800; color: var(--primary); letter-spacing: -1px; }
.auth-header p { color: var(--muted); font-size: 13px; margin-top: 4px; }
.auth-footer { text-align: center; margin-top: 20px; font-size: 12px; color: var(--muted); }

/* ─── POS SCREEN ───────────────────────────────────────────── */
/* Mobile: stacked. Desktop: side-by-side */
.pos-wrap {
  display: flex; flex-direction: column;
  height: calc(100dvh - var(--topbar-h) - 32px);
  gap: 0;
}
@media (min-width: 900px) {
  .pos-wrap { flex-direction: row; height: calc(100vh - var(--topbar-h) - 40px); }
}

/* Products panel */
.pos-left { flex: 1; overflow-y: auto; padding: 12px; background: var(--bg); min-height: 0; }
.pos-search-bar { display: flex; gap: 8px; margin-bottom: 10px; }
.pos-search-bar input { flex: 1; }
.product-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 480px)  { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 768px)  { .product-grid { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 900px)  { .product-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .product-grid { grid-template-columns: repeat(4, 1fr); } }

.product-card {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: 10px; padding: 10px 8px; cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
  active: scale(.97);
}
.product-card:hover  { border-color: var(--primary); box-shadow: 0 2px 8px rgba(79,126,248,.15); }
.product-card:active { transform: scale(.97); }
.product-card.out-of-stock { opacity: .45; pointer-events: none; }
.p-name  { font-weight: 600; font-size: 12px; margin-bottom: 4px; line-height: 1.3; }
.p-price { color: var(--primary); font-weight: 700; font-size: 14px; }
.p-stock { font-size: 10px; color: var(--muted); margin-top: 2px; }

/* Cart panel */
.pos-right {
  background: var(--white);
  display: flex; flex-direction: column;
  border-top: 2px solid var(--border);
  min-height: 0;
}
@media (min-width: 900px) {
  .pos-right { width: 360px; flex-shrink: 0; border-top: none; border-left: 1px solid var(--border); }
}

/* Mobile cart toggle */
.cart-tab-bar {
  display: flex; background: var(--white);
  border-top: 1px solid var(--border);
  position: sticky; bottom: 0; z-index: 100;
}
@media (min-width: 900px) { .cart-tab-bar { display: none; } }

.cart-tab-btn {
  flex: 1; padding: 10px; border: none; background: none;
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  border-top: 3px solid transparent;
}
.cart-tab-btn.active { color: var(--primary); border-top-color: var(--primary); }

/* Mobile: cart panel hidden by default, shown as bottom sheet */
.pos-right { display: none; }
.pos-right.cart-visible { display: flex; }
@media (min-width: 900px) { .pos-right { display: flex !important; } }

/* Cart inner styles */
.cart-header { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.cart-header strong { font-size: 14px; }
.cart-clear { background: none; border: none; color: var(--danger); cursor: pointer; font-size: 12px; font-weight: 600; }
.cart-items { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cart-item {
  display: grid; grid-template-columns: 1fr auto auto auto;
  gap: 6px; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.item-name { font-weight: 500; font-size: 12px; line-height: 1.3; }
.item-serial { font-size: 10px; color: var(--muted); }
.qty-ctrl  { display: flex; align-items: center; gap: 3px; }
.qty-btn   { width: 22px; height: 22px; border: 1px solid var(--border); background: var(--white); border-radius: 4px; cursor: pointer; font-size: 14px; line-height: 1; display: flex; align-items: center; justify-content: center; -webkit-tap-highlight-color: transparent; }
.qty-input { width: 34px; text-align: center; border: 1px solid var(--border); border-radius: 4px; padding: 2px; font-size: 12px; }
.item-total{ font-weight: 600; font-size: 12px; min-width: 60px; text-align: right; white-space: nowrap; }
.item-del  { color: var(--danger); cursor: pointer; font-size: 16px; padding: 0 2px; line-height: 1; }

/* Cart summary */
.cart-summary { padding: 10px 14px; border-top: 1px solid var(--border); background: #fafafa; }
.sum-row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.sum-total { font-size: 16px; font-weight: 700; color: var(--dark); }

/* Payment methods */
.pay-section { padding: 8px 14px 0; }
.pay-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .5px; margin-bottom: 6px; }
.pay-btns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.pay-btn {
  padding: 8px 4px; border: 1.5px solid var(--border); border-radius: 8px;
  background: var(--white); cursor: pointer; font-size: 11px; font-weight: 600;
  color: var(--dark); text-align: center; transition: border-color .15s;
  -webkit-tap-highlight-color: transparent;
}
.pay-btn.selected { border-color: var(--primary); background: var(--primary-light); color: var(--primary); }
.pay-input-row { display: flex; gap: 6px; margin-bottom: 6px; }
.pay-input-row input { flex: 1; min-width: 0; }

/* Action buttons */
.pos-actions { display: grid; grid-template-columns: 1fr 2fr; gap: 8px; padding: 8px 14px 14px; }
.btn-hold    { padding: 12px; border-radius: 8px; border: 1.5px solid var(--border); background: var(--white); cursor: pointer; font-size: 13px; font-weight: 600; -webkit-tap-highlight-color: transparent; }
.btn-complete{ padding: 12px; border-radius: 8px; border: none; background: var(--success); color: #fff; cursor: pointer; font-size: 14px; font-weight: 700; -webkit-tap-highlight-color: transparent; }
.btn-complete:active { background: #16a34a; transform: scale(.98); }

/* Customer + discount row */
.pos-customer-row { display: flex; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.pos-customer-row select { flex: 1; min-width: 140px; }
.pos-disc-row { display: flex; gap: 6px; margin-bottom: 10px; }
.pos-disc-row input  { width: 90px; }
.pos-disc-row select { flex: 1; }

/* ─── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 1000;
  align-items: flex-end; justify-content: center;
}
@media (min-width: 600px) { .modal-overlay { align-items: center; } }
.modal-overlay.show { display: flex; }
.modal-box {
  background: var(--white); width: 100%; max-width: 480px;
  border-radius: 16px 16px 0 0; padding: 20px;
  max-height: 90dvh; overflow-y: auto;
}
@media (min-width: 600px) { .modal-box { border-radius: 16px; } }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.modal-sub   { color: var(--muted); font-size: 13px; margin-bottom: 14px; }

/* ─── BOTTOM NAV (Mobile only quick-nav) ───────────────────── */
.bottom-nav {
  display: flex; position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--white); border-top: 1px solid var(--border);
  z-index: 250; padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
@media (min-width: 992px) { .bottom-nav { display: none; } }
.bottom-nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 4px; cursor: pointer; color: var(--muted);
  font-size: 10px; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  border: none; background: none;
}
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item svg { flex-shrink: 0; }

/* Push content above bottom nav on mobile */
@media (max-width: 991px) {
  .main-content { padding-bottom: 70px; }
  /* POS screen doesn't need extra padding — it handles its own layout */
  body.pos-page .main-content { padding-bottom: 0; }
}

/* ─── PRINT ────────────────────────────────────────────────── */
@media print {
  .sidebar, .topbar, .bottom-nav, .cart-tab-bar,
  .no-print, .page-actions, .form-actions,
  .btn, .action-btns { display: none !important; }
  .main-wrapper { margin-left: 0 !important; }
  .main-content { padding: 0 !important; }
  .card { border: none !important; box-shadow: none !important; }
}

/* ─── INSTALLER ────────────────────────────────────────────── */
.install-wrap  { max-width: 620px; margin: 30px auto; padding: 16px; }
.install-card  { background: var(--white); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
@media (min-width: 600px) { .install-card { padding: 36px; } }
.install-header { text-align: center; margin-bottom: 24px; }
.install-logo  { font-size: 28px; font-weight: 800; color: var(--primary); }
.step-list     { display: flex; gap: 0; margin-bottom: 24px; }
.step-item     { flex: 1; text-align: center; padding: 8px 4px; font-size: 11px; border-bottom: 3px solid var(--border); }
.step-item.active { border-bottom-color: var(--primary); color: var(--primary); font-weight: 600; }
.step-item.done   { border-bottom-color: var(--success);  color: var(--success); }

/* ─── UTILITIES ────────────────────────────────────────────── */
.d-none { display: none !important; }
.d-flex { display: flex !important; }
.flex-wrap { flex-wrap: wrap; }
.gap-8  { gap: 8px; }
.w-100  { width: 100% !important; }
.mt-8   { margin-top: 8px; }
.mt-12  { margin-top: 12px; }
.mb-0   { margin-bottom: 0 !important; }

/* ─── ADDITIONAL RESPONSIVE HELPERS ───────────────────────── */

/* Stack card actions vertically on very small screens */
@media (max-width: 480px) {
  .page-actions { flex-direction: column; }
  .page-actions .search-bar { width: 100%; }
  .page-actions .search-bar input,
  .page-actions .search-bar select { flex: 1; min-width: 0; }
  .action-btns { width: 100%; }
  .action-btns .btn { flex: 1; justify-content: center; }

  /* Make stat values smaller */
  .stat-value { font-size: 16px !important; }
  .stat-card  { padding: 10px 12px; }

  /* Full-width form actions */
  .form-actions .btn { flex: 1; justify-content: center; }

  /* Card body padding reduction */
  .card-body { padding: 12px; }

  /* Product form grid full width on phone */
  .form-grid { grid-template-columns: 1fr !important; }
}

/* Inventory table — hide less important cols on small screens */
@media (max-width: 640px) {
  .table th.hide-mobile,
  .table td.hide-mobile { display: none; }
}

/* Make dash-grid single column on small screens */
@media (max-width: 767px) {
  .dash-grid { grid-template-columns: 1fr !important; }
}

/* Repair status badges wrap on mobile */
@media (max-width: 600px) {
  .badge { font-size: 10px; padding: 2px 6px; }
}

/* Responsive pos-bar items */
@media (max-width: 600px) {
  .pos-customer-row select { font-size: 14px; }
  .pos-disc-row { flex-wrap: wrap; }
}

/* Table actions column: stack buttons on mobile */
@media (max-width: 640px) {
  .actions { display: flex; flex-direction: column; gap: 4px; }
  .actions .btn { display: block; }
}

/* Bottom nav safe area */
.bottom-nav {
  padding-bottom: max(6px, env(safe-area-inset-bottom, 6px));
}

/* Sidebar scrollbar styling */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }

/* Smooth scrolling */
html { scroll-behavior: smooth; }
.cart-items, .pos-left { scroll-behavior: smooth; }

/* Focus ring for accessibility */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); }

/* Loading state */
.loading { opacity: .6; pointer-events: none; }

/* ── Branch pill in topbar ────────────────────────── */
.branch-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px; background: #eff3ff; color: #4f7ef8;
  border-radius: 20px; font-size: 12px; font-weight: 600;
  white-space: nowrap; text-decoration: none; flex-shrink: 0;
}
.branch-pill:hover { background: #dbeafe; text-decoration: none; }

/* ── Installment plan progress bar ───────────────── */
.inst-progress { height: 8px; background: #e5e7eb; border-radius: 20px; overflow: hidden; margin: 6px 0; }
.inst-progress-bar { height: 100%; border-radius: 20px; background: #4f7ef8; transition: width .5s; }
.inst-progress-bar.complete { background: #22c55e; }
