/* ==========================================================================
   سَنَشُدُّ POS (Sanashud POS) — الهوية البصرية الاحترافية الجديدة
   الخط: Cairo | الألوان: Executive Teal & Slate FinTech
   الأيقونات: Custom Handcrafted SVG Icons
   ========================================================================== */

/* تحميل الخط يتم بشكل غير حاجب للتصيير (Non-Blocking) في index.html لضمان سرعة الأوفلاين */

:root {
  /* الألوان الرئيسية (Executive FinTech Teal & Slate) */
  --primary: #0F766E;
  --primary-hover: #115E59;
  --primary-light: #F0FDFA;
  --primary-border: #99F6E4;

  --accent: #4F46E5;
  --accent-light: #EEF2FF;
  --accent-border: #C7D2FE;

  --success: #059669;
  --success-hover: #047857;
  --success-light: #ECFDF5;
  --success-border: #A7F3D0;

  --warning: #D97706;
  --warning-light: #FFFBEB;
  --warning-border: #FDE68A;

  --danger: #DC2626;
  --danger-hover: #B91C1C;
  --danger-light: #FEF2F2;
  --danger-border: #FECACA;

  --rose: #E11D48;
  --rose-light: #FFF1F2;

  --dark-bg: #0F172A;
  --dark-surface: #1E293B;

  --bg-page: #F3F5F8;
  --surface: #FFFFFF;
  --border: #E2E8F0;
  --border-light: #F1F5F9;

  --text-main: #0F172A;
  --text-muted: #475569;
  --text-sub: #94A3B8;

  --radius-sm: 8px;
  --radius-md: 11px;
  --radius-lg: 15px;
  --radius-xl: 20px;

  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 10px -2px rgba(15, 23, 42, 0.06), 0 2px 4px -2px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 12px 24px -6px rgba(15, 23, 42, 0.09), 0 4px 8px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 24px 40px -12px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Cairo', -apple-system, BlinkMacSystemFont, "Segoe UI", Tahoma, sans-serif;
  direction: rtl;
  background-color: var(--bg-page);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-feature-settings: "tnum" on, "lnum" on;
  font-variant-numeric: tabular-nums;
}

/* Custom SVG Icon Wrapper */
.ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
  line-height: 1;
}

.ico svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

/* ==========================================================================
   Header Bar (شريط الرأس العلوي)
   ========================================================================== */
.app-header {
  height: 64px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  flex-shrink: 0;
  z-index: 40;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  cursor: pointer;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), #0D9488);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px -2px rgba(15, 118, 110, 0.4);
}

.brand-info h1 {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.25;
  white-space: nowrap;
}

.brand-info span {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Header Navigation Bar */
.header-nav {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow-x: auto;
  padding: 4px 2px;
  flex: 1;
  scrollbar-width: none;
}
.header-nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
  border: 1px solid transparent;
  background: transparent;
  white-space: nowrap;
}

.nav-item:hover {
  color: var(--primary);
  background: var(--primary-light);
}

.nav-item.active {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 4px 10px -2px rgba(15, 118, 110, 0.35);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.badge-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-online {
  background: var(--success-light);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.badge-session {
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
}

.badge-session.closed {
  background: var(--danger-light);
  color: var(--danger);
  border-color: var(--danger-border);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

.header-user-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-page);
  border: 1px solid var(--border);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  color: var(--text-main);
}

.header-user-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary-border);
  color: var(--primary);
}

.btn-new-store-header {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--dark-bg);
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  white-space: nowrap;
}

.btn-new-store-header:hover {
  background: var(--primary);
}

/* Sidebar Drawer Toggle Button */
.btn-menu-drawer {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.18s;
}

.btn-menu-drawer:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

/* Navigation Drawer (Off-Canvas Menu) */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  z-index: 100;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  width: 285px;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  z-index: 101;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-overlay.active .drawer-panel {
  transform: translateX(0);
}

.drawer-header {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-header h3 {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-main);
}

.drawer-menu {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  width: 100%;
  text-align: right;
  cursor: pointer;
  transition: all 0.15s;
}

.drawer-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.drawer-item.active {
  background: var(--primary);
  color: #fff;
}

.drawer-footer {
  padding: 14px;
  border-top: 1px solid var(--border);
  background: var(--bg-page);
}

/* ==========================================================================
   Main Application Body
   ========================================================================== */
