:root{
  --primary:#1E3A8A;--secondary:#F59E0B;--tertiary:#10B981;--bg:#F8FAFC;
  --surface:#fff;--text:#0F172A;--muted:#64748B;--border:#E2E8F0;--error:#EF4444;
  --gold:#FBBF24;--shadow:0 10px 30px rgba(15,23,42,.08);--radius:18px
}
*{box-sizing:border-box}html,body{margin:0;min-height:100%;font-family:Inter,system-ui,sans-serif;background:var(--bg);color:var(--text)}
button,input,select,textarea{font:inherit}button{cursor:pointer}
a{color:inherit}.app-shell{min-height:100vh}.container{max-width:1200px;margin:auto;padding:24px}
.topbar{height:70px;background:var(--surface);border-bottom:1px solid var(--border);display:flex;align-items:center;justify-content:space-between;padding:0 24px;position:sticky;top:0;z-index:20}
.brand{display:flex;gap:12px;align-items:center;font-weight:800;color:var(--primary);font-size:22px}.logo{width:44px;height:44px;border-radius:12px;background:var(--primary);border:2px solid var(--secondary);display:grid;place-items:center;color:white;font-weight:800}
.top-actions{display:flex;gap:10px;align-items:center}.icon-btn,.ghost-btn{border:1px solid var(--border);background:#fff;border-radius:12px;padding:10px 13px}
.primary-btn,.secondary-btn,.danger-btn,.success-btn{border:0;border-radius:12px;padding:11px 16px;font-weight:700}.primary-btn{background:var(--primary);color:#fff}.secondary-btn{background:#FEF3C7;color:#92400E}.success-btn{background:#D1FAE5;color:#065F46}.danger-btn{background:#FEE2E2;color:#991B1B}
.auth{min-height:100vh;display:grid;place-items:center;padding:24px}.auth-card{width:min(480px,100%);background:#fff;border:1px solid var(--border);border-radius:26px;box-shadow:var(--shadow);padding:30px}.auth-logo{width:80px;height:80px;margin:auto;border-radius:20px;background:var(--primary);border:2px solid var(--secondary);display:grid;place-items:center;color:#fff;font-size:30px;font-weight:800}.center{text-align:center}.muted{color:var(--muted)}.small{font-size:12px}.form-grid{display:grid;gap:14px}.two-col{display:grid;grid-template-columns:1fr 1fr;gap:14px}.field{display:grid;gap:7px}.field label{font-size:13px;font-weight:700}.field input,.field select,.field textarea{width:100%;border:1px solid var(--border);border-radius:12px;padding:12px;background:#fff;outline:none}.field textarea{min-height:100px;resize:vertical}.field input:focus,.field select:focus,.field textarea:focus{border-color:var(--primary);box-shadow:0 0 0 3px rgba(30,58,138,.1)}
.role-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:8px}.role{padding:10px;border:1px solid var(--border);border-radius:12px;background:#fff;font-size:12px;font-weight:700}.role.active{background:#DBEAFE;border-color:var(--primary);color:var(--primary)}
.error{color:#991B1B;background:#FEE2E2;border-radius:10px;padding:10px;font-size:13px}.link{border:0;background:none;color:var(--primary);font-weight:700;padding:0}
.layout{display:grid;grid-template-columns:250px 1fr;min-height:calc(100vh - 70px)}.sidebar{background:#fff;border-right:1px solid var(--border);padding:18px;position:sticky;top:70px;height:calc(100vh - 70px)}.nav{display:grid;gap:7px}.nav button{text-align:left;border:0;background:transparent;padding:12px;border-radius:12px;color:var(--muted);font-weight:700}.nav button.active,.nav button:hover{background:#DBEAFE;color:var(--primary)}.main{min-width:0}.hero{background:linear-gradient(135deg,var(--primary),#294db0);color:#fff;border-radius:24px;padding:28px;box-shadow:var(--shadow)}.hero h1{margin:0 0 8px;font-size:clamp(26px,4vw,42px)}.hero p{margin:0;opacity:.88}.section{margin-top:24px}.section-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:14px}.section-head h2,.section-head h3{margin:0}.cards{display:grid;grid-template-columns:repeat(3,1fr);gap:16px}.cards-4{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.card{background:#fff;border:1px solid var(--border);border-radius:var(--radius);padding:18px;box-shadow:0 4px 15px rgba(15,23,42,.04)}.clickable{transition:.18s}.clickable:hover{transform:translateY(-2px);box-shadow:var(--shadow);border-color:#BFDBFE}.stat{font-size:28px;font-weight:800}.badge{display:inline-flex;align-items:center;border-radius:999px;padding:5px 9px;font-size:11px;font-weight:800}.approved,.available,.delivered,.completed{background:#D1FAE5;color:#065F46}.pending,.requested,.placed{background:#FEF3C7;color:#92400E}.busy,.accepted{background:#DBEAFE;color:#1E3A8A}.rejected,.cancelled{background:#FEE2E2;color:#991B1B}.offline{background:#E2E8F0;color:#475569}.list{display:grid;gap:12px}.row{display:flex;align-items:center;justify-content:space-between;gap:12px}.actions{display:flex;flex-wrap:wrap;gap:8px}.product-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:14px}.product-card{display:grid;gap:10px}.product-img{height:130px;border-radius:14px;background:#EFF6FF;display:grid;place-items:center;font-size:52px}.price{font-weight:800;color:var(--primary);font-size:18px}.rating{color:#B45309;font-weight:700}.category-strip{display:flex;gap:10px;overflow:auto;padding-bottom:6px}.category{min-width:105px;background:#fff;border:1px solid var(--border);border-radius:16px;padding:14px;text-align:center;font-weight:700}.category span{font-size:26px;display:block;margin-bottom:7px}.bottom-nav{display:none}.modal-backdrop{position:fixed;inset:0;background:rgba(15,23,42,.42);z-index:100;display:grid;place-items:end center;padding:16px}.modal{background:#fff;width:min(680px,100%);max-height:90vh;overflow:auto;border-radius:24px;padding:22px;box-shadow:0 30px 70px rgba(15,23,42,.25)}.map{height:250px;border-radius:18px;background:linear-gradient(145deg,#e0f2fe,#dcfce7);position:relative;overflow:hidden;border:1px solid var(--border)}.map:before,.map:after{content:"";position:absolute;background:#fff8;width:160%;height:18px;left:-30%;top:48%;transform:rotate(-18deg);box-shadow:0 55px 0 rgba(255,255,255,.8)}.map:after{top:20%;transform:rotate(35deg)}.pin{position:absolute;z-index:2;width:18px;height:18px;background:var(--primary);border:4px solid #fff;border-radius:50%;box-shadow:0 2px 8px rgba(0,0,0,.2)}.pin.start{left:18%;top:64%}.pin.end{right:18%;top:24%;background:var(--tertiary)}.route{position:absolute;z-index:1;left:20%;top:55%;width:60%;height:2px;background:var(--secondary);transform:rotate(-25deg);transform-origin:left}.progress{height:8px;background:#E2E8F0;border-radius:99px;overflow:hidden}.progress>span{display:block;height:100%;background:var(--tertiary);transition:.4s}.table-wrap{overflow:auto}.table{width:100%;border-collapse:collapse}.table th,.table td{text-align:left;padding:12px;border-bottom:1px solid var(--border);font-size:13px;vertical-align:top}.kpi{display:grid;grid-template-columns:repeat(4,1fr);gap:14px}.empty{padding:30px;text-align:center;color:var(--muted);border:1px dashed var(--border);border-radius:16px}.toast{position:fixed;right:20px;bottom:20px;background:#0F172A;color:#fff;padding:13px 16px;border-radius:12px;z-index:200;box-shadow:var(--shadow)}
@media(max-width:900px){.layout{grid-template-columns:1fr}.sidebar{display:none}.cards,.product-grid{grid-template-columns:repeat(2,1fr)}.cards-4,.kpi{grid-template-columns:repeat(2,1fr)}.bottom-nav{position:fixed;bottom:0;left:0;right:0;background:#fff;border-top:1px solid var(--border);display:flex;z-index:30;padding:7px}.bottom-nav button{flex:1;border:0;background:none;padding:7px;font-size:11px;color:var(--muted)}.bottom-nav button.active{color:var(--primary);font-weight:800}.main{padding-bottom:75px}}
@media(max-width:600px){.container{padding:14px}.two-col,.cards,.product-grid{grid-template-columns:1fr}.cards-4,.kpi{grid-template-columns:1fr 1fr}.role-grid{grid-template-columns:repeat(2,1fr)}.topbar{padding:0 14px}.hero{padding:22px}.modal-backdrop{padding:0}.modal{border-radius:24px 24px 0 0}.top-actions .hide-mobile{display:none}}

/* BringAll final UI cleanup */
.close-btn, [data-close], .modal-close, .panel-close {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal { position: relative; }
.modal-close { position: absolute; top: 14px; right: 14px; border: 0; background: transparent; color: var(--muted); font-size: 28px; line-height: 1; padding: 6px; }
.modal-close:hover { color: var(--text); }
.success-text { color: #065F46; font-weight: 700; }
.notification-new { border-left: 4px solid var(--secondary); }
.quantity-control, .promo-row { display: flex; align-items: center; gap: 10px; }
.quantity-control button { min-width: 38px; padding: 8px; }
.promo-row input { flex: 1; min-width: 0; border: 1px solid var(--border); border-radius: 10px; padding: 10px; }
.estimate { background: #EFF6FF; border: 1px solid #BFDBFE; border-radius: 12px; padding: 14px; color: var(--primary); }
.provider-identity { display: flex; align-items: center; gap: 12px; }
.provider-photo { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: #DBEAFE; font-size: 24px; flex: 0 0 auto; }
.provider-photo.large { width: 68px; height: 68px; font-size: 36px; }
.details-grid { margin: 14px 0; }
.details-grid p { margin: 4px 0 12px; }
.review { border-top: 1px solid var(--border); padding-top: 10px; }
html[data-theme="dark"] { --bg:#0F172A; --surface:#172033; --text:#E5E7EB; --muted:#A8B3C7; --border:#334155; --primary:#93C5FD; --shadow:0 10px 30px rgba(0,0,0,.28); }
html[data-theme="dark"] .card,html[data-theme="dark"] .sidebar,html[data-theme="dark"] .topbar,html[data-theme="dark"] .modal,html[data-theme="dark"] .auth-card,html[data-theme="dark"] .field input,html[data-theme="dark"] .field select,html[data-theme="dark"] .field textarea,html[data-theme="dark"] .ghost-btn,html[data-theme="dark"] .icon-btn { background:#172033; color:var(--text); }
html[data-theme="dark"] .category,html[data-theme="dark"] .promo-row input { background:#172033; color:var(--text); border-color:var(--border); }
@media print {.topbar,.sidebar,.bottom-nav,.actions,.ghost-btn,.primary-btn,.danger-btn,.success-btn{display:none!important}.modal-backdrop{position:static;background:#fff}.modal{box-shadow:none;width:100%;max-height:none}}
.mini-map { height: 130px; margin: 12px 0; }
.tracking-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 22px 0; }
.tracking-step { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; }
.tracking-step span { width: 28px; height: 28px; margin: auto; display: grid; place-items: center; border: 2px solid var(--border); border-radius: 50%; background: #fff; }
.tracking-step.done { color: var(--primary); }
.tracking-step.done span { background: var(--primary); border-color: var(--primary); color: #fff; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid rgba(245, 158, 11, .65); outline-offset: 2px; }
@media(max-width:600px){.tracking-steps{grid-template-columns:1fr 1fr}.actions>button{min-height:44px}.modal{padding:20px}.row{align-items:flex-start}}
.role-section + .role-section { margin-top: 20px; }
.rider-status-toggle { display:flex; gap:8px; align-items:center; }

/* Phone controls: large, visual buttons that remain above the system gesture area. */
@media(max-width:900px){
  .topbar{height:64px;padding:0 12px}
  .brand{gap:8px;font-size:20px}
  .logo{width:38px;height:38px;border-radius:10px}
  .top-actions{margin-left:auto}
  .top-actions .ghost-btn{min-height:44px;padding:10px 13px;white-space:nowrap}
  .bottom-nav{display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:6px;padding:8px 8px calc(8px + env(safe-area-inset-bottom));box-shadow:0 -8px 24px rgba(15,23,42,.10)}
  .bottom-nav button{min-height:54px;border:1px solid transparent;border-radius:13px;background:#F8FAFC;padding:6px 2px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;font-size:10px;font-weight:700;line-height:1.1;color:var(--muted)}
  .bottom-nav button.active{background:#DBEAFE;border-color:#93C5FD;color:var(--primary)}
  .mobile-nav-icon{font-size:18px;line-height:1}
  .main{padding-bottom:104px}
}
@media(max-width:430px){
  .topbar{height:60px}
  .brand{font-size:18px}
  .logo{width:34px;height:34px}
  .top-actions .ghost-btn{font-size:12px;padding:9px 11px}
  .container{padding:12px}
}
