:root {
  --pos-primary: #059669;
  --pos-primary-dark: #047857;
  --pos-primary-light: #ecfdf5;
  --pos-text-main: #1e293b;
  --pos-text-muted: #64748b;
  --pos-border-color: #e2e8f0;
  --pos-bg-app: #f8fafc;
  --pos-card-bg: #ffffff;
  --pos-danger: #dc2626;
  --pos-danger-light: #fee2e2;
  --pos-danger-border: #fecdd3;
  --pos-warning: #d97706;
  --pos-warning-light: #fef3c7;
  --pos-blue: #2563eb;
  --pos-blue-light: #eff6ff;
  --pos-blue-border: #bfdbfe;
  --pos-radius-sm: 8px;
  --pos-radius-md: 12px;
  --pos-radius-lg: 16px;
  --pos-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
}

.pos-container {
  width: 100%;
  max-width: 480px;
  background: var(--pos-bg-app);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-bottom: 95px;
  margin: 0 auto;
}

/* رأس الصفحة */
.pos-app-header {
  background: #ffffff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--pos-border-color);
  position: sticky;
  top: 0;
  z-index: 40;
}

.pos-app-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pos-app-header-title {
  font-size: 16px;
  font-weight: 800;
  color: var(--pos-text-main);
  margin: 0;
}

