/* ===== CSS VARIABLES ===== */
:root {
  --bg-page: #0d0d0f;
  --bg-card: #18181c;
  --bg-card-hover: #1f1f25;
  --bg-input: #222228;
  --bg-sidebar: #111115;
  --bg-sidebar-section: #16161a;
  --text-primary: #f0f0f5;
  --text-secondary: #888899;
  --text-muted: #555566;
  --border-color: #2a2a35;
  --border-hover: #3a3a50;
  --accent: #7c3aed;
  --accent-dark: #5b21b6;
  --accent-secondary: #38bdf8;
  --accent-gradient: linear-gradient(135deg, #7c3aed 0%, #38bdf8 100%);
  --accent-gradient-hover: linear-gradient(135deg, #6d28d9 0%, #0ea5e9 100%);
  --glow: rgba(124, 58, 237, 0.15);
  --glow-blue: rgba(56, 189, 248, 0.1);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
  --shadow-hover: 0 8px 32px rgba(124,58,237,0.2);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

body.light-theme {
  --bg-page: #f0f0f7;
  --bg-card: #ffffff;
  --bg-card-hover: #f8f8ff;
  --bg-input: #f0f0f7;
  --bg-sidebar: #fafafa;
  --bg-sidebar-section: #f5f5fc;
  --text-primary: #0d0d1a;
  --text-secondary: #5a5a7a;
  --text-muted: #64748b;
  --border-color: #e0e0ee;
  --border-hover: #c0c0dd;
  --glow: rgba(124, 58, 237, 0.08);
  --glow-blue: rgba(56, 189, 248, 0.05);
  --shadow-card: 0 4px 24px rgba(0,0,0,0.08);
  --shadow-hover: 0 8px 32px rgba(124,58,237,0.12);
}

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

html,
body,
button,
input,
select,
textarea {
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif !important;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

body {
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  direction: rtl;
  font-size: 16px;
  line-height: 1.5;
}

.sar-icon {
  height: 1em;
  width: auto;
  font-size: inherit;
  line-height: inherit;
  vertical-align: baseline;
  margin-right: 2px;
  display: inline-block;
  filter: brightness(0) invert(1);
}

body.light-theme .sar-icon {
  filter: brightness(0);
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ===== LOGIN PAGE ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--bg-page);
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(124,58,237,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, rgba(56,189,248,0.06) 0%, transparent 50%);
  overflow: auto;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 2.75rem;
  box-shadow: var(--shadow-card), 0 0 0 1px rgba(124,58,237,0.05);
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-gradient);
}

.login-card .logo-area {
  text-align: center;
  margin-bottom: 2rem;
}

.login-card .logo-area img {
  height: 72px;
  margin-bottom: 1rem;
  filter: drop-shadow(0 4px 12px rgba(124,58,237,0.3));
}

.login-card .logo-area h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 0.4rem;
}

.login-card .logo-area p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin: 0;
}

.form-label {
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
  display: block;
}

.form-control {
  background-color: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
  padding: 0.65rem 1rem !important;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif !important;
  font-size: 0.9rem !important;
}

.form-control:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--glow) !important;
  outline: none !important;
}

.form-control::placeholder { color: var(--text-muted) !important; }

.input-group .form-control {
  border-right: none !important;
  border-left: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
}

.input-group .input-group-text:first-child {
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0 !important;
  border-right: 1px solid var(--border-color) !important;
  border-left: none !important;
}

.input-group .input-group-text:last-child {
  border-radius: var(--radius-sm) 0 0 var(--radius-sm) !important;
  border-left: 1px solid var(--border-color) !important;
  border-right: none !important;
}

.input-group:focus-within .form-control,
.input-group:focus-within .input-group-text {
  border-color: var(--accent) !important;
}

.input-group:focus-within .input-group-text {
  color: var(--accent) !important;
}

.btn-accent {
  background: var(--accent-gradient);
  border: none;
  color: #fff;
  font-weight: 700;
  padding: 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  width: 100%;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
  cursor: pointer;
  letter-spacing: 0.3px;
  transition: opacity 0.2s, transform 0.15s, box-shadow 0.2s !important;
  box-shadow: 0 4px 16px rgba(124,58,237,0.3);
}

.btn-accent:hover {
  opacity: 0.92;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(124,58,237,0.4);
  color: #fff;
}

.btn-accent:active {
  transform: translateY(0);
}

.form-check {
  padding-right: 1.5em;
  padding-left: 0;
  text-align: right;
}

.form-check .form-check-input {
  float: right;
  margin-right: -1.5em;
  margin-left: 0;
}

.form-check-input:checked {
  background-color: var(--accent) !important;
  border-color: var(--accent) !important;
}

.theme-toggle-btn {
  position: fixed;
  top: 1rem;
  left: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  font-size: 0.85rem;
  transition: all 0.2s !important;
}

.theme-toggle-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--glow);
}

/* ===== POS LAYOUT ===== */
.pos-wrapper {
  display: grid;
  grid-template-columns: 210px 9fr 11fr;
  height: 100vh;
  overflow: hidden;
  background-color: var(--bg-page);
}

/* ===== SIDEBAR ===== */
.pos-sidebar {
  background-color: var(--bg-sidebar);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  text-align: center;
  padding: 1.25rem 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar-section);
}

.sidebar-logo img {
  height: 38px;
  margin-bottom: 0.4rem;
  filter: drop-shadow(0 2px 8px rgba(124,58,237,0.25));
}

.sidebar-logo span {
  display: block;
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: -0.3px;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.user-info {
  text-align: center;
  padding: 1rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.user-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.6rem;
  font-size: 1.1rem;
  color: white;
  box-shadow: 0 4px 12px rgba(124,58,237,0.35);
}

.user-info .user-name {
  font-weight: 700;
  font-size: 0.875rem;
  margin-bottom: 0.2rem;
  color: var(--text-primary);
}

.user-info .user-role {
  font-size: 0.7rem;
  color: white;
  background: var(--accent-gradient);
  padding: 0.1rem 0.6rem;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 0.3rem;
}

.user-info .user-branch {
  font-size: 0.72rem;
  color: var(--accent-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
}

.clock-section {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar-section);
  text-align: center;
}

.live-clock {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent-secondary);
  letter-spacing: 2px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.live-date {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.categories-section {
  padding: 0.75rem;
  flex: 1;
}

.category-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 0.5rem;
  padding: 0 0.2rem;
  font-weight: 600;
}

.cat-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: right;
  transition: background 0.13s, border-color 0.13s, color 0.13s !important;
}

.cat-btn i {
  width: 16px;
  text-align: center;
  font-size: 0.8rem;
}

.cat-btn:hover {
  background: var(--glow);
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.cat-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 12px rgba(124,58,237,0.3);
  font-weight: 600;
}

.sidebar-actions {
  padding: 0.75rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  background: var(--bg-sidebar-section);
}

.sidebar-actions .btn {
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
  font-size: 0.8rem;
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.6rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  transition: all 0.18s !important;
}

.shift-status-card {
  margin: 0.75rem;
  padding: 0.7rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-sidebar-section);
}

.shift-status-title {
  font-weight: 700;
  font-size: 0.86rem;
  margin-bottom: 0.45rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.shift-status-row {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
}

.shift-status-row strong {
  color: var(--text-primary);
  font-weight: 700;
}

.btn-shift-open {
  background: linear-gradient(135deg, #059669, #10b981);
  border: none;
  color: white;
}

.btn-shift-open:hover { opacity: 0.9; color: white; }

.btn-shift-close {
  background: linear-gradient(135deg, #d97706, #fbbf24);
  border: none;
  color: white;
}

.btn-shift-close:hover { opacity: 0.9; color: white; }

.btn-shift-report {
  background: linear-gradient(135deg, #1d4ed8, #3b82f6);
  border: none;
  color: #fff;
}

.btn-shift-report:hover {
  opacity: 0.9;
  color: #fff;
}

.btn-shift-report:disabled,
.btn-shift-open:disabled,
.btn-shift-close:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.shift-inline-alert {
  margin-top: 0.35rem;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 0.5rem 0.6rem;
  font-size: 0.76rem;
  font-weight: 600;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
}

.shift-inline-alert.success {
  border-color: rgba(16,185,129,.55);
  background: rgba(16,185,129,.11);
  color: #6ee7b7;
}

.shift-inline-alert.error {
  border-color: rgba(239,68,68,.55);
  background: rgba(239,68,68,.11);
  color: #fca5a5;
}

.shift-inline-alert.warning {
  border-color: rgba(251,191,36,.55);
  background: rgba(251,191,36,.11);
  color: #fcd34d;
}

.shift-inline-alert.info {
  border-color: rgba(56,189,248,.55);
  background: rgba(56,189,248,.11);
  color: #7dd3fc;
}

.shift-center-alert {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(.96);
  opacity: 0;
  z-index: 12000;
  min-width: 280px;
  max-width: min(92vw, 420px);
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid rgba(16,185,129,.35);
  background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(12,20,36,.98));
  box-shadow: 0 22px 55px rgba(0,0,0,.55), 0 0 0 1px rgba(16,185,129,.12) inset;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
}

.shift-center-alert.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.shift-center-alert__icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #6ee7b7;
  background: rgba(16,185,129,.14);
  border: 1px solid rgba(16,185,129,.35);
  flex-shrink: 0;
}

.shift-center-alert__text {
  color: #d1fae5;
  font-size: .9rem;
  font-weight: 700;
  line-height: 1.35;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
}

.btn-theme-sidebar {
  position: absolute;
  top: 0.85rem;
  left: 1rem;
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  z-index: 3;
  font-size: 0.8rem;
  box-shadow: var(--shadow-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-theme-sidebar:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ===== CENTER: PRODUCTS ===== */
.pos-center {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-page);
}

.pos-center-topbar {
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar);
}

.search-wrapper {
  position: relative;
}

.search-wrapper .search-icon {
  position: absolute;
  right: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.85rem;
  pointer-events: none;
}

.search-wrapper .form-control {
  padding-right: 2.4rem !important;
  border-radius: var(--radius-md) !important;
}

.products-area {
  flex: 1;
  overflow-y: auto;
  padding: 0.85rem;
}

.products-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.6rem;
}

.product-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.9rem 0.75rem;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease, background-color 0.2s ease !important;
  position: relative;
  overflow: hidden;
}

.product-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--accent-gradient);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  background: var(--bg-card-hover);
}

.product-card:active {
  transform: translateY(0) scale(0.98);
}

.product-card .product-icon {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: block;
  line-height: 1;
}

.product-card .product-name {
  font-weight: 600;
  font-size: 0.8rem;
  margin-bottom: 0.35rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.product-card .product-price {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--accent-secondary);
  margin-bottom: 0.25rem;
}

.product-card .product-stock {
  font-size: 0.68rem;
  color: var(--text-muted);
}

.product-card .product-stock.low-stock {
  color: #f59e0b;
}

.category-badge {
  font-size: 0.62rem;
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
  background: rgba(124,58,237,0.12);
  color: var(--accent-secondary);
  margin-bottom: 0.45rem;
  display: inline-block;
  font-weight: 600;
  letter-spacing: 0.3px;
}

/* ===== CART PANEL ===== */
.pos-cart {
  position: relative;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cart-header {
  position: relative;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar-section);
}

.cart-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 2rem;
  margin-bottom: 0.6rem;
}

.cart-header h5 {
  font-weight: 800;
  margin: 0;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.cart-header h5 i {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.cart-invoice-no {
  position: absolute;
  left: 4.25rem;
  top: 0.95rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  font-weight: 600;
}

.customer-search .form-control {
  font-size: 0.82rem !important;
  padding: 0.5rem 0.75rem !important;
}

.cart-body {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem 1rem;
}

.cart-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 2.5rem 1rem;
  font-size: 0.875rem;
}

.cart-empty i {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
  display: block;
  opacity: 0.3;
}

.cart-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border-color);
}

.cart-item:last-child { border-bottom: none; }

.cart-item .item-name {
  flex: 1;
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.qty-controls {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.15rem;
}

.qty-controls button {
  width: 22px;
  height: 22px;
  border-radius: 5px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 700;
  transition: all 0.15s !important;
}

.qty-controls button:hover {
  background: var(--accent);
  color: white;
}

.qty-controls input {
  width: 30px;
  text-align: center;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.82rem;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
  font-weight: 700;
  outline: none;
}

/* Remove number input arrows */
.qty-controls input::-webkit-inner-spin-button,
.qty-controls input::-webkit-outer-spin-button { -webkit-appearance: none; }
.qty-controls input[type=number] { -moz-appearance: textfield; }

.item-total {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--accent-secondary);
  min-width: 65px;
  text-align: left;
  white-space: nowrap;
}


.item-total,
#subtotalDisplay,
#discountDisplay,
#taxDisplay,
#totalDisplay {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-variant-numeric: tabular-nums;
  flex-direction: row-reverse;
}

.btn-delete-item {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  border-radius: 5px;
  transition: all 0.15s !important;
  font-size: 0.75rem;
}

.btn-delete-item:hover {
  color: #ef4444;
  background: rgba(239,68,68,0.1);
}

/* ===== PAYMENT ===== */

