/* ============================================================
   GULIYA POS & ERP — Multi-Company POS & ERP Design System
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap');

/* ── Design Tokens ── */
:root, [data-theme="dark"] {
  --bg-dark:         #07090f;
  --bg-card:         #0f1629;
  --bg-card-hover:   #172040;
  --bg-surface:      #1a2444;
  --surface-2:       #1e2a4a;
  --border-color:    rgba(255,255,255,0.07);

  /* Primary — Indigo (Guliya POS brand) */
  --primary:         #6366f1;
  --primary-hover:   #4f52e0;
  --primary-light:   rgba(99,102,241,0.15);

  /* Categories */
  --cat-sm:          #3b82f6;
  --cat-sm-light:    rgba(59,130,246,0.13);
  --cat-sm-border:   rgba(59,130,246,0.3);
  --cat-hw:          #f59e0b;
  --cat-hw-light:    rgba(245,158,11,0.13);
  --cat-hw-border:   rgba(245,158,11,0.3);
  --cat-ft:          #10b981;
  --cat-ft-light:    rgba(16,185,129,0.13);
  --cat-ft-border:   rgba(16,185,129,0.3);

  /* Accent — Emerald */
  --accent:          #10b981;
  --accent-hover:    #059669;
  --accent-light:    rgba(16,185,129,0.13);

  --warning:         #f59e0b;
  --warning-light:   rgba(245,158,11,0.13);
  --danger:          #ef4444;
  --danger-light:    rgba(239,68,68,0.13);
  --info:            #06b6d4;
  --info-light:      rgba(6,182,212,0.13);
  --purple:          #8b5cf6;
  --purple-light:    rgba(139,92,246,0.13);

  --text-main:       #f0f4ff;
  --text-muted:      #8896b3;
  --text-dim:        #4e5d7a;

  --radius-xs:       6px;
  --radius-sm:       10px;
  --radius-md:       16px;
  --radius-lg:       22px;
  --radius-full:     9999px;

  --shadow-sm:       0 4px 16px rgba(0,0,0,0.3);
  --shadow-md:       0 12px 40px rgba(0,0,0,0.45);
  --shadow-glow:     0 0 30px rgba(99,102,241,0.2);

  --font-heading:    'Outfit', sans-serif;
  --font-body:       'Plus Jakarta Sans', sans-serif;
}

[data-theme="light"] {
  --bg-dark:         #eef1f8;
  --bg-card:         #ffffff;
  --bg-card-hover:   #f4f6fb;
  --bg-surface:      #f0f2f9;
  --surface-2:       #e8ecf5;
  --border-color:    #d1d9ed;

  --primary:         #4f46e5;
  --primary-hover:   #4338ca;
  --primary-light:   rgba(79,70,229,0.1);

  --cat-sm:          #2563eb;
  --cat-sm-light:    rgba(37,99,235,0.08);
  --cat-sm-border:   rgba(37,99,235,0.2);
  --cat-hw:          #d97706;
  --cat-hw-light:    rgba(217,119,6,0.08);
  --cat-hw-border:   rgba(217,119,6,0.2);
  --cat-ft:          #059669;
  --cat-ft-light:    rgba(5,150,105,0.08);
  --cat-ft-border:   rgba(5,150,105,0.2);

  --accent:          #059669;
  --accent-light:    rgba(5,150,105,0.1);
  --warning:         #d97706;
  --warning-light:   rgba(217,119,6,0.1);
  --danger:          #dc2626;
  --danger-light:    rgba(220,38,38,0.1);
  --info:            #0891b2;
  --info-light:      rgba(8,145,178,0.1);
  --purple:          #7c3aed;
  --purple-light:    rgba(124,58,237,0.1);

  --text-main:       #0f1629;
  --text-muted:      #4a5578;
  --text-dim:        #8896b3;
  --shadow-sm:       0 2px 10px rgba(0,0,0,0.06);
  --shadow-md:       0 10px 32px rgba(0,0,0,0.10);
  --shadow-glow:     0 0 20px rgba(79,70,229,0.10);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
input, select, textarea, button { font-family: inherit; }

/* Hide number input spinners globally */
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
}

