/* EBT Orders — phone first. Colours = Odoo 17/18 (Ahmad 10-11-2026: «نفس الوان اودو للازرار والخلفية»):
   brand purple #714B67 (main buttons), teal #017E84 (actions), light grey page, white cards. Company gold #C9A14A for totals. */
:root {
  --o-purple: #714b67; --o-purple-dark: #5b3c53; --o-purple-soft: #f3eef2; --o-teal: #017e84; --o-teal-dark: #01666b; --o-teal-soft: #e6f4f4;
  --ink: #1f2937; --text: #374151; --muted: #6b7280; --line: #e5e7eb; --line-2: #d8dadd; --bg: #f3f4f6; --card: #ffffff;
  --ok: #1e8449; --ok-soft: #e8f5ee; --bad: #d44c59; --bad-soft: #fcebed; --warn: #b8770a; --warn-soft: #fdf3e1; --gold: #c9a14a; --wa: #1aa053;
  --r: 14px; --r-sm: 10px; --tap: 48px; --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Tahoma, Arial, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); -webkit-text-size-adjust: 100%; }
main { padding: 14px 16px 150px; max-width: 780px; margin: 0 auto; }
h1 { font-size: 17px; margin: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 700; }
h2 { font-size: 15px; margin: 20px 0 10px; color: var(--ink); font-weight: 700; letter-spacing: .2px; }
/* ---------- top bar */
.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 12px; align-items: center; padding: 8px 14px; background: #fff;
  border-bottom: 3px solid var(--o-purple); box-shadow: var(--shadow); min-height: 58px; }
