/* Cashier, packing, orders, stock, customers, installments, and the shared
 * pieces that copy the old program's screens (search box, filter button,
 * "⋮" menus, floating action pill). */

/* ---------- shared pieces (rw-) ---------- */
.rw-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.rw-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.rw-title.col { flex-direction: column; align-items: flex-start; gap: 0; }
.rw-title h2 { margin: 0; font-size: 14px; font-weight: 700; }
.rw-count { color: var(--label); font-size: 11px; font-weight: 600; }
.rw-search { display: flex; align-items: center; gap: 6px; flex: 0 1 260px; min-width: 170px; height: 33px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: text; }
.rw-search:focus-within { border-color: #9cbcf5; box-shadow: 0 0 0 3px rgba(12, 102, 228, 0.12); }
.rw-search > .ico { color: var(--faint); font-size: 11px; }
.rw-search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; font-size: 12px; color: var(--ink); }
.rw-search input::placeholder { color: var(--faint); }
.rw-mic { border: 0; background: none; padding: 0 2px; color: var(--faint); cursor: pointer; }
.rw-mic:hover { color: var(--ink); }
.rw-ibtn { width: 33px; height: 33px; flex: 0 0 33px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px;
  background: #fff; color: var(--muted); cursor: pointer; }
.rw-ibtn .ico { font-size: 12px; }
.rw-ibtn:hover, .rw-ibtn.on { background: var(--soft); color: var(--ink); border-color: #cfd4dc; }
.rw-ibtn:focus-visible, .rw-pill-btn:focus-visible, .rw-menu-item:focus-visible { outline: 2px solid var(--brand-2); outline-offset: 1px; }
.rw-head .segs { height: 33px; align-items: stretch; }
.rw-head .segs .seg { height: auto; padding: 0 10px; }
.rw-head .btn { height: 33px; font-size: 11px; border-radius: 9px; padding: 0 12px; }
.rw-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--soft); }
.rw-filters > .inp, .rw-filters > select.inp, .rw-filters .stk-slot > select.inp { width: auto; flex: 0 1 190px; min-width: 130px; height: 34px; }
.rw-filters > .picker { flex: 0 1 220px; min-width: 150px; }
.rw-filters .inp.stk-price { width: 110px; }
.rw-select { display: inline-flex; align-items: center; gap: 6px; height: 33px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--muted); }
.rw-select-in { border: 0; background: none; height: 100%; font-size: 11px; font-weight: 700; color: var(--ink); outline: 0; cursor: pointer; }
.rw-more { position: relative; display: inline-flex; }
.rw-dots { color: var(--faint); }
.rw-menu { position: absolute; top: calc(100% + 4px); inset-inline-end: 0; z-index: 45; min-width: 180px; padding: 4px; background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 30px rgba(16, 24, 40, 0.14); display: grid; }
.rw-menu-item { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 7px 10px; border-radius: 7px; text-align: start;
  font-size: 12px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.rw-menu-item .ico { color: var(--faint); }
.rw-menu-item:hover { background: var(--soft); }
.rw-menu-item.danger, .rw-menu-item.danger .ico { color: var(--red); }
.rw-avatar { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 50%; display: inline-grid; place-items: center; background: var(--chip);
  color: var(--muted); font-size: 12px; font-weight: 700; }
.rw-avatar.small { width: 20px; height: 20px; flex-basis: 20px; font-size: 10px; }
.rw-avatar.big { width: 38px; height: 38px; flex-basis: 38px; font-size: 14px; }
.rw-count-chip { min-width: 22px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--ink); color: #fff; font-size: 10px; font-weight: 700;
  display: inline-grid; place-items: center; }
.rw-pill { position: sticky; bottom: 14px; z-index: 16; display: flex; width: max-content; max-width: 100%; overflow-x: auto; gap: 2px; align-items: center;
  margin-top: 14px; margin-inline-start: auto; padding: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 30px rgba(16, 24, 40, 0.16); }
.rw-pill-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: none;
  color: var(--ink-2); font-size: 11px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.rw-pill-btn:hover { background: var(--soft); }
