:root{--bg:#F4F6F9;--card:#fff;--ink:#0F172A;--muted:#475569;--line:#E2E8F0;--pri:#1D4ED8;--pri-d:#1E3A8A;--red:#B91C1C;--red-bg:#FBE0E0;--amber:#9A3412;--amber-bg:#FFF7ED;--green:#14532D;--green-bg:#DCFCE7}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--ink);font-family:'IBM Plex Sans Arabic',system-ui,sans-serif;font-size:15px}
a{color:var(--pri)}a:hover{color:var(--pri-d)}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}
.muted{color:var(--muted)}.small{font-size:12px}
.top{background:var(--ink);color:#fff;display:flex;flex-wrap:wrap;align-items:center;gap:12px 20px;padding:10px 20px}
.brand{display:flex;align-items:center;gap:10px;color:#fff;text-decoration:none}
.brand:hover{color:#fff}
.logo{width:36px;height:36px;border-radius:9px;background:var(--pri);color:#fff;display:inline-flex;align-items:center;justify-content:center;font-weight:700}
.brand-t{display:flex;flex-direction:column;line-height:1.2}.brand-t small{color:#CBD5E1;font-size:12px}
.nav{display:flex;gap:4px;flex:1 1 auto;flex-wrap:wrap}
.nav a{color:#E2E8F0;text-decoration:none;padding:8px 12px;border-radius:8px;min-height:40px;display:inline-flex;align-items:center}
.nav a:hover{background:#1E293B;color:#fff}
.who{display:flex;align-items:center;gap:10px;font-size:14px}
.who form{margin:0}
.btn-ghost{font:inherit;font-size:13px;color:#E2E8F0;background:transparent;border:1px solid #334155;border-radius:8px;padding:6px 12px;min-height:36px;cursor:pointer}
.wrap{max-width:1600px;margin:0 auto;padding:18px 20px 40px;display:flex;flex-direction:column;gap:14px}
.bar{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.h1{margin:0;font-size:22px}.h2{margin:8px 2px 0;font-size:16px}
.seg{display:flex;gap:6px}
.chip{font:inherit;font-size:14px;border:1px solid #CBD5E1;background:#fff;color:#334155;border-radius:999px;padding:8px 14px;min-height:40px;cursor:pointer}
.chip-on{background:var(--ink);color:#fff;border-color:var(--ink)}
.search{flex:1 1 320px;display:flex}
.search input{flex:1;min-width:0;font:inherit;font-size:14px;border:1px solid #CBD5E1;border-radius:10px;padding:10px 12px;min-height:42px;background:#fff}
.kpis{display:flex;flex-wrap:wrap;gap:12px}
.kpi{background:var(--card);border:1px solid var(--line);border-radius:12px;padding:12px 16px;display:flex;flex-direction:column;gap:2px;flex:1 1 170px;min-width:0}
.kpi span{font-size:12px;color:var(--muted)}.kpi strong{font-size:28px}.kpi small{font-size:12px}
.kpi-warn{border-color:#FDBA74}.kpi-warn strong{color:var(--amber)}
.kpi-red{border-color:#FCA5A5}.kpi-red strong{color:var(--red)}
.filters{display:flex;flex-wrap:wrap;gap:8px}
.split{display:flex;flex-wrap:wrap;gap:14px;align-items:flex-start}
.card{background:var(--card);border:1px solid var(--line);border-radius:12px}
.table-card{flex:999 1 640px;min-width:0;overflow:hidden}
.grow{flex:999 1 560px;min-width:0;padding:14px 16px}
.side{flex:1 1 320px;min-width:0;padding:14px 16px}
.card-h{display:flex;justify-content:space-between;align-items:baseline;gap:8px;flex-wrap:wrap;margin-bottom:10px}
.card-h h2{margin:0;font-size:16px}
section.card:not(.table-card):not(.grow):not(.side){padding:14px 16px}
.scroll{overflow-x:auto}
table{border-collapse:collapse;width:100%;font-size:14px}
.table-card table{min-width:980px}
th{font-weight:600;color:var(--muted);text-align:right;padding:10px 12px;border-bottom:1px solid var(--line);background:#F8FAFC;white-space:nowrap}
td{padding:9px 12px;border-bottom:1px solid #EEF2F6;white-space:nowrap}
tr.cx td{background:var(--red-bg);color:#7F1D1D}
tr.need td{background:var(--amber-bg)}
tr.sel td{box-shadow:inset 0 0 0 9999px rgba(29,78,216,.07)}
.oid{font:inherit;font-weight:600;color:var(--pri);background:none;border:0;padding:6px 0;cursor:pointer;text-decoration:underline;text-underline-offset:3px;min-height:32px}
.src{display:inline-block;border:1px solid #CBD5E1;border-radius:6px;padding:1px 7px;font-size:12px;background:#fff;color:#334155}
.pill{display:inline-block;border-radius:999px;padding:3px 10px;font-size:12px;font-weight:600}
.p-confirmed{background:#DBEAFE;color:var(--pri-d)}.p-active{background:#FEF3C7;color:#78350F}
.p-done{background:var(--green-bg);color:var(--green)}.p-cancelled{background:var(--red);color:#fff}
.p-noshow{background:#1F2937;color:#fff}.p-fell,.p-other{background:#E2E8F0;color:#334155}
.nodrv{font-weight:600;color:var(--amber)}
.detail{flex:1 1 320px;min-width:0;padding:16px;display:flex;flex-direction:column;gap:12px}
.dgrid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.field{display:flex;flex-direction:column;gap:2px}.field span{font-size:12px;color:var(--muted)}.field b{font-weight:500;white-space:normal;word-break:break-word}
.wide{grid-column:span 2}
.btn{font:inherit;font-size:14px;font-weight:600;border-radius:10px;padding:10px 14px;min-height:44px;cursor:pointer;border:1px solid #CBD5E1;background:#fff;color:var(--ink);text-decoration:none;display:inline-flex;align-items:center;justify-content:center}
.btn-pri{background:var(--pri);border-color:var(--pri);color:#fff}.btn-pri:hover{color:#fff;background:var(--pri-d)}
.actions{display:flex;flex-wrap:wrap;gap:8px}.actions .btn{flex:1 1 140px}
.log{border-top:1px solid var(--line);padding-top:10px;display:flex;flex-direction:column;gap:6px;font-size:13px}
.log div{display:flex;gap:10px}.log time{color:var(--muted);flex:0 0 96px}
.center{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:16px}
.auth-card{background:#fff;border:1px solid var(--line);border-radius:16px;padding:24px;width:100%;max-width:380px;display:flex;flex-direction:column;gap:14px}
.auth-brand{display:flex;gap:10px;align-items:center}.auth-brand div{display:flex;flex-direction:column}.auth-brand small{color:var(--muted)}
.stack{display:flex;flex-direction:column;gap:12px}
label{display:flex;flex-direction:column;gap:6px;font-size:14px}
input{font:inherit;font-size:15px;border:1px solid #CBD5E1;border-radius:10px;padding:10px 12px;min-height:44px}
.err{background:var(--red-bg);color:#7F1D1D;border-radius:10px;padding:10px 12px;margin:0}
.ok{background:var(--green-bg);color:var(--green);border-radius:10px;padding:10px 12px;margin:0}
.legend{font-size:12px;color:var(--muted);display:flex;gap:10px;align-items:center}
.sw{display:inline-block;width:10px;height:10px;border-radius:2px;margin-inline-end:4px}
.sw-ok{background:var(--pri)}.sw-cx{background:#F87171}.sw-ot{background:#CBD5E1}
.chart{display:grid;grid-template-columns:repeat(30,minmax(0,1fr));gap:4px;align-items:end;height:220px}
.col{display:flex;flex-direction:column;justify-content:flex-end;height:100%;gap:1px;position:relative}
.col i{display:block;width:100%}.col .b-ok{background:var(--pri)}.col .b-cx{background:#F87171}.col .b-ot{background:#CBD5E1;border-radius:3px 3px 0 0}
.col small{position:absolute;bottom:-18px;left:0;right:0;text-align:center;font-size:10px;color:var(--muted)}
.chart{margin-bottom:22px}
.hrow{display:flex;flex-direction:column;gap:6px}.hrow div{display:flex;justify-content:space-between;font-size:14px}
.htrack{background:#EEF2F6;border-radius:6px;height:12px}.hfill{background:var(--pri);border-radius:6px;height:12px}
.phone{background:var(--bg)}
.drv{max-width:520px;margin:0 auto;padding:14px;display:flex;flex-direction:column;gap:12px}
.next{padding:16px;display:flex;flex-direction:column;gap:10px}
.next .t{font-size:30px;font-weight:700}
.later{background:#fff;border-radius:14px;padding:12px 14px;display:flex;justify-content:space-between;gap:8px;align-items:center}
@media (max-width:700px){.top{padding:10px 12px}.wrap{padding:12px}.kpi strong{font-size:22px}.chart{gap:2px}.col small{display:none}}
/* ---- v2: console UX ---- */
button.kpi{font:inherit;text-align:right;cursor:pointer;color:inherit}
button.kpi:hover{border-color:#94A3B8}
.kpi-on{box-shadow:0 0 0 2px var(--ink) inset}
.alert{font:inherit;font-size:15px;font-weight:600;text-align:right;width:100%;border:1px solid #F59E0B;background:#FFFBEB;color:#78350F;border-radius:12px;padding:12px 16px;min-height:48px;cursor:pointer}
.alert:hover{background:#FEF3C7}
tr.nowline td{background:#0F172A;color:#fff;font-size:12px;font-weight:700;padding:3px 12px;letter-spacing:.02em}
tr.need.soon td{background:#FFEDD5}
tr.need.soon td.c-drv{box-shadow:inset 0 0 0 2px #F59E0B}
tr.past td{opacity:.55}
table.rides tbody tr{cursor:pointer}
table.rides tbody tr:hover td{box-shadow:inset 0 0 0 9999px rgba(15,23,42,.035)}
.c-time b{display:block;font-size:15px}
.until{display:block;font-size:11px;color:var(--muted)}
tr.need.soon .until{color:var(--amber);font-weight:700}
.saving{color:var(--pri);font-weight:600}
.rep{display:block;font-size:11px;color:#78350F}
.empty{text-align:center;padding:28px}
.big{font-size:20px}
.assignbox{display:flex;flex-direction:column;gap:8px;background:#F8FAFC;border:1px solid var(--line);border-radius:12px;padding:12px}
.assignbox label{font-weight:600}
.assignbox .btn:disabled{opacity:.6;cursor:progress}
.detail .err{font-size:13px}
.toasts{position:fixed;bottom:16px;left:16px;right:16px;display:flex;flex-direction:column;gap:8px;align-items:flex-start;z-index:50;pointer-events:none}
.toast{background:#0F172A;color:#fff;border-radius:10px;padding:10px 14px;font-size:14px;max-width:min(520px,100%);box-shadow:0 6px 20px rgba(15,23,42,.25);transition:opacity .4s,transform .4s}
.toast.ok{background:#14532D}.toast.err{background:#991B1B}
.toast.out{opacity:0;transform:translateY(8px)}
.btn-warn{background:#FEF2F2;border-color:#FCA5A5;color:#991B1B}
.btn.dim{opacity:.6}
/* phones: rides table becomes cards */
@media (max-width:760px){
  .table-card table.rides{min-width:0}
  table.rides thead{display:none}
  table.rides,table.rides tbody,table.rides tr,table.rides td{display:block;width:100%}
  table.rides tr{border-bottom:8px solid var(--bg);padding:6px 4px}
  table.rides td{border:0;padding:4px 10px;display:flex;justify-content:space-between;gap:12px;white-space:normal}
  table.rides td::before{content:attr(data-l);color:var(--muted);font-size:12px;flex:0 0 auto}
  table.rides tr.nowline td::before,table.rides td.empty::before{content:none}
  .c-time b{display:inline}
}
/* ---- v2: driver app ---- */
.drv-head{display:flex;justify-content:space-between;align-items:center;gap:8px}
.drv-head div{display:flex;flex-direction:column}.drv-head strong{font-size:20px}
.note{background:#EFF6FF;color:#1E3A8A;border-radius:10px;padding:10px 12px;font-size:13px;margin:0}
.next .t{font-size:34px;font-weight:700;line-height:1.1}
.until-big{font-size:14px;color:var(--muted)}
.steps{display:flex;gap:6px}.steps i{flex:1;height:6px;border-radius:3px;background:var(--line)}.steps i.on{background:var(--pri)}
.legs{display:flex;flex-direction:column;gap:10px}
.leg{display:flex;gap:10px;align-items:flex-start}
.leg .field{flex:1;min-width:0}
.leg .btn{min-height:40px;padding:6px 12px;font-size:13px}
.dot{width:12px;height:12px;flex:0 0 12px;margin-top:6px}.dot.a{border-radius:50%;background:var(--pri)}.dot.b{border-radius:2px;background:var(--ink)}
.act{font:inherit;font-size:18px;font-weight:700;width:100%;min-height:58px;border:0;border-radius:14px;background:var(--pri);color:#fff;cursor:pointer}
.act:active{transform:scale(.99)}
.empty-big{font-size:18px;text-align:center;padding:24px 0;margin:0;color:var(--muted)}
.center-t{text-align:center}
/* ---- v2.1 polish ---- */
.assign{font:inherit;font-size:13px;font-weight:600;background:#FFF7ED;color:#9A3412;border:1px solid #FDBA74;border-radius:8px;padding:6px 12px;cursor:pointer;min-height:34px}
.assign:hover{background:#FFEDD5}
@media (min-width:761px){
  .table-card .scroll{max-height:calc(100vh - 330px);min-height:360px;overflow:auto}
  .table-card thead th{position:sticky;top:0;z-index:2}
  .detail{position:sticky;top:12px;max-height:calc(100vh - 24px);overflow:auto}
}
.rev{display:flex;flex-direction:column;gap:2px}
.rev b{font-size:26px;direction:ltr;text-align:right}