/* ── Select & Option Styling (Dark Mode Visibility Fix) ── */
select {
  background-color: var(--bg-surface);
  color: var(--text-main);
}
select option {
  background-color: var(--bg-card, #1e293b);
  color: var(--text-main, #f8fafc);
  padding: 8px 12px;
}
[data-theme="dark"] select option,
html[data-theme="dark"] option {
  background-color: #1e293b !important;
  color: #f8fafc !important;
}
[data-theme="light"] select option,
html[data-theme="light"] option {
  background-color: #ffffff !important;
  color: #0f172a !important;
}

/* ── App Shell ── */
.app-container { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Navbar ── */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  z-index: 100;
  flex-shrink: 0;
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 16px; }

.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.brand-logo {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: #fff;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-family: var(--font-heading); font-weight: 900; font-size: 1.1rem; letter-spacing: 0.5px; color: var(--text-main); line-height: 1; }
.brand-sub  { font-size: 0.6rem; color: var(--primary); font-weight: 700; letter-spacing: 2px; text-transform: uppercase; line-height: 1; margin-top: 2px; }

.nav-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--text-muted); }
.nav-breadcrumb .sep { color: var(--text-dim); }
.nav-breadcrumb .crumb-cat { font-weight: 600; }
.nav-breadcrumb .crumb-br  { color: var(--text-main); font-weight: 600; }

.nav-scope-selector { display: flex; align-items: center; gap: 8px; }
.nav-scope-selector select {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  cursor: pointer;
}

.status-pill { display: flex; align-items: center; gap: 6px; font-size: 0.75rem; padding: 4px 10px; background: var(--accent-light); color: var(--accent); border-radius: var(--radius-full); font-weight: 600; }
.status-pill .dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1;} 50%{opacity:.4;} }

.db-status { font-size: 0.72rem; padding: 4px 10px; border-radius: var(--radius-full); font-weight: 600; }
.db-status.online { background: rgba(16, 185, 129, 0.15); color: #10b981; border: 1px solid rgba(16, 185, 129, 0.3); }
.db-status.connecting { background: rgba(245, 158, 11, 0.15); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.3); }
.db-status.offline { background: rgba(239, 68, 68, 0.15); color: #ef4444; border: 1px solid rgba(239, 68, 68, 0.3); }

.icon-btn { position: relative; width: 36px; height: 36px; background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-main); border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: background .2s; }
.icon-btn:hover { background: var(--bg-card-hover); }

/* ── Notification Badge ── */
.notif-badge-dot {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.6rem;
  font-weight: 800;
  border-radius: var(--radius-full);
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--bg-card);
  animation: notif-pop 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), notif-pulse 2.5s 0.3s infinite;
  line-height: 1;
  pointer-events: none;
}
@keyframes notif-pop {
  0%   { transform: scale(0); opacity: 0; }
  70%  { transform: scale(1.25); }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes notif-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(239,68,68,0); }
}

.user-pill { display: flex; align-items: center; gap: 8px; }
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; flex-shrink: 0; }
.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 0.82rem; font-weight: 600; line-height: 1.2; }
.user-role { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }

/* ── Main Layout ── */
.main-wrapper { display: flex; flex: 1; overflow: hidden; }

/* ── Sidebar ── */
.sidebar {
  width: 232px;
  background: var(--bg-card);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  padding: 12px;
  gap: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  flex-shrink: 0;
}

.role-switcher { padding: 8px 8px 10px; border-bottom: 1px solid var(--border-color); margin-bottom: 6px; }
.role-switcher-label { font-size: 0.62rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 1px; font-weight: 700; margin-bottom: 6px; }
.role-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.role-pill { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-muted); font-size: 0.68rem; padding: 4px 6px; border-radius: 6px; cursor: pointer; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: all .15s; }
.role-pill:hover { background: var(--bg-card-hover); color: var(--text-main); }
.role-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

.sidebar-section-label {
  font-size: 0.6rem; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px;
  color: var(--text-dim); padding: 10px 10px 4px; margin-top: 4px;
}
.sidebar-divider { border: none; border-top: 1px solid var(--border-color); margin: 6px 0; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: transparent; border: none;
  color: var(--text-muted); font-size: 0.83rem; font-weight: 500;
  cursor: pointer; width: 100%; text-align: left;
  transition: all .15s;
}
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-item:hover  { background: var(--bg-card-hover); color: var(--text-main); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 700; }
.nav-item.active-sm { background: var(--cat-sm-light); color: var(--cat-sm); font-weight: 700; }
.nav-item.active-hw { background: var(--cat-hw-light); color: var(--cat-hw); font-weight: 700; }
.nav-item.active-ft { background: var(--cat-ft-light); color: var(--cat-ft); font-weight: 700; }

.nav-item-cat { padding-left: 20px; font-size: 0.8rem; }

/* Category color labels in sidebar */
.cat-label-sm { color: var(--cat-sm); }
.cat-label-hw { color: var(--cat-hw); }
.cat-label-ft { color: var(--cat-ft); }
.cat-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.cat-dot-sm { background: var(--cat-sm); }
.cat-dot-hw { background: var(--cat-hw); }
.cat-dot-ft { background: var(--cat-ft); }

/* ── Content Area ── */
.content-area { flex: 1; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 22px 24px; background: var(--bg-dark); }

