/* Order edit dialog (views/order_edit.js): item lines with a quantity stepper, product search, delivery
   and the customer's note, live totals. Logical properties only, so the dialog mirrors in Arabic (RTL). */
.oe-form { gap: 20px; }
.oe-products { gap: 10px; }

/* Lines: thumb | product | qty stepper | unit price | line total | remove; an error spans under them. */
.oe-head, .oe-line {
  display: grid; gap: 6px 12px; align-items: center;
  grid-template-columns: 36px minmax(0, 1fr) auto 128px minmax(88px, auto) 32px;
  grid-template-areas: "thumb what step price total remove" ". err err err err err";
}
.oe-head { padding: 0 12px; grid-template-areas: "thumb what step price total remove"; }
.oe-head .oe-h-what { grid-area: what; }
.oe-head .oe-h-step { grid-area: step; text-align: center; min-width: 116px; }
.oe-head .oe-h-price { grid-area: price; }
.oe-head .oe-h-total { grid-area: total; text-align: end; }
.oe-lines { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.oe-lines:empty { display: none; }
.oe-line { padding: 10px 12px; border-top: 1px solid var(--line); border-inline-start: 3px solid transparent; }
.oe-line:first-child { border-top: 0; border-start-start-radius: var(--radius-sm); border-start-end-radius: var(--radius-sm); }
.oe-line:last-child { border-end-start-radius: var(--radius-sm); border-end-end-radius: var(--radius-sm); }
.oe-line.changed { border-inline-start-color: var(--accent); }
.oe-line.invalid { border-inline-start-color: var(--crit); background: var(--crit-soft); }
.oe-line > .thumb { grid-area: thumb; }
.oe-what { grid-area: what; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.oe-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-meta { gap: 4px 8px; min-width: 0; }
.oe-new { font-size: 11px; }
.oe-stock { color: var(--muted); }
.oe-stock.over { color: var(--crit-ink); font-weight: 550; }
.oe-step {
  grid-area: step; display: inline-flex; align-items: center; justify-self: center;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface);
}
.oe-step:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.oe-step .input { width: 44px; height: 30px; border: 0; padding: 0 2px; text-align: center; background: transparent; font-variant-numeric: tabular-nums; }
.oe-step .input:focus { box-shadow: none; }
.oe-step .btn { width: 34px; height: 30px; border-radius: 0; }
.oe-price { grid-area: price; min-width: 0; }
.oe-price.prefix .input { height: 30px; }
.oe-price-ro { color: var(--ink-2); }
.oe-line-total { grid-area: total; text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.oe-remove { grid-area: remove; }
.oe-err { grid-area: err; }
.oe-list-err { font-size: 12px; color: var(--crit-ink); }

/* Add a product: a search box and its result list, in the flow (works the same on phones). */
.oe-add { display: flex; flex-direction: column; gap: 6px; }
.oe-add .input.search { width: 100%; }
.oe-results {
  max-height: 288px; overflow: auto; overscroll-behavior: contain;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface); box-shadow: var(--shadow);
}
.oe-res {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; border-top: 1px solid var(--line);
  background: none; color: inherit; font: inherit; text-align: start; cursor: pointer;
}
.oe-res:first-child { border-top: 0; }
.oe-res:hover, .oe-res:focus-visible { background: var(--surface-2); outline: none; }
.oe-res[disabled] { opacity: .55; cursor: not-allowed; }
.oe-res-t { min-width: 0; }
.oe-res-t > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oe-res-price { white-space: nowrap; font-variant-numeric: tabular-nums; }
.oe-res-msg { padding: 10px 12px; }

.oe-totals-wrap { display: flex; justify-content: flex-end; }
.oe-totals { min-width: min(280px, 100%); }
.oe-ship { gap: 8px; align-items: center; flex-wrap: nowrap; }
.oe-ship .prefix { flex: 1; min-width: 0; }
.oe-ship-ro { font-variant-numeric: tabular-nums; }
.oe-address, .oe-note { min-height: 64px; }
.oe-sum { min-width: 0; }

/* Phones: the product on its own row (thumb, name, remove), then stepper, price and total. */
@media (max-width: 640px) {
  .oe-head { display: none; }
  .oe-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .oe-line > .thumb { order: 1; }
  .oe-what { order: 2; flex: 1 1 calc(100% - 100px); }
  .oe-remove { order: 3; }
  .oe-step { order: 4; flex: none; }
  .oe-step .input { width: 38px; }
  .oe-step .btn { width: 30px; }
  .oe-price { order: 5; flex: 0 1 96px; }
  .oe-line-total { order: 6; flex: none; margin-inline-start: auto; }
  .oe-err { order: 7; flex-basis: 100%; }
  .oe-totals-wrap { justify-content: stretch; }
  .oe-totals { min-width: 0; width: 100%; }
  .drawer-f .oe-sum { flex: 1 0 100%; }
}
