:root {
    --bg: #0f1115;
    --surface: #181b21;
    --surface-2: #20242c;
    --border: rgba(255, 255, 255, .08);
    --text: #f4f5f7;
    --text-2: #c9ccd3;
    --muted: #8a8f9a;
    --brand: #fc303a;
    --brand-2: #ff6a3d;
    --emerald: #22c55e;
    --amber: #f5a623;
    --sky: #0ea5e9;
    --violet: #8b5cf6;
    --rose: #ef4444;
    --radius: 18px;
    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; font-size: 15px; }
body { min-height: 100dvh; overscroll-behavior-y: contain; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.mono { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; letter-spacing: .02em; }
[hidden] { display: none !important; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.splash { flex: 1; display: grid; place-items: center; }
.splash img { height: 42px; opacity: .9; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .4; } }

/* header */
.top { position: sticky; top: 0; z-index: 20; padding: calc(14px + var(--safe-t)) 18px 14px; background: linear-gradient(180deg, rgba(15,17,21,.98), rgba(15,17,21,.86)); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.top h1 { margin: 0; font-size: 17px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top .sub { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }
.icon-btn { width: 42px; height: 42px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; position: relative; flex-shrink: 0; cursor: pointer; }
.icon-btn svg { width: 20px; height: 20px; }
.dot { position: absolute; top: 7px; inset-inline-end: 7px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--brand); font-size: 10px; font-weight: 700; display: grid; place-items: center; border: 2px solid var(--bg); }

.content { flex: 1; padding: 16px 16px calc(96px + var(--safe-b)); }

/* hero */
.hero { position: relative; overflow: hidden; border-radius: 22px; padding: 18px; background: #15171c; border: 1px solid var(--border); }
.hero::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 10% 110%, rgba(252,48,58,.5), transparent 60%), radial-gradient(ellipse at 100% -10%, rgba(139,92,246,.35), transparent 55%); }
.hero > * { position: relative; }
.hero .hello { font-size: 13px; color: rgba(255,255,255,.6); }
.hero .name { font-size: 20px; font-weight: 700; margin-top: 2px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
.stat { background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 10px; }
.stat b { display: block; font-size: 20px; }
.stat span { font-size: 11px; color: rgba(255,255,255,.6); }

/* tracking switch */
.track { margin-top: 14px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.track .pulse { width: 12px; height: 12px; border-radius: 99px; background: var(--muted); flex-shrink: 0; }
.track.on .pulse { background: var(--emerald); box-shadow: 0 0 0 0 rgba(34,197,94,.6); animation: ring 1.6s infinite; }
@keyframes ring { 70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); } 100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); } }
.track .txt { flex: 1; min-width: 0; }
.track .txt b { display: block; font-size: 14px; }
.track .txt small { color: var(--muted); font-size: 12px; }
.switch { width: 52px; height: 30px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--border); position: relative; cursor: pointer; flex-shrink: 0; transition: .2s; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; border-radius: 99px; background: #fff; transition: .2s; }
.switch.on { background: var(--emerald); }
.switch.on::after { inset-inline-start: 25px; }