/* ── Typography ── */
h1,h2,h3,h4 { font-family: var(--font-heading); font-weight: 700; }
.page-title { font-size: 1.35rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.page-title svg { width: 22px; height: 22px; }
.text-muted { color: var(--text-muted); }
.text-dim { color: var(--text-dim); }
.text-success { color: var(--accent); }
.text-warning { color: var(--warning); }
.text-danger  { color: var(--danger); }
.text-info    { color: var(--info); }
.text-primary { color: var(--primary); }
.text-sm { font-size: 0.78rem; }
.text-xs { font-size: 0.7rem; }
.font-bold { font-weight: 700; }
.font-heading { font-family: var(--font-heading); }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 8px 16px; border-radius: var(--radius-sm); border: none; font-weight: 600; font-size: 0.82rem; cursor: pointer; transition: all .15s; white-space: nowrap; }
.btn svg { width: 14px; height: 14px; }
.btn-primary   { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success   { background: var(--accent); color: #fff; }
.btn-secondary { background: var(--bg-surface); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-danger    { background: var(--danger); color: #fff; }
.btn-warning   { background: var(--warning); color: #000; }
.btn-outline   { background: transparent; border: 1px solid var(--border-color); color: var(--text-main); }
.btn-ghost     { background: transparent; color: var(--text-muted); border: none; }
.btn-sm  { padding: 5px 10px; font-size: 0.75rem; }
.btn-xs  { padding: 3px 8px; font-size: 0.7rem; border-radius: 6px; }
.btn-lg  { padding: 12px 22px; font-size: 0.9rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: var(--radius-full); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .3px; }
.badge-primary  { background: var(--primary-light); color: var(--primary); }
.badge-success  { background: var(--accent-light); color: var(--accent); }
.badge-warning  { background: var(--warning-light); color: var(--warning); }
.badge-danger   { background: var(--danger-light); color: var(--danger); }
.badge-info     { background: var(--info-light); color: var(--info); }
.badge-purple   { background: var(--purple-light); color: var(--purple); }
.badge-dim      { background: var(--bg-surface); color: var(--text-muted); }

/* Category badges */
.badge-sm { background: var(--cat-sm-light); color: var(--cat-sm); }
.badge-hw { background: var(--cat-hw-light); color: var(--cat-hw); }
.badge-ft { background: var(--cat-ft-light); color: var(--cat-ft); }

/* ── Cards ── */
.card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 20px; }
.card-sm { padding: 14px 16px; }
.card:hover { border-color: rgba(255,255,255,0.12); }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-title { font-size: 0.88rem; font-weight: 700; color: var(--text-main); }

/* ── Stats Grid ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); padding: 18px 20px; display: flex; flex-direction: column; gap: 6px; }
.stat-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; font-weight: 600; }
.stat-val   { font-size: 1.6rem; font-weight: 800; font-family: var(--font-heading); line-height: 1; }
.stat-change { font-size: 0.72rem; color: var(--accent); font-weight: 600; }

/* ── Group Overview Category Cards ── */
.category-cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.category-card {
  background: var(--bg-card); border-radius: var(--radius-lg);
  padding: 22px; display: flex; flex-direction: column; gap: 14px;
  border: 1px solid var(--border-color); transition: all .2s;
}
.category-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.category-card.cat-sm { border-top: 3px solid var(--cat-sm); }
.category-card.cat-hw { border-top: 3px solid var(--cat-hw); }
.category-card.cat-ft { border-top: 3px solid var(--cat-ft); }

.cat-card-header { display: flex; align-items: center; gap: 12px; }
.cat-card-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }
.cat-card-icon.sm { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.cat-card-icon.hw { background: linear-gradient(135deg, #f59e0b, #b45309); }
.cat-card-icon.ft { background: linear-gradient(135deg, #10b981, #065f46); }
.cat-card-icon svg { width: 22px; height: 22px; }
.cat-card-name  { font-family: var(--font-heading); font-size: 1rem; font-weight: 800; }
.cat-card-count { font-size: 0.72rem; color: var(--text-muted); }

.cat-card-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cat-kpi { background: var(--bg-surface); border-radius: var(--radius-sm); padding: 10px 12px; }
.cat-kpi-label { font-size: 0.65rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; }
.cat-kpi-val   { font-size: 1rem; font-weight: 800; font-family: var(--font-heading); }

.cat-card-branches { display: flex; flex-direction: column; gap: 6px; }
.branch-chip { display: flex; align-items: center; justify-content: space-between; background: var(--bg-surface); border-radius: var(--radius-xs); padding: 7px 10px; font-size: 0.78rem; cursor: pointer; transition: background .15s; }
.branch-chip:hover { background: var(--bg-card-hover); }
.branch-chip-name { font-weight: 600; }
.branch-chip-rev  { color: var(--text-muted); font-size: 0.72rem; }

.cat-card-footer { margin-top: 4px; }

/* ── Data Table ── */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.data-table thead th { padding: 10px 14px; border-bottom: 1px solid var(--border-color); color: var(--text-muted); text-transform: uppercase; font-size: 0.68rem; letter-spacing: .5px; font-weight: 700; text-align: left; white-space: nowrap; }
.data-table tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border-color); vertical-align: middle; }
.data-table tbody tr:hover { background: var(--bg-surface); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── POS Layout ── */
.pos-layout { display: flex; gap: 18px; height: calc(100vh - 100px); overflow: hidden; }
.pos-catalog { flex: 1; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.pos-panel { width: 360px; flex-shrink: 0; background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-md); display: flex; flex-direction: column; overflow: hidden; }

.search-bar { display: flex; align-items: center; gap: 10px; background: var(--bg-card); border: 1px solid var(--border-color); padding: 10px 16px; border-radius: var(--radius-md); }
.search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-bar input { background: transparent; border: none; outline: none; color: var(--text-main); width: 100%; font-size: 0.88rem; }

.cat-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; flex-shrink: 0; }
.cat-tab { background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-muted); padding: 6px 13px; border-radius: var(--radius-full); font-size: 0.78rem; white-space: nowrap; cursor: pointer; transition: all .15s; flex-shrink: 0; }
.cat-tab:hover { color: var(--text-main); }
.cat-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  grid-auto-rows: max-content;
  align-content: start;
  gap: 14px;
  overflow-y: auto;
  padding-right: 6px;
  flex: 1;
}
.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s, border-color 0.2s;
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 240px;
}
.product-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4), 0 0 15px rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.4);
}
.product-card-img {
  position: relative;
  height: 115px;
  background: #090d16;
  overflow: hidden;
}
.product-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.product-card:hover .product-card-img img {
  transform: scale(1.06);
}
.stock-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(15, 22, 41, 0.85);
  backdrop-filter: blur(6px);
  color: #fff;
  font-size: 0.68rem;
  padding: 3px 8px;
  border-radius: var(--radius-full);
  font-weight: 700;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.stock-badge.low {
  background: var(--warning);
  border-color: var(--warning);
}
.stock-badge.out-of-stock {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  font-weight: 800;
}
.product-card.out-of-stock-card {
  opacity: 0.65;
  filter: grayscale(35%);
  border-color: rgba(239, 68, 68, 0.3);
}
.product-card.out-of-stock-card:hover {
  transform: none;
}
.product-card-body {
  padding: 10px 12px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
}
.product-code {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  font-weight: 700;
}
.product-name {
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
  padding-top: 6px;
  border-top: 1px dashed var(--border-color);
}
.product-price {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--accent);
  font-family: var(--font-heading);
}
.add-btn {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s;
}
.product-card:hover .add-btn {
  background: var(--primary-hover);
  transform: scale(1.05);
}
.add-btn svg {
  width: 15px;
  height: 15px;
}