.app-main {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

.tab-pane {
  display: none;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.tab-pane.active {
  display: flex;
}

/* ==========================================================================
   POS Terminal Screen Layout
   ========================================================================== */
.pos-container {
  display: flex;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.pos-catalog-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  overflow: hidden;
  border-left: 1px solid var(--border);
}

.pos-search-bar {
  padding: 12px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  align-items: center;
}

.search-input-wrapper {
  flex: 1;
  position: relative;
}

.search-input-wrapper input {
  width: 100%;
  height: 42px;
  padding: 0 42px 0 14px;
  background: var(--bg-page);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-main);
  outline: none;
  transition: all 0.18s;
}

.search-input-wrapper input:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.search-icon {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-sub);
  display: flex;
}

.barcode-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  padding: 8px 13px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  white-space: nowrap;
}

/* Categories Strip */
.pos-categories-strip {
  display: flex;
  gap: 8px;
  padding: 11px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  flex-shrink: 0;
  scrollbar-width: thin;
}

.category-chip {
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.15s ease;
}

.category-chip:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.category-chip.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  box-shadow: 0 4px 10px -2px rgba(15, 118, 110, 0.3);
}

/* Product Cards Grid */
.pos-products-grid {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  align-content: start;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  user-select: none;
  box-shadow: var(--shadow-sm);
}

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

.product-card:active {
  transform: scale(0.985);
}

.product-icon-badge {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.product-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 38px;
}

.product-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 9px;
  border-top: 1px dashed var(--border);
}

.product-price {
  font-size: 14.5px;
  font-weight: 700;
  color: var(--primary);
}

.product-stock {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.product-stock.low-stock {
  color: var(--danger);
  background: var(--danger-light);
  padding: 2px 7px;
  border-radius: 6px;
}

/* ==========================================================================
   Left Side: POS Cart Panel
   ========================================================================== */
.pos-cart-pane {
  width: 420px;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: -4px 0 24px rgba(15, 23, 42, 0.04);
}

.cart-header {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: #FAFBFD;
}

.customer-selector-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
}

.customer-select {
  flex: 1;
  height: 39px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0 11px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-main);
  background: #fff;
  outline: none;
}

.customer-select:focus {
  border-color: var(--primary);
}

.btn-icon-add {
  width: 39px;
  height: 39px;
  border-radius: var(--radius-sm);
  background: var(--primary-light);
  color: var(--primary);
  border: 1px solid var(--primary-border);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.18s;
}

.btn-icon-add:hover {
  background: var(--primary);
  color: #fff;
}

/* Customer Loyalty Banner */
.customer-loyalty-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 9px;
}

.customer-loyalty-bar.active {
  display: flex;
}

.btn-redeem-loyalty {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 4px 11px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

.btn-redeem-loyalty:hover {
  opacity: 0.9;
}

/* Order Type Tabs (عادي / إهداء / حجز) */
.order-type-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}

.order-type-btn {
  padding: 7px 6px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: all 0.18s;
}

.order-type-btn.active {
  background: var(--dark-bg);
  color: #fff;
  border-color: var(--dark-bg);
}

/* Dynamic Order Type Inputs */
.order-special-fields {
  display: none;
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px;
  margin-top: 9px;
  font-size: 12px;
}

.order-special-fields.active {
  display: block;
}

.order-special-fields input,
.order-special-fields textarea {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #CBD5E1;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
  margin-top: 4px;
  outline: none;
  background: #fff;
}

/* Cart Items List */
.cart-items-wrapper {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cart-empty-state {
  margin: auto;
  text-align: center;
  color: var(--text-sub);
  padding: 30px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.cart-empty-icon {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  background: var(--bg-page);
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.cart-item:hover {
  border-color: var(--primary-border);
  background: #FAFDFE;
}

.cart-item-info {
  flex: 1;
  padding-left: 8px;
}

.cart-item-name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.cart-item-unit-price {
  font-size: 11px;
  color: var(--text-muted);
}

.cart-item-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.qty-control-btn {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-page);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-main);
  transition: all 0.15s;
}

.qty-control-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary-border);
}

.qty-count {
  font-size: 13px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
}

.cart-item-total {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
  min-width: 64px;
  text-align: left;
}

.btn-remove-item {
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  padding: 4px;
  display: flex;
  transition: color 0.15s;
}

