:root {
  --purple: #7E059B;
  --purple-2: #A21FC4;
  --orange: #FD6A02;
  --ink: #14101C;
  --ink-2: #1C1727;
  --ink-3: #262034;
  --line: #332B45;
  --text: #EFEAF7;
  --muted: #A79EBE;
  --white: #ffffff;
  --bg: #F7F5FB;
  --paper: #ffffff;
  --green: #17B26A;
  --red: #E5484D;
  --amber: #F5A524;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(20, 16, 28, .08);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); color: var(--ink); background: var(--bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.02em; }
h1 { font-size: clamp(2rem, 4vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 2.4vw, 2.2rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
img { max-width: 100%; }

.wrap { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 14px; }

/* ---------- landing ---------- */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-bottom: 1px solid #E9E4F2; }
.topbar .inner { display: flex; align-items: center; gap: 22px; height: 68px; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: -.03em; font-size: 1.2rem; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--purple), var(--orange)); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .95rem; }
.nav { display: flex; gap: 18px; margin-left: auto; align-items: center; }
.nav a { color: #4A4258; font-weight: 500; font-size: .95rem; }
.nav a:hover { color: var(--purple); text-decoration: none; }

.hero { padding: 72px 0 40px; background: radial-gradient(1200px 500px at 12% -10%, #F0E4FA 0%, transparent 60%), radial-gradient(900px 420px at 90% 0%, #FFF0E4 0%, transparent 55%); }
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 48px; align-items: center; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #E9E4F2; padding: 6px 14px; border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--purple); }
.hero p.lead { font-size: 1.1rem; color: #4A4258; max-width: 46ch; }
.hero-actions { display: flex; gap: 12px; margin-top: 26px; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 10px; padding: 11px 20px; font: inherit; font-weight: 600; cursor: pointer; transition: .15s ease; background: #F1ECF8; color: var(--ink); }
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-2); color: #fff; }
.btn-orange { background: var(--orange); color: #fff; }
.btn-ghost { background: #fff; border-color: #E0D8EC; }
.btn-sm { padding: 7px 12px; font-size: .85rem; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.card { background: var(--paper); border: 1px solid #EDE8F5; border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 22px; }

.mock { background: var(--ink); border-radius: 18px; padding: 16px; color: var(--text); box-shadow: 0 30px 60px rgba(20,16,28,.25); }
.mock-head { display: flex; gap: 6px; margin-bottom: 14px; }
.mock-dot { width: 9px; height: 9px; border-radius: 50%; background: #4B4260; }
.mock-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 12px; border-radius: 10px; background: var(--ink-2); margin-bottom: 8px; font-size: .86rem; }
.mock-bar { height: 8px; border-radius: 99px; background: var(--ink-3); overflow: hidden; }
.mock-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--purple), var(--orange)); }

.section { padding: 64px 0; }
.section-head { max-width: 60ch; margin-bottom: 34px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.feature { background: #fff; border: 1px solid #EDE8F5; border-radius: var(--radius); padding: 20px; }
.feature .ico { width: 38px; height: 38px; border-radius: 10px; background: #F4EBFB; display: grid; place-items: center; margin-bottom: 12px; font-size: 1.05rem; }
.feature h3 { margin-bottom: 6px; }
.feature p { margin: 0; color: #56506A; font-size: .92rem; }

.steps { counter-reset: step; display: grid; gap: 14px; grid-template-columns: repeat(5, 1fr); }
.step { background: #fff; border: 1px solid #EDE8F5; border-radius: var(--radius); padding: 18px; }
.step::before { counter-increment: step; content: counter(step); display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--purple); color: #fff; font-size: .8rem; font-weight: 700; margin-bottom: 10px; }
.step b { display: block; margin-bottom: 4px; }
.step span { font-size: .85rem; color: #56506A; }

.cta-band { background: linear-gradient(120deg, var(--ink), #2A1240 60%, #4A1030); color: var(--text); border-radius: 22px; padding: 42px; display: grid; grid-template-columns: 1.4fr 1fr; gap: 26px; align-items: center; }
.cta-band h2 { color: #fff; }
.cta-band .muted { color: #C4B9DA; }

.site-foot { padding: 40px 0; border-top: 1px solid #E9E4F2; margin-top: 30px; color: #6A6379; font-size: .9rem; }

/* ---------- forms ---------- */
label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: #3C3550; }
.inp, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #DDD5EA; border-radius: 9px; font: inherit; background: #fff; color: var(--ink); }
.inp:focus, select:focus, textarea:focus { outline: 2px solid rgba(126,5,155,.25); border-color: var(--purple); }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- app shell ---------- */
.app { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; background: var(--ink); color: var(--text); }
.side { background: #100D18; border-right: 1px solid var(--line); padding: 18px 14px; display: flex; flex-direction: column; gap: 6px; }
.side .logo { color: #fff; margin-bottom: 14px; }
.side a.navlink { display: flex; align-items: center; gap: 10px; color: #BFB4D6; padding: 10px 12px; border-radius: 9px; font-size: .93rem; font-weight: 500; }
.side a.navlink:hover { background: var(--ink-2); color: #fff; text-decoration: none; }
.side a.navlink.active { background: var(--ink-3); color: #fff; }
.side .who { margin-top: auto; font-size: .8rem; color: var(--muted); padding: 10px 12px; border-top: 1px solid var(--line); }
.main { padding: 22px 26px 60px; overflow-x: hidden; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 1.55rem; margin: 0; color: #fff; }

.panel { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.panel h3 { color: #fff; font-size: 1rem; margin-bottom: 12px; }
.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.kpi .n { font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; }
.kpi .l { font-size: .8rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.kpi.accent .n { color: var(--orange); }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; white-space: nowrap; }
td { padding: 11px 10px; border-bottom: 1px solid #2A2440; vertical-align: middle; }
tr:hover td { background: #221C31; }
.table-wrap { overflow-x: auto; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .02em; }
.badge.new { background: #2C2545; color: #C9B8E6; }
.badge.assigned { background: #2B2A55; color: #A9B4FF; }
.badge.picked { background: #2A3B4F; color: #8FCBF5; }
.badge.out { background: #3A2E1B; color: #F2C078; }
.badge.delivered { background: #17362A; color: #6FE0AA; }
.badge.failed { background: #3B1D24; color: #F58C93; }
.badge.cancelled, .badge.returned { background: #2A2535; color: #9C93B0; }
.badge.pending { background: #3A2E1B; color: #F2C078; }

.pill { display: inline-flex; gap: 8px; align-items: center; }

.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button { background: var(--ink-2); border: 1px solid var(--line); color: #BFB4D6; padding: 8px 14px; border-radius: 999px; font: inherit; font-size: .85rem; cursor: pointer; }
.tabs button.active { background: var(--purple); border-color: var(--purple); color: #fff; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(80px); background: var(--ink-3); color: #fff; padding: 12px 20px; border-radius: 10px; box-shadow: 0 12px 30px rgba(0,0,0,.3); opacity: 0; transition: .25s ease; z-index: 90; font-size: .9rem; max-width: 90vw; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.modal { position: fixed; inset: 0; background: rgba(10,8,16,.72); display: none; place-items: center; z-index: 80; padding: 20px; }
.modal.open { display: grid; }
.modal-box { background: var(--ink-2); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(560px, 100%); max-height: 86vh; overflow: auto; color: var(--text); }
.modal-box h3 { color: #fff; }
.modal-box label { color: #C4B9DA; }
.modal-box .inp, .modal-box select, .modal-box textarea { background: #171223; border-color: var(--line); color: #fff; }

.empty { text-align: center; padding: 36px 16px; color: var(--muted); font-size: .92rem; }
.help { font-size: .8rem; color: var(--muted); }
.err { color: #F58C93; font-size: .88rem; }

/* ---------- auth / track ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(900px 400px at 50% -20%, #F1E5FA, transparent 60%), var(--bg); padding: 30px 16px; }
.auth-card { width: min(430px, 100%); background: #fff; border-radius: 18px; padding: 30px; box-shadow: 0 24px 60px rgba(20,16,28,.12); }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 4px; }

.track-page { background: var(--bg); min-height: 100vh; padding: 28px 16px 60px; }
.track-card { width: min(560px, 100%); margin: 0 auto; background: #fff; border-radius: 18px; padding: 24px; box-shadow: var(--shadow); }
.timeline { list-style: none; padding: 0; margin: 18px 0 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; border-left: 2px solid #EFE9F7; margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: #D9D2E6; }
.timeline li.done::before { background: var(--green); }
.timeline li.current::before { background: var(--orange); box-shadow: 0 0 0 4px rgba(253,106,2,.18); }
.timeline .t { font-size: .78rem; color: #7A7389; }

/* ---------- driver app ---------- */
.drv { min-height: 100vh; background: var(--ink); color: var(--text); padding: 0 0 90px; }
.drv-head { padding: 16px 16px 12px; background: #100D18; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.drv-body { padding: 14px; display: grid; gap: 12px; }
.job { background: var(--ink-2); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.job h4 { color: #fff; margin: 0 0 4px; font-size: 1rem; }
.job .addr { font-size: .88rem; color: #C4B9DA; }
.job .acts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 12px; }
.bottom-bar { position: fixed; bottom: 0; left: 0; right: 0; background: #100D18; border-top: 1px solid var(--line); display: grid; grid-template-columns: repeat(3, 1fr); z-index: 25; }
.bottom-bar a { color: #BFB4D6; text-align: center; padding: 12px 4px; font-size: .75rem; }
.bottom-bar a.active { color: #fff; }
.bottom-bar a:hover { text-decoration: none; }

@media (max-width: 1000px) {
  .hero-grid, .grid-4, .grid-3, .steps, .cta-band { grid-template-columns: 1fr 1fr; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .app { grid-template-columns: 1fr; }
  .side { flex-direction: row; overflow-x: auto; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side .logo, .side .who { display: none; }
  .side a.navlink { white-space: nowrap; }
}
@media (max-width: 680px) {
  .hero-grid, .grid-2, .grid-3, .grid-4, .steps, .cta-band, .form-grid { grid-template-columns: 1fr; }
  .hero { padding: 40px 0 20px; }
  .section { padding: 40px 0; }
  .main { padding: 16px 14px 60px; }
  .cta-band { padding: 26px; }
  .nav { gap: 10px; }
  .nav a.hide-sm { display: none; }
}

/* ---------- right-to-left (Arabic) ---------- */
[dir="rtl"] body, [dir="rtl"] .track-card, [dir="rtl"] .auth-card { text-align: right; }
[dir="rtl"] .timeline li { border-left: 0; border-right: 2px solid #EFE9F7; padding: 0 26px 18px 0; margin: 0 6px 0 0; }
[dir="rtl"] .timeline li::before { left: auto; right: -7px; }
[dir="rtl"] .timeline li:last-child { border-right-color: transparent; }
[dir="rtl"] th, [dir="rtl"] td { text-align: right; }
[dir="rtl"] .side { border-right: 0; border-left: 1px solid var(--line); }
[dir="rtl"] .hero-grid, [dir="rtl"] .spread { direction: rtl; }
[dir="rtl"] .nav { margin-left: 0; margin-right: auto; }
[dir="rtl"] .job .acts, [dir="rtl"] .bottom-bar { direction: rtl; }
@media (max-width: 1000px) { [dir="rtl"] .side { border-left: 0; } }