.pos-header-user-tag {
  font-size: 11px;
  background: #f1f5f9;
  color: #475569;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* حاوية الأكورديون */
.pos-accordion-container {
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* بطاقة القسم */
.pos-acc-item {
  background: var(--pos-card-bg);
  border-radius: var(--pos-radius-md);
  border: 1px solid var(--pos-border-color);
  box-shadow: var(--pos-shadow-sm);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.pos-acc-item.active {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* شريط عنوان القسم */
.pos-acc-header {
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
  background: #ffffff;
  transition: background 0.2s;
}

.pos-acc-header:active {
  background: #f8fafc;
}

.pos-acc-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
}

.pos-acc-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pos-icon-client { background: #eff6ff; color: #2563eb; }
.pos-icon-items { background: #ecfdf5; color: #059669; }
.pos-icon-shipping { background: #f5f3ff; color: #7c3aed; }
.pos-icon-finance { background: var(--pos-warning-light); color: var(--pos-warning); }

.pos-acc-titles {
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.pos-acc-title-main {
  font-size: 14px;
  font-weight: 800;
  color: var(--pos-text-main);
}

.pos-acc-summary-chip {
  font-size: 11px;
  color: var(--pos-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
}

.pos-acc-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
}

.pos-acc-step-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background: #f1f5f9;
  color: #64748b;
}

.pos-acc-item.active .pos-acc-step-badge {
  background: var(--pos-primary-light);
  color: var(--pos-primary-dark);
}

.pos-acc-arrow {
  color: #94a3b8;
  font-size: 13px;
  transition: transform 0.3s;
}

.pos-acc-item.active .pos-acc-arrow {
  transform: rotate(180deg);
  color: var(--pos-text-main);
}

/* محتوى القسم */
.pos-acc-content {
  display: none;
  padding: 0 12px 12px 12px;
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
  flex-direction: column;
  gap: 12px;
}

.pos-acc-item.active .pos-acc-content {
  display: flex;
}

/* ---------------------------------------------------- */
/* خانات الإدخال الموحدة */
/* ---------------------------------------------------- */
.pos-form-group-compact {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pos-form-group-compact label {
  font-size: 11px;
  font-weight: 600;
  color: var(--pos-text-muted);
  white-space: nowrap;
}

.pos-input-compact {
  width: 100%;
  height: 38px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--pos-border-color);
  border-radius: var(--pos-radius-sm);
  background-color: #f8fafc;
  color: var(--pos-text-main);
  font-weight: 600;
  outline: none;
  transition: border-color 0.2s, background-color 0.2s, opacity 0.2s;
}

.pos-input-compact:focus {
  border-color: var(--pos-primary);
  background-color: #ffffff;
}

.pos-input-compact:disabled {
  background-color: #f1f5f9;
  color: #94a3b8;
  border-color: #e2e8f0;
  cursor: not-allowed;
}

/* ---------------------------------------------------- */
/* 1. قسم العميل */
/* ---------------------------------------------------- */
.pos-meta-three-cols {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}

.pos-customer-row {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pos-customer-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pos-customer-label-row label {
  font-size: 12px;
  font-weight: 700;
  color: var(--pos-text-main);
}

.pos-customer-input-group {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pos-customer-search-wrap {
  flex: 1;
  position: relative;
}

.pos-customer-search-wrap input {
  width: 100%;
  height: 40px;
  padding: 0 12px 0 32px;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid var(--pos-border-color);
  border-radius: var(--pos-radius-sm);
  background-color: #f8fafc;
  outline: none;
}

.pos-customer-search-wrap input:focus {
  border-color: var(--pos-primary);
  background-color: #ffffff;
}

.pos-customer-search-wrap .pos-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--pos-text-muted);
  pointer-events: none;
}

.pos-btn-add-customer {
  height: 40px;
  padding: 0 12px;
  background: var(--pos-blue-light);
  border: 1px solid var(--pos-blue-border);
  color: var(--pos-blue);
  border-radius: var(--pos-radius-sm);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------------------------------------------------- */
/* 2. قسم الأصناف */
/* ---------------------------------------------------- */
.pos-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.pos-item-card {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-right: 4px solid var(--pos-primary);
  border-radius: var(--pos-radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.pos-item-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pos-item-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--pos-text-main);
}

.pos-item-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.pos-btn-icon-action {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px;
}

.pos-item-card-body {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--pos-text-muted);
  background: #ffffff;
  border: 1px solid #e2e8f0;
  padding: 6px 10px;
  border-radius: 6px;
}

.pos-item-stat-group {
  display: flex;
  gap: 12px;
}

.pos-item-stat span {
  color: var(--pos-text-main);
  font-weight: 700;
}

.pos-item-net-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--pos-primary);
}

.pos-add-item-box {
  background: #ffffff;
  border: 1px solid var(--pos-border-color);
  border-radius: var(--pos-radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.pos-add-item-box-title {
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 6px;
}

.pos-add-item-row-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.pos-btn-submit-item {
  height: 38px;
  background: var(--pos-primary);
  color: white;
  border: none;
  border-radius: var(--pos-radius-sm);
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
}

.pos-btn-submit-item:active {
  background: var(--pos-primary-dark);
}

/* ---------------------------------------------------- */
/* 3. قسم الشحن واللوجستيات */
/* ---------------------------------------------------- */
.pos-shipping-section-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

.pos-packaging-box {
  background: #ffffff;
  border: 1px solid var(--pos-border-color);
  border-radius: var(--pos-radius-sm);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pos-packaging-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--pos-text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
}

.pos-pkg-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.pos-pkg-chip {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 11px;
  font-weight: 600;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 5px;
}

.pos-shipping-delivery-box {
  background: #ffffff;
  border: 1px solid var(--pos-border-color);
  border-radius: var(--pos-radius-sm);
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pos-shipping-row-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 10px;
  align-items: flex-end;
}

.pos-toggle-shipping-selector {
  display: flex;
  background: #f1f5f9;
  padding: 3px;
  border-radius: var(--pos-radius-sm);
  gap: 3px;
  border: 1px solid var(--pos-border-color);
  height: 38px;
}

.pos-btn-ship-option {
  flex: 1;
  border: none;
  background: transparent;
  color: #64748b;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
}

.pos-btn-ship-option.active {
  background: #ffffff;
  color: var(--pos-blue);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* ---------------------------------------------------- */
/* 4. قسم الماليات */
/* ---------------------------------------------------- */
.pos-finance-content-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.pos-extra-discount-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pos-extra-discount-label h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--pos-text-main);
  margin: 0;
}

.pos-extra-discount-label span {
  font-size: 12px;
  color: var(--pos-text-muted);
}

.pos-extra-discount-label .pos-highlight-red {
  color: var(--pos-danger);
  font-weight: 700;
}

.pos-extra-discount-input-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pos-extra-discount-input-wrap span {
  font-size: 13px;
  font-weight: 700;
  color: var(--pos-text-muted);
}

.pos-extra-discount-input {
  width: 70px;
  height: 38px;
  border: 1px solid var(--pos-border-color);
  border-radius: var(--pos-radius-sm);
  text-align: center;
  font-size: 15px;
  font-weight: 800;
  color: var(--pos-danger);
  outline: none;
  background-color: #f8fafc;
}

.pos-vat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
}

.pos-vat-row label {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
}

.pos-vat-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-vat-toggle-wrap span {
  font-size: 13px;
  font-weight: 700;
  color: var(--pos-text-muted);
}

.pos-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

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

.pos-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #cbd5e1;
  transition: .3s;
  border-radius: 24px;
}

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

.pos-switch input:checked + .pos-slider {
  background-color: var(--pos-primary);
}

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

.pos-calc-breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
}

.pos-calc-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.pos-calc-line-label {
  color: #475569;
  font-weight: 600;
}

.pos-calc-line-value {
  font-weight: 700;
  color: var(--pos-text-main);
}

.pos-calc-line-value.pos-discount-red {
  color: var(--pos-danger);
}

.pos-payment-method-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid #f1f5f9;
  padding-top: 10px;
}

.pos-payment-method-box label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pos-text-muted);
}

