:root {
  --sam-yellow: #F2C200;
  --sam-gray: #3C3C3B;
  --bg: #F6F6F4;
  --card: #FFFFFF;
  --text: #1E1E1E;
  --muted: #6B6B6B;
  --line: #E3E3E0;
  --ok: #1F7A3D;
  --warn: #A15C00;
  --bad: #B3261E;
  --radius: 14px;
  font-size: 17px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }

.bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 8px;
  background: var(--sam-gray); color: #fff; padding: 12px 16px; padding-top: max(12px, env(safe-area-inset-top)); }
.bar h1 { flex: 1; margin: 0; font-size: 1.1rem; font-weight: 700; }
.bar h1::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: var(--sam-yellow); margin-inline-end: 8px; vertical-align: middle; }
.icon-btn, .link-btn { background: none; border: 0; color: #fff; font: inherit; padding: 6px 10px; cursor: pointer; }
.icon-btn { font-size: 1.3rem; }

main { max-width: 640px; margin: 0 auto; padding: 16px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); min-height: 110px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  font-size: 1.1rem; font-weight: 700; color: var(--text); cursor: pointer; }
.tile .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--sam-yellow); display: grid; place-items: center;
  font-size: 1.4rem; color: var(--sam-gray); }
.tile:active { transform: scale(.98); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--muted); font-size: .9rem; }
.stat { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin-top: 12px; }
.stat b { display: block; font-size: 1.2rem; }

label { display: block; font-weight: 600; margin: 12px 0 6px; }
input, select, textarea { width: 100%; font: inherit; padding: 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; color: var(--text); }
input:focus, select:focus { outline: 2px solid var(--sam-yellow); border-color: var(--sam-yellow); }

.btn { display: block; width: 100%; padding: 14px; border: 0; border-radius: 12px; font: inherit; font-weight: 700;
  background: var(--sam-yellow); color: var(--sam-gray); cursor: pointer; margin-top: 14px; }
.btn.secondary { background: #fff; border: 1px solid var(--line); color: var(--text); }
.btn:disabled { opacity: .55; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.list li .sku { color: var(--muted); font-size: .85rem; direction: ltr; unicode-bidi: isolate; }

.qty { display: flex; align-items: center; gap: 6px; }
.qty button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: #fff; font-size: 1.2rem; }
.qty input { width: 76px; text-align: center; padding: 8px; }

.pill { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: #EEE; }
.pill.ok { background: #E3F3E8; color: var(--ok); }
.pill.warn { background: #FFF1D6; color: var(--warn); }
.pill.bad { background: #FBE4E2; color: var(--bad); }

.alert { border-radius: 12px; padding: 12px; margin: 12px 0; background: #FFF1D6; color: var(--warn); }
.alert.ok { background: #E3F3E8; color: var(--ok); }
.alert.bad { background: #FBE4E2; color: var(--bad); }

#toast { position: fixed; inset-inline: 16px; bottom: 20px; background: var(--sam-gray); color: #fff; padding: 12px 16px;
  border-radius: 12px; text-align: center; z-index: 20; }

.num { direction: ltr; unicode-bidi: isolate; }

/* v0.6 — product picture slot (placeholder until Zoho pictures are added) + "ask the office" price note */
.list li.item-row { display: flex; gap: 10px; align-items: flex-start; }
.item-row .item-body { flex: 1; min-width: 0; }
.pic { flex: 0 0 52px; width: 52px; height: 52px; border-radius: 10px; border: 1px dashed var(--line);
  background: #F7F7F5; color: #A3A3A0; display: flex; align-items: center; justify-content: center; }
.pic.has { border-style: solid; color: var(--muted); }
.ask { color: #9A5B00; font-size: .85rem; margin-top: 2px; }

/* v0.8 — per-unit discount in the order review */
.disc-row { display: grid; grid-template-columns: 1fr 120px; gap: 4px 8px; align-items: center; margin-top: 6px; }
.disc-lbl { margin: 0; font-weight: 600; font-size: .85rem; }
.disc-in { padding: 8px; text-align: center; }
.disc-range, .disc-out { grid-column: 1 / -1; font-size: .8rem; }
.disc-out { color: var(--ok); }
.disc-out.bad { color: var(--bad); font-weight: 700; }

/* v1.0 — real product picture over the placeholder icon */
.pic { position: relative; overflow: hidden; }
.pic img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: #fff; }
.ret-why { margin-top: 6px; font-size: .9rem; }
.chat-log { display: flex; flex-direction: column; gap: 8px; padding-bottom: 90px; }
.chat-msg { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; max-width: 88%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; background: #FFF6D6; }
.chat-who { font-size: .8rem; font-weight: 600; margin-bottom: 2px; }
.chat-body { white-space: normal; word-wrap: break-word; }
.chat-del { font-size: .75rem; color: var(--bad); padding: 0; margin-top: 2px; }
.chat-send { position: fixed; bottom: 0; left: 0; right: 0; display: flex; gap: 8px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--bg, #f6f6f4); border-top: 1px solid var(--line); }
.chat-send textarea { flex: 1; margin: 0; }