.btn-remove-item:hover {
  color: var(--danger);
}

/* Cart Footer & Totals */
.cart-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  background: #FAFBFD;
}

.cart-quick-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
  padding-bottom: 9px;
  border-bottom: 1px dashed var(--border);
}

.btn-cart-tool {
  background: #fff;
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.btn-cart-tool:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.summary-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 500;
}

.summary-line.discount-line {
  color: var(--danger);
  font-weight: 600;
}

.summary-grand-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1.5px dashed #CBD5E1;
}

.grand-total-val {
  color: var(--primary);
  font-size: 21px;
  font-weight: 700;
}

.cart-checkout-actions {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 8px;
  margin-top: 12px;
}

.btn-clear-cart {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

.btn-clear-cart:hover {
  background: var(--danger);
  color: #fff;
}

.btn-checkout-primary {
  background: linear-gradient(135deg, var(--primary), #0D9488);
  color: #fff;
  border: none;
  border-radius: var(--radius-md);
  padding: 12px;
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 8px 16px -4px rgba(15, 118, 110, 0.4);
  transition: all 0.18s;
}

.btn-checkout-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 20px -4px rgba(15, 118, 110, 0.5);
}

.btn-checkout-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

/* ==========================================================================
   Full Screen Content Panes
   ========================================================================== */
.pane-view {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  background: var(--bg-page);
  padding: 22px;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-shrink: 0;
  flex-wrap: wrap;
  gap: 12px;
}

.view-title-group h2 {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
}

.view-title-group p {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.view-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.btn-action-primary {
  background: var(--primary);
  color: #fff;
  border: none;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 7px;
  box-shadow: 0 4px 12px -2px rgba(15, 118, 110, 0.3);
  transition: all 0.18s;
}

.btn-action-primary:hover {
  background: var(--primary-hover);
}

.btn-action-outline {
  background: #fff;
  color: var(--text-main);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 6px;
  transition: all 0.18s;
}

.btn-action-outline:hover {
  background: var(--bg-page);
  border-color: #CBD5E1;
}

.btn-action-outline.active {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* Data Tables */
.table-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
}

.table-responsive {
  flex: 1;
  overflow-x: auto;
  max-height: 520px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 13px;
}

.data-table th {
  background: #F8FAFC;
  padding: 12px 16px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: nowrap;
}

.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-main);
  font-weight: 500;
}

.data-table tr:hover td {
  background: #FAFDFE;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.status-completed {
  background: var(--success-light);
  color: var(--success);
}

.status-reserved {
  background: var(--warning-light);
  color: var(--warning);
}

.status-cancelled {
  background: var(--danger-light);
  color: var(--danger);
}

/* Metric Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.stat-info span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.stat-info h3 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-main);
}

.stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ==========================================================================
   Shifts Management Screen
   ========================================================================== */
.shift-dashboard-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}

.shift-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 12px;
}

.shift-user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.shift-avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.shift-actions-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.shift-metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
}