/* POS Cart Panel */
.cart-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border-color); flex-shrink: 0; }
.cart-title { font-size: 0.88rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.cart-title svg { width: 16px; height: 16px; }
.cart-customer { padding: 8px 16px; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.cart-customer svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.cart-customer select { background: transparent; border: none; outline: none; color: var(--text-main); font-size: 0.8rem; flex: 1; cursor: pointer; }
.cart-customer select option { background: #1e293b; color: #f8fafc; padding: 8px 12px; }
[data-theme="light"] .cart-customer select option { background: #ffffff; color: #0f172a; }
.cart-items { flex: 1 1 auto; min-height: 120px; overflow-y: auto; padding: 10px 16px; display: flex; flex-direction: column; gap: 8px; }
.cart-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 8px; color: var(--text-dim); text-align: center; }
.cart-empty svg { width: 40px; height: 40px; }
.cart-empty p { font-size: 0.8rem; }
.cart-item { background: var(--bg-surface); border-radius: var(--radius-sm); padding: 9px; display: flex; gap: 8px; align-items: center; }
.cart-item-info { flex: 1; min-width: 0; }
.cart-item-name { font-size: 0.78rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cart-item-price { font-size: 0.7rem; color: var(--text-muted); }
.qty-ctrl { display: flex; align-items: center; gap: 6px; }
.qty-btn { width: 22px; height: 22px; background: var(--bg-card); border: 1px solid var(--border-color); color: var(--text-main); border-radius: 5px; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.9rem; font-weight: 700; flex-shrink: 0; }
.qty-val { font-size: 0.82rem; font-weight: 700; min-width: 20px; text-align: center; }
.cart-item-total { font-size: 0.82rem; font-weight: 700; text-align: right; min-width: 70px; }

.cart-summary { padding: 10px 16px; border-top: 1px solid var(--border-color); display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.sum-row { display: flex; justify-content: space-between; font-size: 0.8rem; }
.sum-row.total { font-size: 1rem; font-weight: 800; color: var(--accent); padding-top: 6px; border-top: 1px solid var(--border-color); }
.sum-input { width: 110px; background: var(--bg-surface); border: 1px solid var(--border-color); border-radius: 6px; color: var(--text-main); padding: 5px 10px; text-align: right; font-size: 0.9rem; font-weight: 700; outline: none; }
.sum-input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-light); }
.pm-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; margin-top: 4px; }
.pm-btn { background: var(--bg-surface); border: 1px solid var(--border-color); color: var(--text-muted); padding: 5px; border-radius: 7px; font-size: 0.72rem; cursor: pointer; font-weight: 600; transition: all .15s; }
.pm-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.change-row { background: var(--bg-surface); border-radius: 7px; padding: 6px 10px; display: flex; justify-content: space-between; font-size: 0.8rem; }
.change-row strong { color: var(--accent); font-size: 0.95rem; }
.cart-actions { padding: 10px 16px; border-top: 1px solid var(--border-color); display: flex; gap: 8px; flex-shrink: 0; }

/* ── Forms ── */
.form-group { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.form-group label { font-size: 0.75rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .3px; }
.form-group input, .form-group select, .form-group textarea {
  background: var(--bg-surface); border: 1px solid var(--border-color);
  color: var(--text-main); padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 0.85rem; outline: none; transition: border-color .15s, box-shadow .15s;
  width: 100%; max-width: 100%; min-width: 0; text-overflow: ellipsis;
  box-sizing: border-box;
}
.form-group select {
  appearance: auto;
  cursor: pointer;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
}
.form-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; width: 100%; }

/* ── Modals ── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.75); display: flex; align-items: center; justify-content: center; z-index: 200; backdrop-filter: blur(4px); padding: 16px; }
.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  box-sizing: border-box;
  box-shadow: var(--shadow-md);
}
.modal-lg { max-width: 720px; }
.modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-shrink: 0; }
.modal-title { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-title svg { width: 18px; height: 18px; flex-shrink: 0; }
.modal-footer { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }

/* Receipt Modal */
.receipt-paper { background: #fff; color: #000; padding: 20px 18px; border-radius: 8px; font-family: 'Courier New', monospace; font-size: 0.75rem; line-height: 1.5; }
.receipt-paper h2 { font-size: 1rem; margin-bottom: 2px; }
.receipt-hr { border-top: 1px dashed #888; margin: 8px 0; }
.receipt-row { display: flex; justify-content: space-between; }
.receipt-row.grand { font-weight: 900; font-size: 0.9rem; border-top: 1px solid #000; border-bottom: 1px solid #000; padding: 3px 0; margin: 4px 0; }
.receipt-center { text-align: center; }

/* Held Orders */
.held-list { display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.held-item { display: flex; justify-content: space-between; align-items: center; background: var(--bg-surface); padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.8rem; }

/* ── Login Screen (Stunning Modern Redesign) ── */
.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #080c14;
  position: relative;
  overflow: hidden;
  padding: 24px;
}

/* Ambient Background Glow Blobs */
.login-bg-glow1 {
  position: absolute;
  top: -150px;
  left: 50%;
  transform: translateX(-50%);
  width: 650px;
  height: 650px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.22) 0%, rgba(16, 185, 129, 0.08) 50%, transparent 70%);
  filter: blur(90px);
  pointer-events: none;
  border-radius: 50%;
  animation: pulseGlow 8s ease-in-out infinite alternate;
}

.login-bg-glow2 {
  position: absolute;
  bottom: -200px;
  right: -100px;
  width: 550px;
  height: 550px;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.15) 0%, rgba(99, 102, 241, 0.05) 60%, transparent 80%);
  filter: blur(90px);
  pointer-events: none;
  border-radius: 50%;
}

@keyframes pulseGlow {
  0% { transform: translateX(-50%) scale(0.95); opacity: 0.8; }
  100% { transform: translateX(-50%) scale(1.1); opacity: 1; }
}

.login-wrap {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  position: relative;
  z-index: 2;
}

.login-brand {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.login-logo {
  width: 68px;
  height: 68px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed, #059669);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 12px 36px rgba(99, 102, 241, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: transform 0.3s ease;
}

.login-logo:hover {
  transform: scale(1.05) rotate(2deg);
}

.login-logo svg {
  width: 34px;
  height: 34px;
  stroke-width: 2px;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-top: 2px;
}

.brand-subtitle {
  font-size: 0.8rem;
  color: #94a3b8;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  font-weight: 600;
}

.division-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 4px;
}

.div-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  backdrop-filter: blur(10px);
}