.rw-pill-btn.primary { background: var(--ink); color: #fff; }
.rw-pill-btn.primary:hover { background: #1f2937; }
.rw-head.wide .rw-search { flex: 1 1 auto; }
.subtabs .rw-tab-end { margin-inline-start: auto; align-self: center; margin-bottom: 4px; }

/* ---------- stock ---------- */
.stk-sums { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--label); font-size: 11px; font-weight: 600; margin: -4px 0 10px; }
.stk-sums b { color: var(--ink); }
.stk-group { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; font-size: 13px; }
.stk-group > .ico { color: var(--muted); }
.stk-rows { display: grid; gap: 0; border: 1px solid var(--line); border-radius: var(--radius); overflow: visible; background: #fff; }
.stk-row { display: flex; align-items: center; gap: 14px; padding: 8px 12px; border-bottom: 1px solid var(--line); cursor: pointer; min-width: 0; }
.stk-row:last-child { border-bottom: 0; }
.stk-row:hover { background: var(--soft); }
.stk-row.off { opacity: 0.6; }
.stk-row.neg { background: var(--orange-soft); }
.stk-row .stk-thumb { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px; object-fit: cover; }
.stk-thumb.no-img { display: inline-grid; place-items: center; background: var(--chip); color: var(--faint); font-size: 14px; }
.stk-name { flex: 1 1 220px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.stk-open { border: 0; background: none; padding: 0; text-align: start; font-weight: 700; font-size: 12px; color: var(--ink); cursor: pointer; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stk-name small { color: var(--label); font-size: 10.5px; }
.stk-fig { flex: 0 0 104px; display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.stk-fig small { color: var(--label); font-size: 10px; font-weight: 600; }
.stk-fig b { font-size: 12.5px; font-variant-numeric: tabular-nums; }
.stk-fig .stk-unit { font-size: 10px; }
.stk-qty.red { color: var(--red); } .stk-qty.green { color: var(--green); } .stk-qty.orange { color: var(--orange); }
.stk-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 0 0 auto; }
.stk-chip { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 7px; background: var(--chip); color: var(--muted);
  font-size: 10.5px; font-weight: 600; white-space: nowrap; }
.stk-chip .ico { font-size: 9px; color: var(--faint); }

/* ---------- customers ---------- */
.cus-who { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.cus-who b { display: block; font-size: 12.5px; }
.cus-who .cus-sub { color: var(--label); font-size: 10.5px; }
.cus-bal { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; white-space: nowrap; }
.cus-name { font-weight: 700; color: var(--ink); }
.cus-bal { white-space: nowrap; font-weight: 700; direction: ltr; unicode-bidi: plaintext; }
.cus-bal small { color: var(--label); font-weight: 400; font-size: 10px; }
.cus-bal.pos b { color: #0b7d45; } .cus-bal.neg b { color: #b91c1c; } .cus-bal.zero { color: var(--faint); }
.cus-totals { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--label); font-size: 11px; font-weight: 600; margin: -4px 0 10px; }
.cus-total b { color: var(--ink); }
.cus-total.pos b { color: #0b7d45; } .cus-total.neg b { color: #b91c1c; }

/* ---------- packing ---------- */
.pb-ok { color: var(--green); font-weight: 600; }
.pb-bad { color: var(--red); font-weight: 600; }
.pb-narrow { max-width: 440px; }
.btn.pb-sm { min-height: 30px; height: 30px; padding: 4px 10px; font-size: 11px; }
.btn.pb-big { min-height: 52px; font-size: 17px; font-weight: 700; margin-top: 14px; }
.pb-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pb-progress { position: relative; height: 18px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; min-width: 90px; }
.pb-progress i { position: absolute; inset-block: 0; inset-inline-start: 0; background: var(--green-soft); border-inline-end: 2px solid var(--green); }
.pb-progress span { position: relative; display: block; text-align: center; font-size: 11px; line-height: 16px; font-weight: 600; }
.pck-table { border: 1px solid var(--line); }
.pck-table table.grid th { background: var(--soft); }
.pck-day td { background: var(--soft); padding: 4px 8px; }
.pck-day-btn { display: inline-flex; align-items: center; gap: 10px; border: 0; background: none; cursor: pointer; padding: 2px; font-size: 12px; color: var(--ink); }
.pck-day-btn > .ico { color: var(--muted); transition: transform 0.15s; }
.pck-day-btn[aria-expanded="false"] > .ico { transform: rotate(90deg); }
[dir="rtl"] .pck-day-btn[aria-expanded="false"] > .ico { transform: rotate(-90deg); }
.pck-date { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-weight: 700; }
.pck-user { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.pck-acts { white-space: nowrap; text-align: end; }
.pb-lines { display: grid; gap: 6px; margin-top: 10px; }
.pb-line { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.pb-line.on { background: var(--green-soft); border-color: var(--green); }
.pb-line img { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; }
.pb-line small { display: block; }
.pb-line .chk { width: 22px; height: 22px; }

/* ---------- orders ---------- */
.screen > .ord-bar:first-child { margin-top: -14px; }
.ord-bar { align-items: flex-end; }
.ord-bar .subtab .ico { color: var(--muted); }
.ord-sep { width: 1px; height: 18px; background: var(--line-2); align-self: center; margin: 0 6px; }
.ord-card { padding: 4px; }
.ord-card table.grid th { background: var(--soft); }
.ord-chk { width: 34px; }
.ord-rem { display: block; font-size: 10px; }
.ord-empty { width: min(300px, 100%); margin: 40px auto; padding: 26px 16px; display: grid; justify-items: center; gap: 4px; text-align: center;
  border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 10px 30px rgba(16, 24, 40, 0.06); color: var(--label); }
.ord-empty-ico { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--brand-soft); color: #9cbcf5; font-size: 18px; margin-bottom: 6px; }
.ord-empty b { color: var(--ink-2); font-size: 13px; }
.ord-settings { margin-top: 0; }
.pb-selbar { background: var(--brand-soft); padding: 8px 10px; border-radius: var(--radius); }
.pb-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 14px; }
.pb-card { display: grid; gap: 6px; text-align: start; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); min-width: 0; }
button.pb-card { cursor: pointer; }
button.pb-card:hover { border-color: var(--brand-2); }
.pb-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; min-width: 0; }
.pb-card-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pb-board { display: grid; grid-template-columns: repeat(4, minmax(240px, 1fr)); gap: 10px; overflow-x: auto; align-items: start; }
.pb-col { background: #eef1f6; border-radius: var(--radius); padding: 8px; display: grid; gap: 8px; min-width: 0; }
.pb-col-head { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px; }
.pb-settings { display: grid; gap: 8px; margin: 10px 0; }
details.card > summary { cursor: pointer; font-weight: 600; }


/* ---------- installments ---------- */
.pb-ins.late { border-inline-start: 4px solid var(--red); }
.pb-ins-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.pb-ins-who { display: grid; gap: 2px; min-width: 0; }
.pb-ins-figs { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; }
.pb-ins-figs > div { display: grid; gap: 2px; }
.pb-ins-prog { min-width: 140px; }
.pb-ins-items { margin-top: 10px; }

@media (max-width: 860px) {
  .pb-board { grid-template-columns: repeat(4, minmax(220px, 80vw)); }
  .pb-ins-figs { gap: 12px; }
  .screen > .ord-bar:first-child { margin-top: -12px; }
  .rw-head { gap: 6px; }
  .rw-search { flex: 1 1 100%; min-width: 0; }
  .rw-head .grow { display: none; }
  .rw-search input { font-size: 16px; }
  .rw-filters > .inp, .rw-filters > select.inp, .rw-filters .stk-slot > select.inp, .rw-filters > .picker { flex: 1 1 140px; }
  .stk-row { flex-wrap: wrap; gap: 6px 12px; padding: 10px; }
  .stk-name { flex: 1 1 calc(100% - 110px); }
  .stk-fig { flex: 1 1 80px; }
  .stk-fig.hide-phone { display: none; }
  .stk-chips { order: 5; }
  .rw-pill { bottom: calc(10px + env(safe-area-inset-bottom)); }
}

/* Shop icon instead of a letter (an Arabic letter alone looks like a Latin one). */
.rw-avatar.shop { background: #fff4e5; color: #d97706; font-size: 13px; }
/* The action pill floats at the bottom of the screen, like the previous system. */
.rw-pill { position: fixed; bottom: 18px; inset-inline-end: 24px; }
body.mob .rw-pill { bottom: calc(18px + env(safe-area-inset-bottom)); inset-inline-end: 16px; }

/* ---------- stock rows, measured from the previous system ---------- */
.elm-group { margin-bottom: 18px; }
.elm-group-head { display: flex; align-items: center; gap: 7px; padding: 0 2px 8px; }
.elm-group-head b { font-size: 12px; font-weight: 700; color: var(--ink); }
.elm-group-ico { width: 22px; height: 22px; border-radius: 7px; background: #f3f4f6; color: #6b7280; display: grid; place-items: center; font-size: 10px; }
.elm-group-count { height: 17px; padding: 0 5px; min-width: 17px; border-radius: 9px; background: var(--ink); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.elm-rows { background: #fff; border: 1px solid #e8eaed; border-radius: 10px; overflow: hidden; }
.elm-row { display: grid; grid-template-columns: 38px minmax(0, 2.3fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.55fr) 24px; gap: 14px; align-items: center; padding: 9px 12px; cursor: pointer; }
.elm-row + .elm-row { border-top: 1px solid #f1f2f4; }
.elm-row:hover, .elm-row.sel { background: #f7f8fa; }
.elm-row.off { opacity: 0.55; }
.elm-img { position: relative; width: 38px; height: 38px; }
.elm-img img, .elm-noimg { width: 38px; height: 38px; border-radius: 8px; border: 1px solid #f1f2f4; object-fit: cover; display: grid; place-items: center; background: #fafbfc; color: #c3c8cf; font-size: 15px; }
.elm-check { position: absolute; top: -4px; inset-inline-start: -4px; width: 15px; height: 15px; margin: 0; opacity: 0; accent-color: var(--ink); }
.elm-row:hover .elm-check, .elm-check:checked { opacity: 1; }
.elm-title { font-size: 12px; font-weight: 700; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.elm-code { font-size: 10px; font-weight: 600; color: #b0b5bd; margin-top: 2px; direction: ltr; text-align: end; }
[dir="rtl"] .elm-code { text-align: right; }
.elm-off { color: var(--red); }
.elm-label { font-size: 10px; font-weight: 600; color: #b0b5bd; margin-bottom: 2px; }
.elm-price { font-size: 12px; font-weight: 700; color: #111827; }
.elm-stock { font-size: 12px; font-weight: 700; }
.elm-stock small { font-size: 10px; font-weight: 600; color: #b0b5bd; }
.elm-stock.s-ok { color: #16a34a; } .elm-stock.s-low { color: #d97706; } .elm-stock.s-empty, .elm-stock.s-neg { color: #ef4444; }
.elm-tags { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.elm-tag { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 6px; background: #f5f6f8; color: #6b7280; font-size: 10px; font-weight: 600; white-space: nowrap; }
.elm-tag i { font-size: 9px; color: #b0b5bd; }
.elm-row .rw-more { justify-self: center; }
@media (max-width: 860px) {
  .elm-row { grid-template-columns: 38px minmax(0, 1fr) auto auto 24px; gap: 10px; }
  .elm-tags { display: none; }
}

/* ---------- product dialog, measured from the previous system ---------- */
.adp-panel { width: min(720px, 100%); max-height: calc(100vh - 32px); background: #fff; border-radius: 14px; display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(16,24,40,0.25); overflow: hidden; }
.adp-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 12px; border-bottom: 1px solid #f1f2f4; }
.adp-head-ico { width: 34px; height: 34px; border-radius: 9px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 13px; flex: 0 0 auto; }
.adp-title { font-size: 14px; font-weight: 700; color: #111827; }
.adp-sub { font-size: 11px; font-weight: 600; color: #b0b5bd; margin-top: 2px; }
.adp-x { border: 0; background: none; color: #9ca3af; cursor: pointer; width: 30px; height: 30px; border-radius: 8px; }
.adp-x:hover { background: #f3f4f6; color: #111827; }
.adp-body { flex: 1; overflow-y: auto; padding: 14px 21px 6px; background: #f7f8fa; }
.adp-sec { background: #fff; border: 1px solid #e8eaed; border-radius: 10px; padding: 12px 14px 14px; margin-bottom: 10px; }
.adp-sec-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.adp-sec-ico { width: 22px; height: 22px; border-radius: 7px; background: #f3f4f6; color: #6b7280; display: grid; place-items: center; font-size: 10px; }
.adp-sec-title { font-size: 12px; font-weight: 700; color: #111827; }
.adp-sec-sub { font-size: 10.5px; font-weight: 600; color: #b0b5bd; }
.adp-field { display: flex; flex-direction: column; min-width: 0; margin-bottom: 10px; }
.adp-label { font-size: 11px; font-weight: 600; color: #6b7280; margin-bottom: 5px; }
.adp-req { color: #ef4444; }
.adp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 10px; }
.adp-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.adp-in { width: 100%; height: 34px; border: 1px solid #e8eaed; border-radius: 8px; background: #fff; padding: 0 10px; font-size: 12px; font-weight: 600; color: #111827; }
.adp-in:focus { outline: none; border-color: #9cbcf5; box-shadow: 0 0 0 3px rgba(12,102,228,0.12); }
.adp-in:disabled { background: #f7f8fa; color: #9ca3af; }
.adp-in.num { direction: ltr; text-align: end; }
.adp-area { height: auto; padding: 8px 10px; resize: vertical; font-weight: 500; }
.adp-with { position: relative; }
.adp-with .adp-in { padding-inline-end: 64px; }
.adp-cur { position: absolute; top: 5px; inset-inline-end: 5px; height: 24px; padding: 0 8px; border-radius: 7px; background: #f3f4f6; color: #6b7280; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
.adp-hint { display: block; font-size: 10px; color: #b0b5bd; margin-top: 3px; }
.adp-pk { border: 1px solid #e8eaed; border-radius: 9px; overflow: hidden; }
.adp-pk-row { display: grid; grid-template-columns: 30px minmax(0, 1.55fr) minmax(0, 0.9fr) minmax(0, 1.3fr) minmax(0, 1.7fr) 28px; gap: 6px; align-items: center; padding: 6px; }
.adp-pk-row + .adp-pk-row { border-top: 1px solid #f1f2f4; }
.adp-pk-head { background: #fafbfc; font-size: 10px; font-weight: 600; color: #b0b5bd; }
.adp-radio { width: 16px; height: 16px; margin: 0 auto; accent-color: var(--ink); }
.adp-ibtn { width: 28px; height: 28px; border: 0; border-radius: 7px; background: none; color: #9ca3af; cursor: pointer; }
.adp-ibtn:hover { background: #f3f4f6; color: #111827; }
.adp-ibtn.danger:hover { background: var(--red-soft); color: var(--red); }
.adp-pk-add { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 38px; border: 0; border-top: 1px solid #f1f2f4; background: #fff; color: #6b7280; font-size: 11px; font-weight: 600; cursor: pointer; }
.adp-pk-add:hover { background: #fafbfc; }
.adp-sug { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.adp-sug small { font-size: 11px; color: #b0b5bd; font-weight: 600; }
.adp-sug-chip { height: 26px; padding: 0 9px; border: 1px solid #e8eaed; border-radius: 8px; background: #fff; color: #6b7280; font-size: 11px; font-weight: 600; cursor: pointer; }
.adp-sug-chip:hover { border-color: #cfd4dc; color: #111827; }
.adp-imgs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.adp-img { position: relative; width: 92px; height: 92px; border-radius: 10px; overflow: hidden; border: 1px solid #e8eaed; cursor: grab; }
.adp-img img { width: 100%; height: 100%; object-fit: cover; }
.adp-img-main { position: absolute; bottom: 4px; inset-inline-start: 4px; background: var(--ink); color: #fff; font-size: 9px; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.adp-img-x { position: absolute; top: 4px; inset-inline-end: 4px; width: 20px; height: 20px; border: 0; border-radius: 6px; background: rgba(255,255,255,0.9); color: #ef4444; font-size: 10px; cursor: pointer; }
.adp-drop { flex: 1; min-width: 200px; min-height: 92px; border: 1.5px dashed #d6dae1; border-radius: 10px; background: #fafbfc; color: #9ca3af; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; cursor: pointer; }
.adp-drop i { font-size: 18px; }
.adp-drop b { font-size: 12px; color: #6b7280; }
.adp-drop small { font-size: 10.5px; }
.adp-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.adp-chip { height: 30px; padding: 0 12px; border: 1px solid #e8eaed; border-radius: 8px; background: #fff; color: #6b7280; font-size: 11px; font-weight: 600; cursor: pointer; }
.adp-chip.on { background: #111827; border-color: #111827; color: #fff; }
.adp-foot { display: flex; align-items: center; justify-content: flex-start; gap: 6px; padding: 10px 18px; border-top: 1px solid #f1f2f4; background: #fff; }
.adp-cancel { height: 34px; padding: 0 16px; border: 0; border-radius: 9px; background: #f5f6f8; color: #6b7280; font-size: 12px; font-weight: 600; cursor: pointer; }
.adp-submit { height: 34px; padding: 0 20px; border: 0; border-radius: 9px; background: #111827; color: #fff; font-size: 12px; font-weight: 700; cursor: pointer; }
.adp-submit:disabled { opacity: 0.6; }
@media (max-width: 860px) {
  .adp-overlay { padding: 0; align-items: end; }
  .adp-panel { max-height: 94vh; border-radius: 18px 18px 0 0; }
  .adp-grid, .adp-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adp-pk-row { grid-template-columns: 26px minmax(0, 1.4fr) 54px minmax(0, 1.2fr) minmax(0, 1.3fr) 26px; gap: 4px; }
}

/* products header and numbered pages, measured from the previous system */
.elm-board-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.elm-board-info { display: flex; align-items: baseline; gap: 8px; }
.elm-board-title { font-size: 13px; font-weight: 700; color: #111827; }
.elm-board-info .rw-count { font-size: 11px; font-weight: 600; color: #b0b5bd; }
.elm-board-tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.elm-search { width: 240px; }
.elm-search .inp, .elm-search input { height: 32px; border-radius: 10px; font-size: 12px; font-weight: 400; }
.elm-tool { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; min-width: 32px; padding: 0 10px; border: 1px solid #e8eaed; border-radius: 10px; background: #fff; color: #6b7280; font-size: 11px; font-weight: 700; cursor: pointer; }
.elm-tool:hover { border-color: #cfd4dc; color: #111827; }
.elm-tool.dark { background: #111827; border-color: #111827; color: #fff; }
.elm-sep { width: 1px; height: 20px; background: #e8eaed; }
.pg-bar { display: flex; align-items: center; justify-content: center; gap: 4px; padding: 8px 0 10px; }
.pg-info { font-size: 11px; font-weight: 600; color: #b0b5bd; margin: 0 8px; }
.pg-btn { min-width: 28px; height: 28px; padding: 0 8px; border: 1px solid #e8eaed; border-radius: 8px; background: #fff; color: #6b7280; font-size: 11px; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.pg-btn i { font-size: 9px; }
.pg-btn.on { background: #111827; border-color: #111827; color: #fff; }
.pg-btn:disabled { opacity: 0.4; cursor: default; }
.pg-dots { width: 20px; text-align: center; color: #b0b5bd; font-size: 11px; }
@media (max-width: 860px) { .elm-search { width: 100%; flex: 1 1 100%; } }
.adp-folds { padding: 0; overflow: hidden; }
.adp-fold + .adp-fold { border-top: 1px solid #f1f2f4; }
.adp-fold-head { display: flex; align-items: center; gap: 8px; width: 100%; padding: 11px 14px; border: 0; background: none; cursor: pointer; text-align: start; }
.adp-fold-head:hover { background: #fafbfc; }
.adp-fold-head .grow { flex: 1; }
.adp-fold-chev { font-size: 10px; color: #b0b5bd; transition: transform 0.15s; }
.adp-fold-head.open .adp-fold-chev { transform: rotate(180deg); }
.adp-fold-body { padding: 2px 14px 14px; }
/* picture drop area like the old program */
.adp-drop { width: 100%; min-height: 117px; border: 1px dashed #d6dae1; background: #fafbfc; }
.adp-drop i { width: 34px; height: 34px; border-radius: 9px; border: 1px solid #e8eaed; background: #fff; color: #9aa2ad; display: grid; place-items: center; font-size: 14px; margin-bottom: 4px; }
.adp-drop b { font-size: 12px; font-weight: 700; color: #111827; }

/* sell/buy: tools, costs and attachments like the previous system */
.chip.icon-only { padding: 0 10px; }
.chip i { font-size: 11px; color: #6b7280; }
.subtab-action { color: #6b7280; display: inline-flex; align-items: center; gap: 6px; }
.subtab-action i { font-size: 11px; }
.cost-head, .cost-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) 30px; gap: 6px; align-items: center; }
.cost-head { padding: 7px 8px; margin: 4px 0 6px; border-radius: 8px; background: #f7f8fa; font-size: 11px; font-weight: 700; color: #6b7280; }
.cost-row { margin-bottom: 6px; }
.cost-add { width: 100%; height: 34px; margin-top: 4px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px dashed #d6dae1; border-radius: 9px; background: #fff; color: #6b7280; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.cost-add:hover { background: #f7f8fa; color: #111827; }
.att-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 10px 0; }
.att-btn { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid #e8eaed; border-radius: 9px; background: #fff; color: #374151; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.att-btn i { font-size: 11px; color: #6b7280; }
.att-count { font-size: 12px; font-weight: 700; color: #2b74d6; }

.subtabs .grow { flex: 1 1 auto; }

/* ---------- صفحة العميل (like the previous system's customer page) ---------- */
.cp { display: flex; flex-direction: column; gap: 12px; padding-bottom: 64px; }
.cp-head { display: flex; align-items: center; gap: 14px; }
.cp-avatar { width: 64px; height: 64px; border-radius: 16px; background: var(--chip); color: var(--brand-2); display: grid; place-items: center; font-size: 26px; flex: 0 0 auto; }
.cp-head h2 { margin: 0; font-size: 20px; }
.cp-place { margin: 2px 0 6px; font-size: 12px; }
.cp-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cp-tag { border: 1px solid var(--line); border-radius: 8px; padding: 1px 10px; font-size: 12px; color: var(--ink-2); background: var(--card); }
.cp-tag.red { color: var(--red); border-color: var(--red-soft); background: var(--red-soft); }
.cp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 16px; margin-bottom: 12px; }
.cp-field { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); font-weight: 600; }
.cp-dealing { margin: 4px 0 14px; display: inline-flex; border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 3px; }
.cp-switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); cursor: pointer; }
.cp-switch b { display: block; font-size: 14px; }
.cp-switch small { display: block; }
.cp-switch-in { width: 44px; height: 24px; appearance: none; -webkit-appearance: none; border-radius: 99px; background: var(--line-2); position: relative; cursor: pointer; flex: 0 0 auto; transition: background 0.15s; }
.cp-switch-in::after { content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.25); transition: inset-inline-start 0.15s; }
.cp-switch-in:checked { background: var(--st-navy-1, #2b3d5c); }
.cp-switch-in:checked::after { inset-inline-start: 23px; }
.cp-place-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-top: 4px; }
.cp-place-box summary { cursor: pointer; font-weight: 700; font-size: 13px; }
.cp-place-box .cp-grid { margin: 12px 0 0; }
.cp-added { font-size: 12px; margin: 10px 0 0; }
.cp-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cp-bal { display: flex; flex-direction: column; gap: 8px; margin: 0; text-align: center; }
.cp-bal-head { text-align: center; }
.cp-bal-head b { display: block; font-size: 13px; }
.cp-bal-head small { color: var(--label); font-size: 11px; }
.cp-bal-amount { font-size: 26px; font-weight: 800; text-align: center; direction: ltr; unicode-bidi: isolate; padding: 6px 0; }
.cp-bal-amount.pos { color: #0b7d45; } .cp-bal-amount.neg { color: #b91c1c; } .cp-bal-amount.zero { color: var(--faint); }
.cp-moves-head { align-items: center; }
.cp-moves-head h3 { margin: 0; }
.cp-filters { display: flex; flex-wrap: wrap; gap: 8px; }
.cp-filters .inp { width: auto; min-width: 130px; min-height: 34px; height: 34px; }
.cp-move { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.cp-move.rev { opacity: 0.6; }
.cp-move-ico { width: 36px; height: 36px; border-radius: 10px; background: var(--chip); color: var(--brand-2); display: grid; place-items: center; flex: 0 0 auto; }
.cp-move b { font-size: 14px; }
.cp-move-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12px; margin: 4px 0; }
.cp-ba { border: 1px solid var(--line); border-radius: 8px; padding: 0 8px; font-weight: 700; color: var(--ink-2); }
.cp-move-amount { white-space: nowrap; font-size: 14px; }
.cp-move-amount.up { color: #b91c1c; } .cp-move-amount.down { color: #0b7d45; }
.cp-center { text-align: center; padding: 18px 0; }
.cp-rgrid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 12px 0; }
.cp-rcard { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; padding: 14px; min-height: 86px; background: var(--card); }
.cp-rcard small { display: block; color: var(--muted); font-size: 12px; font-weight: 600; }
.cp-rcard b { display: block; font-size: 17px; margin-top: 8px; position: relative; z-index: 1; word-break: break-word; }
.cp-rcard-ico { position: absolute; inset-inline-end: 12px; top: 12px; font-size: 30px; color: var(--line-2); }
.cp-chips .chip.on { font-weight: 700; }
.cp-sub { font-size: 14px; margin: 8px 0; }
.cp-search { margin-bottom: 10px; }
.cp-price-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.cp-price-row small { display: block; }
.cp-price-in { width: 140px; }
.cp-note-add { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.cp-note-add textarea { flex: 1; }
.cp-note { position: relative; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 8px; margin-bottom: 8px; }
.cp-note p { margin: 0 0 4px; white-space: pre-wrap; }
.cp-note .icon-btn { position: absolute; top: 6px; inset-inline-end: 6px; }
.cp-file { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.cp-file a { flex: 1; color: var(--brand-2); font-weight: 600; word-break: break-all; }
.cp-drop { border: 1.5px dashed var(--line-2); border-radius: 12px; text-align: center; padding: 26px 10px; margin: 6px 0 0; }
.cp-portal-link { margin-top: 10px; }
.cp-link-row { display: flex; gap: 8px; margin-top: 4px; }
.cp-link-row .inp { flex: 1; }
.cp-settle-pick { display: grid; gap: 10px; }
.cp-st-btn { position: fixed; bottom: 18px; inset-inline-end: auto; inset-inline-start: calc(var(--side, 246px) + 26px); z-index: 30; border: 0; border-radius: 12px;
  background: linear-gradient(180deg, var(--st-navy-1, #2b3d5c), var(--st-navy, #22324b)); color: #fff; font: inherit; font-weight: 700; font-size: 13px;
  padding: 10px 16px; box-shadow: 0 6px 18px rgba(17, 30, 52, 0.3); cursor: pointer; }
[dir="rtl"] .cp-st-btn { inset-inline-start: auto; left: 22px; }
.cp-st-menu { display: flex; flex-direction: column; gap: 8px; }
.cp-st-group { display: flex; flex-direction: column; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.cp-st-opt { display: flex; align-items: center; gap: 12px; text-align: start; border: 1px solid var(--line); border-radius: 12px; background: var(--card); padding: 10px 12px; font: inherit; color: var(--ink); cursor: pointer; }
.cp-st-opt:hover { border-color: var(--gold, #a98e65); }
.cp-st-opt b, .cp-st-opt small { display: block; }
.cp-st-opt i { font-size: 18px; color: var(--brand-2); }
/* the statement as a document (prints alone) */
.cp-doc-wrap { display: flex; flex-direction: column; gap: 12px; }
.cp-doc { background: #fff; color: #111; border: 1px solid #e3e6eb; border-radius: 14px; padding: 18px; font-size: 13px; direction: rtl; }
.cp-doc-band { display: flex; align-items: center; justify-content: space-between; gap: 16px; background: linear-gradient(160deg, #45548a, #283255); color: #fff; border-radius: 12px; padding: 14px 18px; }
.cp-doc-band img { height: 64px; max-width: 160px; object-fit: contain; }
.cp-doc-shop { font-size: 18px; }
.cp-doc-info { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 14px 0; }
.cp-doc-kv { display: flex; border: 1px solid #e3e6eb; border-radius: 8px; overflow: hidden; }
.cp-doc-kv span { background: #f3f4f8; padding: 6px 10px; min-width: 120px; color: #5d6680; font-weight: 600; }
.cp-doc-kv b { padding: 6px 10px; flex: 1; }
.cp-doc-title { font-size: 14px; margin: 8px 0; color: #34416a; }
.cp-doc-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid #e3e6eb; border-radius: 10px; overflow: hidden; }
.cp-doc-table th { background: #34416a; color: #fff; font-weight: 700; padding: 8px; font-size: 12px; text-align: center; }
.cp-doc-table td { padding: 7px 8px; border-top: 1px solid #eef0f4; text-align: center; }
.cp-doc-table tr:nth-child(even) td { background: #f8f8fb; }
.cp-doc-table tr.opening td { background: #f3efe7; font-weight: 700; }
.cp-doc-table .n { white-space: nowrap; font-weight: 700; }
.cp-doc-table .up, .cp-doc-table .neg { color: #b91c1c; } .cp-doc-table .down, .cp-doc-table .pos { color: #0b7d45; }
.cp-doc-total { display: flex; justify-content: flex-end; gap: 0; margin-top: 12px; }
.cp-doc-total span { background: #34416a; color: #fff; padding: 8px 14px; border-radius: 0 10px 10px 0; font-weight: 700; }
.cp-doc-total b { border: 1px solid #34416a; padding: 7px 18px; border-radius: 10px 0 0 10px; font-size: 16px; }
.cp-doc-total b.neg { color: #b91c1c; } .cp-doc-total b.pos { color: #0b7d45; }
@media print {
  body.cp-printing > *:not(.overlay) { display: none !important; }
  body.cp-printing .overlay { position: static; background: none; padding: 0; }
  body.cp-printing .overlay .modal { box-shadow: none; border: 0; max-height: none; width: auto; }
  body.cp-printing .modal-head, body.cp-printing .modal-foot, body.cp-printing .cp-doc-tools { display: none !important; }
  body.cp-printing .cp-doc { border: 0; padding: 0; }
  @page { size: A4; margin: 12mm; }
}
@media (max-width: 860px) {
  .cp-grid, .cp-cards, .cp-doc-info { grid-template-columns: 1fr; }
  .cp-rgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cp-st-btn { left: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); }
  .cp-doc-table { font-size: 11px; }
}
/* «نوع التعامل»: three compact choices sized to their words */
.cp-dealing { display: inline-flex; gap: 4px; padding: 4px; margin: 4px 0 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--chip); width: auto; }
.cp-deal { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 13px; font-weight: 700; padding: 6px 16px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.cp-deal:hover { color: var(--ink); }
.cp-deal.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(17, 30, 52, 0.15); }
.cp-settle-opt { height: 48px; font-size: 14px; border-radius: 12px; }
.cp-field > .cp-dealing { align-self: flex-start; }
/* customer page drop-downs: the words fill the box and the arrow sits inside it (2026-11-20) */
html body .cp-filters select.inp, html body .cp-field select.inp {
  appearance: none; -webkit-appearance: none; text-align: start; line-height: 1.2;
  padding-block: 0; padding-inline: 12px 32px; font-size: 13px; font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2.5 4.5 6 8l3.5-3.5' fill='none' stroke='%238a94a6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 12px; background-position: left 12px center;
}
html[dir="ltr"] body .cp-filters select.inp, html[dir="ltr"] body .cp-field select.inp { background-position: right 12px center; }
html body .cp-filters select.inp { min-width: 0; width: auto; height: 36px; min-height: 36px; }
@media (max-width: 760px) {
  .cp-moves-head { flex-wrap: wrap; gap: 10px; }
  .cp-filters { width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
  html body .cp-filters select.inp { width: 100%; padding-inline: 6px 20px; font-size: 12px; background-size: 10px; background-position: left 6px center; text-overflow: ellipsis; }
  html[dir="ltr"] body .cp-filters select.inp { background-position: right 6px center; }
}
/* a move with a document opens on a tap of the row itself (2026-11-21) */
.cp-move-open { cursor: pointer; border-radius: 12px; transition: background 0.12s; }
/* the icon and the amount sit inside the row, away from the card edge (2026-11-21) */
.cp-move { padding-inline: 12px; }
.cp-move-ico { margin-top: 2px; }
.cp-move-open:hover, .cp-move-open:focus-visible { background: var(--chip); outline: 0; }
.cp-move-open:active { background: var(--line); }
.cp-moves-head { margin-bottom: 8px; }
/* بيع مباشر: the note under the name box (2026-11-21) */
.direct-hint { flex: 1 1 100%; margin-top: 6px; color: var(--muted); font-size: 12px; }
.bl_head:has(> .direct-hint) { flex-wrap: wrap; }