.shift-metric-box {
  background: var(--bg-page);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.shift-metric-box.highlight {
  background: var(--primary-light);
  border-color: var(--primary-border);
}

.shift-metric-box span {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}

.shift-metric-box .metric-value {
  font-size: 19px;
  font-weight: 700;
  color: var(--text-main);
}

.shift-metric-box.highlight .metric-value {
  color: var(--primary);
  font-size: 21px;
}

/* ==========================================================================
   Onboarding & Sign-up Modal
   ========================================================================== */
.onboarding-card {
  max-width: 520px;
  width: 100%;
  background: #fff;
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: var(--shadow-xl);
  margin: auto;
  border: 1px solid var(--border);
  animation: modalEnter 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.onboarding-header {
  text-align: center;
  margin-bottom: 22px;
}

.onboarding-header h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.onboarding-header p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.business-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.business-type-card {
  border: 1.5px solid var(--border);
  border-radius: 13px;
  padding: 12px 14px;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
  background: var(--bg-page);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.business-type-card:hover {
  border-color: #CBD5E1;
  background: #fff;
}

.business-type-card.active {
  border-color: var(--primary);
  background: var(--primary-light);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

.business-type-card .card-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-main);
}

.business-type-card .card-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.onboarding-phone-row {
  display: flex;
  gap: 8px;
  direction: ltr;
}

.btn-brand-submit {
  background: linear-gradient(135deg, var(--primary), var(--success));
  color: #fff;
  font-family: inherit;
  font-weight: 700;
  font-size: 15px;
  padding: 13px;
  border-radius: 12px;
  border: none;
  width: 100%;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 8px 18px -4px rgba(15, 118, 110, 0.45);
  margin-top: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-brand-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px -4px rgba(15, 118, 110, 0.55);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow-y: auto;
}

.modal-overlay.active {
  display: flex;
}

.modal-window {
  background: var(--surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalEnter 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 19px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.modal-body {
  padding: 20px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.15s;
  background: #fff;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background: var(--bg-page);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* Quick Cash Buttons */
.quick-cash-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.quick-cash-btn {
  padding: 8px 0;
  background: var(--primary-light);
  border: 1px solid var(--primary-border);
  color: var(--primary);
  font-family: inherit;
  font-weight: 700;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  transition: all 0.15s;
}

.quick-cash-btn:hover {
  background: var(--primary);
  color: #fff;
}

/* ==========================================================================
   Thermal Receipt Styling
   ========================================================================== */
#receipt-container {
  display: none;
}

@media print {
  body * { visibility: hidden; }
  #receipt-container, #receipt-container * { visibility: visible; }
  #receipt-container {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    margin: 0;
    padding: 10px 5px;
    font-family: 'Cairo', monospace;
    color: #000;
    background: #fff;
    font-size: 12px;
    line-height: 1.4;
    direction: rtl;
  }
  .receipt-divider { border-top: 1px dashed #000; margin: 8px 0; }
}

.receipt-card {
  width: 80mm;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  padding: 16px 12px;
  font-family: 'Cairo', monospace;
  color: #000;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: var(--shadow-lg);
  border-radius: 8px;
}

.receipt-center { text-align: center; }
.receipt-store-title { font-size: 15.5px; font-weight: 700; margin-bottom: 2px; }
.receipt-item-row { display: flex; justify-content: space-between; margin-bottom: 4px; }
.receipt-divider { border-top: 1px dashed #475569; margin: 8px 0; }
.receipt-qr-svg-wrap {
  width: 124px;
  height: 124px;
  margin: 10px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.receipt-qr-svg-wrap svg { width: 100%; height: 100%; }

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: var(--dark-bg);
  color: #fff;
  padding: 11px 17px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  display: flex;
  align-items: center;
  gap: 9px;
  animation: toastSlide 0.22s ease;
}

@keyframes toastSlide {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1180px) {
  .header-nav { display: none; }
  .pos-cart-pane { width: 380px; }
}

@media (max-width: 768px) {
  body { height: auto; overflow-y: auto; }
  .app-header { padding: 0 10px; gap: 6px; }
  .brand-info span, #header-session-pill { display: none; }
  .brand-info h1 { font-size: 13.5px; }
  .pane-view { padding: 12px; }
  .view-header { flex-direction: column; align-items: stretch; gap: 10px; }
  .view-actions { flex-wrap: wrap; }
  .app-main { flex-direction: column; overflow: visible; }
  .pos-container { flex-direction: column; height: auto; overflow: visible; }
  .pos-cart-pane { width: 100%; box-shadow: none; border-top: 2px solid var(--border); }
  .pos-products-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .shift-metrics-grid { grid-template-columns: 1fr 1fr; }
  .business-type-grid { grid-template-columns: 1fr; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 620px; }
  .modal-window { width: 94%; max-height: 92vh; }
}

/* ==========================================================================
   Reusable Utility & Settings Classes (Clean Refactoring)
   ========================================================================== */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 18px;
  align-items: start;
}

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}

.settings-card-title {
  margin-bottom: 14px;
  font-size: 14.5px;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}

.settings-backup-card {
  text-align: center;
}

.settings-backup-card .settings-card-title {
  text-align: center;
}

.settings-backup-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2px 4px 0;
}

.settings-backup-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
  text-align: center;
  line-height: 1.65;
  max-width: 340px;
}

.settings-backup-actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-backup-actions .btn-action-outline {
  width: 100%;
  justify-content: center;
  text-align: center;
  padding: 11px 16px;
  font-size: 13px;
}

.btn-backup-danger {
  color: var(--danger) !important;
  border-color: var(--danger-border) !important;
}

.btn-backup-danger:hover {
  background: var(--danger-light) !important;
}

.table-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-xs {
  padding: 4px 9px !important;
  font-size: 11.5px !important;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-row input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--primary);
}