.div-pill svg { width: 13px; height: 13px; }

.div-pill.sm { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
.div-pill.hw { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); }
.div-pill.ft { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }

/* Glass Card */
.login-card {
  background: rgba(15, 23, 42, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05) inset;
}

.login-card-header {
  text-align: center;
}

.login-card-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f8fafc;
}

.login-card-header p {
  font-size: 0.8rem;
  color: #94a3b8;
  margin-top: 4px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.input-with-icon {
  position: relative;
  display: flex;
  align-items: center;
}

.input-with-icon .field-icon {
  position: absolute;
  left: 14px;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.input-with-icon .field-icon svg {
  width: 17px;
  height: 17px;
}

.input-with-icon input {
  width: 100%;
  background: rgba(30, 41, 59, 0.7);
  border: 1.5px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  color: #f8fafc;
  padding: 12px 14px 12px 42px;
  font-size: 0.9rem;
  outline: none;
  transition: all 0.2s ease;
}

.input-with-icon input:focus {
  border-color: #6366f1;
  background: rgba(30, 41, 59, 0.95);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.25);
}

.pass-toggle-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.pass-toggle-btn:hover {
  color: #f8fafc;
}

.pass-toggle-btn svg {
  width: 18px;
  height: 18px;
}

.btn-login-submit {
  width: 100%;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  border: none;
  padding: 13px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: 0 10px 25px -5px rgba(99, 102, 241, 0.4);
  transition: all 0.2s ease;
  margin-top: 4px;
}

.btn-login-submit:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 15px 30px -5px rgba(99, 102, 241, 0.55);
  background: linear-gradient(135deg, #4338ca, #4f46e5);
}

.btn-login-submit svg {
  width: 18px;
  height: 18px;
}

.login-security-notice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.72rem;
  color: #64748b;
  padding-top: 4px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
}