.top .logo { height: 38px; width: auto; display: block; }
.top .link { color: var(--o-purple); }
.top .icon { color: var(--o-purple); font-size: 22px; }
.bar { font-size: 12px; color: var(--muted); padding: 5px 16px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; } .dot.on { background: var(--ok); } .dot.off { background: var(--bad); }
.pend { color: var(--warn); font-weight: 700; }
/* ---------- buttons (Odoo style) */
button, .btn { min-height: var(--tap); padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid var(--line-2); background: #fff; color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .15s, border-color .15s, transform .05s; }
button:active, .btn:active { transform: scale(.98); }
button:disabled { opacity: .45; cursor: default; transform: none; }
button.primary { background: var(--o-purple); border-color: var(--o-purple); color: #fff; }
button.primary:hover { background: var(--o-purple-dark); }
button.action { background: var(--o-teal); border-color: var(--o-teal); color: #fff; }
button.wa { background: var(--wa); border-color: var(--wa); color: #fff; }
button.danger { color: var(--bad); border-color: #f0c4c9; background: #fff; }
button.ghost { background: transparent; border-color: transparent; color: var(--o-purple); }
button.link, button.icon { background: none; border: 0; min-height: 0; padding: 6px 8px; font-weight: 700; }
a.btn { color: var(--o-teal); border-color: #b5dcdd; background: var(--o-teal-soft); }
/* ---------- forms */
input, textarea, select { width: 100%; min-height: var(--tap); padding: 11px 13px; border: 1px solid var(--line-2); border-radius: var(--r-sm); font: inherit; background: #fff; color: var(--ink); }
input:focus, textarea:focus { outline: none; border-color: var(--o-purple); box-shadow: 0 0 0 3px rgba(113, 75, 103, .15); }
button:focus-visible, .btn:focus-visible { outline: 3px solid rgba(113, 75, 103, .35); outline-offset: 2px; }
input[type=search] { padding-inline-start: 40px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='8' cy='8' r='6'/%3E%3Cpath d='M17 17l-4.5-4.5'/%3E%3C/svg%3E") no-repeat; background-position: 14px center; }
[dir=rtl] input[type=search] { background-position: calc(100% - 14px) center; }
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 5px; font-weight: 600; }
label.check { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 15px; margin: 0; }
label.check input { width: 22px; min-height: 22px; accent-color: var(--o-purple); }
textarea { resize: vertical; }
/* ---------- cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); }
.muted { color: var(--muted); } .small { font-size: 12px; }
.err { color: var(--bad); font-size: 14px; } .ok { color: var(--ok); font-weight: 600; }
.row { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; } .row > * { flex: 1; }
/* ---------- login */
.hero { margin: -14px -16px 0; padding: 34px 16px 64px; background: linear-gradient(160deg, #714b67 0%, #4f3449 100%); text-align: center; color: #fff; }
.hero .logos { display: flex; justify-content: center; align-items: center; gap: 26px; }
.hero .logos .ebt { height: 74px; background: #fff; border-radius: 18px; padding: 10px 12px; box-shadow: 0 6px 18px rgba(0, 0, 0, .18); }
.hero .logos .aplus { height: 92px; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .3)); }
.hero h2 { color: #fff; font-size: 20px; margin: 18px 0 2px; } .hero p { margin: 0; opacity: .85; font-size: 14px; }
.login { max-width: 420px; margin: -40px auto 20px; position: relative; } .login button { width: 100%; margin-top: 18px; }
.foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 18px; }
/* ---------- home */
.hello { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--o-purple); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; }
.hello b { display: block; color: var(--ink); font-size: 17px; }
.tile { width: 100%; min-height: 88px; justify-content: space-between; flex-wrap: wrap; font-size: 18px; border-radius: var(--r); box-shadow: var(--shadow); margin: 10px 0; text-align: start; }
.tile.primary { background: linear-gradient(135deg, #714b67, #8a5c7e); }
.tile .sub { width: 100%; font-size: 13px; font-weight: 500; opacity: .8; }
.chips { display: inline-flex; gap: 5px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 3px 9px; border-radius: 99px; background: var(--o-purple-soft); color: var(--o-purple); font-weight: 700; white-space: nowrap; }
.chip.disc, b.disc { background: #fbf3df; color: #7a5a12; }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.st-draft { background: #eef0f3; color: #4b5563; } .st-awaiting_customer { background: var(--warn-soft); color: var(--warn); }
.st-ready, .st-approved { background: var(--o-teal-soft); color: var(--o-teal-dark); } .st-rejected { background: var(--bad-soft); color: var(--bad); }
.st-in_odoo, .st-invoiced { background: var(--ok-soft); color: var(--ok); } .st-cancelled { background: #eee; color: #777; }
/* ---------- lists */
.list { list-style: none; margin: 8px 0; padding: 0; }
.list li { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 13px 14px; margin: 9px 0; cursor: pointer; box-shadow: var(--shadow); }
.list li:active { background: var(--o-purple-soft); }
.list li.empty { color: var(--muted); cursor: default; text-align: center; box-shadow: none; background: transparent; border-style: dashed; }
.l1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; } .l1 b { color: var(--ink); }
.l2 { color: var(--muted); font-size: 13px; margin-top: 3px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tabs { display: flex; gap: 6px; margin: 4px 0 10px; background: #e9eaee; padding: 4px; border-radius: 12px; }
.tabs button { flex: 1; min-height: 40px; border: 0; background: transparent; font-size: 14px; }
.tabs button.on { background: #fff; color: var(--o-purple); box-shadow: var(--shadow); }
/* ---------- customer card */
.cust { border-top: 4px solid var(--o-purple); }
.cust .l1 b { font-size: 17px; }
.cust .kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin-top: 12px; font-size: 14px; align-items: baseline; }
.cust .kv > span:nth-child(odd) { color: var(--muted); }
.badge-big { font-size: 22px; font-weight: 800; color: var(--o-purple); }
.warnbox { background: var(--warn-soft); color: var(--warn); border-radius: var(--r-sm); padding: 8px 10px; font-size: 13px; margin-top: 10px; font-weight: 600; }
/* ---------- products */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.prod { background: #fff; border: 2px solid var(--line); border-radius: var(--r); padding: 8px; display: flex; flex-direction: column; gap: 5px; box-shadow: var(--shadow); transition: border-color .15s; }
.prod.has { border-color: var(--o-purple); background: #fcfafc; }
.prod.off { opacity: .55; }
.prod img, .codecard { width: 100%; aspect-ratio: 1; object-fit: contain; background: #f7f7f9; border-radius: 10px; cursor: pointer; }
.codecard { display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 22px; color: var(--o-purple); background: var(--o-purple-soft); }
.pc { display: flex; justify-content: space-between; font-size: 14px; } .pc b { color: var(--ink); } .price { color: var(--o-teal); font-weight: 700; }
.pn { font-size: 12px; color: var(--muted); min-height: 32px; line-height: 1.3; }
.step { display: grid; grid-template-columns: 44px 1fr 44px; gap: 4px; }
.step button { min-height: 44px; padding: 0; font-size: 22px; border-radius: 10px; color: var(--o-purple); }
.step button:last-child { background: var(--o-purple); color: #fff; border-color: var(--o-purple); }
.step input { text-align: center; padding: 6px 2px; font-weight: 800; font-size: 18px; -moz-appearance: textfield; min-height: 44px; }
.step input::-webkit-outer-spin-button, .step input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.lpo { display: grid; gap: 10px; margin: 14px 0; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
/* ---------- actions + totals */
.actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 16px 0; }
.actions > span { display: contents; } .actions > span > button { width: 100%; }
.actions .primary { grid-column: 1 / -1; min-height: 56px; font-size: 17px; }
.actions .wa { grid-column: 1 / -1; }
.totals { position: fixed; bottom: 0; left: 0; right: 0; z-index: 6; background: #fff; border-top: 3px solid var(--o-purple); box-shadow: 0 -4px 14px rgba(0, 0, 0, .08);
  display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); font-size: 13px; color: var(--muted); }
.totals .tot { grid-column: 1 / -1; font-size: 19px; font-weight: 800; color: var(--o-purple); }
.totals .tot small { font-size: 12px; color: var(--muted); font-weight: 600; }
#toast { position: fixed; bottom: 104px; left: 16px; right: 16px; z-index: 20; background: #1f2937; color: #fff; padding: 13px 15px; border-radius: 12px; text-align: center; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
#toast.bad { background: var(--bad); }
.update { position: fixed; top: 64px; left: 16px; right: 16px; z-index: 21; background: var(--o-teal); color: #fff; padding: 12px; border-radius: 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between; box-shadow: var(--shadow); }
.update button { background: #fff; color: var(--o-teal); min-height: 38px; border: 0; }
.modal { position: fixed; inset: 0; z-index: 30; background: rgba(17, 24, 39, .5); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal .box { background: #fff; border-radius: var(--r); padding: 16px; width: 100%; max-width: 560px; display: grid; gap: 12px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
canvas.sig { width: 100%; height: auto; aspect-ratio: 600 / 260; border: 2px dashed var(--line-2); border-radius: 12px; touch-action: none; background: #fff; }
/* mixed Arabic/English values («90 days, Credit», «60.984 OMR»): each value takes its own direction, still aligned to the page side */
.cust .kv > :nth-child(even), .l2, .pn, .totals > div, .bar span, .warnbox { unicode-bidi: plaintext; }
[dir=rtl] .cust .kv > :nth-child(even), [dir=rtl] .l2, [dir=rtl] .pn, [dir=rtl] .totals > div { text-align: right; }
/* phone numbers are always left-to-right (Ahmad 10-11: «رقم هاتف العميل يضهر معكوسا») */
.tel { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; color: var(--o-teal); font-weight: 700; text-decoration: none; }
[dir=rtl] .cust .kv > .tel { text-align: right; }