.check-row label {
  margin: 0;
  cursor: pointer;
}

/* Modal & Form Refactoring Utilities */
.ltr-input {
  text-align: left;
  direction: ltr;
}

.form-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pay-option-card {
  border: 1.5px solid var(--border);
  border-radius: 9px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.pay-option-card:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.pay-option-card input {
  accent-color: var(--primary);
}

.pay-option-card span {
  font-weight: 600;
  font-size: 12.5px;
}

.section-subtitle {
  margin: 14px 0 10px;
  font-size: 14.5px;
}

.modal-sm { max-width: 390px; }
.modal-md { max-width: 440px; }
.modal-lg { max-width: 480px; }

.info-box-danger {
  background: var(--danger-light);
  border: 1px solid var(--danger-border);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 14px;
}

.info-box-muted {
  background: var(--bg-page);
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.info-box-label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
}

.btn-bg-success { background: var(--success); }
.btn-bg-danger { background: var(--danger); }
.mb-20 { margin-bottom: 20px; }
.mb-14 { margin-bottom: 14px; }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }

/* ==========================================================================
   Full-Screen Account Login Screen (Mezan-Style Ambient Auth Card)
   ========================================================================== */
.auth-screen-overlay {
  position: fixed;
  inset: 0;
  z-index: 140;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background-color: #F4F6FA;
  background-image:
    radial-gradient(circle at 72% 24%, rgba(190, 242, 100, 0.42) 0%, rgba(16, 185, 129, 0.08) 32%, transparent 58%),
    radial-gradient(circle at 24% 82%, rgba(167, 139, 250, 0.35) 0%, rgba(99, 102, 241, 0.08) 34%, transparent 58%);
}

.auth-screen-overlay.active {
  display: flex;
}

.auth-login-card {
  width: 100%;
  max-width: 380px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-radius: 22px;
  padding: 30px 26px 24px;
  box-shadow: 0 24px 48px -12px rgba(15, 23, 42, 0.12), 0 4px 12px -2px rgba(15, 23, 42, 0.04);
  text-align: center;
}

.auth-brand-header {
  margin-bottom: 20px;
}

.auth-brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 4px;
}

.auth-brand-logo .ico {
  color: var(--primary);
}

.auth-brand-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

.auth-login-form {
  text-align: right;
}

.auth-field-group {
  margin-bottom: 13px;
}

.auth-field-group label {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.auth-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 11px;
  border: 1px solid #E2E8F0;
  background: #FFFFFF;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.auth-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.auth-btn-login {
  width: 100%;
  height: 43px;
  margin-top: 6px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #D9F99D 0%, #BEF264 100%);
  color: #1A2E05;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px -4px rgba(132, 204, 22, 0.45);
  transition: transform 0.15s, box-shadow 0.15s;
}

.auth-btn-login:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px -4px rgba(132, 204, 22, 0.55);
}

.auth-links-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 11px 0 13px;
  padding: 0 2px;
}

.auth-forgot-btn,
.auth-demo-fill-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 11.5px;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
}

.auth-demo-fill-btn {
  color: var(--primary);
  text-decoration: underline;
}

.auth-forgot-btn:hover {
  color: var(--text-main);
}

.auth-btn-signup-dashed {
  width: 100%;
  height: 41px;
  border-radius: 11px;
  border: 1.5px dashed #94A3B8;
  background: rgba(248, 250, 252, 0.7);
  color: var(--text-main);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 10px;
  transition: all 0.18s;
}

.auth-btn-signup-dashed:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.auth-btn-whatsapp {
  width: 100%;
  height: 41px;
  border-radius: 11px;
  border: none;
  background: #22C55E;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-bottom: 12px;
  box-shadow: 0 6px 14px -4px rgba(34, 197, 94, 0.4);
  transition: opacity 0.15s, transform 0.15s;
}

.auth-btn-whatsapp:hover {
  opacity: 0.94;
  transform: translateY(-1px);
}

.auth-contact-line {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.auth-contact-line b {
  color: var(--text-main);
  font-weight: 700;
}

.auth-users-pill {
  display: inline-block;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 11px;
  color: var(--text-muted);
}

.auth-users-pill b {
  color: var(--text-main);
  font-weight: 700;
}