.payment-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.btn-payment {
  border: none;
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.4rem;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s !important;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.btn-payment:hover {
  transform: translateY(-1px);
  filter: brightness(1.1);
}

.btn-payment:active {
  transform: translateY(0) scale(0.97);
}

.btn-cash { background: linear-gradient(135deg, #059669, #10b981); }
.btn-card { background: linear-gradient(135deg, #1d4ed8, #3b82f6); }
.btn-tamara { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.btn-tabby { background: linear-gradient(135deg, #0f766e, #14b8a6); }
.btn-mixed {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, #c2410c, #f97316);
  padding: 0.6rem;
}

/* ===== CART FOOTER ===== */
.cart-footer {
  padding: 0.6rem 1rem 0.75rem;
  display: flex;
  flex-wrap: nowrap;
  gap: 0.4rem;
  border-top: 1px solid var(--border-color);
}
.cart-footer .btn {
  flex: 1 1 0;
  min-width: 0;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
  font-size: 0.78rem;
  border-radius: var(--radius-sm);
  padding: 0.45rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: all 0.18s !important;
}

.btn-print {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}

.btn-print:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-cancel {
  background: rgba(239,68,68,0.08);
  border: 1px solid rgba(239,68,68,0.2);
  color: #ef4444;
}

.btn-cancel:hover {
  background: rgba(239,68,68,0.15);
  border-color: #ef4444;
}

/* ===== ALERTS ===== */
.alert-danger {
  background: rgba(239,68,68,0.08) !important;
  border: 1px solid rgba(239,68,68,0.2) !important;
  color: #f87171 !important;
  border-radius: var(--radius-sm) !important;
}

/* ===== HOME DASHBOARD ===== */

.home-navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 52px;
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 100;
}

.home-navbar-logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.home-navbar-logo img {
  height: 32px;
}

.home-navbar-logo span {
  font-weight: 800;
  font-size: 1rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.home-navbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.home-branch-badge {
  font-size: 0.75rem;
  color: var(--accent-secondary);
  background: rgba(56,189,248,0.08);
  border: 1px solid rgba(56,189,248,0.2);
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
}

.home-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.home-user-avatar {
  width: 32px;
  height: 32px;
  margin: 0;
  font-size: 0.8rem;
}

.home-main {
  padding: 1.5rem;
  margin-top: 52px;
  min-height: calc(100vh - 52px);
  background: var(--bg-page);
  overflow-y: auto;
}

.home-greeting {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.home-greeting h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.home-greeting p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.stat-card .stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  font-weight: 600;
}

.stat-card .stat-value {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 0.2rem;
  line-height: 1;
}

.stat-card .stat-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.stat-value-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-value-amber {
  color: #fbbf24;
}

.stat-value-blue {
  color: #60a5fa;
}

.stat-value-red {
  color: #f87171;
}

.home-modules-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.home-modules-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

.mod-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.15rem 0.95rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  position: relative;
  overflow: hidden;
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease, background-color 0.2s ease !important;
}

.mod-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
  background: var(--bg-card-hover);
}

.mod-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
}

.mod-card.mod-purple::before { background: linear-gradient(90deg, #7c3aed, #38bdf8); }
.mod-card.mod-green::before  { background: linear-gradient(90deg, #059669, #34d399); }
.mod-card.mod-blue::before   { background: linear-gradient(90deg, #1d4ed8, #60a5fa); }
.mod-card.mod-orange::before { background: linear-gradient(90deg, #c2410c, #fb923c); }
.mod-card.mod-teal::before   { background: linear-gradient(90deg, #0f766e, #2dd4bf); }
.mod-card.mod-pink::before   { background: linear-gradient(90deg, #9d174d, #ec4899); }
.mod-card.mod-amber::before  { background: linear-gradient(90deg, #92400e, #fbbf24); }
.mod-card.mod-gray::before   { background: linear-gradient(90deg, #374151, #9ca3af); }

.mod-icon-box {
  width: 46px;
  height: 46px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-size: 1.15rem;
}

.mod-card.mod-purple .mod-icon-box { background: rgba(124,58,237,0.15); color: #a78bfa; }
.mod-card.mod-green .mod-icon-box  { background: rgba(5,150,105,0.15);  color: #34d399; }
.mod-card.mod-blue .mod-icon-box   { background: rgba(29,78,216,0.15);  color: #60a5fa; }
.mod-card.mod-orange .mod-icon-box { background: rgba(194,65,12,0.15);  color: #fb923c; }
.mod-card.mod-teal .mod-icon-box   { background: rgba(15,118,110,0.15); color: #2dd4bf; }
.mod-card.mod-pink .mod-icon-box   { background: rgba(157,23,77,0.15);  color: #ec4899; }
.mod-card.mod-amber .mod-icon-box  { background: rgba(146,64,14,0.15);  color: #fbbf24; }
.mod-card.mod-gray .mod-icon-box   { background: rgba(55,65,81,0.25);   color: #9ca3af; }

.mod-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.15rem;
}

.mod-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
}

@media (max-width: 1400px) {
  .home-modules-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 992px) {
  .home-modules-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .home-modules-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.mod-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-size: 0.6rem;
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.2);
  padding: 0.1rem 0.4rem;
  border-radius: 20px;
  font-weight: 700;
}

.home-navbar {
  direction: ltr;
}

.home-navbar-logo,
.home-navbar-right,
.home-greeting,
.home-stats-filter,
.home-stats,
.home-modules-label,
.home-modules-grid {
  direction: rtl;
}

.btn-theme-home {
  width: 32px;
  height: 32px;
  min-width: 32px;
  padding: 0;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-theme-home:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.home-stats-filter {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.home-filter-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 700;
}

.home-filter-actions {
  display: inline-flex;
  gap: 0.4rem;
}

.home-filter-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.home-filter-btn:hover {
  border-color: var(--border-hover);
  color: var(--text-primary);
}

.home-filter-btn.active {
  background: var(--accent-gradient);
  border-color: transparent;
  color: #fff;
}

.shift-reports-section {
  margin-bottom: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.shift-reports-section h4 {
  margin: 0;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text-primary);
}

.shift-reports-accordion .accordion-item {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-input);
  margin-bottom: 0.5rem;
}

.shift-reports-accordion .accordion-button {
  background: var(--bg-sidebar);
  color: var(--text-primary);
  box-shadow: none !important;
}

.shift-reports-accordion .accordion-button:not(.collapsed) {
  background: rgba(56, 189, 248, 0.12);
  color: var(--text-primary);
}

.shift-accordion-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.shift-metric {
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.shift-metric strong {
  color: var(--text-primary);
  font-size: 0.9rem;
}


.btn-home-nav {
  background: linear-gradient(135deg, #2563eb, #38bdf8);
  border: none;
  color: #fff;
}

.btn-home-nav:hover {
  opacity: 0.9;
  color: #fff;
}

/* ===== EMPLOYEES / ROLES ===== */
.management-page { height: 100vh; overflow: auto; }
.management-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
}
.management-card .table { color: var(--text-primary); }
.management-card .table thead th { color: var(--text-secondary); border-color: var(--border-color); }
.management-card .table td { border-color: var(--border-color); }
.management-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.permission-group {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}
.permission-group h6 { color: var(--accent-secondary); }
.form-select {
  background-color: var(--bg-input) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
}

/* ===== GLOBAL LOADING ===== */
.global-loading {
  position: fixed;
  inset: 0;
  background: rgba(13, 13, 15, 0.45);
  backdrop-filter: blur(2px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.global-loading.d-none {
  display: none !important;
}

.global-loading-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: var(--shadow-card);
}

/* ===== DS v2 SEARCHABLE SELECTS (Select2) ===== */
select.ds-select2-source,
select.select2-field {
  background-color: var(--bg-input) !important;
  color: var(--text-primary) !important;
  border-color: var(--border-color) !important;
}

.select2-container {
  direction: rtl;
  width: 100% !important;
  max-width: 100%;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif !important;
  z-index: 7000;
}

.select2-container .select2-selection--single {
  min-height: 42px !important;
  height: 42px !important;
  background: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  color: var(--text-primary) !important;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.01);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease !important;
}

.select2-container--default.select2-container--focus .select2-selection--single,
.select2-container--default.select2-container--open .select2-selection--single {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.16) !important;
  background: var(--bg-card) !important;
}

.select2-container--default.select2-container--disabled .select2-selection--single {
  background: var(--bg-input) !important;
  border-color: var(--border-color) !important;
  opacity: .72;
  cursor: not-allowed;
}

.select2-container .select2-selection__rendered {
  color: var(--text-primary) !important;
  line-height: 40px !important;
  padding-right: 0.85rem !important;
  padding-left: 2rem !important;
  font-weight: 600;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.select2-container--default .select2-selection--single .select2-selection__placeholder {
  color: var(--text-muted) !important;
  font-weight: 500;
}

.select2-container .select2-selection__arrow {
  height: 40px !important;
  left: 8px !important;
  right: auto !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow b {
  border-color: var(--text-secondary) transparent transparent transparent !important;
}

.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
  border-color: transparent transparent var(--accent-secondary) transparent !important;
}

.select2-dropdown,
.select2-container--default .select2-dropdown {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: var(--radius-sm) !important;
  overflow: hidden !important;
  box-shadow: 0 18px 48px rgba(0,0,0,0.44) !important;
  z-index: 9100 !important;
  color: var(--text-primary) !important;
}

.select2-container--open .select2-dropdown--below { border-top: 1px solid var(--border-color) !important; margin-top: 4px; }
.select2-container--open .select2-dropdown--above { border-bottom: 1px solid var(--border-color) !important; margin-top: -4px; }

.select2-search--dropdown {
  background: var(--bg-card) !important;
  padding: 8px !important;
  border-bottom: 1px solid var(--border-color);
}

.select2-search__field,
.select2-container--default .select2-search--dropdown .select2-search__field {
  background: var(--bg-input) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 8px !important;
  min-height: 36px;
  padding: 0.35rem 0.7rem !important;
  outline: none !important;
  direction: rtl;
}

.select2-search__field:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.14) !important;
}

.select2-search__field::placeholder { color: var(--text-muted) !important; }

.select2-results,
.select2-results__options {
  background: var(--bg-card) !important;
  color: var(--text-primary) !important;
}

.select2-results__options {
  max-height: 260px !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(124,58,237,0.55) transparent;
}

.select2-results__options::-webkit-scrollbar { width: 8px; }
.select2-results__options::-webkit-scrollbar-track { background: transparent; }
.select2-results__options::-webkit-scrollbar-thumb { background: rgba(124,58,237,0.45); border-radius: 99px; }

.select2-results__option {
  background: transparent !important;
  color: var(--text-primary) !important;
  padding: 0.62rem 0.85rem !important;
  font-weight: 600;
  line-height: 1.35;
  transition: background .12s ease, color .12s ease !important;
}

.select2-results__option:hover,
.select2-container--default .select2-results__option--highlighted.select2-results__option--selectable,
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-results__option--highlighted {
  background: rgba(124,58,237,0.26) !important;
  color: #f5f3ff !important;
}

.select2-container--default .select2-results__option--selected,
.select2-results__option[aria-selected="true"],
.select2-results__option[data-selected="true"] {
  background: rgba(124,58,237,0.42) !important;
  color: #ffffff !important;
}

.select2-results__option[aria-disabled="true"] {
  background: rgba(15,15,20,0.35) !important;
  color: var(--text-muted) !important;
  cursor: not-allowed;
}

.select2-results__message {
  color: var(--text-secondary) !important;
  background: var(--bg-card) !important;
  padding: 0.75rem !important;
}

.select2-selection__clear {
  color: var(--text-secondary) !important;
  margin-left: .35rem !important;
}

.select2-selection__choice {
  background: rgba(124,58,237,0.28) !important;
  border: 1px solid rgba(167,139,250,0.38) !important;
  color: #fff !important;
  border-radius: 999px !important;
  padding: 0.18rem 0.55rem !important;
}

.select2-selection__choice__remove { color: #ddd6fe !important; }

/* Light-theme text-contrast fixes: the states above use a translucent purple
   background at various opacities designed to read on a dark panel. On a white
   panel the same translucent purple turns pale, so the near-white text used for
   dark mode (#f5f3ff / #fff / #ddd6fe) becomes unreadable — swap in dark purple. */
body.light-theme .select2-results__option:hover,
body.light-theme .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable,
body.light-theme .select2-container--default .select2-results__option--highlighted[aria-selected],
body.light-theme .select2-results__option--highlighted {
  color: #3730a3 !important;
}
body.light-theme .select2-container--default .select2-results__option--selected,
body.light-theme .select2-results__option[aria-selected="true"],
body.light-theme .select2-results__option[data-selected="true"] {
  color: #4c1d95 !important;
}
body.light-theme .select2-results__option[aria-disabled="true"] {
  background: rgba(15, 23, 42, .05) !important;
}
body.light-theme .select2-selection__choice {
  background: rgba(124, 58, 237, 0.12) !important;
  border-color: rgba(124, 58, 237, 0.35) !important;
  color: #4c1d95 !important;
}
body.light-theme .select2-selection__choice__remove { color: #6d28d9 !important; }

/* ===== CUSTOMER SEARCH (POS) ===== */
.customer-search-wrapper { position: relative; }
.customer-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  z-index: 500;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.customer-result-item { display:flex; align-items:center; gap:.6rem; padding:.6rem .75rem; cursor:pointer; border-bottom:1px solid var(--border-color); transition:background .15s; }
.customer-result-item:hover { background: var(--bg-input); }
.customer-result-item:last-child { border-bottom:none; }
.customer-result-avatar { width:30px; height:30px; border-radius:50%; background:var(--accent-gradient); display:flex; align-items:center; justify-content:center; font-size:.75rem; color:white; font-weight:700; flex-shrink:0; }
.customer-result-info .result-name { font-size:.82rem; font-weight:600; color:var(--text-primary); }
.customer-result-info .result-phone { font-size:.72rem; color:var(--text-muted); }
.customer-result-info .result-imei { font-size:.68rem; color:var(--accent-secondary); }
.customer-dropdown-footer { padding:.5rem; background:var(--bg-sidebar); border-top:1px solid var(--border-color); }
.btn-add-customer { width:100%; background:var(--accent-gradient); border:none; color:white; border-radius:var(--radius-sm); padding:.5rem; font-family:'Tajawal',sans-serif; font-size:.82rem; font-weight:700; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:.4rem; transition:opacity .2s; }
.btn-add-customer:hover { opacity:.9; }
.selected-customer-badge { display:flex; align-items:center; gap:.5rem; background:rgba(124,58,237,.1); border:1px solid rgba(124,58,237,.3); border-radius:var(--radius-sm); padding:.4rem .75rem; margin-top:.4rem; font-size:.82rem; color:var(--accent); }
.selected-customer-badge i { color:var(--accent); }
.selected-customer-badge span { flex:1; font-weight:600; }
.btn-clear-customer { background:transparent; border:none; color:var(--text-muted); cursor:pointer; padding:0; font-size:.75rem; transition:color .15s; }
.btn-clear-customer:hover { color:#ef4444; }
.no-results { text-align:center; padding:1rem; color:var(--text-muted); font-size:.82rem; }

/* ===== CUSTOMER MODAL (POS) ===== */
.customer-modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.7); z-index:9000; display:flex; align-items:center; justify-content:center; padding:1rem; }
.customer-modal-box { background:var(--bg-card); border:1px solid var(--border-color); border-radius:var(--radius-lg); width:100%; max-width:480px; max-height:90vh; overflow-y:auto; box-shadow:0 24px 64px rgba(0,0,0,.5); }
.customer-modal-header { display:flex; align-items:center; justify-content:space-between; padding:1rem 1.25rem; border-bottom:1px solid var(--border-color); position:sticky; top:0; background:var(--bg-card); z-index:1; }
.customer-modal-header h5 { font-size:.95rem; font-weight:800; margin:0; display:flex; align-items:center; gap:.4rem; color:var(--text-primary); }
.customer-modal-body { padding:1.25rem; max-height: calc(90vh - 140px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.customer-modal-footer { display:flex; gap:.5rem; padding:1rem 1.25rem; border-top:1px solid var(--border-color); background:var(--bg-sidebar); border-radius:0 0 var(--radius-lg) var(--radius-lg); }
.modal-close { background:transparent; border:none; color:var(--text-muted); cursor:pointer; font-size:1rem; padding:.2rem; border-radius:6px; transition:all .15s; }
.modal-close:hover { background:rgba(239,68,68,.1); color:#ef4444; }
.type-toggle { display:flex; gap:.4rem; background:var(--bg-input); border-radius:var(--radius-sm); padding:.25rem; }
.type-btn { flex:1; background:transparent; border:none; color:var(--text-secondary); border-radius:6px; padding:.45rem; font-family:'Tajawal',sans-serif; font-size:.82rem; font-weight:600; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:.3rem; transition:all .18s; }
.type-btn.active { background:var(--accent-gradient); color:white; }
.modal-field { margin-bottom:.85rem; }
.modal-field label { display:flex; align-items:center; gap:.4rem; font-size:.78rem; color:var(--text-secondary); font-weight:600; margin-bottom:.35rem; }
.required { color:#ef4444; }
.field-hint { font-size:.68rem; color:var(--text-muted); font-weight:400; }
.modal-field input,.modal-field textarea { width:100%; background:var(--bg-input); border:1px solid var(--border-color); color:var(--text-primary); border-radius:var(--radius-sm); padding:.6rem .85rem; font-family:'Tajawal',sans-serif; font-size:.875rem; outline:none; transition:border-color .18s; }
.modal-field input:focus,.modal-field textarea:focus { border-color:var(--accent); box-shadow:0 0 0 3px var(--glow); }
.modal-field textarea { resize:none; }
.imei-input-wrapper { display:flex; gap:.4rem; }
.imei-input-wrapper input { flex:1; }
.btn-scan { background:var(--bg-input); border:1px solid var(--border-color); color:var(--accent-secondary); border-radius:var(--radius-sm); padding:.5rem .75rem; cursor:pointer; font-size:1rem; transition:all .18s; flex-shrink:0; }
.btn-scan:hover { border-color:var(--accent-secondary); background:rgba(56,189,248,.08); }
.imei-hint { font-size:.68rem; color:var(--text-muted); margin-top:.3rem; display:flex; align-items:center; gap:.3rem; }
.modal-error { background:rgba(239,68,68,.08); border:1px solid rgba(239,68,68,.2); color:#f87171; border-radius:var(--radius-sm); padding:.6rem .75rem; font-size:.82rem; margin-top:.5rem; }
.btn-modal-cancel { background:var(--bg-input); border:1px solid var(--border-color); color:var(--text-secondary); border-radius:var(--radius-sm); padding:.6rem 1rem; font-family:'Tajawal',sans-serif; font-size:.85rem; font-weight:600; cursor:pointer; transition:all .18s; }
.btn-modal-cancel:hover { border-color:var(--accent); color:var(--accent); }
.btn-modal-save { flex:1; background:var(--accent-gradient); border:none; color:white; border-radius:var(--radius-sm); padding:.6rem 1rem; font-family:'Tajawal',sans-serif; font-size:.85rem; font-weight:700; cursor:pointer; display:flex; align-items:center; justify-content:center; gap:.4rem; transition:opacity .18s; box-shadow:0 4px 12px rgba(124,58,237,.3); }
.btn-modal-save:hover { opacity:.9; }
.btn-modal-save:disabled { opacity:.6; cursor:not-allowed; }

/* ===== PRODUCTS & CATEGORIES MANAGEMENT UI ===== */
.customers-page {
  background: var(--bg-page);
  min-height: calc(100vh - 70px);
  padding: 1rem;
  font-family: 'Tajawal', sans-serif;
}
.page-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.topbar-title-wrap { display: flex; align-items: center; gap: .65rem; }
.page-title { margin: 0; font-size: 1.15rem; color: var(--text-primary); font-weight: 800; display: flex; align-items: center; gap: .45rem; }
.page-count-badge { display:inline-flex; margin-top:.15rem; background: var(--bg-input); color: var(--text-muted); border:1px solid var(--border-color); border-radius: 999px; padding:.1rem .5rem; font-size:.72rem; }
.btn-back {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.btn-back:hover { color: var(--accent); border-color: var(--accent); }
.btn-primary-action {
  border: none;
  background: var(--accent-gradient);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: .58rem .9rem;
  font-size: .82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
}
.customers-search-form {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.products-stamp-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: .65rem;
  margin-bottom: .95rem;
}
.products-stamp-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: .7rem .8rem;
  display: flex;
  align-items: center;
  gap: .65rem;
}
.products-stamp-stat-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: .92rem;
  flex-shrink: 0;
}
.products-stamp-stat-icon.blue { background: rgba(59,130,246,.12); color: #60a5fa; }
.products-stamp-stat-icon.green { background: rgba(16,185,129,.12); color: #34d399; }
.products-stamp-stat-icon.amber { background: rgba(245,158,11,.12); color: #fbbf24; }
.products-stamp-stat-icon.purple { background: rgba(124,58,237,.12); color: #a78bfa; }
.products-stamp-stat-value {
  color: var(--text-primary);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}
.products-stamp-stat-label {
  color: var(--text-muted);
  font-size: .72rem;
  margin-top: .2rem;
}
.products-stamp-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .7rem .8rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar);
}
.products-stamp-table-title {
  color: var(--text-primary);
  font-size: .86rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
}
.search-wrapper {
  position: relative;
  min-width: 260px;
}
.search-icon {
  position: absolute;
  right: .7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}
.form-control.dark,
.modal-field input,
.modal-field textarea,
.modal-field select {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
}
.search-wrapper .form-control.dark { padding-right: 2rem; }
.btn-search {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  padding: .56rem .85rem;
  font-size: .8rem;
  font-weight: 700;
  display: inline-flex;
  gap: .35rem;
  align-items: center;
}
.btn-search:hover { color: var(--accent); border-color: var(--accent); }
.customers-table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: auto;
}
.customers-table { width: 100%; border-collapse: collapse; }
.customers-table th,
.customers-table td { border-bottom: 1px solid var(--border-color); padding: .75rem; color: var(--text-primary); }
.customers-table thead th { color: var(--text-secondary); font-size: .78rem; font-weight: 800; background: var(--bg-sidebar); }
.customer-cell { display:flex; flex-direction:column; gap:.2rem; }
.customer-cell small { color: var(--text-muted); font-size: .72rem; }
.row-actions { display:flex; gap:.35rem; }
.btn-row-edit {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-input);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-row-edit:hover { color: var(--accent); border-color: var(--accent); }
.btn-row-delete:hover { color: #ef4444; border-color: rgba(239,68,68,.45); }
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 4000; display: none; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay[style*="display: block"], .modal-overlay:where(.show) { display: flex !important; }
.modal-box { width: 100%; max-width: 600px; }
.modal-lg-box { max-width: 960px; }
.modal-grid-3 { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:.6rem; }
.modal-field label { font-size: .78rem; color: var(--text-secondary); font-weight: 700; }
.dark-textarea { min-height: 78px; }
.variant-row-wrap { border-bottom: 1px dashed var(--border-color); padding-bottom: .35rem; margin-bottom: .35rem; }

.badge-type-simple {
  background: rgba(124,58,237,0.12);
  color: #a78bfa;
  border: 1px solid rgba(124,58,237,0.25);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge-type-variant {
  background: rgba(15,118,110,0.12);
  color: #2dd4bf;
  border: 1px solid rgba(15,118,110,0.25);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.badge-type-warranty {
  background: rgba(146,64,14,0.12);
  color: #fbbf24;
  border: 1px solid rgba(146,64,14,0.25);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

@media (max-width: 1100px) {
  .products-stamp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .products-stamp-stats { grid-template-columns: 1fr; }
}

.badge-active {
  background: rgba(5,150,105,0.12);
  color: #34d399;
  border: 1px solid rgba(5,150,105,0.25);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
}

.badge-inactive {
  background: rgba(55,65,81,0.2);
  color: #9ca3af;
  border: 1px solid rgba(55,65,81,0.3);
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
}

.tag-model {
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.3);
  color: #a78bfa;
  border-radius: 20px;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin: 0.15rem;
}

.tag-model a {
  color: #ef4444;
  text-decoration: none;
  font-weight: 700;
}

.variants-section {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-top: 0.5rem;
}

.variant-row-header {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr 1fr auto;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.variant-row-header span {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.variant-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr 1fr auto;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  align-items: center;
}

.variant-remove-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(239,68,68,.35);
  background: rgba(239,68,68,.08);
  color: #f87171;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.variant-remove-btn:hover { background: rgba(239,68,68,.16); color:#ef4444; }

/* ============================================================
   DESIGN SYSTEM v2 — Link POS
   Premium Enterprise Dark Dashboard
   Arabic RTL · Unified Components · Consistent Tokens
   ============================================================ */

/* ── EXTENDED THEME TOKENS ── */
:root {
  --ds-blue:      #3b82f6;
  --ds-blue-soft: rgba(59,130,246,0.12);
  --ds-green:     #10b981;
  --ds-green-soft:rgba(16,185,129,0.12);
  --ds-amber:     #f59e0b;
  --ds-amber-soft:rgba(245,158,11,0.12);
  --ds-red:       #ef4444;
  --ds-red-soft:  rgba(239,68,68,0.12);
  --ds-teal:      #14b8a6;
  --ds-teal-soft: rgba(20,184,166,0.12);
  --ds-purple:    #7c3aed;
  --ds-purple-soft:rgba(124,58,237,0.12);
  --ds-pink:      #ec4899;
  --ds-pink-soft: rgba(236,72,153,0.12);

  /* Elevation aliases (used in show/detail pages) */
  --bg-elevated:    var(--bg-card);
  --border-subtle:  var(--border-color);

  /* Type scale */
  --ds-text-xs:   0.72rem;
  --ds-text-sm:   0.82rem;
  --ds-text-base: 0.9rem;
  --ds-text-lg:   1.1rem;
  --ds-text-xl:   1.3rem;
  --ds-text-2xl:  1.6rem;
  --ds-text-3xl:  1.9rem;

  /* Spacing */
  --ds-sp-1: 4px;
  --ds-sp-2: 8px;
  --ds-sp-3: 12px;
  --ds-sp-4: 16px;
  --ds-sp-6: 24px;
  --ds-sp-8: 32px;
}

/* ── TYPOGRAPHY ── */
.ds-page-title    { font-size: var(--ds-text-2xl); font-weight: 800; color: var(--text-primary); margin: 0; line-height: 1.2; letter-spacing: -0.3px; }
.ds-section-title { font-size: var(--ds-text-lg);  font-weight: 700; color: var(--text-primary); margin: 0; }
.ds-card-title    { font-size: var(--ds-text-base); font-weight: 700; color: var(--text-primary); margin: 0; }
.ds-body          { font-size: var(--ds-text-sm);   color: var(--text-primary); }
.ds-muted         { font-size: var(--ds-text-xs);   color: var(--text-muted); }
.ds-secondary     { font-size: var(--ds-text-xs);   color: var(--text-secondary); }
.ds-kpi-number    { font-size: var(--ds-text-3xl);  font-weight: 900; line-height: 1; }
.ds-label         { display: block; font-size: 0.72rem; color: var(--text-secondary); font-weight: 600; margin-bottom: 0.3rem; letter-spacing: 0.1px; }
.ds-hint          { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.2rem; }

/* ── SURFACE / ELEVATION SYSTEM ── */
.ds-surface          { background: var(--bg-card); }
.ds-surface-base     { background: var(--bg-page); }
.ds-surface-elevated { background: var(--bg-card); border: 1px solid var(--border-color); box-shadow: var(--shadow-card); }
.ds-surface-input    { background: var(--bg-input); }
.ds-surface-sidebar  { background: var(--bg-sidebar); }

/* ── PAGE LAYOUT ── */
.ds-page {
  background: var(--bg-page);
  min-height: 100vh;
  padding: 1.5rem;
  direction: rtl;
  color: var(--text-primary);
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
}
.ds-page-inner { max-width: 1440px; margin: 0 auto; }

/* ── PAGE HEADER ── */
.ds-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.ds-page-header-left { display: flex; align-items: center; gap: 0.75rem; }
.ds-page-header-meta { display: flex; flex-direction: column; gap: 0.15rem; }
.ds-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}
.ds-breadcrumb a { color: var(--text-muted); text-decoration: none; transition: color 0.12s ease !important; }
.ds-breadcrumb a:hover { color: var(--text-secondary); }
.ds-breadcrumb-sep { opacity: 0.35; font-size: 0.6rem; }
.ds-page-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; font-weight: 400; }
.ds-page-actions { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }

/* ── BUTTON SYSTEM ── */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
  font-weight: 700;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.14s ease, border-color 0.14s ease, color 0.14s ease, box-shadow 0.14s ease, transform 0.12s ease, opacity 0.14s ease !important;
  line-height: 1;
  vertical-align: middle;
}
.ds-btn:disabled, .ds-btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none !important; pointer-events: none; }

/* Button sizes */
.ds-btn-sm  { font-size: 0.78rem; padding: 0.44rem 0.85rem; min-height: 32px; }
.ds-btn-md  { font-size: 0.85rem; padding: 0.58rem 1.05rem; min-height: 38px; }
.ds-btn-lg  { font-size: 0.95rem; padding: 0.7rem 1.35rem; min-height: 44px; }

/* Button variants */
.ds-btn-primary {
  background: var(--accent-gradient);
  color: #fff;
}
.ds-btn-primary:hover  { opacity: 0.88; transform: translateY(-1px); box-shadow: 0 4px 14px rgba(124,58,237,0.28); color: #fff; }
.ds-btn-primary:active { transform: translateY(0); opacity: 1; }

.ds-btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
}
.ds-btn-secondary:hover { border-color: var(--border-hover); color: var(--text-primary); background: var(--bg-card-hover); }
.ds-btn-secondary:active { transform: scale(0.99); }

.ds-btn-ghost {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
}
.ds-btn-ghost:hover { background: rgba(124,58,237,0.06); border-color: var(--border-color); color: var(--text-primary); }

.ds-btn-danger {
  background: rgba(239,68,68,0.07);
  border: 1px solid rgba(239,68,68,0.18);
  color: #ef4444;
}
.ds-btn-danger:hover { background: rgba(239,68,68,0.14); border-color: rgba(239,68,68,0.5); color: #f87171; }

.ds-btn-success {
  background: linear-gradient(135deg, #059669, #10b981);
  color: #fff;
}
.ds-btn-success:hover { opacity: 0.88; transform: translateY(-1px); color: #fff; box-shadow: 0 4px 14px rgba(5,150,105,0.25); }

.ds-btn-blue {
  border: 1px solid rgba(59,130,246,0.35);
  color: #60a5fa;
  background: rgba(59,130,246,0.07);
}
.ds-btn-blue:hover { background: rgba(59,130,246,0.14); border-color: #60a5fa; color: #93c5fd; }

.ds-btn-green {
  border: 1px solid rgba(16,185,129,0.35);
  color: #34d399;
  background: rgba(16,185,129,0.07);
}
.ds-btn-green:hover { background: rgba(16,185,129,0.14); border-color: #34d399; color: #6ee7b7; }

/* Back button */
.ds-btn-back {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: background 0.13s, border-color 0.13s, color 0.13s !important;
  flex-shrink: 0;
  cursor: pointer;
  font-size: 0.85rem;
}
.ds-btn-back:hover { color: var(--accent); border-color: rgba(124,58,237,0.4); background: rgba(124,58,237,0.06); }

/* ── BADGE SYSTEM ── */
.ds-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.18rem 0.55rem;
  border-radius: 20px;
  font-size: 0.68rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
  line-height: 1.4;
}
.ds-badge-active    { background: rgba(5,150,105,0.12);   color: #34d399; border-color: rgba(5,150,105,0.25); }
.ds-badge-inactive  { background: rgba(55,65,81,0.2);     color: #9ca3af; border-color: rgba(55,65,81,0.3); }
.ds-badge-pending   { background: rgba(245,158,11,0.12);  color: #fbbf24; border-color: rgba(245,158,11,0.25); }
.ds-badge-completed { background: rgba(5,150,105,0.12);   color: #34d399; border-color: rgba(5,150,105,0.25); }
.ds-badge-cancelled { background: rgba(239,68,68,0.12);   color: #f87171; border-color: rgba(239,68,68,0.25); }
.ds-badge-open      { background: rgba(56,189,248,0.12);  color: #7dd3fc; border-color: rgba(56,189,248,0.25); }
.ds-badge-closed    { background: rgba(55,65,81,0.2);     color: #9ca3af; border-color: rgba(55,65,81,0.3); }
.ds-badge-warning   { background: rgba(245,158,11,0.12);  color: #fbbf24; border-color: rgba(245,158,11,0.25); }
.ds-badge-simple    { background: rgba(124,58,237,0.12);  color: #a78bfa; border-color: rgba(124,58,237,0.25); }
.ds-badge-variant   { background: rgba(15,118,110,0.12);  color: #2dd4bf; border-color: rgba(15,118,110,0.25); }
.ds-badge-warranty  { background: rgba(146,64,14,0.12);   color: #fbbf24; border-color: rgba(146,64,14,0.25); }
.ds-badge-blue      { background: rgba(59,130,246,0.12);  color: #60a5fa; border-color: rgba(59,130,246,0.25); }
.ds-badge-green     { background: rgba(16,185,129,0.12);  color: #34d399; border-color: rgba(16,185,129,0.25); }
.ds-badge-amber     { background: rgba(245,158,11,0.12);  color: #fbbf24; border-color: rgba(245,158,11,0.25); }
.ds-badge-teal      { background: rgba(20,184,166,0.12);  color: #2dd4bf; border-color: rgba(20,184,166,0.25); }
.ds-badge-purple    { background: rgba(124,58,237,0.12);  color: #a78bfa; border-color: rgba(124,58,237,0.25); }
.ds-badge-red       { background: rgba(239,68,68,0.12);   color: #f87171; border-color: rgba(239,68,68,0.25); }

/* Count badge (inline pill next to title) */
.ds-count-badge {
  display: inline-flex;
  align-items: center;
  background: var(--bg-input);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 600;
}

/* ── FORM / INPUT SYSTEM ── */
.ds-input, .ds-select, .ds-textarea {
  width: 100%;
  background: var(--bg-input) !important;
  border: 1px solid var(--border-color) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-sm) !important;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif !important;
  font-size: 0.875rem !important;
  outline: none !important;
  transition: border-color 0.14s, box-shadow 0.14s !important;
}
.ds-input, .ds-select { height: 38px; padding: 0 0.85rem !important; }
.ds-textarea { height: auto; min-height: 84px; padding: 0.55rem 0.85rem !important; resize: vertical; }
.ds-input::placeholder, .ds-textarea::placeholder { color: var(--text-muted) !important; opacity: 0.7; }
.ds-input:focus, .ds-select:focus, .ds-textarea:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(124,58,237,0.18) !important;
}

/* Search bar wrapper */
.ds-search-bar {
  position: relative;
  display: flex;
  align-items: center;
}
.ds-search-bar .ds-search-icon {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.75rem;
  pointer-events: none;
  opacity: 0.6;
}
.ds-search-bar .ds-input { padding-right: 2.25rem !important; }
.ds-search-bar:focus-within .ds-search-icon { opacity: 1; color: var(--accent); }

/* ── FILTER BAR ── */
.ds-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.ds-filter-bar .ds-input,
.ds-filter-bar .ds-select { flex: 1; min-width: 140px; max-width: 200px; }
.ds-filter-bar .ds-search-bar { flex: 1.5; min-width: 220px; }
.ds-filter-bar .ds-btn { flex-shrink: 0; }

/* ── KPI STAT CARDS ── */
.ds-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.ds-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s !important;
}
.ds-kpi-card:hover { border-color: var(--border-hover); transform: translateY(-1px); box-shadow: 0 6px 20px rgba(0,0,0,0.15); }
/* Accent bar on right edge (visible in RTL) */
.ds-kpi-card::after {
  content: '';
  position: absolute;
  top: 0; bottom: 0; right: 0;
  width: 3px;
  border-radius: 2px 0 0 2px;
}
.ds-kpi-card.ds-kpi-blue::after   { background: var(--ds-blue); }
.ds-kpi-card.ds-kpi-green::after  { background: var(--ds-green); }
.ds-kpi-card.ds-kpi-amber::after  { background: var(--ds-amber); }
.ds-kpi-card.ds-kpi-purple::after { background: var(--ds-purple); }
.ds-kpi-card.ds-kpi-red::after    { background: var(--ds-red); }
.ds-kpi-card.ds-kpi-teal::after   { background: var(--ds-teal); }

.ds-kpi-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}
.ds-kpi-blue   .ds-kpi-icon { background: var(--ds-blue-soft);   color: #60a5fa; }
.ds-kpi-green  .ds-kpi-icon { background: var(--ds-green-soft);  color: #34d399; }
.ds-kpi-amber  .ds-kpi-icon { background: var(--ds-amber-soft);  color: #fbbf24; }
.ds-kpi-purple .ds-kpi-icon { background: var(--ds-purple-soft); color: #a78bfa; }
.ds-kpi-red    .ds-kpi-icon { background: var(--ds-red-soft);    color: #f87171; }
.ds-kpi-teal   .ds-kpi-icon { background: var(--ds-teal-soft);   color: #2dd4bf; }

.ds-kpi-body   { display: flex; flex-direction: column; gap: 0.2rem; min-width: 0; }
.ds-kpi-value  { font-size: 1.6rem; font-weight: 900; line-height: 1.15; color: var(--text-primary); letter-spacing: 0; display: flex; align-items: center; gap: 0.3rem; flex-wrap: nowrap; }
/* Isolate numeric content from RTL context to prevent Arabic-Indic numeral substitution */
.ds-kpi-num    { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "lnum" 1, "tnum" 1; white-space: nowrap; letter-spacing: 0; }
/* SAR icon sizing inside KPI value */
.ds-kpi-sar    { font-size: 0.72em; opacity: 0.9; flex-shrink: 0; line-height: 1; display: inline-flex; align-items: center; }
.ds-kpi-sar .sar-icon { height: 0.82em; margin-right: 0; }
.ds-kpi-label  { font-size: 0.7rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; letter-spacing: 0.1px; }
.ds-kpi-sub    { font-size: 0.65rem; color: var(--text-muted); margin-top: 0.1rem; }

/* Color-tinted values */
.ds-kpi-blue   .ds-kpi-value { color: #60a5fa; }
.ds-kpi-green  .ds-kpi-value { color: #34d399; }
.ds-kpi-amber  .ds-kpi-value { color: #fbbf24; }
.ds-kpi-purple .ds-kpi-value { color: #a78bfa; }
.ds-kpi-red    .ds-kpi-value { color: #f87171; }
.ds-kpi-teal   .ds-kpi-value { color: #2dd4bf; }

/* ── TABLE SYSTEM ── */
.ds-table-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.ds-table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar-section);
}
.ds-table-wrap { overflow-x: auto; }
.ds-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 720px;
}
.ds-table th {
  position: sticky;
  top: 0;
  background: var(--bg-sidebar-section);
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 700;
  text-align: right;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.ds-table th:first-child { border-right: 3px solid transparent; } /* placeholder for stock indicator */
.ds-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid rgba(42,42,53,0.7);
  vertical-align: middle;
  font-size: 0.85rem;
  color: var(--text-primary);
  transition: background 0.1s !important;
}
body.light-theme .ds-table td { border-bottom-color: rgba(224,224,238,0.8); }
.ds-table tbody tr:last-child td { border-bottom: none; }
/* Subtle row hover — perceptible but not jarring */
.ds-table tbody tr:hover td { background: rgba(124,58,237,0.04) !important; }
body.light-theme .ds-table tbody tr:hover td { background: rgba(124,58,237,0.05) !important; }
/* No zebra in dark — cleaner look */
.ds-table tbody tr:nth-child(even) td { background: transparent; }
body.light-theme .ds-table tbody tr:nth-child(even) td { background: rgba(0,0,0,0.014); }

/* Stock indicator left-border (RTL: shown on right side) */
.ds-row-stock-low  td:first-child { border-right: 3px solid #f59e0b !important; }
.ds-row-stock-zero td:first-child { border-right: 3px solid #ef4444 !important; }

/* Table cell helpers */
.ds-cell-primary   { font-weight: 700; font-size: 0.875rem; color: var(--text-primary); line-height: 1.3; }
.ds-cell-secondary { font-size: 0.73rem; color: var(--text-secondary); margin-top: 0.12rem; line-height: 1.4; }
.ds-cell-muted     { font-size: 0.7rem; color: var(--text-muted); }
.ds-cell-mono      { font-family: 'Courier New', monospace; font-size: 0.76rem; color: var(--text-muted); letter-spacing: 0.2px; }
.ds-cell-num       { font-weight: 700; font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "lnum" 1, "tnum" 1; letter-spacing: 0; direction: ltr; unicode-bidi: isolate; }
.ds-cell-num-muted { font-size: 0.8rem; color: var(--text-secondary); font-variant-numeric: tabular-nums lining-nums; font-feature-settings: "lnum" 1, "tnum" 1; direction: ltr; unicode-bidi: isolate; }

/* Reference number utility — always renders # on the LEFT regardless of RTL context */
.ref-num {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-variant-numeric: tabular-nums;
}
.ref-hash { color: var(--accent); opacity: .7; font-weight: 600; }
a.ref-num, a.inv-ref-link {
  color: inherit;
  text-decoration: none;
}
a.ref-num:hover, a.inv-ref-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Row action buttons */
.ds-row-btn {
  width: 30px; height: 30px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s !important;
  font-size: 0.75rem;
  text-decoration: none;
}
.ds-row-btn:hover         { color: var(--accent); border-color: var(--border-color); background: var(--bg-input); }
.ds-row-btn-danger:hover  { color: #ef4444; border-color: rgba(239,68,68,0.45); background: rgba(239,68,68,0.08); }
.ds-row-btn-success:hover { color: #34d399; border-color: rgba(16,185,129,0.45); background: rgba(16,185,129,0.08); }
.ds-row-actions { display: flex; gap: 0.3rem; align-items: center; }

/* ── PAGINATION ── */
.ds-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-color);
  flex-wrap: wrap;
  gap: 0.75rem;
}
.ds-pagination-info { font-size: 0.78rem; color: var(--text-muted); }
.ds-pagination-links { display: flex; gap: 0.3rem; align-items: center; }
.ds-pag-btn {
  height: 32px;
  min-width: 32px;
  padding: 0 0.6rem;
  border-radius: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  background: var(--bg-card);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, border-color 0.12s, color 0.12s !important;
  font-family: 'Tajawal', sans-serif;
}
.ds-pag-btn:hover       { border-color: var(--accent); color: var(--accent); background: var(--glow); }
.ds-pag-btn-active      { background: var(--accent-gradient); color: #fff !important; border-color: transparent; }
.ds-pag-btn-disabled    { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

/* ── CARD SYSTEM ── */
.ds-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}
.ds-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar-section);
}
.ds-card-body { padding: 1rem; }
.ds-card-footer {
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-sidebar);
}

/* Inline form/panel card */
.ds-form-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 1rem;
}

/* ── MODAL SYSTEM ── */
.ds-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 4000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(3px);
}
.ds-modal-overlay.show, .ds-modal-overlay[style*="display: flex"] { display: flex !important; }
.ds-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,0.45), 0 0 0 1px rgba(255,255,255,0.03) inset;
  display: flex;
  flex-direction: column;
}
.ds-modal-md { max-width: 640px; }
.ds-modal-lg { max-width: 880px; }
.ds-modal-xl { max-width: 1060px; }
.ds-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.25rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar-section);
  flex-shrink: 0;
}
.ds-modal-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}
.ds-modal-close {
  width: 28px; height: 28px;
  border-radius: 7px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s, color 0.12s !important;
  font-size: 0.85rem;
}
.ds-modal-close:hover { background: rgba(239,68,68,0.1); color: #ef4444; }
.ds-modal-body {
  padding: 1.25rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.ds-modal-footer {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-sidebar);
  flex-shrink: 0;
}

/* ── EMPTY STATE ── */
.ds-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1.5rem;
  text-align: center;
  gap: 0.5rem;
}
.ds-empty-icon  { font-size: 2rem; opacity: 0.25; color: var(--text-muted); line-height: 1; margin-bottom: 0.25rem; }
.ds-empty-title { font-size: 0.875rem; font-weight: 700; color: var(--text-secondary); margin: 0; }
.ds-empty-desc  { font-size: 0.78rem; color: var(--text-muted); margin: 0; max-width: 280px; line-height: 1.55; }
.ds-empty-action { margin-top: 0.75rem; }

/* ── FORM FIELDS (modal context) ── */
.ds-field { margin-bottom: 0.9rem; }
.ds-field:last-child { margin-bottom: 0; }
.ds-field-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.ds-field-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.65rem; }
.ds-required { color: #ef4444; font-size: 0.7rem; }
.ds-field-error { font-size: 0.72rem; color: #f87171; margin-top: 0.25rem; }

/* ── TOPBAR (page-level navigation bar) ── */
.ds-topbar {
  background: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  height: 52px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 50;
}
.ds-topbar-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto; /* RTL: push to left visually */
}
.ds-topbar-brand img   { height: 28px; }
.ds-topbar-brand span  {
  font-weight: 800;
  font-size: 0.95rem;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.ds-topbar-actions { display: flex; align-items: center; gap: 0.6rem; }

/* Theme toggle button (shared) */
.ds-btn-theme {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.18s !important;
}
.ds-btn-theme:hover { border-color: var(--accent); color: var(--accent); background: var(--glow); }

/* ── ALERT / NOTICE ── */
.ds-alert {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1.4;
}
.ds-alert-danger  { background: rgba(239,68,68,0.08);  border-color: rgba(239,68,68,0.2);  color: #f87171; }
.ds-alert-success { background: rgba(16,185,129,0.08); border-color: rgba(16,185,129,0.2); color: #34d399; }
.ds-alert-warning { background: rgba(245,158,11,0.08); border-color: rgba(245,158,11,0.2); color: #fbbf24; }
.ds-alert-info    { background: rgba(56,189,248,0.08); border-color: rgba(56,189,248,0.2); color: #7dd3fc; }

/* ── STOCK INDICATORS ── */
.ds-stock-ok   { color: #34d399; font-weight: 700; }
.ds-stock-mid  { color: #fbbf24; font-weight: 700; }
.ds-stock-low  { color: #f59e0b; font-weight: 700; }
.ds-stock-zero { color: #f87171; font-weight: 700; }

/* ── IMPORT PANEL ── */
.ds-import-panel {
  display: none;
  margin-bottom: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1rem;
}
.ds-import-panel-inner {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.75rem;
  align-items: center;
}
.ds-import-link { color: var(--accent); font-weight: 700; text-decoration: none; font-size: 0.85rem; white-space: nowrap; }
.ds-import-link:hover { opacity: 0.8; }
.ds-import-msg  { margin-top: 0.6rem; font-size: 0.8rem; }

/* ── COMPATIBLE MODELS TAG ── */
.ds-tag {
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.3);
  color: #a78bfa;
  border-radius: 20px;
  padding: 0.15rem 0.55rem;
  font-size: 0.75rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin: 0.15rem;
}
.ds-tag-remove {
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.15s !important;
}
.ds-tag-remove:hover { opacity: 1; }

/* ── VARIANT ROWS ── */
.ds-variant-row {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr 1fr auto;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
  align-items: center;
  padding-bottom: 0.4rem;
  border-bottom: 1px dashed var(--border-color);
}
.ds-variant-row:last-child { border-bottom: none; margin-bottom: 0; }
.ds-variant-header {
  display: grid;
  grid-template-columns: 2fr 1.5fr 1.5fr 1fr auto;
  gap: 0.4rem;
  margin-bottom: 0.35rem;
}
.ds-variant-header span {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

/* ── MODULE CARDS (dashboard) ── */
.ds-mod-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem 0.9rem;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
  position: relative;
  overflow: hidden;
  transition: border-color 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease, background-color 0.2s ease !important;
}
.ds-mod-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  background: var(--bg-card-hover);
}
.ds-mod-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
}
/* Color accent bars */
.ds-mod-purple::before { background: linear-gradient(90deg, #7c3aed, #a78bfa); }
.ds-mod-green::before  { background: linear-gradient(90deg, #059669, #34d399); }
.ds-mod-blue::before   { background: linear-gradient(90deg, #1d4ed8, #60a5fa); }
.ds-mod-orange::before { background: linear-gradient(90deg, #c2410c, #fb923c); }
.ds-mod-teal::before   { background: linear-gradient(90deg, #0f766e, #2dd4bf); }
.ds-mod-pink::before   { background: linear-gradient(90deg, #9d174d, #ec4899); }
.ds-mod-amber::before  { background: linear-gradient(90deg, #92400e, #fbbf24); }
.ds-mod-gray::before   { background: linear-gradient(90deg, #374151, #9ca3af); }
.ds-mod-indigo::before { background: linear-gradient(90deg, #3730a3, #818cf8); }
.ds-mod-gold::before   { background: linear-gradient(90deg, #b45309, #fcd34d); }

.ds-mod-icon {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.7rem;
  font-size: 1.1rem;
}
.ds-mod-purple .ds-mod-icon { background: rgba(124,58,237,0.15); color: #a78bfa; }
.ds-mod-green  .ds-mod-icon { background: rgba(5,150,105,0.15);  color: #34d399; }
.ds-mod-blue   .ds-mod-icon { background: rgba(29,78,216,0.15);  color: #60a5fa; }
.ds-mod-orange .ds-mod-icon { background: rgba(194,65,12,0.15);  color: #fb923c; }
.ds-mod-teal   .ds-mod-icon { background: rgba(15,118,110,0.15); color: #2dd4bf; }
.ds-mod-pink   .ds-mod-icon { background: rgba(157,23,77,0.15);  color: #ec4899; }
.ds-mod-amber  .ds-mod-icon { background: rgba(146,64,14,0.15);  color: #fbbf24; }
.ds-mod-gray   .ds-mod-icon { background: rgba(55,65,81,0.25);   color: #9ca3af; }
.ds-mod-indigo .ds-mod-icon { background: rgba(55,48,163,0.15);  color: #818cf8; }
.ds-mod-gold   .ds-mod-icon { background: rgba(180,83,9,0.15);   color: #fcd34d; }

.ds-mod-name { font-size: 0.875rem; font-weight: 700; color: var(--text-primary); margin-bottom: 0.15rem; line-height: 1.3; }
.ds-mod-desc { font-size: 0.7rem; color: var(--text-muted); }
.ds-mod-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  font-size: 0.6rem;
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.2);
  padding: 0.1rem 0.4rem;
  border-radius: 20px;
  font-weight: 700;
}
.ds-modules-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.75rem;
}

/* ── DASHBOARD ── */
.ds-dashboard { padding: 1.5rem; background: var(--bg-page); min-height: calc(100vh - 52px); }
.ds-dashboard-greeting { margin-bottom: 1.5rem; }
.ds-dashboard-greeting h2 { font-size: 1.3rem; font-weight: 800; color: var(--text-primary); margin-bottom: 0.2rem; }
.ds-dashboard-greeting p  { font-size: 0.82rem; color: var(--text-muted); margin: 0; }
.ds-stats-filter { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; gap: 0.75rem; flex-wrap: wrap; }
.ds-stats-filter-label { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.ds-filter-pills { display: inline-flex; gap: 0.35rem; }
.ds-filter-pill {
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s !important;
  font-family: 'Tajawal', sans-serif;
}
.ds-filter-pill:hover  { border-color: var(--border-hover); color: var(--text-primary); }
.ds-filter-pill.active { background: var(--accent-gradient); border-color: transparent; color: #fff; }
.ds-modules-section-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

/* ── RESPONSIVE ── */
@media (max-width: 1400px) {
  .ds-modules-grid  { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .ds-kpi-grid      { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .ds-kpi-grid      { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-modules-grid  { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
  .ds-modules-grid  { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ds-page          { padding: 1rem; }
  .ds-filter-bar    { flex-direction: column; align-items: stretch; }
  .ds-filter-bar .ds-input,
  .ds-filter-bar .ds-select { max-width: 100%; }
  .ds-page-header   { flex-direction: column; }
  .ds-kpi-grid      { grid-template-columns: 1fr 1fr; }
  .ds-import-panel-inner { grid-template-columns: 1fr 1fr; }
  .ds-field-grid-3  { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .ds-kpi-grid      { grid-template-columns: 1fr; }
  .ds-modules-grid  { grid-template-columns: 1fr 1fr; }
  .ds-field-grid-2, .ds-field-grid-3 { grid-template-columns: 1fr; }
}

/* ── LIGHT THEME OVERRIDES for DS ── */
body.light-theme .ds-table tbody tr:nth-child(even) td { background: rgba(0,0,0,0.014); }
body.light-theme .ds-table-header { background: var(--bg-input); }
body.light-theme .ds-table th { background: var(--bg-input); color: var(--text-secondary); }
body.light-theme .ds-table-card { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
body.light-theme .ds-kpi-card { box-shadow: 0 1px 4px rgba(0,0,0,0.06); }
body.light-theme .ds-filter-bar { box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
/* Badge backgrounds are too washed-out in light mode — boost opacity */
body.light-theme .ds-badge-active    { background: rgba(5,150,105,0.15);   color: #065f46; border-color: rgba(5,150,105,0.3); }
body.light-theme .ds-badge-cancelled { background: rgba(239,68,68,0.1);    color: #b91c1c; border-color: rgba(239,68,68,0.25); }
body.light-theme .ds-badge-pending   { background: rgba(245,158,11,0.12);  color: #92400e; border-color: rgba(245,158,11,0.3); }
body.light-theme .ds-badge-warning   { background: rgba(245,158,11,0.12);  color: #92400e; border-color: rgba(245,158,11,0.3); }
body.light-theme .ds-badge-open      { background: rgba(56,189,248,0.1);   color: #0369a1; border-color: rgba(56,189,248,0.25); }
body.light-theme .ds-badge-blue      { background: rgba(59,130,246,0.1);   color: #1d4ed8; border-color: rgba(59,130,246,0.25); }
body.light-theme .ds-badge-green     { background: rgba(16,185,129,0.1);   color: #065f46; border-color: rgba(16,185,129,0.25); }
body.light-theme .ds-badge-amber     { background: rgba(245,158,11,0.12);  color: #92400e; border-color: rgba(245,158,11,0.3); }
body.light-theme .ds-badge-teal      { background: rgba(20,184,166,0.1);   color: #0f766e; border-color: rgba(20,184,166,0.25); }
body.light-theme .ds-badge-purple    { background: rgba(124,58,237,0.1);   color: #6d28d9; border-color: rgba(124,58,237,0.25); }
body.light-theme .ds-badge-red       { background: rgba(239,68,68,0.1);    color: #b91c1c; border-color: rgba(239,68,68,0.25); }
body.light-theme .ds-badge-inactive  { background: rgba(107,114,128,0.1);  color: #4b5563; border-color: rgba(107,114,128,0.25); }
/* Light theme KPI icon backgrounds need more saturation */
body.light-theme .ds-kpi-blue   .ds-kpi-icon { background: rgba(59,130,246,0.1);  }
body.light-theme .ds-kpi-green  .ds-kpi-icon { background: rgba(16,185,129,0.1);  }
body.light-theme .ds-kpi-amber  .ds-kpi-icon { background: rgba(245,158,11,0.12); }
body.light-theme .ds-kpi-purple .ds-kpi-icon { background: rgba(124,58,237,0.1);  }
body.light-theme .ds-kpi-red    .ds-kpi-icon { background: rgba(239,68,68,0.1);   }
body.light-theme .ds-kpi-teal   .ds-kpi-icon { background: rgba(20,184,166,0.1);  }
/* Light theme KPI values are muted — darken slightly */
body.light-theme .ds-kpi-blue   .ds-kpi-value { color: #2563eb; }
body.light-theme .ds-kpi-green  .ds-kpi-value { color: #059669; }
body.light-theme .ds-kpi-amber  .ds-kpi-value { color: #d97706; }
body.light-theme .ds-kpi-purple .ds-kpi-value { color: #7c3aed; }
body.light-theme .ds-kpi-red    .ds-kpi-value { color: #dc2626; }
body.light-theme .ds-kpi-teal   .ds-kpi-value { color: #0f766e; }
/* Light theme inputs */
body.light-theme .ds-input,
body.light-theme .ds-select,
body.light-theme .ds-textarea { background: #ffffff !important; }
body.light-theme .ds-btn-secondary { background: #ffffff; }
body.light-theme .ds-row-btn:hover { background: rgba(124,58,237,0.07); }
body.light-theme .ds-modal { box-shadow: 0 20px 60px rgba(0,0,0,0.18); }

/* ── THEME TRANSITION — applied only to theme-sensitive properties ── */
body, .ds-table-card, .ds-kpi-card, .ds-modal, .ds-filter-bar,
.ds-btn, .ds-badge, .ds-input, .ds-select, .ds-textarea,
.ds-page-header, .sidebar-logo, .pos-sidebar, .pos-cart,
.ds-modal-overlay, .ds-empty-state, .ds-row-btn, .ds-page-actions,
.ds-count-badge, .ds-table th, .ds-card-header {
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease !important;
}

/* ── UTILITY ── */
.ds-divider { height: 1px; background: var(--border-color); margin: 1.25rem 0; opacity: 0.7; }
.ds-divider-sm { height: 1px; background: var(--border-color); margin: 0.75rem 0; opacity: 0.5; }
.ds-flex    { display: flex; align-items: center; gap: 0.5rem; }
.ds-flex-between { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.ds-flex-wrap    { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ds-flex-col     { display: flex; flex-direction: column; gap: 0.5rem; }
.ds-stack-sm { display: flex; flex-direction: column; gap: 0.5rem; }
.ds-stack-md { display: flex; flex-direction: column; gap: 0.85rem; }
.ds-stack-lg { display: flex; flex-direction: column; gap: 1.25rem; }
.ds-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.ds-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.ds-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.ds-text-success { color: #34d399 !important; }
.ds-text-danger  { color: #f87171 !important; }
.ds-text-warning { color: #fbbf24 !important; }
.ds-text-info    { color: #7dd3fc !important; }
.ds-text-muted   { color: var(--text-muted) !important; }
.ds-text-primary { color: var(--text-primary) !important; }
.ds-text-mono    { font-family: monospace; font-variant-numeric: tabular-nums; }
.ds-truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-nowrap       { white-space: nowrap; }
.ds-mt-0  { margin-top: 0 !important; }
.ds-mt-sm { margin-top: 0.5rem !important; }
.ds-mt-md { margin-top: 1rem !important; }
.ds-mb-0  { margin-bottom: 0 !important; }
.ds-mb-sm { margin-bottom: 0.75rem !important; }
.ds-mb-md { margin-bottom: 1.25rem !important; }
.ds-mb-lg { margin-bottom: 1.75rem !important; }

/* ── AVATAR / INITIAL CHIP ── */
.ds-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: 0;
  user-select: none;
}
.ds-avatar-sm { width: 26px; height: 26px; font-size: 0.65rem; }
.ds-avatar-lg { width: 40px; height: 40px; font-size: 0.9rem; }

/* ── SECTION HEADER (inline card subheader) ── */
.ds-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-sidebar-section);
}
.ds-section-header-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ── STATUS DOT ── */
.ds-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.ds-dot-green  { background: #10b981; }
.ds-dot-amber  { background: #f59e0b; }
.ds-dot-red    { background: #ef4444; }
.ds-dot-blue   { background: #3b82f6; }
.ds-dot-muted  { background: var(--text-muted); }
.ds-dot-pulse  { animation: ds-pulse 2s ease-in-out infinite; }
@keyframes ds-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(0.85); }
}

/* ── POS POLISH PASS ── */
/* Wider product grid at large screens for cashier density */
@media (min-width: 1280px) {
  .products-grid { grid-template-columns: repeat(4, 1fr); }
}
/* Reduce POS product card padding for better density */
.product-card {
  padding: 0.75rem 0.65rem;
}
.product-card .product-icon { font-size: 1.6rem; margin-bottom: 0.4rem; }
.product-card .product-name { font-size: 0.78rem; margin-bottom: 0.25rem; }
.product-card .product-price { font-size: 0.9rem; }
/* Tighter cart items */
.cart-item { padding: 0.45rem 0; gap: 0.35rem; }
.cart-item .item-name { font-size: 0.78rem; }
/* ── DS CARD CARD-HEADER POLISH ── */
.ds-card-header {
  transition: background-color 0.18s !important;
}

/* ── COUNT BADGE REFINEMENT ── */
.ds-count-badge {
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

/* ── PAGINATION REFINEMENT ── */
.ds-pag-btn {
  transition: background 0.12s, border-color 0.12s, color 0.12s !important;
}

/* ── ALERT REFINEMENT ── */
.ds-alert {
  border-radius: var(--radius-sm);
  font-weight: 500;
}
.ds-alert i { flex-shrink: 0; }

/* ── RESPONSIVE IMPROVEMENTS ── */
@media (max-width: 1100px) {
  .ds-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .ds-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
  .ds-kpi-card { padding: 0.8rem; gap: 0.65rem; }
  .ds-kpi-value { font-size: 1.35rem; gap: 0.25rem; }
  .ds-page { padding: 0.85rem; }
  .ds-page-header { gap: 0.75rem; margin-bottom: 1rem; }
  .ds-table-header { flex-wrap: wrap; gap: 0.5rem; }
  .ds-filter-bar { padding: 0.5rem 0.65rem; }
}


/* ── INDEX FILTER CARD / CRUD TOOLBAR ── */
.ds-index-filter-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 30px rgba(0,0,0,0.10);
}
.ds-index-filter-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  color: var(--text-primary);
  font-weight: 800;
  font-size: 0.86rem;
}
.ds-index-filter-title i {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ds-teal-soft);
  color: #2dd4bf;
  font-size: 0.78rem;
}
.ds-index-filter-card .ds-filter-bar,
.ds-index-filter-toolbar {
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  border-radius: 0;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: nowrap;
}
.ds-index-filter-card .ds-search-bar {
  flex: 1.5 1 260px !important;
  min-width: 240px !important;
}
.ds-index-filter-card .ds-input,
.ds-index-filter-card .ds-select {
  height: 40px;
  max-width: none !important;
  border-radius: 11px !important;
  background: rgba(15, 23, 42, 0.42) !important;
}
.ds-index-filter-card .ds-input:focus,
.ds-index-filter-card .ds-select:focus {
  border-color: #2dd4bf !important;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.16) !important;
}
.ds-index-filter-card .ds-search-bar .ds-input {
  padding-right: 2.45rem !important;
}
.ds-index-filter-card .ds-search-icon {
  right: 0.9rem;
  color: #2dd4bf;
  opacity: 0.75;
}
.ds-index-filter-card .ds-btn {
  height: 40px;
  border-radius: 11px;
  padding-inline: 0.95rem;
  flex-shrink: 0;
}
.ds-index-filter-card .select2-container {
  width: auto !important;
  flex: 1 1 150px;
  min-width: 145px;
}
.ds-index-filter-card .select2-container--default .select2-selection--single {
  height: 40px !important;
  border-radius: 11px !important;
  border-color: var(--border-color) !important;
  background: rgba(15, 23, 42, 0.42) !important;
}
.ds-index-filter-card .select2-container--default.select2-container--focus .select2-selection--single,
.ds-index-filter-card .select2-container--default.select2-container--open .select2-selection--single {
  border-color: #2dd4bf !important;
  box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.16) !important;
}
body.light-theme .ds-index-filter-card .ds-input,
body.light-theme .ds-index-filter-card .ds-select,
body.light-theme .ds-index-filter-card .select2-container--default .select2-selection--single {
  background: var(--bg-input) !important;
}

/* Native/Flatpickr date placeholders used by compact filter cards */
.ds-date-field { position: relative; flex: 0 1 155px; min-width: 135px; }
.ds-date-field .ds-input { width: 100%; }
.ds-date-placeholder {
  position: absolute;
  top: 50%;
  right: 0.9rem;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  pointer-events: none;
  opacity: 0.72;
  transition: opacity 0.12s ease, color 0.12s ease;
}
.ds-date-field:focus-within .ds-date-placeholder { color: #2dd4bf; }
.ds-date-field.has-value .ds-date-placeholder,
.ds-date-field.is-focused .ds-date-placeholder { opacity: 0; }
@media (max-width: 1100px) {
  .ds-index-filter-card .ds-filter-bar,
  .ds-index-filter-toolbar { flex-wrap: wrap; }
  .ds-index-filter-card .ds-search-bar { flex-basis: 100% !important; }
}
@media (max-width: 768px) {
  .ds-index-filter-card { padding: 0.75rem; margin-bottom: 0.85rem; }
  .ds-index-filter-card .ds-filter-bar,
  .ds-index-filter-toolbar {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
  }
  .ds-index-filter-card .ds-search-bar {
    grid-column: 1 / -1;
    min-width: 0 !important;
  }
  .ds-index-filter-card .ds-btn,
  .ds-index-filter-card .ds-input,
  .ds-index-filter-card .ds-select,
  .ds-index-filter-card .select2-container {
    width: 100% !important;
    min-width: 0 !important;
  }
}
@media (max-width: 520px) {
  .ds-index-filter-card .ds-filter-bar,
  .ds-index-filter-toolbar { grid-template-columns: 1fr; }
  .ds-index-filter-card .ds-search-bar { grid-column: auto; }
}


/* Customers, inventory, employees, and warranty package filters need a fixed desktop toolbar rhythm. */
.ds-index-filter-toolbar--customers,
.ds-index-filter-toolbar--inventory,
.ds-index-filter-toolbar--employees,
.ds-index-filter-toolbar--warranty-packages {
  display: grid !important;
  grid-template-columns: minmax(280px, 1.6fr) minmax(160px, 0.62fr) minmax(160px, 0.62fr) auto;
  gap: 0.55rem;
  align-items: center;
}
.ds-index-filter-toolbar--customers .ds-search-bar,
.ds-index-filter-toolbar--inventory .ds-search-bar,
.ds-index-filter-toolbar--employees .ds-search-bar,
.ds-index-filter-toolbar--warranty-packages .ds-search-bar {
  min-width: 0 !important;
  width: 100%;
  flex: none !important;
}
.ds-index-filter-toolbar--customers .ds-input,
.ds-index-filter-toolbar--customers .ds-select,
.ds-index-filter-toolbar--customers .select2-container,
.ds-index-filter-toolbar--inventory .ds-input,
.ds-index-filter-toolbar--inventory .ds-select,
.ds-index-filter-toolbar--inventory .select2-container,
.ds-index-filter-toolbar--employees .ds-input,
.ds-index-filter-toolbar--employees .ds-select,
.ds-index-filter-toolbar--employees .select2-container,
.ds-index-filter-toolbar--warranty-packages .ds-input,
.ds-index-filter-toolbar--warranty-packages .ds-select,
.ds-index-filter-toolbar--warranty-packages .select2-container {
  width: 100% !important;
  min-width: 0 !important;
}
.ds-index-filter-toolbar--customers > .ds-btn,
.ds-index-filter-toolbar--inventory > .ds-btn,
.ds-index-filter-toolbar--employees > .ds-btn,
.ds-index-filter-toolbar--warranty-packages > .ds-btn {
  width: max-content;
  justify-self: start;
  white-space: nowrap;
}
@media (max-width: 980px) {
  .ds-index-filter-toolbar--customers,
  .ds-index-filter-toolbar--inventory,
  .ds-index-filter-toolbar--employees,
  .ds-index-filter-toolbar--warranty-packages {
    grid-template-columns: 1fr 1fr;
  }
  .ds-index-filter-toolbar--customers .ds-search-bar,
  .ds-index-filter-toolbar--inventory .ds-search-bar,
  .ds-index-filter-toolbar--employees .ds-search-bar,
  .ds-index-filter-toolbar--warranty-packages .ds-search-bar {
    grid-column: 1 / -1;
  }
  .ds-index-filter-toolbar--customers > .ds-btn,
  .ds-index-filter-toolbar--inventory > .ds-btn,
  .ds-index-filter-toolbar--employees > .ds-btn,
  .ds-index-filter-toolbar--warranty-packages > .ds-btn {
    width: 100%;
    justify-content: center;
  }
}
@media (max-width: 520px) {
  .ds-index-filter-toolbar--customers,
  .ds-index-filter-toolbar--inventory,
  .ds-index-filter-toolbar--employees,
  .ds-index-filter-toolbar--warranty-packages {
    grid-template-columns: 1fr;
  }
  .ds-index-filter-toolbar--customers .ds-search-bar,
  .ds-index-filter-toolbar--inventory .ds-search-bar,
  .ds-index-filter-toolbar--employees .ds-search-bar,
  .ds-index-filter-toolbar--warranty-packages .ds-search-bar {
    grid-column: auto;
  }
}

/* ── PRINT SAFETY ── */
@media print {
  .ds-filter-bar, .ds-page-actions, .ds-row-actions, .ds-btn-back { display: none !important; }
  .ds-table-card { box-shadow: none !important; border: 1px solid #ddd !important; }
  .ds-kpi-card { break-inside: avoid; }
}

/* ============================================================
   UX OPTIMIZATION PASS — skeleton, filter chips, command palette,
   keyboard hints, toasts
   ============================================================ */

/* ── SKELETON LOADING ── */
@keyframes ds-shimmer {
  0%   { background-position: -400px 0; }
  100% { background-position:  400px 0; }
}
.ds-skeleton {
  background: linear-gradient(
    90deg,
    var(--bg-input) 0%,
    var(--bg-sidebar-section) 40%,
    var(--bg-input) 80%
  );
  background-size: 800px 100%;
  animation: ds-shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
  color: transparent !important;
  pointer-events: none;
  user-select: none;
}
.ds-skeleton * { visibility: hidden; }
.ds-skeleton-line  { height: 0.85em; border-radius: 4px; display: block; }
.ds-skeleton-title { height: 1.3em;  border-radius: 4px; display: block; max-width: 55%; }
.ds-skeleton-avatar { border-radius: 50% !important; }
.ds-skeleton-kpi {
  height: 80px; border-radius: var(--radius-md);
  background: linear-gradient(90deg, var(--bg-input) 0%, var(--bg-sidebar-section) 40%, var(--bg-input) 80%);
  background-size: 800px 100%;
  animation: ds-shimmer 1.5s ease-in-out infinite;
}
/* Table rows skeleton */
.ds-table-row-skeleton td { padding: 0.75rem 1rem; }
.ds-table-row-skeleton td > span {
  display: block; height: 0.75em; border-radius: 4px;
  background: linear-gradient(90deg, var(--bg-input) 0%, var(--bg-sidebar-section) 40%, var(--bg-input) 80%);
  background-size: 800px 100%;
  animation: ds-shimmer 1.5s ease-in-out infinite;
}

/* ── ACTIVE FILTER CHIPS ── */
.ds-filter-chips-bar {
  display: flex; align-items: center; gap: 0.4rem;
  flex-wrap: wrap; margin-bottom: 0.85rem; min-height: 26px;
}
.ds-filter-chip {
  display: inline-flex; align-items: center; gap: 0.3rem;
  background: rgba(124,58,237,0.1); border: 1px solid rgba(124,58,237,0.25);
  color: #a78bfa; border-radius: 20px;
  padding: 0.15rem 0.4rem 0.15rem 0.6rem;
  font-size: 0.68rem; font-weight: 700;
  transition: background 0.12s !important;
}
.ds-filter-chip:hover { background: rgba(124,58,237,0.16); }
.ds-filter-chip-remove {
  background: none; border: none; cursor: pointer; color: inherit;
  opacity: 0.6; padding: 0; font-size: 0.6rem; line-height: 1;
  transition: opacity 0.12s !important;
}
.ds-filter-chip-remove:hover { opacity: 1; }
.ds-filter-chip-label { font-size: 0.6rem; color: var(--text-muted); margin-left: 0.2rem; font-weight: 400; }
.ds-clear-filters {
  font-size: 0.68rem; color: var(--text-muted); background: none; border: none;
  cursor: pointer; padding: 0.1rem 0.3rem;
  transition: color 0.12s !important;
  font-family: 'Tajawal', sans-serif;
}
.ds-clear-filters:hover { color: var(--ds-red); }

/* ── COMMAND PALETTE ── */
.cmd-palette-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  z-index: 9500;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: clamp(60px, 12vh, 130px);
  direction: rtl;
}
.cmd-palette-overlay.open { display: flex; }
.cmd-palette-box {
  width: 100%; max-width: 580px;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04) inset;
  overflow: hidden;
  direction: rtl;
  animation: cmd-slide-in 0.15s ease-out;
}
@keyframes cmd-slide-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.cmd-palette-search {
  display: flex; align-items: center; gap: 0.7rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border-color);
}
.cmd-palette-search-icon { color: var(--text-muted); font-size: 0.8rem; flex-shrink: 0; }
.cmd-palette-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 0.92rem;
  font-family: 'Tajawal', sans-serif; font-weight: 600;
  direction: rtl;
}
.cmd-palette-input::placeholder { color: var(--text-muted); font-weight: 400; font-size: 0.875rem; }
.cmd-kbd-hint {
  font-size: 0.6rem; color: var(--text-muted);
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: 5px; padding: 0.12rem 0.4rem; font-weight: 700;
  white-space: nowrap; letter-spacing: 0.3px;
}
.cmd-results { max-height: 360px; overflow-y: auto; padding: 0.35rem 0; }
.cmd-section-label {
  font-size: 0.6rem; text-transform: uppercase; letter-spacing: 1.3px;
  font-weight: 700; color: var(--text-muted);
  padding: 0.55rem 1rem 0.2rem;
}
.cmd-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.5rem 1rem; cursor: pointer;
  transition: background 0.08s !important;
  border-radius: 0;
}
.cmd-item:hover { background: var(--bg-input); }
.cmd-item.is-active { background: rgba(124,58,237,0.1); }
.cmd-item-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; flex-shrink: 0;
}
.cmd-item-body { flex: 1; min-width: 0; }
.cmd-item-label { font-size: 0.855rem; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.cmd-item-sub   { font-size: 0.7rem; color: var(--text-muted); margin-top: 0.05rem; }
.cmd-item-shortcut {
  font-size: 0.58rem; color: var(--text-muted);
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: 4px; padding: 0.1rem 0.35rem; font-weight: 700; white-space: nowrap;
}
.cmd-empty-state { text-align: center; padding: 1.75rem 1rem; color: var(--text-muted); font-size: 0.82rem; }
.cmd-palette-footer {
  padding: 0.45rem 1rem; border-top: 1px solid var(--border-color);
  display: flex; align-items: center; gap: 1.25rem;
  background: var(--bg-sidebar-section);
  font-size: 0.62rem; color: var(--text-muted);
}
.cmd-palette-footer kbd {
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: 4px; padding: 0.1rem 0.35rem;
  font-size: 0.58rem; color: var(--text-secondary);
  font-family: monospace;
}

/* ── POS KEYBOARD HINTS ── */
.pos-kbd-hints {
  padding: 0.6rem 0.75rem;
  border-top: 1px solid var(--border-color);
  background: var(--bg-sidebar-section);
}
.pos-kbd-hint-title {
  font-size: 0.58rem; text-transform: uppercase; letter-spacing: 1.2px;
  font-weight: 700; color: var(--text-muted); margin-bottom: 0.4rem;
}
.pos-kbd-hint-row {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.67rem; color: var(--text-muted); margin-bottom: 0.25rem;
  gap: 0.35rem;
}
.pos-kbd-hint-label { flex: 1; }
.pos-kbd-key {
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: 4px; padding: 0.08rem 0.3rem;
  font-size: 0.6rem; font-weight: 700; color: var(--text-secondary);
  white-space: nowrap; font-family: monospace;
}

/* ── POS SEARCH IMPROVEMENTS ── */
.pos-search-wrap {
  position: relative;
  display: flex; align-items: center;
}
.pos-search-wrap .pos-search-icon {
  position: absolute; right: 0.8rem;
  color: var(--text-muted); font-size: 0.75rem;
  pointer-events: none; transition: color 0.12s !important;
}
.pos-search-wrap:focus-within .pos-search-icon { color: var(--accent); }
.pos-search-clear {
  position: absolute; left: 0.5rem;
  background: var(--bg-input); border: 1px solid var(--border-color);
  border-radius: 5px; color: var(--text-muted); cursor: pointer;
  padding: 0.15rem 0.45rem; font-size: 0.65rem; font-weight: 700;
  display: none; transition: all 0.12s !important;
  font-family: 'Tajawal', sans-serif;
}
.pos-search-clear.visible { display: block; }
.pos-search-clear:hover { color: var(--text-primary); border-color: var(--border-hover); }

/* ── INLINE TOAST NOTIFICATIONS ── */
#dsToastContainer {
  position: fixed; top: 1.25rem; right: 1.5rem;
  z-index: 9200; display: flex; flex-direction: column-reverse;
  gap: 0.5rem; pointer-events: none; direction: rtl;
}
.ds-toast {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.6rem 0.9rem; border-radius: var(--radius-sm);
  font-size: 0.82rem; font-weight: 600; pointer-events: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  border: 1px solid transparent; min-width: 220px; max-width: 360px;
  animation: ds-toast-in 0.2s ease-out;
  font-family: 'Tajawal', sans-serif;
}
@keyframes ds-toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ds-toast-fadeout { animation: ds-toast-out 0.25s ease-in forwards; }
@keyframes ds-toast-out {
  to { opacity: 0; transform: translateY(-6px); }
}
.ds-toast-success { background: rgba(5,150,105,0.1);  color: #34d399; border-color: rgba(5,150,105,0.3); }
.ds-toast-error   { background: rgba(239,68,68,0.1);  color: #f87171; border-color: rgba(239,68,68,0.3); }
.ds-toast-info    { background: rgba(56,189,248,0.1); color: #7dd3fc; border-color: rgba(56,189,248,0.3); }
.ds-toast-warning { background: rgba(245,158,11,0.1); color: #fbbf24; border-color: rgba(245,158,11,0.3); }

/* ── TABLE KEYBOARD NAVIGATION ── */
.ds-table tbody tr.kb-focused td {
  background: rgba(124,58,237,0.07) !important;
  outline: none;
}

/* ── DEBOUNCE SEARCH INDICATOR ── */
.ds-search-bar.searching .ds-search-icon {
  animation: ds-spin 0.8s linear infinite;
}
@keyframes ds-spin {
  from { transform: translateY(-50%) rotate(0deg); }
  to   { transform: translateY(-50%) rotate(360deg); }
}

/* ===== POS SHIFT UX V2 ===== */
.shift-status-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bg-sidebar-section) 92%, transparent), color-mix(in srgb, var(--bg-card) 88%, transparent));
  box-shadow: 0 14px 34px rgba(2, 6, 23, 0.22), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.shift-status-card[data-shift-open="1"] {
  border-color: rgba(16,185,129,.42);
  box-shadow: 0 16px 36px rgba(16,185,129,.08), inset 0 1px 0 rgba(255,255,255,0.05);
}

.shift-status-card[data-shift-open="0"] {
  border-color: rgba(245,158,11,.38);
}

.shift-status-title {
  margin-bottom: 0;
  line-height: 1.35;
}

.shift-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245,158,11,.12);
  flex: 0 0 auto;
}

.shift-status-card[data-shift-open="1"] .shift-status-dot {
  background: #22c55e;
  box-shadow: 0 0 0 4px rgba(34,197,94,.13), 0 0 18px rgba(34,197,94,.42);
}

.shift-status-hint {
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.55;
  padding: .45rem .55rem;
  border-radius: 10px;
  background: rgba(245,158,11,.08);
  border: 1px solid rgba(245,158,11,.18);
}

.shift-open-only {
  display: none;
}

.shift-status-card[data-shift-open="1"] .shift-open-only {
  display: flex;
}

.shift-status-card[data-shift-open="1"] .shift-status-hint {
  display: none;
}

.pos-shift-warning {
  display: none;
  align-items: center;
  gap: .65rem;
  padding: .72rem .8rem;
  margin-top: .75rem;
  border-radius: 16px;
  border: 1px solid rgba(245,158,11,.24);
  background: linear-gradient(135deg, rgba(245,158,11,.12), rgba(15,23,42,.18));
  color: var(--text-primary);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
  transition: opacity .18s ease, transform .18s ease;
}

.pos-shift-warning.show {
  display: flex;
}

.pos-shift-warning-icon {
  width: 34px;
  height: 34px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fbbf24;
  background: rgba(245,158,11,.13);
  border: 1px solid rgba(245,158,11,.22);
  flex: 0 0 auto;
}

.pos-shift-warning-copy {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  min-width: 0;
  flex: 1;
}

.pos-shift-warning-copy strong {
  font-size: .86rem;
  font-weight: 900;
}

.pos-shift-warning-copy span {
  font-size: .72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.pos-shift-warning-action {
  border: 1px solid rgba(16,185,129,.35);
  background: rgba(16,185,129,.12);
  color: #86efac;
  border-radius: 999px;
  padding: .38rem .7rem;
  font-size: .74rem;
  font-weight: 800;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
  white-space: nowrap;
  transition: all .16s ease;
}

.pos-shift-warning-action:hover {
  background: rgba(16,185,129,.22);
  color: #bbf7d0;
  transform: translateY(-1px);
}

.shift-drawer {
  position: fixed;
  inset: 0;
  z-index: 3100;
  pointer-events: none;
  direction: rtl;
}

.shift-drawer.open {
  pointer-events: none;
}

.shift-drawer-panel {
  position: absolute;
  top: 12px;
  bottom: 12px;
  right: 12px;
  width: min(390px, calc(100vw - 24px));
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid rgba(148,163,184,.22);
  background: linear-gradient(180deg, rgba(15,23,42,.98), rgba(8,13,25,.98));
  box-shadow: 0 26px 70px rgba(0,0,0,.48), inset 0 1px 0 rgba(255,255,255,.06);
  transform: translateX(calc(100% + 28px));
  opacity: 0;
  transition: transform .28s cubic-bezier(.16,1,.3,1), opacity .2s ease;
  pointer-events: auto;
  overflow: hidden;
}

.shift-drawer.open .shift-drawer-panel {
  transform: translateX(0);
  opacity: 1;
}

.shift-drawer-header,
.shift-drawer-footer {
  padding: 1rem;
  border-color: rgba(148,163,184,.14);
}

.shift-drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: .8rem;
  border-bottom: 1px solid rgba(148,163,184,.14);
  background: radial-gradient(circle at top right, rgba(16,185,129,.18), transparent 42%);
}

.shift-drawer-eyebrow {
  color: #6ee7b7;
  font-size: .72rem;
  font-weight: 800;
  margin-bottom: .18rem;
}

.shift-drawer-header h3 {
  margin: 0;
  color: #f8fafc;
  font-size: 1.15rem;
  font-weight: 900;
}

.shift-drawer-header p {
  margin: .25rem 0 0;
  color: #94a3b8;
  font-size: .8rem;
  line-height: 1.5;
}

.shift-drawer-close {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(148,163,184,.2);
  border-radius: 12px;
  background: rgba(15,23,42,.62);
  color: #cbd5e1;
  transition: all .16s ease;
}

.shift-drawer-close:hover {
  border-color: rgba(248,113,113,.38);
  color: #fecaca;
  background: rgba(248,113,113,.12);
}

.shift-drawer-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: .9rem;
  overflow: auto;
}

.shift-drawer-field {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  color: #cbd5e1;
  font-size: .82rem;
  font-weight: 800;
}

.shift-drawer-input-wrap {
  display: flex;
  align-items: center;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.34);
}

.shift-drawer-input-wrap input,
.shift-drawer-field textarea {
  width: 100%;
  border: 0;
  outline: none;
  color: #e2e8f0;
  background: transparent;
  font-family: 'Tajawal', 'NotoSansArabic', sans-serif;
}

.shift-drawer-input-wrap input {
  padding: .72rem .85rem;
  direction: ltr;
  text-align: right;
}

.shift-drawer-input-wrap span {
  padding: 0 .8rem;
  color: #86efac;
  font-size: .78rem;
  font-weight: 900;
  border-right: 1px solid rgba(148,163,184,.16);
}

.shift-drawer-field textarea {
  min-height: 96px;
  resize: vertical;
  padding: .75rem .85rem;
  border-radius: 14px;
  border: 1px solid rgba(148,163,184,.22);
  background: rgba(2,6,23,.34);
}

.shift-drawer-input-wrap:focus-within,
.shift-drawer-field textarea:focus {
  border-color: rgba(16,185,129,.52);
  box-shadow: 0 0 0 3px rgba(16,185,129,.12);
}

.shift-drawer-note {
  display: flex;
  gap: .55rem;
  padding: .7rem .8rem;
  border-radius: 14px;
  border: 1px solid rgba(56,189,248,.18);
  background: rgba(56,189,248,.08);
  color: #bae6fd;
  font-size: .78rem;
  line-height: 1.5;
}

.shift-drawer-footer {
  margin-top: auto;
  display: flex;
  gap: .55rem;
  justify-content: flex-end;
  border-top: 1px solid rgba(148,163,184,.14);
}

.shift-drawer-footer .btn {
  font-weight: 800;
  border-radius: 12px;
}

/* ── Layering contract: content < dropdown < backdrop < modal < modal dropdown ── */
:root {
  --ds-z-content: 1;
  --ds-z-dropdown: 3000;
  --ds-z-modal-backdrop: 7000;
  --ds-z-modal: 7100;
  --ds-z-modal-dropdown: 7200;
}
.ds-index-filter-card,
.ds-filter-bar,
.ds-index-filter-toolbar,
.ds-stats-filter { position: relative; z-index: var(--ds-z-content); }
.select2-container { z-index: var(--ds-z-dropdown); }
.select2-dropdown,
.select2-container--default .select2-dropdown,
.flatpickr-calendar { z-index: var(--ds-z-dropdown) !important; }
.ds-modal-overlay,
.modal-overlay,
.modal-backdrop { z-index: var(--ds-z-modal-backdrop) !important; }
.ds-modal-overlay .ds-modal,
.modal.show { position: relative; z-index: var(--ds-z-modal) !important; }
.ds-modal-overlay .select2-container,
.modal .select2-container,
.ds-modal-overlay .select2-dropdown,
.modal .select2-dropdown,
.ds-modal-overlay .flatpickr-calendar,
.modal .flatpickr-calendar { z-index: var(--ds-z-modal-dropdown) !important; }

.ds-stats-filter-compact { flex-wrap: wrap; gap: .55rem; }
.ds-stats-filter-compact .ds-filter-pills { display:flex; flex-wrap:wrap; gap:.4rem; }
.ds-custom-period { display:flex; gap:.4rem; align-items:center; }
.ds-custom-period[hidden] { display:none !important; }
.ds-custom-period .ds-input { width: 145px; height: 34px; font-size: .78rem; }
.ds-stats-period { color: var(--text-muted); font-size: .78rem; font-weight: 700; }

/* Bootstrap/POS modals must stay above POS fixed panels (payment, warranty, drawers). */
.modal-backdrop.show { z-index: 11000 !important; }
.modal.show,
.modal.pos-modal.show { z-index: 11010 !important; }
.modal.show .select2-container,
.modal.show .select2-dropdown,
.modal.show .flatpickr-calendar { z-index: 11020 !important; }

/* ── Unified modal layer system ────────────────────────────────────────────
   All modal-like overlays are rendered/portaled at body level by layout JS.
   These tokens keep modals above headers, sidebars, POS panels, filters,
   cards, dropdowns and page overlays while preserving RTL + dark theme. */
:root {
  --z-header: 100;
  --z-sidebar: 200;
  --z-dropdown: 500;
  --z-backdrop: 9000;
  --z-modal: 9010;
  --z-modal-dropdown: 9020;

  --ds-z-content: 1;
  --ds-z-dropdown: var(--z-dropdown);
  --ds-z-modal-backdrop: var(--z-backdrop);
  --ds-z-modal: var(--z-modal);
  --ds-z-modal-dropdown: var(--z-modal-dropdown);
}
body.modal-open,
body.modal-layer-open { overflow: hidden !important; padding-left: 0 !important; }
.modal-backdrop,
.modal-backdrop.show {
  position: fixed !important;
  inset: 0 !important;
  z-index: var(--z-backdrop) !important;
}
.modal,
.modal.pos-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: var(--z-modal) !important;
  direction: rtl;
  overflow-x: hidden;
  overflow-y: auto;
}
.modal.show,
.modal.pos-modal.show {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1rem;
}
.modal.show .modal-dialog {
  width: min(100%, var(--bs-modal-width, 560px));
  margin: 0 !important;
  pointer-events: auto;
}
.ds-modal-overlay,
.modal-overlay,
#cashPaymentOverlay,
#paymentMethodOverlay,
#warrantyPackagePickerOverlay,
#warrantyLookupOverlay,
#warrantyClaimOverlay,
#deviceBindingOverlay,
#customerImeiModal,
#imeiEditOverlay,
#printMetaOverlay {
  position: fixed !important;
  inset: 0 !important;
  z-index: var(--z-backdrop) !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 1rem;
  direction: rtl;
  overflow-y: auto;
}
.ds-modal-overlay.show,
.ds-modal-overlay[style*="display: block"],
.ds-modal-overlay[style*="display: flex"],
.modal-overlay.show,
.modal-overlay[style*="display: block"],
.modal-overlay[style*="display: flex"],
#cashPaymentOverlay[style*="display: block"],
#cashPaymentOverlay[style*="display: flex"],
#paymentMethodOverlay[style*="display: block"],
#paymentMethodOverlay[style*="display: flex"],
#warrantyPackagePickerOverlay[style*="display: block"],
#warrantyPackagePickerOverlay[style*="display: flex"],
#warrantyLookupOverlay[style*="display: block"],
#warrantyLookupOverlay[style*="display: flex"],
#warrantyClaimOverlay[style*="display: block"],
#warrantyClaimOverlay[style*="display: flex"],
#deviceBindingOverlay.open,
#deviceBindingOverlay[style*="display: block"],
#deviceBindingOverlay[style*="display: flex"],
#customerImeiModal[style*="display: block"],
#customerImeiModal[style*="display: flex"],
#imeiEditOverlay[style*="display: block"],
#imeiEditOverlay[style*="display: flex"],
#printMetaOverlay[style*="display: block"],
#printMetaOverlay[style*="display: flex"] {
  display: flex !important;
}
.ds-modal-overlay > .ds-modal,
.modal-overlay > *,
#cashPaymentOverlay > *,
#paymentMethodOverlay > *,
#warrantyPackagePickerOverlay > *,
#warrantyLookupOverlay > *,
#warrantyClaimOverlay > *,
#deviceBindingOverlay > *,
#customerImeiModal > *:not(.customer-imei-backdrop),
#imeiEditOverlay > *,
#printMetaOverlay > * {
  position: relative;
  z-index: var(--z-modal) !important;
}
.select2-container--open,
.select2-dropdown,
.flatpickr-calendar { z-index: var(--z-dropdown) !important; }
.modal .select2-container--open,
.modal .select2-dropdown,
.modal .flatpickr-calendar,
.ds-modal-overlay .select2-container--open,
.ds-modal-overlay .select2-dropdown,
.ds-modal-overlay .flatpickr-calendar,
.modal-overlay .select2-container--open,
.modal-overlay .select2-dropdown,
.modal-overlay .flatpickr-calendar,
body > .select2-container--open,
body > .select2-dropdown { z-index: var(--z-modal-dropdown) !important; }


/* =====================================================================
   POS RESPONSIVE — cashier screens (1600×900, 1366×768, 1093×614 DPI)
   ALL rules scoped to body.pos-page to avoid affecting admin pages.
   ===================================================================== */

/* ── 1600 × 900 ────────────────────────────────────────────────────── */
@media screen and (max-width: 1600px) {
  body.pos-page {
    font-size: 15px;
  }

  /* Slightly narrower sidebar */
  body.pos-page .pos-wrapper {
    grid-template-columns: 190px 9fr 11fr;
  }

  /* Tighter topbar */
  body.pos-page .pos-center-topbar {
    padding: 0.75rem 0.85rem 0.6rem;
  }

  /* Compact products area */
  body.pos-page .products-area {
    padding: 0.65rem;
  }

  body.pos-page .products-grid {
    gap: 0.5rem;
  }

  /* Product card: less padding, smaller icon */
  body.pos-page .product-card {
    padding: 0.7rem 0.6rem;
  }

  body.pos-page .product-card .product-icon {
    font-size: 1.5rem;
    margin-bottom: 0.35rem;
  }

  body.pos-page .product-card .product-name {
    font-size: 0.76rem;
  }

  body.pos-page .product-card .product-price {
    font-size: 0.88rem;
  }

  /* Sidebar: tighter category buttons */
  body.pos-page .cat-btn {
    padding: 0.38rem 0.6rem;
    font-size: 0.79rem;
  }

  body.pos-page .sidebar-logo img {
    height: 34px;
  }

  /* Checkout totals: slightly smaller */
  body.pos-page .checkout-row {
    font-size: 0.88rem;
  }

  body.pos-page .checkout-row span[id] {
    font-size: 0.88rem;
  }

  body.pos-page .checkout-row.is-total .ct-label {
    font-size: 0.95rem;
  }

  body.pos-page .checkout-row.is-total span[id] {
    font-size: 1.1rem;
  }

  /* Cart body: tighter horizontal padding */
  body.pos-page .cart-body {
    padding: 0.4rem 0.75rem;
  }

  body.pos-page .cart-header {
    padding: 0.75rem;
  }
}

/* ── 1366 × 768 (and 1366×768 at 100% DPI) ────────────────────────── */
@media screen and (max-width: 1366px) {
  body.pos-page {
    font-size: 14px;
  }

  /* Narrower sidebar — gives catalog and cart more room */
  body.pos-page .pos-wrapper {
    grid-template-columns: 170px 9fr 11fr;
  }

  /* Very compact topbar — saves ~12px of height */
  body.pos-page .pos-center-topbar {
    padding: 0.55rem 0.75rem 0.45rem;
  }

  /* Tighter product area padding */
  body.pos-page .products-area {
    padding: 0.5rem;
  }

  body.pos-page .products-grid {
    gap: 0.4rem;
  }

  /* Product cards: compact enough to show 6-8 without scrolling on 768px height */
  body.pos-page .product-card {
    padding: 0.55rem 0.5rem;
  }

  body.pos-page .product-card .product-icon {
    font-size: 1.3rem;
    margin-bottom: 0.25rem;
  }

  body.pos-page .product-card .product-name {
    font-size: 0.73rem;
    margin-bottom: 0.2rem;
  }

  body.pos-page .product-card .product-price {
    font-size: 0.82rem;
    margin-bottom: 0.15rem;
  }

  body.pos-page .product-card .product-stock {
    font-size: 0.62rem;
  }

  /* Category badge inside product card */
  body.pos-page .category-badge {
    font-size: 0.58rem;
    margin-bottom: 0.3rem;
  }

  /* Sidebar logo & avatar */
  body.pos-page .sidebar-logo img {
    height: 30px;
    margin-bottom: 0.2rem;
  }

  body.pos-page .sidebar-logo span {
    font-size: 0.82rem;
  }

  body.pos-page .sidebar-logo {
    padding: 0.85rem 0.5rem 0.7rem;
  }

  body.pos-page .user-avatar {
    width: 36px;
    height: 36px;
  }

  body.pos-page .user-info {
    padding: 0.65rem 0.5rem;
  }

  /* Sidebar category buttons: more compact */
  body.pos-page .cat-btn {
    padding: 0.32rem 0.5rem;
    font-size: 0.77rem;
    margin-bottom: 0.15rem;
  }

  body.pos-page .categories-section {
    padding: 0.5rem;
  }

  body.pos-page .category-label {
    margin-bottom: 0.3rem;
  }

  /* Sidebar action buttons */
  body.pos-page .sidebar-actions {
    padding: 0.5rem;
    gap: 0.3rem;
  }

  body.pos-page .sidebar-actions .btn {
    font-size: 0.74rem;
    padding: 0.35rem 0.5rem;
  }

  /* Shift status card: tighter */
  body.pos-page .shift-status-card {
    margin: 0.5rem;
    padding: 0.5rem 0.6rem;
  }

  body.pos-page .shift-status-title {
    font-size: 0.78rem;
    margin-bottom: 0.3rem;
  }

  body.pos-page .shift-status-row {
    font-size: 0.7rem;
  }

  /* Cart header: tighter */
  body.pos-page .cart-header {
    padding: 0.6rem 0.75rem;
  }

  body.pos-page .cart-header h5 {
    font-size: 0.85rem;
  }

  body.pos-page .cart-header-top {
    margin-bottom: 0.4rem;
    min-height: 1.7rem;
  }

  body.pos-page .customer-search .form-control {
    font-size: 0.76rem !important;
    padding: 0.38rem 0.6rem !important;
  }

  /* Cart body: tighter padding so items columns have more room */
  body.pos-page .cart-body {
    padding: 0.3rem 0.6rem;
  }

  /* Cart column header + items: shrink fixed columns to fit narrow cart */
  body.pos-page .cart-col-header {
    grid-template-columns: 1fr 58px 100px 78px 24px;
    padding: 0.28rem 0.75rem;
    gap: 5px;
  }

  body.pos-page .cart-col-header span {
    font-size: 0.58rem;
  }

  body.pos-page #cartItems .cart-item {
    grid-template-columns: 1fr 58px 100px 78px 24px !important;
    gap: 5px;
    padding: 0.4rem 0.75rem !important;
  }

  body.pos-page .ci-prod-icon {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
  }

  body.pos-page .ci-name-row {
    gap: 5px;
  }

  body.pos-page .cart-item .item-name,
  body.pos-page #cartItems .item-name {
    font-size: 0.72rem;
  }

  body.pos-page .ci-unit-price {
    font-size: 0.74rem;
  }

  body.pos-page #cartItems .item-total {
    font-size: 0.76rem;
  }

  /* Qty controls: slightly more compact */
  body.pos-page .qty-controls button {
    width: 19px;
    height: 19px;
    font-size: 0.78rem;
  }

  body.pos-page .qty-controls input {
    width: 24px;
    font-size: 0.76rem;
  }

  /* Checkout coupon: tighter */
  body.pos-page .checkout-coupon {
    padding: 0.3rem 0.65rem;
    min-height: 32px;
  }

  /* Checkout bar: smaller totals + pay button */
  body.pos-page .checkout-totals {
    padding: 0.38rem 0.65rem;
    gap: 0.12rem;
  }

  body.pos-page .checkout-row {
    font-size: 0.8rem;
  }

  body.pos-page .checkout-row span[id] {
    font-size: 0.8rem;
  }

  body.pos-page .checkout-row.is-total {
    margin-top: 0.15rem;
    padding-top: 0.18rem;
  }

  body.pos-page .checkout-row.is-total .ct-label {
    font-size: 0.88rem;
  }

  body.pos-page .checkout-row.is-total span[id] {
    font-size: 1rem;
  }

  /* Pay button: slightly more compact */
  body.pos-page .btn-execute-payment {
    padding: 0.45rem 0.4rem;
  }

  body.pos-page .ep-icon {
    font-size: 1.05rem;
  }

  body.pos-page .ep-label {
    font-size: 0.7rem;
  }

  body.pos-page .ep-amount {
    font-size: 0.82rem;
    padding: 0.14rem 0.4rem;
  }

  /* Cart footer: tighter */
  body.pos-page .cart-footer {
    padding: 0.4rem 0.65rem 0.5rem;
  }

  body.pos-page .cart-footer .btn {
    font-size: 0.7rem;
    padding: 0.35rem 0.4rem;
  }

  /* Modals on short screens: max-height cap */
  body.pos-page .modal-dialog-centered .modal-content {
    max-height: calc(100vh - 2rem);
  }

  body.pos-page .modal-dialog-scrollable .modal-body {
    max-height: calc(100vh - 12rem);
  }

  /* Shift status card */
  body.pos-page .shift-center-alert {
    min-width: 220px;
    padding: 10px 12px;
    font-size: 0.82rem;
  }
}

/* ── 1100px and below (accounts for 125% DPI on 1366px screens) ───── */
@media screen and (max-width: 1100px) {
  /* At this width the sidebar must be minimal */
  body.pos-page .pos-wrapper {
    grid-template-columns: 150px 9fr 11fr;
  }

  /* Product grid: switch to 2 columns so cards aren't too narrow */
  body.pos-page .products-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.35rem;
  }

  /* Sidebar: hide label text in action buttons to save space */
  body.pos-page .sidebar-actions .btn-label-text {
    display: none;
  }

  /* Category buttons: shrink further */
  body.pos-page .cat-btn {
    padding: 0.28rem 0.4rem;
    font-size: 0.72rem;
  }

  /* Cart column header: collapse further */
  body.pos-page .cart-col-header {
    grid-template-columns: 1fr 52px 90px 70px 22px;
    gap: 4px;
    padding: 0.25rem 0.5rem;
  }

  body.pos-page #cartItems .cart-item {
    grid-template-columns: 1fr 52px 90px 70px 22px !important;
    gap: 4px;
    padding: 0.35rem 0.5rem !important;
  }

  /* Cart body even tighter */
  body.pos-page .cart-body {
    padding: 0.25rem 0.5rem;
  }
}