/* tabs */
.tabs { display: flex; gap: 6px; margin: 18px 0 12px; background: var(--surface); padding: 5px; border-radius: 14px; border: 1px solid var(--border); }
.tabs button { flex: 1; border: 0; background: none; padding: 10px; border-radius: 10px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tabs button.active { background: var(--surface-2); color: var(--text); }

/* cards */
.list { display: flex; flex-direction: column; gap: 10px; }
.ship { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.ship:active { transform: scale(.99); }
.ship .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ship .who { font-weight: 700; font-size: 16px; }
.ship .addr { color: var(--text-2); font-size: 13px; margin-top: 4px; line-height: 1.6; }
.ship .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: rgba(255,255,255,.07); color: var(--text-2); white-space: nowrap; }
.tone-emerald { background: rgba(34,197,94,.14); color: #4ade80; }
.tone-amber { background: rgba(245,166,35,.15); color: #fbbf24; }
.tone-sky { background: rgba(14,165,233,.15); color: #38bdf8; }
.tone-violet { background: rgba(139,92,246,.16); color: #a78bfa; }
.tone-rose { background: rgba(239,68,68,.15); color: #f87171; }
.tone-orange { background: rgba(249,115,22,.15); color: #fb923c; }
.tone-slate, .tone-indigo { background: rgba(255,255,255,.07); color: var(--text-2); }
.cod { font-weight: 700; color: #fbbf24; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.card h3 { margin: 0 0 12px; font-size: 13px; color: var(--muted); font-weight: 600; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; font-size: 14px; }
.kv span:first-child { color: var(--muted); }
.big { font-size: 22px; font-weight: 700; }
.actions-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.chip-btn { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 600; cursor: pointer; }
.chip-btn svg { width: 22px; height: 22px; }

/* buttons */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 54px; border-radius: 16px; border: 1px solid transparent; font-weight: 700; font-size: 16px; cursor: pointer; transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn svg { width: 20px; height: 20px; }
.btn-primary { background: linear-gradient(90deg, var(--brand), var(--brand-2)); color: #fff; box-shadow: 0 10px 30px -10px rgba(252,48,58,.7); }
.btn-success { background: var(--emerald); color: #04230f; }
.btn-danger { background: rgba(239,68,68,.12); color: #f87171; border-color: rgba(239,68,68,.35); }
.btn-ghost { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* sticky action bar */
.bar { position: fixed; inset-inline: 0; bottom: 0; z-index: 25; padding: 12px 16px calc(12px + var(--safe-b)); background: linear-gradient(0deg, rgba(15,17,21,1) 70%, rgba(15,17,21,0)); }
.bar .inner { max-width: 528px; margin: 0 auto; display: flex; gap: 10px; }

/* bottom nav */
.nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 25; background: rgba(21,23,28,.96); backdrop-filter: blur(14px); border-top: 1px solid var(--border); padding-bottom: var(--safe-b); }
.nav .inner { max-width: 560px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0 12px; font-size: 11.5px; font-weight: 600; color: var(--muted); position: relative; }
.nav a svg { width: 23px; height: 23px; }
.nav a.active { color: var(--text); }
.nav a.active::before { content: ''; position: absolute; top: 0; width: 34px; height: 3px; border-radius: 0 0 4px 4px; background: var(--brand); }
.nav .dot { top: 4px; inset-inline-end: calc(50% - 22px); }

/* forms */
.login { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: calc(28px + var(--safe-t)) 22px 28px; position: relative; overflow: hidden; }
.login::before { content: ''; position: absolute; inset: -20% -30% auto; height: 70%; background: radial-gradient(ellipse at 30% 40%, rgba(252,48,58,.35), transparent 60%), radial-gradient(ellipse at 80% 10%, rgba(139,92,246,.25), transparent 55%); pointer-events: none; }
.login > * { position: relative; }
.login .logo { height: 40px; margin-bottom: 26px; }
.login h2 { margin: 0; font-size: 24px; }
.login p { margin: 6px 0 26px; color: var(--muted); }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.field { width: 100%; height: 54px; border-radius: 15px; background: var(--surface); border: 1px solid var(--border); padding: 0 16px; font-size: 16px; outline: none; transition: border-color .2s; }
.field:focus { border-color: var(--brand); }
textarea.field { height: 90px; padding: 12px 16px; resize: none; }
.pin { letter-spacing: .5em; text-align: center; font-size: 22px; font-weight: 700; }
.form-row { margin-bottom: 14px; }
.err { color: #f87171; font-size: 13px; margin: 4px 0 12px; min-height: 18px; }
.hint { color: var(--muted); font-size: 12.5px; line-height: 1.7; }

/* sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; animation: fade .15s; }
.sheet { width: 100%; max-width: 560px; margin: 0 auto; background: var(--surface); border-radius: 24px 24px 0 0; border-top: 1px solid var(--border); padding: 10px 18px calc(18px + var(--safe-b)); max-height: 88dvh; overflow-y: auto; animation: up .22s cubic-bezier(.2,.8,.2,1); }
.sheet .grab { width: 44px; height: 5px; border-radius: 9px; background: rgba(255,255,255,.15); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 14px; font-size: 18px; }
.reasons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.reasons label { padding: 12px; border-radius: 13px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13.5px; font-weight: 600; cursor: pointer; text-align: center; }
.reasons input { display: none; }
.reasons label:has(input:checked) { border-color: var(--brand); background: rgba(252,48,58,.12); color: #fff; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* misc */
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; opacity: .5; margin-bottom: 10px; }
.empty b { display: block; color: var(--text-2); font-size: 15px; margin-bottom: 4px; }
.timeline { position: relative; padding-inline-start: 18px; }
.timeline::before { content: ''; position: absolute; inset-inline-start: 5px; top: 6px; bottom: 6px; width: 2px; background: var(--border); }
.tl { position: relative; padding: 6px 0 10px; }
.tl::before { content: ''; position: absolute; inset-inline-start: -17px; top: 11px; width: 10px; height: 10px; border-radius: 99px; background: var(--surface-2); border: 2px solid var(--muted); }
.tl b { font-size: 13.5px; }
.tl small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.notif { display: flex; gap: 12px; padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.notif.unread { border-color: rgba(252,48,58,.4); background: linear-gradient(90deg, rgba(252,48,58,.08), var(--surface)); }
.notif .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; }
.notif .ic svg { width: 20px; height: 20px; }
.notif b { display: block; font-size: 14.5px; }
.notif p { margin: 3px 0 0; color: var(--text-2); font-size: 13px; line-height: 1.6; }
.notif small { color: var(--muted); font-size: 11.5px; }
.banner { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 16px; background: rgba(14,165,233,.1); border: 1px solid rgba(14,165,233,.3); margin-top: 12px; font-size: 13px; }
.banner button { flex-shrink: 0; border: 0; border-radius: 10px; padding: 8px 12px; background: var(--sky); color: #031722; font-weight: 700; cursor: pointer; }
.banner > svg { width: 22px; height: 22px; flex-shrink: 0; color: var(--sky); }
.badge svg { width: 13px; height: 13px; }
.toast { position: fixed; z-index: 60; inset-inline: 16px; bottom: calc(96px + var(--safe-b)); max-width: 528px; margin: 0 auto; padding: 13px 16px; border-radius: 14px; background: #f4f5f7; color: #111; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.4); animation: up .2s; }
.toast.err { background: #fecaca; color: #7f1d1d; }
.spinner { width: 20px; height: 20px; border-radius: 99px; border: 2.5px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.skel { height: 108px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%); background-size: 200% 100%; animation: sh 1.2s infinite; }
@keyframes sh { to { background-position: -200% 0; } }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.avatar { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; font-size: 24px; font-weight: 700; background: linear-gradient(135deg, var(--brand), var(--violet)); }