.login-security-notice svg {
  width: 14px;
  height: 14px;
  color: #10b981;
}

.login-footer {
  text-align: center;
  font-size: 0.73rem;
  color: #64748b;
  letter-spacing: 0.5px;
}

/* ── Page Wrapper ── */
.page-wrap { display: flex; flex-direction: column; gap: 20px; }
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.page-actions { display: flex; gap: 8px; }

/* ── Empty State ── */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 48px; color: var(--text-dim); text-align: center; }
.empty-state svg { width: 44px; height: 44px; }
.empty-state p { font-size: 0.85rem; }

/* ── Utility ── */
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.gap-4  { gap: 4px; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; width: 100%; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: 100%; }

/* ── Print Styles ── */
@media print {
  body > *:not(#root) { display: none !important; }
  .modal-overlay { position: static !important; background: none !important; }
  .modal { box-shadow: none !important; border: none !important; padding: 0 !important; }
  .receipt-paper { width: 80mm !important; font-size: 11px !important; }
  .modal-footer, .navbar, .sidebar, .pos-catalog { display: none !important; }
}

/* ── Responsive ── */
@media (max-width: 1200px) { .category-cards-grid { grid-template-columns: 1fr; } }
@media (max-width: 900px)  { .pos-layout { flex-direction: column; height: auto; } .pos-panel { width: 100%; } }

/* ═══════════════════════════════════════════════════════════════
   LOOSE SALE / WEIGHT-BASED SELLING STYLES
   ═══════════════════════════════════════════════════════════════ */

/* Product card with loose selling enabled */
.product-card-loose {
  border: 1.5px solid color-mix(in srgb, var(--primary) 30%, transparent);
  position: relative;
}

/* Small indicator badge on the product card image corner */
.loose-indicator {
  position: absolute;
  top: 6px;
  left: 6px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  letter-spacing: 0.3px;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(124,58,237,0.4);
}

/* Group wrapper for add-btn + loose-btn */
.add-btn-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ⚖️ button on product card */
.loose-btn {
  width: 28px;
  height: 28px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border: none;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.85rem;
  flex-shrink: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}
.loose-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(124,58,237,0.45);
}

/* ── Loose Sale Modal ── */
.loose-sale-modal {
  max-width: 440px;
  width: 100%;
}

.loose-sale-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Product info strip inside modal */
.loose-product-info {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-sm);
  padding: 12px;
  border: 1px solid var(--border-color);
}

.loose-product-img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
}

.loose-product-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-main);
}

.loose-product-rate {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 3px;
}

.loose-product-rate strong {
  color: var(--accent);
}

/* Section labels */
.loose-section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
}

/* Preset weight chips */
.loose-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.loose-chip {
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-heading);
}

.loose-chip:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, transparent);
}

.loose-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 2px 8px rgba(var(--primary-rgb, 37,99,235), 0.35);
}

/* Custom weight input row */
.loose-custom-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.loose-custom-input {
  flex: 1;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-main);
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font-heading);
  transition: border-color 0.15s;
  outline: none;
}

.loose-custom-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 15%, transparent);
}

.loose-unit-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Live price preview box */
.loose-price-preview-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg,
    color-mix(in srgb, var(--primary) 8%, transparent),
    color-mix(in srgb, #7c3aed 6%, transparent));
  border: 1.5px solid color-mix(in srgb, var(--primary) 25%, transparent);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

.loose-preview-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
}

