/* تخطيط التطبيقات الثلاثة */
:root { --primary: #ea580c; --primary-dark: #9a3412; --primary-soft: #ffedd5; }
body.driver { --primary: #0f766e; --primary-dark: #115e59; --primary-soft: #ccfbf1; }
body.admin { --primary: #1e3a8a; --primary-dark: #172554; --primary-soft: #dbeafe; }
body { padding-bottom: 76px; }
.app-bar { position: sticky; top: 0; z-index: 20; background: var(--primary); color: #fff; display: flex; align-items: center; gap: 10px; padding: 10px 14px; box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
.app-bar h1 { font-size: 18px; flex: 1; }
.app-bar .icon-btn { color: #fff; }
.app-bar .icon-btn:hover { background: rgba(255, 255, 255, .15); }
main#view { max-width: 720px; margin: 0 auto; padding: 14px; }
body.admin main#view { max-width: 1000px; }
.bottom-nav { position: fixed; bottom: 0; right: 0; left: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); display: flex; box-shadow: 0 -4px 16px rgba(0, 0, 0, .06); padding-bottom: env(safe-area-inset-bottom); }
.bottom-nav a { flex: 1; text-align: center; padding: 8px 2px 6px; color: var(--muted); font-size: 11.5px; font-weight: 700; position: relative; }
.bottom-nav a span { display: block; font-size: 22px; line-height: 1.2; }
.bottom-nav a.on { color: var(--primary); }
.bottom-nav a .dot { position: absolute; top: 4px; right: 50%; margin-right: -22px; background: var(--danger); color: #fff; border-radius: 999px; min-width: 18px; height: 18px; font-size: 11px; display: grid; place-items: center; padding: 0 4px; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }
.card h3 { font-size: 16px; margin-bottom: 8px; }
.sec-title { font-size: 15px; font-weight: 800; margin: 16px 2px 8px; display: flex; justify-content: space-between; align-items: center; }

/* إعلانات */
.ad { display: block; border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; min-height: 84px; background: linear-gradient(135deg, #fb923c, #c2410c); color: #fff; position: relative; box-shadow: var(--shadow); }
.ad img { width: 100%; display: block; max-height: 150px; object-fit: cover; }
.ad .ad-t { position: absolute; inset: auto 0 0 0; padding: 8px 12px; font-weight: 800; background: linear-gradient(transparent, rgba(0, 0, 0, .65)); }
.ad.noimg { display: grid; place-items: center; text-align: center; padding: 20px 14px; font-weight: 800; font-size: 16px; }
.ad.noimg .ad-t { position: static; background: none; padding: 0; }
.ad.bottom { background: linear-gradient(135deg, #fbbf24, #b45309); margin-top: 8px; }

/* بلاطات الرئيسية */
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
.home-tile { background: #fff; border-radius: 18px; box-shadow: var(--shadow); padding: 20px 10px; text-align: center; font-weight: 800; font-size: 16px; cursor: pointer; border: 0; color: var(--text); }
.home-tile span { display: block; font-size: 44px; margin-bottom: 6px; }
.home-tile.main { grid-column: 1 / -1; background: var(--primary); color: #fff; padding: 26px 10px; font-size: 20px; }
.home-tile small { display: block; font-weight: 600; opacity: .85; font-size: 12.5px; margin-top: 2px; }

/* داشبورد */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.tile { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 10px; text-align: center; cursor: pointer; border: 2px solid transparent; }
.tile.on { border-color: var(--primary); }
.tile b { display: block; font-size: 26px; line-height: 1.2; }
.tile small { color: var(--muted); font-weight: 700; }
.tile.t-new b { color: #ca8a04; } .tile.t-prog b { color: #2563eb; } .tile.t-done b { color: var(--ok); } .tile.t-canc b { color: var(--danger); }
.cash-box { background: linear-gradient(135deg, #0f766e, #115e59); color: #fff; border-radius: var(--radius); padding: 14px; margin-bottom: 12px; display: flex; align-items: center; gap: 12px; }
.cash-box b { font-size: 24px; display: block; }
.cash-box .btn { margin-right: auto; color: var(--text); }
.cash-box small { display: block; opacity: .85; font-size: 12.5px; }

/* كارت أوردر */
.ord { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px; margin-bottom: 10px; cursor: pointer; border-right: 5px solid var(--line); }
.ord .top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.ord .top b { font-size: 15px; }
.ord .top .st { margin-right: auto; }
.ord p { font-size: 13.5px; color: #334155; }
.ord .meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.ord.s-received { border-color: #eab308; } .ord.s-assigned, .ord.s-accepted { border-color: #f97316; }
.ord.s-picked_up, .ord.s-on_the_way { border-color: #2563eb; } .ord.s-delivered { border-color: var(--ok); } .ord.s-cancelled { border-color: var(--danger); }
.st-received { background: #fef9c3; color: #a16207; } .st-assigned, .st-accepted { background: #ffedd5; color: #c2410c; }
.st-picked_up { background: #dbeafe; color: #1d4ed8; } .st-delivered { background: var(--ok-soft); color: var(--ok); } .st-cancelled { background: var(--danger-soft); color: var(--danger); }

/* خط التقدم بالنقاط */
.steps { position: relative; margin: 10px 0 4px; padding-right: 4px; }
.step { display: flex; gap: 12px; position: relative; padding-bottom: 20px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ''; position: absolute; right: 11px; top: 24px; bottom: -2px; width: 3px; background: var(--line); }
.step:last-child::before { display: none; }
.step.done::before { background: var(--ok); }
.step .pt { width: 25px; height: 25px; border-radius: 50%; border: 3px solid var(--line); background: #fff; flex: none; display: grid; place-items: center; font-size: 12px; color: #fff; z-index: 1; }
.step.done .pt { background: var(--ok); border-color: var(--ok); }
.step.cur .pt { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 5px rgba(234, 88, 12, .15); animation: pulse 1.6s infinite; }
.step .tx b { display: block; font-size: 14.5px; } .step .tx small { color: var(--muted); }
.step:not(.done):not(.cur) .tx { opacity: .55; }
@keyframes pulse { 50% { box-shadow: 0 0 0 9px rgba(234, 88, 12, .05); } }
.cancel-note { background: var(--danger-soft); color: #991b1b; border-radius: 10px; padding: 8px 12px; font-weight: 700; margin-top: 8px; }

/* العروض */
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 14px; font-weight: 700; white-space: nowrap; cursor: pointer; }
.chip.on { background: var(--primary); color: #fff; border-color: var(--primary); }
.offers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.offer { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.offer .im { aspect-ratio: 4/3; background: linear-gradient(135deg, #fed7aa, #ea580c); display: grid; place-items: center; font-size: 46px; }
.offer .im img { width: 100%; height: 100%; object-fit: cover; }
.offer .bd { padding: 8px 10px 10px; }
.offer .bd b { display: block; font-size: 14px; } .offer .bd small { color: var(--muted); display: block; }
.offer .bd p { font-size: 12.5px; margin: 4px 0 6px; }

.sizes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sizes label { border: 2px solid var(--line); border-radius: 12px; padding: 10px 4px; text-align: center; font-weight: 800; cursor: pointer; font-size: 13px; }
.sizes label span { display: block; font-size: 26px; }
.sizes input { display: none; }
.sizes label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.seg label:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 8px; font-size: 14px; }
.kv dt { color: var(--muted); font-weight: 700; } .kv dd { margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.actions .btn { flex: 1; }
.paused-banner { background: #fef3c7; color: #92400e; border-radius: 12px; padding: 10px 12px; font-weight: 700; margin-bottom: 12px; }

/* الدخول */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--primary), var(--primary-dark)); }
.auth .box { background: #fff; border-radius: 22px; padding: 24px 20px; width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0, 0, 0, .3); }
.auth .logo { font-size: 56px; text-align: center; } .auth h1 { text-align: center; font-size: 22px; margin-bottom: 4px; } .auth .sub { text-align: center; color: var(--muted); margin-bottom: 18px; }
.auth .tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-bottom: 14px; }
.demo-hint { background: #f1f5f9; border-radius: 10px; padding: 8px 10px; font-size: 12px; color: var(--muted); margin-top: 12px; direction: rtl; }
.pw-wrap { position: relative; display: block; } .pw-wrap .input { padding-left: 40px; } .pw-eye { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); border: 0; background: none; cursor: pointer; font-size: 17px; }
.install-tip { background: #fff7ed; border: 1px dashed #fdba74; border-radius: 12px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }

/* الإدارة */
.table-wrap { overflow-x: auto; background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); }
table.t { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.t th, table.t td { padding: 9px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t th { background: #f8fafc; font-size: 12.5px; color: var(--muted); }
.drv-card { display: flex; align-items: center; gap: 10px; }
.drv-card .av { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-soft); display: grid; place-items: center; font-size: 22px; flex: none; }
.mini-steps { display: flex; align-items: center; gap: 0; margin: 8px 0 2px; }
.mini-steps i { width: 14px; height: 14px; border-radius: 50%; background: var(--line); flex: none; }
.mini-steps i.done { background: var(--ok); } .mini-steps i.cur { background: var(--primary); box-shadow: 0 0 0 4px rgba(30, 58, 138, .15); }
.mini-steps u { flex: 1; height: 3px; background: var(--line); } .mini-steps u.done { background: var(--ok); }
.pause-tag { background: #fef3c7; color: #92400e; border-radius: 8px; padding: 4px 8px; font-size: 12.5px; font-weight: 700; margin-top: 6px; display: inline-block; }
.rep-bar { height: 10px; background: var(--primary); border-radius: 6px; min-width: 2px; }
.range { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.co-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; background: #fff; flex: none; }
.co-name { font-size: 12px; font-weight: 700; background: rgba(255, 255, 255, .2); border-radius: 999px; padding: 2px 9px; white-space: nowrap; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; }
.logo-pick { display: flex; align-items: center; gap: 12px; }
.logo-pick img { width: 64px; height: 64px; border-radius: 14px; object-fit: cover; border: 1px solid var(--line); }
