*{margin:0;padding:0;box-sizing:border-box}
html,body{height:100%;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;background:#f8fafc;overflow:hidden}

/* ── APP SHELL ── */
.app-container{display:flex;height:100vh}

/* ── SIDEBAR ── */
.sidebar{width:256px;flex-shrink:0;background:#fff;border-right:1px solid #e2e8f0;display:flex;flex-direction:column;overflow-y:auto;z-index:100}
.sidebar-brand{padding:16px 20px;border-bottom:1px solid #f1f5f9}
.sidebar-brand a{display:flex;align-items:center;gap:6px;font-weight:800;font-size:1.05rem;color:#0f172a;text-decoration:none}
.brand-dot{color:#f97316}
.sidebar-nav{flex:1;padding:12px 8px}
.nav-section-label{padding:10px 12px 5px;font-size:.62rem;color:#94a3b8;text-transform:uppercase;letter-spacing:1px;font-weight:700}
.sidebar-nav a{display:flex;align-items:center;gap:10px;padding:10px 12px;font-size:.875rem;color:#475569;text-decoration:none;border-radius:10px;margin-bottom:2px;transition:all .15s;font-weight:500}
.sidebar-nav a:hover{background:#f8fafc;color:#0f172a}
.sidebar-nav a.active{background:#fff7ed;color:#f97316;font-weight:700}
.sidebar-nav .badge{margin-left:auto;background:#f97316;color:#fff;font-size:.6rem;font-weight:700;padding:2px 7px;border-radius:10px}
.sidebar-footer{padding:12px 8px;border-top:1px solid #f1f5f9}
.user-card{display:flex;align-items:center;gap:10px;padding:10px 12px;background:#f8fafc;border-radius:10px;margin-bottom:8px}
.user-avatar{width:34px;height:34px;border-radius:50%;background:#f97316;color:#fff;display:flex;align-items:center;justify-content:center;font-size:.9rem;font-weight:700;flex-shrink:0}
.user-name{font-size:.82rem;font-weight:700;color:#0f172a}
.user-status{font-size:.68rem;color:#94a3b8}
.signout-btn{width:100%;padding:9px;background:#fef2f2;color:#ef4444;border:1px solid #fecaca;border-radius:10px;cursor:pointer;font-size:.82rem;font-weight:600;font-family:inherit}

/* ── MAIN ── */
.main-panel{flex:1;display:flex;flex-direction:column;height:100vh;overflow:hidden}
.top-bar{height:56px;background:rgba(255,255,255,.95);backdrop-filter:blur(12px);border-bottom:1px solid #e2e8f0;display:flex;align-items:center;padding:0 24px;gap:16px;flex-shrink:0}
.top-bar h1{font-size:1.05rem;font-weight:700;color:#0f172a}
.menu-toggle{display:none;background:none;border:none;font-size:1.4rem;cursor:pointer;color:#0f172a;padding:4px 8px}
.topbar-right{margin-left:auto;display:flex;align-items:center;gap:12px}
#topbar-user{font-size:.78rem;color:#64748b}
.hub-link{font-size:.78rem;font-weight:600;color:#f97316;text-decoration:none;padding:5px 12px;border:1px solid #fed7aa;border-radius:8px;transition:all .15s}
.hub-link:hover{background:#fff7ed}

/* ── PAGE SECTIONS ── */
.page-section{display:none;flex:1;overflow:hidden}
.page-section.active{display:flex}

/* ── BOOK LAYOUT ── */
.book-layout{display:flex;flex:1;height:100%}
.form-panel{width:420px;flex-shrink:0;display:flex;flex-direction:column;background:#fff;border-right:1px solid #e2e8f0;overflow-y:auto}
.form-panel-header{padding:20px 20px 14px;border-bottom:1px solid #f1f5f9}
.form-panel-header h2{font-size:1.15rem;font-weight:700;color:#0f172a;margin-bottom:3px}
.form-panel-header p{font-size:.78rem;color:#64748b}
.form-body{padding:16px 20px 24px;display:flex;flex-direction:column;gap:12px}

/* ── FORM FIELDS ── */
.field-group{display:flex;flex-direction:column;gap:4px;position:relative}
.field-group label{font-size:.72rem;font-weight:700;color:#475569;text-transform:uppercase;letter-spacing:.4px}
.field-group input,.field-group textarea,.field-group select{padding:10px 14px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;font-size:.875rem;color:#0f172a;font-family:inherit;outline:none;transition:border-color .15s;appearance:none;-webkit-appearance:none}
.field-group input:focus,.field-group select:focus{border-color:#f97316;box-shadow:0 0 0 3px rgba(249,115,22,.1);background:#fff}
.field-group select{background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-right:36px;cursor:pointer}
.input-wrap{position:relative}
.input-wrap input{width:100%}
.locating-tag{position:absolute;right:12px;top:50%;transform:translateY(-50%);font-size:.7rem;color:#f97316;font-weight:600;animation:pulse 1.5s infinite;pointer-events:none}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.4}}
.field-row{display:grid;grid-template-columns:1fr 1fr;gap:10px}

/* ── SUGGESTIONS ── */
.suggestions{position:absolute;top:100%;left:0;right:0;z-index:30;background:#fff;border:1px solid #e2e8f0;border-radius:10px;box-shadow:0 8px 30px rgba(0,0,0,.12);max-height:220px;overflow-y:auto;display:none;margin-top:3px}
.suggestions.show{display:block}
.sug-item{padding:9px 14px;cursor:pointer;font-size:.82rem;color:#0f172a;border-bottom:1px solid #f8fafc;display:flex;align-items:center;gap:8px}
.sug-item:hover{background:#fff7ed}
.sug-item:last-child{border-bottom:none}
.sug-item .sug-pin{font-size:.85rem;flex-shrink:0}
.sug-item .sug-addr{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* ── ROUTE PILL ── */
.route-pill{display:flex;align-items:center;gap:10px;background:#fff7ed;border:1px solid #fed7aa;border-radius:20px;padding:7px 16px;font-size:.8rem;font-weight:600;color:#c2410c}
.pill-sep{width:1px;height:14px;background:#fed7aa}

/* ── VEHICLE TOGGLE ── */
.vehicle-toggle{display:flex;gap:6px}
.vt-btn{flex:1;padding:8px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:8px;font-size:.78rem;font-weight:600;color:#475569;cursor:pointer;font-family:inherit;transition:all .15s}
.vt-btn.active{background:#fff7ed;border-color:#fed7aa;color:#f97316}

/* ── AGENT LIST (book panel) ── */
.agents-label{font-size:.72rem;font-weight:700;color:#94a3b8;text-transform:uppercase;letter-spacing:.4px}
.agent-list{display:flex;flex-direction:column;gap:8px;max-height:260px;overflow-y:auto}
.agent-item{display:flex;align-items:center;gap:12px;padding:12px;background:#fff;border:1px solid #e2e8f0;border-radius:12px;cursor:pointer;transition:all .15s}
.agent-item:hover{border-color:#f97316;box-shadow:0 2px 8px rgba(249,115,22,.08)}
.agent-item.selected{border-color:#f97316;background:#fff7ed}
.agent-item.offline{opacity:.5;cursor:not-allowed}
.agent-avatar{width:38px;height:38px;border-radius:50%;background:linear-gradient(135deg,#f97316,#ea580c);color:#fff;display:flex;align-items:center;justify-content:center;font-size:1rem;font-weight:700;flex-shrink:0;position:relative}
.agent-online-dot{position:absolute;bottom:0;right:0;width:10px;height:10px;border-radius:50%;border:2px solid #fff}
.dot-online{background:#16a34a}
.dot-offline{background:#94a3b8}
.agent-info{flex:1;min-width:0}
.agent-info h4{font-size:.85rem;font-weight:700;color:#0f172a;margin-bottom:2px}
.agent-meta{font-size:.72rem;color:#64748b;display:flex;gap:8px;flex-wrap:wrap}
.agent-meta .rating{color:#f59e0b;font-weight:700}
.agent-vehicle-badge{display:inline-flex;align-items:center;gap:3px;font-size:.65rem;font-weight:700;padding:2px 7px;border-radius:6px}
.badge-moto{background:#fef3c7;color:#92400e}
.badge-car{background:#dbeafe;color:#1e40af}
.agent-fare{text-align:right;flex-shrink:0}
.agent-fare .price{font-size:.9rem;font-weight:800;color:#f97316}
.agent-fare .eta{font-size:.68rem;color:#94a3b8}
.agent-phone{font-size:.7rem;color:#64748b;margin-top:2px}

/* ── FARE SUMMARY ── */
.fare-summary{background:#f8fafc;border:1px solid #e2e8f0;border-radius:12px;padding:14px 16px;display:flex;flex-direction:column;gap:8px}
.fare-row{display:flex;justify-content:space-between;font-size:.82rem;color:#475569}
.fare-row span:last-child{font-weight:600;color:#0f172a}
.fare-total{border-top:1px solid #e2e8f0;padding-top:8px;font-weight:700;font-size:.9rem}
.fare-total span:last-child{color:#f97316;font-size:1rem}

/* ── SEND BUTTON ── */
.send-btn{padding:14px;background:#f97316;color:#fff;border:none;border-radius:12px;font-size:.95rem;font-weight:700;cursor:pointer;font-family:inherit;transition:background .15s}
.send-btn:hover{background:#ea580c}
.send-btn:disabled{background:#94a3b8;cursor:not-allowed}
.send-btn.success{background:#16a34a}

/* ── MAP ── */
.map-panel{flex:1;min-width:0;position:relative}
#delivery-map{width:100%;height:100%}
.map-center-btn{position:absolute;bottom:40px;right:16px;z-index:5;width:44px;height:44px;background:#fff;border:none;border-radius:12px;box-shadow:0 4px 12px rgba(0,0,0,.15);cursor:pointer;font-size:1.2rem;display:flex;align-items:center;justify-content:center}

/* ── CONTENT AREA (orders / agents / profile pages) ── */
.content-area{flex:1;overflow-y:auto;padding:24px;max-width:860px;margin:0 auto;width:100%}
.section-head{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px;flex-wrap:wrap;gap:10px}
.section-head h3{font-size:1rem;font-weight:700;color:#0f172a}
.count-badge{background:#f1f5f9;color:#64748b;font-size:.75rem;font-weight:600;padding:3px 12px;border-radius:20px}
.agent-filter-btns{display:flex;gap:6px;flex-wrap:wrap}
.filter-btn{padding:5px 14px;background:#f1f5f9;border:1px solid #e2e8f0;border-radius:20px;font-size:.75rem;font-weight:600;color:#475569;cursor:pointer;font-family:inherit;transition:all .15s}
.filter-btn.active{background:#fff7ed;border-color:#fed7aa;color:#f97316}

/* ── AGENTS GRID ── */
.agents-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
.agent-card{background:#fff;border:1px solid #e2e8f0;border-radius:16px;padding:20px;transition:box-shadow .15s}
.agent-card:hover{box-shadow:0 4px 16px rgba(0,0,0,.08)}
.agent-card.offline-card{opacity:.6}
.ac-top{display:flex;align-items:center;gap:12px;margin-bottom:14px}
.ac-avatar{width:48px;height:48px;border-radius:50%;background:linear-gradient(135deg,#f97316,#ea580c);color:#fff;display:flex;align-items:center;justify-content:center;font-size:1.3rem;font-weight:700;flex-shrink:0;position:relative}
.ac-name{font-size:.9rem;font-weight:700;color:#0f172a}
.ac-sub{font-size:.72rem;color:#64748b;margin-top:2px}
.ac-stats{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:14px}
.ac-stat{background:#f8fafc;border-radius:8px;padding:8px 10px;text-align:center}
.ac-stat .val{font-size:.9rem;font-weight:700;color:#0f172a}
.ac-stat .lbl{font-size:.62rem;color:#94a3b8;text-transform:uppercase;letter-spacing:.4px;margin-top:1px}
.ac-contact{display:flex;align-items:center;gap:8px;font-size:.78rem;color:#475569;margin-bottom:12px}
.ac-contact a{color:#f97316;font-weight:600;text-decoration:none}
.ac-book-btn{width:100%;padding:9px;background:#f97316;color:#fff;border:none;border-radius:10px;font-size:.82rem;font-weight:700;cursor:pointer;font-family:inherit;transition:background .15s}
.ac-book-btn:hover{background:#ea580c}
.ac-book-btn:disabled{background:#94a3b8;cursor:not-allowed}

/* ── ORDERS ── */
.order-card{background:#fff;border:1px solid #e2e8f0;border-radius:14px;padding:16px;margin-bottom:10px;transition:box-shadow .15s}
.order-card:hover{box-shadow:0 2px 10px rgba(0,0,0,.06)}
.oc-top{display:flex;align-items:center;justify-content:space-between;margin-bottom:10px;flex-wrap:wrap;gap:8px}
.oc-id{font-size:.68rem;color:#94a3b8;font-family:monospace}
.oc-status{display:inline-flex;align-items:center;gap:5px;padding:3px 10px;border-radius:20px;font-size:.68rem;font-weight:700;text-transform:uppercase;letter-spacing:.4px}
.st-pending{background:#fef3c7;color:#92400e}
.st-accepted{background:#dbeafe;color:#1e40af}
.st-picked_up,.st-in_transit{background:#fff7ed;color:#c2410c}
.st-delivered{background:#dcfce7;color:#166534}
.st-cancelled{background:#fee2e2;color:#991b1b}
.oc-route{background:#f8fafc;border-radius:10px;padding:10px 12px;margin-bottom:10px;font-size:.8rem}
.oc-route-row{display:flex;align-items:flex-start;gap:8px;margin-bottom:4px}
.oc-route-row:last-child{margin-bottom:0}
.oc-dot{width:8px;height:8px;border-radius:50%;flex-shrink:0;margin-top:4px}
.oc-dot.pickup{background:#3b82f6}
.oc-dot.dropoff{background:#ef4444}
.oc-addr{color:#334155;font-weight:500;line-height:1.4}
.oc-footer{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:8px}
.oc-agent{font-size:.75rem;color:#64748b}
.oc-fare{font-size:.9rem;font-weight:800;color:#f97316}
.oc-chat-btn{padding:6px 14px;background:#fff7ed;color:#f97316;border:1px solid #fed7aa;border-radius:8px;font-size:.75rem;font-weight:700;cursor:pointer;font-family:inherit;transition:all .15s}
.oc-chat-btn:hover{background:#f97316;color:#fff}

/* ── EMPTY STATE ── */
.empty-state{text-align:center;padding:48px 20px;color:#94a3b8}
.empty-state .ei{font-size:2.5rem;margin-bottom:10px;opacity:.4}
.empty-state p{font-size:.875rem}

/* ── PROFILE ── */
.profile-card{background:#fff;border:1px solid #e2e8f0;border-radius:16px;padding:24px;max-width:480px}
.profile-field{margin-bottom:14px}
.profile-field label{display:block;font-size:.68rem;font-weight:700;color:#94a3b8;text-transform:uppercase;letter-spacing:.5px;margin-bottom:4px}
.pval{font-size:.95rem;font-weight:600;color:#0f172a;padding:8px 12px;background:#f8fafc;border-radius:8px;border:1px solid #e2e8f0}

/* ── OVERLAY ── */
.overlay{position:fixed;inset:0;z-index:2000;display:none;align-items:center;justify-content:center;background:rgba(15,23,42,.65);backdrop-filter:blur(4px)}
.overlay.show{display:flex}
.overlay-card{width:90%;max-width:380px;background:#fff;border-radius:20px;padding:2rem;text-align:center;box-shadow:0 20px 60px rgba(0,0,0,.25);animation:zoomIn .22s ease}
@keyframes zoomIn{from{transform:scale(.9);opacity:0}to{transform:scale(1);opacity:1}}
.overlay-icon{font-size:2.8rem;margin-bottom:.75rem}
.overlay-card h3{font-size:1.2rem;font-weight:800;margin-bottom:.4rem}
.overlay-card p{font-size:.82rem;color:#64748b;margin-bottom:1rem}
.overlay-details{text-align:left;background:#f8fafc;border-radius:12px;padding:12px 14px;margin-bottom:1rem;font-size:.8rem}
.overlay-details .od-row{display:flex;justify-content:space-between;padding:5px 0;border-bottom:1px solid #e2e8f0}
.overlay-details .od-row:last-child{border-bottom:none}
.overlay-details .od-label{color:#64748b}
.overlay-details .od-val{font-weight:600;color:#0f172a}
.overlay-btn{width:100%;padding:12px;background:#f97316;color:#fff;border:none;border-radius:12px;font-size:.9rem;font-weight:700;cursor:pointer;font-family:inherit}

/* ── CHAT MODAL ── */
.chat-modal{width:90%;max-width:440px;background:#fff;border-radius:20px;display:flex;flex-direction:column;max-height:85vh;box-shadow:0 20px 60px rgba(0,0,0,.25);animation:zoomIn .22s ease;overflow:hidden}
.chat-header{display:flex;align-items:center;gap:12px;padding:16px 20px;border-bottom:1px solid #f1f5f9;flex-shrink:0}
.chat-avatar{width:38px;height:38px;border-radius:50%;background:linear-gradient(135deg,#f97316,#ea580c);color:#fff;display:flex;align-items:center;justify-content:center;font-size:1rem;font-weight:700;flex-shrink:0}
.chat-agent-name{font-size:.9rem;font-weight:700;color:#0f172a}
.chat-order-id{font-size:.68rem;color:#94a3b8;font-family:monospace}
.chat-close{margin-left:auto;background:none;border:none;font-size:1.2rem;cursor:pointer;color:#94a3b8;padding:4px 8px;border-radius:8px;transition:background .15s}
.chat-close:hover{background:#f1f5f9}
.chat-messages{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:10px;background:#f8fafc}
.msg{max-width:78%;padding:9px 13px;border-radius:14px;font-size:.82rem;line-height:1.5;word-break:break-word}
.msg.customer{align-self:flex-end;background:#f97316;color:#fff;border-bottom-right-radius:4px}
.msg.agent{align-self:flex-start;background:#fff;color:#0f172a;border:1px solid #e2e8f0;border-bottom-left-radius:4px}
.msg.system{align-self:center;background:#f1f5f9;color:#64748b;font-size:.72rem;text-align:center;border-radius:10px;max-width:90%;white-space:pre-line}
.msg-time{font-size:.6rem;opacity:.6;margin-top:3px;text-align:right}
.chat-input-row{display:flex;gap:8px;padding:12px 16px;border-top:1px solid #f1f5f9;flex-shrink:0;background:#fff}
.chat-input-row input{flex:1;padding:10px 14px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;font-size:.875rem;font-family:inherit;outline:none;transition:border-color .15s}
.chat-input-row input:focus{border-color:#f97316}
#chat-send-btn{padding:10px 18px;background:#f97316;color:#fff;border:none;border-radius:10px;font-size:.82rem;font-weight:700;cursor:pointer;font-family:inherit;transition:background .15s}
#chat-send-btn:hover{background:#ea580c}

/* ── AGENT SEARCH ── */
.agent-search-wrap{display:flex;align-items:center;gap:8px;background:#f8fafc;border:1px solid #e2e8f0;border-radius:10px;padding:0 12px;transition:border-color .15s;margin-bottom:2px}
.agent-search-wrap:focus-within{border-color:#f97316;background:#fff;box-shadow:0 0 0 3px rgba(249,115,22,.1)}
.agent-search-icon{font-size:.85rem;flex-shrink:0;color:#94a3b8}
.agent-search-input{flex:1;padding:9px 0;background:transparent;border:none;font-size:.85rem;color:#0f172a;font-family:inherit;outline:none}
.agent-search-input::placeholder{color:#94a3b8}
.agent-search-clear{background:none;border:none;cursor:pointer;color:#94a3b8;font-size:.75rem;padding:4px;border-radius:6px;display:none;align-items:center;justify-content:center;line-height:1;transition:color .15s}
.agent-search-clear:hover{color:#ef4444}
.agents-grid-search{margin-bottom:16px}

/* ── RESPONSIVE ── */
@media(max-width:768px){
    .sidebar{position:fixed;top:0;bottom:0;left:-256px;transition:left .3s}
    .sidebar.open{left:0}
    .menu-toggle{display:block}
    .book-layout{flex-direction:column}
    .form-panel{width:100%;max-height:55vh;border-right:none;border-bottom:1px solid #e2e8f0}
    .map-panel{flex:1;min-height:280px}
    .field-row{grid-template-columns:1fr}
}