.loose-preview-value {
  font-size: 1.25rem;
  font-weight: 900;
  color: var(--primary);
  font-family: var(--font-heading);
}

/* ── Cart: Loose item row ── */
.cart-item-loose {
  background: color-mix(in srgb, #7c3aed 8%, var(--bg-surface));
  border: 1px solid color-mix(in srgb, #7c3aed 20%, transparent);
  border-radius: var(--radius-sm);
}

/* Loose badge inside cart item name */
.loose-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  font-size: 0.63rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  margin-left: 4px;
  vertical-align: middle;
  letter-spacing: 0.2px;
}

/* Danger remove button for loose items */
.qty-btn-danger {
  background: #fef2f2 !important;
  border-color: #fca5a5 !important;
  color: #ef4444 !important;
  font-weight: 900 !important;
  font-size: 0.75rem !important;
}

.qty-btn-danger:hover {
  background: #ef4444 !important;
  color: #fff !important;
}

/* Dark-mode safe overrides */
[data-theme="dark"] .qty-btn-danger {
  background: rgba(239,68,68,0.15) !important;
  border-color: rgba(239,68,68,0.4) !important;
  color: #f87171 !important;
}

[data-theme="dark"] .qty-btn-danger:hover {
  background: #ef4444 !important;
  color: #fff !important;
}

/* Discount toggle badge in cart summary */
.discount-toggle-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: var(--font-heading);
}

.discount-toggle-badge:hover {
  transform: scale(1.05);
}

.discount-toggle-badge.active {
  background: color-mix(in srgb, #10b981 18%, transparent);
  border-color: #10b981;
  color: #10b981;
}

/* ── Per-Item Discount Row ───────────────────────────────────── */
.item-disc-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.item-disc-label {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 0.65rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.item-disc-label i { width: 10px; height: 10px; }

.item-disc-input {
  width: 72px;
  padding: 2px 6px;
  font-size: 0.72rem;
  border: 1px solid var(--border-color);
  border-radius: 5px;
  background: var(--bg-surface);
  color: var(--text-primary);
  text-align: right;
  transition: border-color 0.15s;
}

.item-disc-input:focus {
  outline: none;
  border-color: #f59e0b;
  box-shadow: 0 0 0 2px rgba(245,158,11,0.15);
}

.item-disc-net {
  font-size: 0.72rem;
  font-weight: 700;
  color: #10b981;
}

/* Strikethrough old price when item has discount */
.cart-item-total.has-disc {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 1px;
}

.disc-old {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-decoration: line-through;
}

/* Item Discounts summary row */
.text-danger { color: #ef4444; }

/* ── Discount Management Page Styles ─────────────────────────── */
.disc-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-full, 9999px);
  font-size: 0.75rem;
  font-weight: 700;
}

.disc-badge-active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.disc-badge-inactive {
  background: rgba(107, 114, 128, 0.15);
  color: #6b7280;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

.disc-badge-flat {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.prod-disc-name {
  font-weight: 600;
  color: var(--text-primary);
  font-size: 0.88rem;
}

.prod-disc-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.disc-active-row {
  background: rgba(16, 185, 129, 0.03);
}

.disc-inactive-row {
  opacity: 0.75;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  cursor: pointer;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--border-color, #374151);
  transition: .2s;
  border-radius: 20px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 14px; width: 14px;
  left: 3px; bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
  background-color: #10b981;
}

.toggle-switch input:checked + .toggle-slider:before {
  transform: translateX(16px);
}

/* Stat Chips & Preview Box */
.stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md, 8px);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.discount-preview-box {
  margin-top: 12px;
  padding: 10px 12px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.4;
}

/* ── Tab Bar & Tab Navigation (Clean Horizontal Scroll & No Overflow) ── */
.tab-bar, .cat-tabs, .nav-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border-color);
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
  -webkit-overflow-scrolling: touch;
}

.tab-bar::-webkit-scrollbar, .cat-tabs::-webkit-scrollbar, .nav-tabs::-webkit-scrollbar {
  height: 4px;
}
.tab-bar::-webkit-scrollbar-thumb, .cat-tabs::-webkit-scrollbar-thumb, .nav-tabs::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.tab-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border-color: rgba(255,255,255,0.15);
}

.tab-btn.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  font-weight: 700;
}

/* Modal and Mobile Responsive Grid Fallback */
@media (max-width: 640px) {
  .form-grid-2, .grid-2, .grid-3 {
    grid-template-columns: 1fr !important;
  }
  .modal {
    padding: 18px;
    max-width: 100%;
    border-radius: var(--radius-md);
  }
  .modal-footer {
    flex-direction: column-reverse;
  }
  .modal-footer .btn {
    width: 100%;
    justify-content: center;
  }
}

