:root {
  --teal: #00B3A6; --green: #7AC943; --amber: #FFC83D;
  --teal-deep: #0E6E7A; --teal-bright: #22D3C5; --mint: #E6F7F5;
  --line: #E5E7EB; --ink: #0F2A2E; --muted: #5B6B6E; --bg: #FFFFFF;
  --danger: #E5484D; --radius: 14px;
  --green-soft: #EAF7DF; --amber-soft: #FFF4D1; --danger-soft: #FDE9EA;
  --shadow: 0 1px 2px rgba(15,42,46,.06), 0 6px 20px rgba(15,42,46,.06);
  --font: 'Cairo', 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 64px; --side-w: 244px;
}
html[lang="en"] { --font: 'Inter', 'Cairo', system-ui, sans-serif; }
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); color: var(--ink); background: #F6FBFA; font-size: 16px; line-height: 1.6; min-height: 100vh; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.3; color: var(--ink); }
h1 { font-size: 1.6rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
a { color: var(--teal-deep); }
button, input, select, textarea { font: inherit; color: inherit; }
.skip { position: absolute; inset-inline-start: -999px; top: 0; background: var(--teal-deep); color: #fff; padding: 8px 14px; z-index: 100; }
.skip:focus { inset-inline-start: 8px; }
:focus-visible { outline: 3px solid var(--teal-bright); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); } .small { font-size: .875rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 14px; }
.grow { flex: 1 1 auto; }
.num { font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: start; }

/* boot + spinner */
.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 18px; }
.boot-mark { font-weight: 700; font-size: 2rem; color: var(--teal-deep); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--mint); border-top-color: var(--teal); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* shell */
.shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 8px 14px; min-height: 60px; }
.brand { font-weight: 700; font-size: 1.35rem; color: var(--teal-deep); text-decoration: none; display: flex; align-items: baseline; gap: 8px; }
.brand small { font-family: 'Inter', sans-serif; font-weight: 500; font-size: .8rem; color: var(--muted); }
.topbar .spacer { flex: 1; }
.icon-btn { position: relative; width: 44px; height: 44px; min-width: 44px; display: inline-grid; place-items: center; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--teal-deep); cursor: pointer; }
.icon-btn:hover { background: var(--mint); }
.icon-btn .badge { position: absolute; top: 4px; inset-inline-end: 4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--danger); color: #fff; font-size: .7rem; display: grid; place-items: center; padding: 0 4px; font-weight: 600; }
.lang-btn { font-weight: 600; font-size: .9rem; width: auto; padding: 0 12px; }
.body { display: flex; min-width: 0; }
.sidenav { display: none; }
.content { flex: 1; min-width: 0; padding: 18px 14px calc(var(--nav-h) + 28px); max-width: 1100px; margin-inline: auto; width: 100%; }
.bottomnav { position: fixed; inset-inline: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); display: flex; padding-bottom: env(safe-area-inset-bottom); }
.bottomnav a { flex: 1; min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--muted); font-size: .72rem; font-weight: 600; padding: 4px 2px; text-align: center; }
.bottomnav a[aria-current="page"] { color: var(--teal-deep); }
.bottomnav a[aria-current="page"] svg { color: var(--teal-deep); }
.bottomnav a[aria-current="page"]::before { content: ''; width: 28px; height: 3px; border-radius: 2px; background: var(--teal); margin-bottom: 2px; }
@media (min-width: 900px) {
  .sidenav { display: flex; flex-direction: column; gap: 4px; width: var(--side-w); padding: 18px 12px; background: #fff; border-inline-end: 1px solid var(--line); position: sticky; top: 60px; align-self: flex-start; height: calc(100vh - 60px); }
  .sidenav a { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 12px; border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 600; }
  .sidenav a:hover { background: var(--mint); }
  .sidenav a[aria-current="page"] { background: var(--mint); color: var(--teal-deep); }
  .bottomnav { display: none; }
  .content { padding: 28px 28px 48px; }
}
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .sub { color: var(--muted); margin: 0; }

/* menus */
.menu-wrap { position: relative; }
.menu { position: absolute; inset-inline-end: 0; top: 50px; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 6px; z-index: 50; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 12px; background: none; border: 0; border-radius: 10px; cursor: pointer; text-align: start; text-decoration: none; color: var(--ink); }
.menu button:hover, .menu a:hover { background: var(--mint); }
.menu .head { padding: 8px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.notif-panel { width: min(360px, 92vw); max-height: 70vh; overflow: auto; padding: 0; }
.notif { padding: 12px 14px; border-bottom: 1px solid var(--line); display: block; }
.notif.unread { background: var(--mint); }
.notif:last-child { border-bottom: 0; }

/* surfaces */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.card.hover { transition: transform .2s ease, box-shadow .2s ease; }
.card.hover:hover { transform: translateY(-3px); box-shadow: 0 10px 28px rgba(14,110,122,.14); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.stat { display: flex; align-items: center; gap: 14px; }
.stat .ico { width: 48px; height: 48px; border-radius: 14px; background: var(--mint); color: var(--teal-deep); display: grid; place-items: center; flex: none; }
.stat .val { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.hero { position: relative; overflow: hidden; border-radius: 20px; padding: 22px 18px; background: linear-gradient(135deg, var(--teal-deep), var(--teal)); color: #fff; margin-bottom: 18px; }
.hero h1, .hero p { color: #fff; position: relative; z-index: 1; }
.hero::before, .hero::after { content: ''; position: absolute; border-radius: 50%; filter: blur(30px); opacity: .55; animation: float 9s ease-in-out infinite; }
.hero::before { width: 180px; height: 180px; background: var(--green); inset-inline-end: -40px; top: -60px; }
.hero::after { width: 150px; height: 150px; background: var(--amber); inset-inline-start: -30px; bottom: -70px; animation-delay: -4s; }
@keyframes float { 50% { transform: translate(14px, 10px) scale(1.08); } }
.wave { position: absolute; inset-inline: 0; bottom: -1px; height: 26px; z-index: 1; color: #F6FBFA; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 20px; border-radius: 12px; border: 2px solid var(--teal-deep); background: var(--teal-deep); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .15s ease, box-shadow .15s ease, background .15s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 6px 14px rgba(14,110,122,.25); }
.btn:active { transform: translateY(0); }
.btn.secondary { background: #fff; color: var(--teal-deep); }
.btn.danger { background: #fff; color: var(--danger); border-color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--teal-deep); }
.btn.big { min-height: 56px; font-size: 1.1rem; padding: 0 26px; }
.btn.small { min-height: 44px; padding: 0 14px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.btn .spinner { width: 18px; height: 18px; border-width: 2px; }

/* pills */
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 28px; padding: 2px 12px; border-radius: 999px; font-size: .82rem; font-weight: 600; white-space: nowrap; }
.pill::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.pill.ok { color: #3F7D1B; background: var(--green-soft); }
.pill.low { color: #8A6200; background: var(--amber-soft); }
.pill.out { color: #B3262B; background: var(--danger-soft); }
.pill.info { color: var(--teal-deep); background: var(--mint); }
.pill.neutral { color: var(--muted); background: #EEF1F2; }

/* forms */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .85rem; margin-top: 3px; display: block; }
.input, select.input, textarea.input { width: 100%; min-height: 48px; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; }
.input:focus { border-color: var(--teal); outline: 3px solid rgba(34,211,197,.3); }
textarea.input { min-height: 90px; resize: vertical; }
.input.err { border-color: var(--danger); }
.field-error { color: var(--danger); font-size: .85rem; margin-top: 3px; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; width: 100%; height: 100%; z-index: 2; }
.switch i { position: absolute; inset: 0; border-radius: 15px; background: #CBD5D6; transition: background .2s; }
.switch i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + i { background: var(--teal); }
html[dir="rtl"] .switch input:checked + i::after { transform: translateX(-22px); }
html[dir="ltr"] .switch input:checked + i::after { transform: translateX(22px); }
.switch input:focus-visible + i { outline: 3px solid var(--teal-bright); outline-offset: 2px; }
.sw-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tag { min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; cursor: pointer; font-weight: 500; }
.tag[aria-pressed="true"] { background: var(--mint); border-color: var(--teal); color: var(--teal-deep); font-weight: 600; }
.seg { display: flex; gap: 8px; flex-wrap: wrap; }

/* lists + tables */
.list { display: grid; gap: 10px; }
.item { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: grid; gap: 8px; }
.item .top { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.item .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; min-width: 560px; }
th, td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; background: #FAFCFC; }
tr:last-child td { border-bottom: 0; }

/* empty / skeleton / notice */
.empty { text-align: center; padding: 34px 16px; color: var(--muted); display: grid; justify-items: center; gap: 10px; }
.empty .ico { width: 72px; height: 72px; border-radius: 50%; background: var(--mint); color: var(--teal-deep); display: grid; place-items: center; animation: bob 3.2s ease-in-out infinite; }
.empty h3 { color: var(--ink); margin: 0; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.skel { background: linear-gradient(90deg, #EEF3F3 25%, #F8FBFB 50%, #EEF3F3 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.skel.line { height: 16px; margin: 8px 0; } .skel.block { height: 90px; border-radius: var(--radius); margin-bottom: 10px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--amber-soft); border: 1px solid #F3DA8C; color: #5C4300; }
.notice.info { background: var(--mint); border-color: #BFE8E3; color: var(--teal-deep); }
.notice.err { background: var(--danger-soft); border-color: #F4C2C4; color: #8E1D21; }
.notice svg { flex: none; margin-top: 2px; }
.locked { text-align: center; padding: 36px 18px; display: grid; justify-items: center; gap: 10px; }
.locked .ico { width: 84px; height: 84px; border-radius: 50%; background: var(--amber-soft); color: #8A6200; display: grid; place-items: center; }

/* toasts + modal */
.toasts { position: fixed; z-index: 90; inset-inline: 12px; bottom: calc(var(--nav-h) + 16px); display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow); max-width: 480px; animation: rise .3s ease; }
.toast.ok { background: var(--teal-deep); } .toast.err { background: #B3262B; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.modal-back { position: fixed; inset: 0; background: rgba(15,42,46,.5); z-index: 80; display: grid; place-items: center; padding: 14px; animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.modal { background: #fff; border-radius: 18px; padding: 20px; width: min(520px, 100%); max-height: 90vh; overflow: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); animation: rise .25s ease; }

/* auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 18px; background: radial-gradient(900px 400px at 85% -10%, rgba(34,211,197,.25), transparent), radial-gradient(700px 400px at 0% 100%, rgba(255,200,61,.22), transparent), #F6FBFA; }
.auth-card { width: min(440px, 100%); background: #fff; border-radius: 22px; padding: 26px 22px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.auth-card .logo { text-align: center; margin-bottom: 14px; }
.auth-card .logo b { display: block; font-size: 2.1rem; color: var(--teal-deep); line-height: 1.1; }
.auth-card .logo span { color: var(--muted); font-size: .92rem; }
.role-cards { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.role-card { border: 2px solid var(--line); border-radius: 16px; background: #fff; padding: 16px 10px; cursor: pointer; display: grid; justify-items: center; gap: 6px; text-align: center; min-height: 128px; transition: transform .2s, border-color .2s, box-shadow .2s; }
.role-card:hover { transform: translateY(-3px); border-color: var(--teal); box-shadow: var(--shadow); }
.role-card[aria-pressed="true"] { border-color: var(--teal-deep); background: var(--mint); }
.role-card .ico { width: 52px; height: 52px; border-radius: 16px; background: var(--mint); color: var(--teal-deep); display: grid; place-items: center; }
.role-card b { font-size: 1.05rem; }
.role-card small { color: var(--muted); font-size: .8rem; line-height: 1.3; }
.lang-float { position: absolute; top: 12px; inset-inline-end: 12px; }

/* pickup code + stepper */
.code-box { text-align: center; padding: 22px 12px; border-radius: 18px; background: linear-gradient(135deg, var(--mint), #fff); border: 2px dashed var(--teal); }
.code { font-size: clamp(2.4rem, 11vw, 3.6rem); font-weight: 700; letter-spacing: .14em; color: var(--teal-deep); direction: ltr; unicode-bidi: isolate; font-family: 'Inter', monospace; }
.stepper { display: flex; gap: 6px; margin-bottom: 18px; }
.stepper i { flex: 1; height: 6px; border-radius: 3px; background: var(--line); transition: background .3s; }
.stepper i.done { background: var(--teal); }
.stepper i.now { background: var(--amber); }
.choice { text-align: start; width: 100%; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px 14px; cursor: pointer; display: grid; gap: 4px; min-height: 56px; }
.choice:hover { border-color: var(--teal); }
.choice[aria-pressed="true"], .choice.sel { border-color: var(--teal-deep); background: var(--mint); }
.med-line { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: #FAFCFC; }
.med-line .f { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; }

/* scan */
.scan-box { position: relative; background: #0b1a1c; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/3; display: grid; place-items: center; color: #fff; }
.scan-box video { width: 100%; height: 100%; object-fit: cover; }
.scan-box .frame { position: absolute; inset: 18% 12%; border: 3px solid var(--teal-bright); border-radius: 14px; box-shadow: 0 0 0 999px rgba(0,0,0,.28); pointer-events: none; }
.qty-ctl { display: flex; align-items: center; gap: 10px; }
.qty-ctl .input { width: 90px; text-align: center; }
.qty-ctl .btn { min-width: 52px; padding: 0; }

/* tour */
.tour-back { position: fixed; inset: 0; z-index: 95; }
.tour-hl { position: fixed; z-index: 96; border-radius: 12px; box-shadow: 0 0 0 9999px rgba(15,42,46,.55); border: 3px solid var(--amber); transition: all .25s ease; pointer-events: none; }
.tour-pop { position: fixed; z-index: 97; width: min(340px, calc(100vw - 24px)); background: #fff; border-radius: 16px; padding: 16px; box-shadow: 0 16px 48px rgba(0,0,0,.35); animation: rise .25s ease; }
.tour-pop h3 { margin-bottom: 4px; color: var(--teal-deep); }
.tour-dots { display: flex; gap: 5px; margin: 8px 0 12px; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.tour-dots i.on { background: var(--teal); }

.reveal { animation: reveal .5s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(16px); } }
.reveal:nth-child(2) { animation-delay: .08s; } .reveal:nth-child(3) { animation-delay: .16s; } .reveal:nth-child(4) { animation-delay: .24s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
