/* المرحلة الثالثة: نقطة البيع، الصندوق، التقارير، وصلاحيات التنقل */
.p3-layout {
  min-height: 100vh;
  background: #f6f7f3;
  color: #1b3028;
  direction: rtl;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr);
  font-family: inherit;
}
.p3-layout * {
  box-sizing: border-box;
}
.p3-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  min-height: 100vh;
  background: #123d31;
  color: #f4f8f4;
  padding: 18px 12px 16px;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.p3-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 8px 20px;
  color: inherit;
  text-decoration: none;
}
.p3-brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: #e9f1dc;
  color: #164535;
  display: grid;
  place-items: center;
  font-size: 25px;
  font-weight: 850;
}
.p3-brand strong {
  display: block;
  font-size: 18px;
}
.p3-brand small {
  display: block;
  margin-top: 3px;
  color: #b4c9bc;
  font-size: 10px;
}
.p3-nav-caption {
  padding: 5px 10px 9px;
  color: #9fb9aa;
  font-size: 10px;
  font-weight: 750;
}
.p3-nav {
  display: grid;
  gap: 3px;
}
.p3-nav-item {
  min-height: 39px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 10px;
  border-radius: 10px;
  color: #d0ddd5;
  text-decoration: none;
  font-size: 11px;
  transition:
    background 0.16s,
    color 0.16s,
    transform 0.16s;
}
.p3-nav-item:hover {
  background: #ffffff14;
  color: #fff;
  transform: translateX(-2px);
}
.p3-nav-item.active {
  background: #e8f3ed;
  color: #14523d;
  font-weight: 800;
}
.p3-side-foot {
  margin-top: auto;
  border-top: 1px solid #ffffff25;
  padding: 13px 9px 3px;
  color: #d5e3da;
  font-size: 10px;
  line-height: 1.8;
}
.p3-side-foot span {
  color: #9eb9a9;
}
.p3-main {
  min-width: 0;
}
.p3-topbar {
  min-height: 70px;
  padding: 11px clamp(15px, 2.5vw, 34px);
  background: #fbfcf9;
  border-bottom: 1px solid #e5e9e2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.p3-breadcrumb {
  font-size: 10px;
  color: #75817a;
  margin-bottom: 4px;
}
.p3-breadcrumb span {
  padding: 0 4px;
  color: #aeb9b0;
}
.p3-topbar > div:first-child > strong {
  font-size: 14px;
  color: #203b2e;
}
.p3-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.p3-online {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #64746b;
  font-size: 10px;
}
.p3-online i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3c9c70;
}
.p3-role-pill {
  border-radius: 20px;
  background: #e8f3ed;
  color: #176b52;
  padding: 6px 9px;
  font-size: 10px;
  font-weight: 750;
  white-space: nowrap;
}
.p3-content {
  max-width: 1500px;
  margin: 0 auto;
  padding: 25px clamp(14px, 2.7vw, 38px) 32px;
}
.p3-footer {
  padding: 17px 4px 5px;
  color: #98a39b;
  font-size: 9px;
  line-height: 1.7;
}
.p3-shortcuts {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}
.p3-shortcuts > a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.p3-pos-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 13px;
  padding: 12px;
  background: #fff;
  border: 1px solid #e4e9e3;
  border-radius: 13px;
  box-shadow: 0 4px 14px #23483208;
}
.p3-scan-field,
.p3-search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  height: 43px;
  padding: 0 12px;
  border: 1px solid #dfe6df;
  background: #fbfcfa;
  border-radius: 10px;
  color: #6e8377;
}
.p3-scan-field {
  flex: 1;
  border-color: #9cbda9;
  box-shadow: 0 0 0 2px #176b520b;
}
.p3-scan-field input,
.p3-search-field input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  color: #1d382c;
}
.p3-scan-field input::placeholder,
.p3-search-field input::placeholder {
  color: #97a49b;
}
.p3-price-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
  color: #64756a;
  font-size: 10px;
}
.p3-price-switch select,
.p3-ledger-controls select {
  height: 36px;
  border: 1px solid #dfe6df;
  border-radius: 8px;
  padding: 0 8px;
  background: white;
  color: #244438;
  font: inherit;
  font-size: 11px;
}
.p3-pos-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  align-items: start;
  gap: 13px;
}
.p3-products-panel,
.p3-cart-panel {
  min-width: 0;
}
.p3-search-field {
  height: 38px;
  margin-bottom: 11px;
}
.p3-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: 530px;
  overflow: auto;
  padding: 1px;
}
.p3-product-card {
  min-width: 0;
  text-align: right;
  border: 1px solid #e5ebe5;
  background: #fff;
  border-radius: 11px;
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  color: #2a4838;
  font: inherit;
  cursor: pointer;
  transition:
    border-color 0.16s,
    transform 0.16s,
    box-shadow 0.16s;
}
.p3-product-card:hover {
  border-color: #8db59c;
  transform: translateY(-1px);
  box-shadow: 0 6px 13px #153d2a0e;
}
.p3-product-card.low {
  border-color: #ead7b9;
  background: #fffdfa;
}
.p3-product-title {
  font-size: 11px;
  font-weight: 800;
}
.p3-product-code {
  font-family: ui-monospace, monospace;
  font-size: 9px;
  color: #839087;
  direction: ltr;
  text-align: right;
}
.p3-product-meta {
  font-size: 9px;
  color: #828f86;
}
.p3-product-card > strong {
  font-size: 12px;
  color: #176b52;
  margin-top: 2px;
}
.p3-cart-lines {
  display: grid;
  gap: 8px;
}
.p3-cart-empty {
  min-height: 185px;
  border: 1px dashed #dbe4dc;
  border-radius: 11px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-align: center;
  color: #718077;
  padding: 18px;
}
.p3-empty-mark {
  width: 39px;
  height: 39px;
  border-radius: 13px;
  background: #e8f3ed;
  color: #176b52;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 800;
}
.p3-cart-empty strong {
  font-size: 12px;
  color: #2d493a;
}
.p3-cart-empty small {
  font-size: 10px;
  line-height: 1.6;
}
.p3-cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 106px auto 27px;
  align-items: center;
  gap: 7px;
  border: 1px solid #e8ede7;
  background: #fff;
  border-radius: 10px;
  padding: 8px;
}
.p3-cart-title {
  min-width: 0;
}
.p3-cart-title strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  color: #2c4639;
}
.p3-cart-title small {
  display: block;
  margin-top: 3px;
  font-size: 8px;
  color: #89958e;
  direction: ltr;
  text-align: right;
}
.p3-unit-select {
  height: 30px;
  min-width: 0;
  border: 1px solid #e1e8e1;
  border-radius: 7px;
  background: #fbfcfa;
  color: #335443;
  font: inherit;
  font-size: 9px;
}
.p3-qty-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}
.p3-qty-stepper button {
  width: 25px;
  height: 27px;
  border: 0;
  border-radius: 7px;
  background: #e9f3ed;
  color: #176b52;
  font-weight: 800;
  cursor: pointer;
}
.p3-qty-stepper input {
  width: 45px;
  height: 27px;
  border: 1px solid #e3e9e3;
  border-radius: 7px;
  text-align: center;
  font: inherit;
  font-size: 10px;
}
.p3-cart-price {
  text-align: left;
  white-space: nowrap;
}
.p3-cart-price small {
  display: block;
  color: #849087;
  font-size: 8px;
}
.p3-cart-price strong {
  display: block;
  margin-top: 2px;
  color: #1e583e;
  font-size: 11px;
}
.p3-remove-line {
  width: 25px;
  height: 25px;
  border: 0;
  border-radius: 7px;
  background: #fff0ee;
  color: #a24b43;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.p3-cart-stock {
  grid-column: 1/-1;
  color: #8b978f;
  font-size: 8px;
}
.p3-total-box {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: 9px;
  margin: 11px 0;
  padding: 11px 12px;
  border: 1px solid #e1eae2;
  border-radius: 10px;
  background: #f4f8f4;
}
.p3-total-box > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
}
.p3-total-box span {
  color: #68766d;
  font-size: 10px;
}
.p3-total-box strong {
  color: #174934;
  font-size: 14px;
}
.p3-total-box > div:last-child strong {
  font-size: 18px;
}
.p3-checkout-form {
  border-top: 1px solid #edf0ec;
  padding-top: 12px;
}
.p3-checkout-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.p3-credit-hint {
  font-size: 9px;
  color: #8b958e;
  line-height: 1.6;
}
.p3-hidden {
  display: none !important;
}
.p3-checkout-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.p3-checkout-actions button {
  flex: 1;
}
.p3-checkout-actions button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.p3-checkout-empty {
  padding: 12px;
  border-radius: 9px;
  background: #f7f8f5;
  color: #849087;
  text-align: center;
  font-size: 10px;
}
.p3-last-sale {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 13px 15px;
  margin-bottom: 13px;
  border: 1px solid #cfe3d4;
  background: #f0f8f1;
  border-radius: 12px;
}
.p3-last-sale > div:first-child {
  display: grid;
  gap: 4px;
}
.p3-last-sale strong {
  font-size: 13px;
  color: #1c573b;
}
.p3-last-sale small {
  font-size: 10px;
  color: #708176;
}
.p3-last-sale > div:last-child {
  display: flex;
  gap: 6px;
}
.p3-period-form {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 13px;
  padding: 11px 13px;
  background: #fff;
  border: 1px solid #e5eae4;
  border-radius: 11px;
}
.p3-period-form label,
.p3-ledger-controls label {
  display: grid;
  gap: 4px;
  color: #6d7b72;
  font-size: 9px;
}
.p3-period-form input {
  height: 33px;
  border: 1px solid #e1e7e0;
  border-radius: 7px;
  padding: 0 8px;
  font: inherit;
  font-size: 10px;
  color: #2b4838;
}
.p3-ledger-controls {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
  margin: 3px 0 13px;
}
.p3-ledger-controls > strong,
.p3-ledger-controls > span {
  margin-inline-start: auto;
  color: #27634a;
  font-size: 11px;
}
.p3-ledger-controls select {
  min-width: 150px;
}
.p3-ledger-report {
  margin-top: 12px;
}
.p3-equation {
  padding: 14px;
  border-radius: 10px;
  background: #f5f8f4;
  color: #5c6d62;
  font-size: 12px;
  line-height: 1.9;
}
.p3-equation strong {
  color: #176b52;
  font-size: 15px;
}
.p3-denied {
  text-align: center;
  padding: 48px 18px;
}
.p3-denied h2 {
  color: #a14d45;
}
.p3-denied p {
  color: #75817a;
  font-size: 12px;
}
.p3-mobile-nav {
  display: none;
}
@media (max-width: 1180px) {
  .p3-layout {
    grid-template-columns: 210px minmax(0, 1fr);
  }
  .p3-sidebar {
    padding-inline: 9px;
  }
  .p3-nav-item {
    font-size: 10px;
    padding-inline: 8px;
  }
  .p3-pos-grid {
    grid-template-columns: minmax(0, 1fr) minmax(330px, 0.95fr);
  }
  .p3-cart-row {
    grid-template-columns: minmax(0, 1fr) 68px 100px auto 25px;
  }
}
@media (max-width: 850px) {
  .p3-layout {
    display: block;
    min-height: 100dvh;
    padding-bottom: calc(66px + env(safe-area-inset-bottom));
  }
  .p3-sidebar {
    display: none;
  }
  .p3-main {
    min-height: 100dvh;
  }
  .p3-topbar {
    min-height: 61px;
    padding: 9px 13px;
  }
  .p3-topbar > div:first-child > strong {
    font-size: 12px;
  }
  .p3-top-actions {
    gap: 5px;
  }
  .p3-online {
    display: none;
  }
  .p3-top-actions .p2-btn {
    min-height: 31px;
    padding: 0 8px;
    font-size: 9px;
  }
  .p3-content {
    padding: 17px 12px 25px;
  }
  .p3-pos-grid {
    grid-template-columns: 1fr;
    gap: 0;
  }
  .p3-products-panel {
    order: 1;
  }
  .p3-cart-panel {
    order: 0;
  }
  .p3-product-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 330px;
  }
  .p3-pos-toolbar {
    padding: 9px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .p3-scan-field {
    flex: 1 1 100%;
    height: 41px;
  }
  .p3-pos-toolbar > .p2-btn {
    flex: 1;
  }
  .p3-price-switch {
    flex: 1;
    justify-content: flex-end;
  }
  .p3-cart-row {
    grid-template-columns: minmax(0, 1fr) 72px 96px 25px;
    gap: 6px;
    padding: 7px;
  }
  .p3-cart-price {
    grid-column: 1/3;
    text-align: right;
  }
  .p3-cart-stock {
    grid-row: 3;
    grid-column: 1/-1;
  }
  .p3-remove-line {
    grid-column: 4;
    grid-row: 1;
  }
  .p3-qty-stepper {
    grid-column: 3;
    grid-row: 1;
  }
  .p3-unit-select {
    grid-column: 2;
    grid-row: 1;
  }
  .p3-cart-title {
    grid-column: 1;
    grid-row: 1;
  }
  .p3-checkout-grid {
    grid-template-columns: 1fr;
  }
  .p3-period-form {
    align-items: stretch;
  }
  .p3-period-form label {
    flex: 1;
  }
  .p3-last-sale {
    align-items: flex-start;
    flex-direction: column;
  }
  .p3-last-sale > div:last-child {
    width: 100%;
  }
  .p3-last-sale button {
    flex: 1;
  }
  .p3-mobile-nav {
    position: fixed;
    z-index: 60;
    bottom: 0;
    inset-inline: 0;
    height: calc(61px + env(safe-area-inset-bottom));
    padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
    display: flex;
    align-items: stretch;
    gap: 2px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    background: #fff;
    border-top: 1px solid #e3e9e2;
    box-shadow: 0 -5px 18px #163d2e0d;
  }
  .p3-mobile-item {
    flex: 0 0 73px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-decoration: none;
    color: #829087;
    border-radius: 9px;
    font-size: 8px;
    white-space: nowrap;
  }
  .p3-mobile-item.active {
    color: #176b52;
    background: #edf5ef;
    font-weight: 800;
  }
  .p3-mobile-item svg {
    width: 17px;
    height: 17px;
  }
  .p3-shortcuts {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .p3-ledger-controls {
    align-items: stretch;
  }
  .p3-ledger-controls label {
    flex: 1;
  }
  .p3-ledger-controls > strong,
  .p3-ledger-controls > span {
    margin-inline-start: 0;
  }
  .p3-equation {
    font-size: 10px;
  }
}
@media (max-width: 420px) {
  .p3-content {
    padding-inline: 9px;
  }
  .p3-topbar {
    padding-inline: 8px;
  }
  .p3-top-actions {
    gap: 3px;
  }
  .p3-top-actions .p2-btn {
    padding-inline: 6px;
    font-size: 8px;
  }
  .p3-product-grid {
    gap: 6px;
  }
  .p3-product-card {
    padding: 8px;
  }
  .p3-product-title {
    font-size: 10px;
  }
  .p3-cart-row {
    grid-template-columns: minmax(0, 1fr) 63px 88px 23px;
  }
  .p3-qty-stepper input {
    width: 38px;
  }
  .p3-mobile-item {
    flex-basis: 64px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .p3-layout * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: #8b978f;
  font-size: 10px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  height: 1px;
  flex: 1;
  background: #e3e9e2;
}
.auth-card form[data-form="cashier-login"] {
  padding-top: 2px;
}
.auth-card [data-role-error] {
  min-height: 17px;
}