.pos-payment-select {
  width: 100%;
  height: 40px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--pos-text-main);
  border: 1px solid var(--pos-border-color);
  border-radius: var(--pos-radius-sm);
  background-color: #f8fafc;
  outline: none;
}

.pos-payment-balance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.pos-balance-box {
  border-radius: var(--pos-radius-md);
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
}

.pos-balance-box.pos-paid {
  background: #ffffff;
  border: 1px solid var(--pos-border-color);
}

.pos-balance-box.pos-paid label {
  font-size: 12px;
  font-weight: 600;
  color: var(--pos-text-muted);
}

.pos-paid-input-field {
  width: 100%;
  height: 38px;
  border: 1px solid var(--pos-border-color);
  border-radius: var(--pos-radius-sm);
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  color: var(--pos-text-main);
  background-color: #f8fafc;
  outline: none;
}

.pos-balance-box.pos-remaining {
  background: #fff1f2;
  border: 1px solid var(--pos-danger-border);
}

.pos-balance-box.pos-remaining label {
  font-size: 12px;
  font-weight: 700;
  color: var(--pos-danger);
}

.pos-remaining-amount-text {
  font-size: 18px;
  font-weight: 800;
  color: var(--pos-danger);
  line-height: 38px;
}

/* الشريط السفلي الثابت */
.pos-sticky-bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 480px;
  background: #ffffff;
  border-top: 1px solid var(--pos-border-color);
  padding: 10px 12px;
  display: flex;
  gap: 10px;
  align-items: center;
  box-shadow: 0 -4px 10px rgba(0, 0, 0, 0.05);
  z-index: 50;
}

.pos-btn-save-invoice {
  flex: 1;
  height: 48px;
  background: var(--pos-primary);
  color: white;
  border: none;
  border-radius: var(--pos-radius-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(5, 150, 105, 0.2);
}

.pos-btn-save-invoice:active {
  background: var(--pos-primary-dark);
}

.pos-btn-save-content {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pos-invoice-total-badge {
  background: rgba(0, 0, 0, 0.22);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 800;
}

.pos-btn-cancel-invoice {
  height: 48px;
  padding: 0 16px;
  background: var(--pos-danger-light);
  border: 1px solid var(--pos-danger-border);
  color: var(--pos-danger);
  border-radius: var(--pos-radius-md);
  font-size: 14px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.pos-btn-cancel-invoice:active {
  background: #fecdd3;
}

.pos-customer-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--pos-border-color);
    border-radius: var(--pos-radius-sm);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}
.pos-customer-search-item {
    padding: 10px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
}
.pos-customer-search-item:hover {
    background: #f8fafc;
}
.pos-product-search-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid var(--pos-border-color);
    border-radius: var(--pos-radius-sm);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}