/* ══════════════════════════════════════════════
   TOUCH MODE — Larger tap targets for touch screens
   Applied by toggling body.touch-mode
══════════════════════════════════════════════ */
body.touch-mode .products-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

body.touch-mode .product-card {
  max-height: none;
  border-radius: 18px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.1s ease;
}

body.touch-mode .product-card:active {
  transform: scale(0.96);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.4);
}

body.touch-mode .product-card-img {
  height: 130px;
}

body.touch-mode .product-card-body {
  padding: 14px 16px 16px;
  gap: 10px;
}

body.touch-mode .product-name {
  font-size: 1rem;
  font-weight: 700;
  -webkit-line-clamp: 2;
}

body.touch-mode .product-price {
  font-size: 1.1rem;
}

body.touch-mode .product-code {
  font-size: 0.72rem;
}

body.touch-mode .add-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

body.touch-mode .add-btn svg {
  width: 22px;
  height: 22px;
}

body.touch-mode .pos-panel {
  width: 380px;
  max-width: 100%;
  max-height: 100%;
}

body.touch-mode .cart-item {
  padding: 10px 10px;
  border-radius: 10px;
  gap: 8px;
}

body.touch-mode .cart-item-name {
  font-size: 0.88rem;
}

body.touch-mode .cart-item-price {
  font-size: 0.78rem;
}

body.touch-mode .cart-item-total {
  font-size: 0.92rem;
  min-width: 70px;
}

body.touch-mode .qty-btn {
  width: 32px;
  height: 32px;
  font-size: 1.1rem;
  border-radius: 6px;
}

body.touch-mode .qty-val {
  font-size: 0.92rem;
  min-width: 24px;
}

body.touch-mode .pm-grid {
  gap: 6px;
  margin-top: 4px;
}

body.touch-mode .pm-btn {
  padding: 7px 4px;
  font-size: 0.8rem;
  border-radius: 8px;
}

body.touch-mode .sum-row {
  font-size: 0.85rem;
  padding: 1px 0;
}

body.touch-mode .sum-row.total {
  font-size: 1.05rem;
  padding-top: 6px;
}

body.touch-mode .sum-input {
  padding: 5px 8px;
  font-size: 0.92rem;
  width: 110px;
  border-radius: 6px;
}

body.touch-mode .cat-tab {
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: 20px;
}

body.touch-mode .search-bar {
  padding: 10px 14px;
}

body.touch-mode .search-bar input {
  font-size: 0.95rem;
}

body.touch-mode .cart-actions .btn {
  padding: 10px 14px;
  font-size: 0.88rem;
}

body.touch-mode .btn-checkout {
  font-size: 0.98rem !important;
  padding: 11px !important;
  letter-spacing: 0.3px;
}

body.touch-mode .cart-summary {
  padding: 10px 14px;
  gap: 6px;
  flex-shrink: 0;
}

body.touch-mode .cart-header {
  padding: 10px 14px;
  flex-shrink: 0;
}

body.touch-mode .cart-customer {
  padding: 8px 14px;
  flex-shrink: 0;
}

body.touch-mode .cart-items {
  padding: 8px 12px;
  gap: 8px;
  flex: 1 1 auto;
  min-height: 140px;
  overflow-y: auto;
}

body.touch-mode .change-row {
  padding: 6px 10px;
  font-size: 0.85rem;
}

body.touch-mode .change-row strong {
  font-size: 1rem;
}

/* ── Touch Display & Small Height Monitor Optimizations (e.g., POS Terminals) ── */
@media (max-height: 820px) {
  .pos-layout {
    height: calc(100vh - 75px) !important;
    gap: 12px !important;
  }
  .cart-header {
    padding: 8px 12px !important;
  }
  .cart-customer {
    padding: 6px 12px !important;
  }
  .cart-items {
    min-height: 120px !important;
    padding: 6px 10px !important;
    gap: 6px !important;
  }
  .cart-summary {
    padding: 8px 12px !important;
    gap: 4px !important;
  }
  .pm-btn {
    padding: 5px 3px !important;
    font-size: 0.76rem !important;
  }
  .change-row {
    padding: 5px 8px !important;
  }
  .cart-actions {
    padding: 6px 12px !important;
  }
  .btn-checkout {
    padding: 9px !important;
    font-size: 0.92rem !important;
  }
}

/* Touch mode toggle button in navbar */
.touch-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid var(--border-color);
  background: var(--bg-surface);
  color: var(--text-muted);
  transition: all 0.2s;
  letter-spacing: 0.3px;
}

.touch-toggle-btn.active {
  background: rgba(99, 102, 241, 0.18);
  border-color: var(--primary);
  color: var(--primary);
}

.touch-toggle-btn svg {
  width: 14px;
  height: 14px;
}
