:root {
    --primary: #FDB813;
    --primary-dark: #E09400;
    --primary-light: #FFE466;
    --secondary: #1f2937;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    --bg-primary: #f9fafb;
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-muted: #484d56;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
}

* { box-sizing: border-box; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg-primary); color: var(--text-primary); line-height: 1.5; }

/* Sidebar */
.tb-sidebar {
    width: 260px; min-height: 100vh; background: #ffffff;
    border-right: 1px solid var(--border-color); display: flex;
    flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0;
    z-index: 30; overflow-y: auto;
}
.tb-sidebar-logo {
    padding: 13px 20px; display: flex; align-items: center; gap: 12px;
    border-bottom: 1px solid var(--border-color);
}
.tb-sidebar-logo-text { font-size: 16px; font-weight: 800; color: var(--secondary); }
.tb-sidebar-logo-text span { color: var(--primary-dark); }

.tb-sidebar-search {
    display: flex; align-items: center; gap: 8px; margin: 12px 16px;
    padding: 8px 12px; border-radius: 10px; cursor: pointer;
    background: rgba(0,0,0,0.03); border: 1px solid rgba(0,0,0,0.06);
    transition: all 0.15s; font-size: 15px;
}
.tb-sidebar-search:hover { background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.1); }

.sidebar-nav {
    flex: 1; overflow-y: auto; padding: 8px 16px; display: flex; flex-direction: column; gap: 2px;
}
.sidebar-divider { height: 1px; background: var(--border-color); margin: 8px 0; }
.sidebar-item {
    display: flex; align-items: center; padding: 0.6rem 0.75rem;
    border-radius: 0.75rem; cursor: pointer; transition: all 0.2s;
    font-weight: 500; color: #64748B; text-decoration: none; font-size: 17px;
}
.sidebar-item:hover { background: rgba(253, 184, 19, 0.1); color: var(--primary-dark); }
.sidebar-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; font-weight: 600; box-shadow: 0 4px 12px rgba(253, 184, 19, 0.3);
}
.sidebar-icon { width: 1.5rem; margin-right: 0.75rem; text-align: center; font-size: 14px; flex-shrink: 0; }
.module-card {
    background: #fff; border: 1px solid #f3f4f6; border-radius: 1rem;
    padding: 20px; cursor: pointer; transition: all 0.2s;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px;
}
.module-card:hover {
    border-color: var(--primary); box-shadow: 0 4px 16px rgba(253,184,19,0.15);
    transform: translateY(-2px);
}
.module-card-icon {
    width: 44px; height: 44px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.module-card-label { font-size: 17px; font-weight: 600; color: #1f2937; }
.module-card-desc { font-size: 13px; color: #9ca3af; line-height: 1.4; }

.tb-sidebar-footer {
    border-top: 1px solid var(--border-color); padding: 16px; margin-top: 16px;
}

/* Main content area */
.tb-main { margin-left: 260px; min-height: 100vh; width: calc(100% - 260px); display: flex; flex-direction: column; }
.tb-content { padding: 24px; width: 100%; flex: 1; }

/* Page header */
.tb-page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 24px; gap: 16px; flex-wrap: wrap;
}
.tb-page-title { font-size: 22px; font-weight: 800; color: var(--secondary); }

/* Buttons */
.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; padding: 0.6rem 1.25rem; border-radius: var(--radius-lg);
    font-weight: 600; box-shadow: 0 4px 12px rgba(253, 184, 19, 0.3);
    transition: all 0.2s; border: none; cursor: pointer;
    display: inline-flex; align-items: center; gap: 0.5rem; font-size: 13px;
    font-family: inherit;
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(253, 184, 19, 0.4); }
.btn-secondary {
    background: #F3F4F6; color: var(--secondary); padding: 0.6rem 1.25rem;
    border-radius: var(--radius-lg); transition: all 0.2s; border: none;
    cursor: pointer; font-weight: 500; display: inline-flex;
    align-items: center; gap: 0.5rem; font-size: 16px; font-family: inherit;
}
.btn-secondary:hover { background: #E5E7EB; }
.btn-danger {
    background: var(--danger); color: white; padding: 0.6rem 1.25rem;
    border-radius: var(--radius-lg); transition: all 0.2s; border: none;
    cursor: pointer; font-weight: 500; font-size: 13px; font-family: inherit;
}
.btn-danger:hover { background: #dc2626; }
.btn-sm { padding: 0.4rem 0.75rem; font-size: 12px; }
.btn-icon {
    width: 36px; height: 36px; border-radius: var(--radius-lg); border: none;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.15s; font-size: 14px; background: #f3f4f6; color: #6b7280;
}
.btn-icon:hover { background: #e5e7eb; color: #374151; }

/* Cards */
.card {
    background: var(--bg-card); border-radius: var(--radius-xl);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}
.card-header {
    padding: 1rem 1.5rem; border-bottom: 1px solid var(--border-color); font-weight: 600;
}
.card-body { padding: 1.5rem; }

/* Status badges */
.status-badge {
    padding: 0.2rem 0.65rem; border-radius: 9999px; font-size: 11px;
    font-weight: 600; display: inline-flex; align-items: center; gap: 0.25rem;
}
.status-pending { background: #fef3c7; color: #d97706; }
.status-searching { background: #ede9fe; color: #7c3aed; }
.status-accepted, .status-driver_arriving { background: #dbeafe; color: #1d4ed8; }
.status-in_progress { background: #d1fae5; color: #059669; }
.status-completed { background: #f3f4f6; color: #374151; }
.status-cancelled { background: #fee2e2; color: #dc2626; }
.status-active, .status-approved { background: #d1fae5; color: #059669; }
.status-inactive, .status-disabled { background: #f3f4f6; color: #6b7280; }
.status-available { background: #d1fae5; color: #059669; }
.status-busy { background: #fef3c7; color: #d97706; }
.status-offline { background: #f3f4f6; color: #6b7280; }

/* Inputs */
.input-field {
    width: 100%; padding: 0.6rem 0.875rem; border: 2px solid var(--border-color);
    border-radius: var(--radius-lg); font-size: 13px; transition: all 0.2s;
    background: white; font-family: inherit;
}
.input-field:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(253, 184, 19, 0.15);
}

/* Tables */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td {
    padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border-color);
}
.data-table th { font-weight: 600; color: var(--text-secondary); background: #f9fafb; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table tbody tr { cursor: pointer; transition: background 0.1s; }
.data-table tbody tr:hover { background: #f9fafb; }

/* Stat cards */
.stat-card {
    background: white; border-radius: var(--radius-xl); padding: 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}
.stat-card-value { font-size: 28px; font-weight: 800; color: var(--secondary); }
.stat-card-label { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.stat-card-icon {
    width: 48px; height: 48px; border-radius: 12px; display: flex;
    align-items: center; justify-content: center; font-size: 20px;
}

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 50; backdrop-filter: blur(4px); animation: fadeIn 0.2s;
}
.modal-content {
    background: white; border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px rgba(0,0,0,0.25); width: 90%;
    max-width: 600px; max-height: 90vh; display: flex;
    flex-direction: column; animation: scaleIn 0.2s;
}
.modal-header {
    padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border-color);
    display: flex; justify-content: space-between; align-items: center;
}
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1; }
.modal-footer {
    padding: 1rem 1.5rem; border-top: 1px solid var(--border-color);
    display: flex; justify-content: flex-end; gap: 0.75rem;
}

/* Tabs */
.tb-tabs {
    display: flex; border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px; gap: 0; flex-wrap: wrap;
}
.tb-tab {
    padding: 10px 16px; font-size: 13px; font-weight: 600;
    color: #64748B; border-bottom: 2px solid transparent;
    margin-bottom: -2px; cursor: pointer; transition: all 0.15s;
    white-space: nowrap; display: flex; align-items: center; gap: 6px;
    background: none; border-top: none; border-left: none; border-right: none;
    font-family: inherit;
}
.tb-tab:hover { color: var(--primary); }
.tb-tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* Filter pills */
.tb-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.tb-filter {
    padding: 6px 14px; border-radius: 20px; font-size: 12px; font-weight: 600;
    background: #f3f4f6; color: var(--text-secondary); cursor: pointer;
    transition: all 0.15s; border: none; font-family: inherit;
}
.tb-filter:hover { background: #e5e7eb; }
.tb-filter.active { background: var(--primary); color: #1f2937; }

/* Detail view */
.tb-detail-header {
    display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.tb-detail-back {
    width: 40px; height: 40px; border-radius: 12px; background: #f3f4f6;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary); font-size: 16px;
    transition: all 0.15s; border: none;
}
.tb-detail-back:hover { background: #e5e7eb; color: var(--secondary); }
.tb-detail-avatar {
    width: 48px; height: 48px; border-radius: 14px;
    background: linear-gradient(135deg, #FDB813, #E09400);
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 18px;
}
.tb-detail-title { font-size: 20px; font-weight: 700; color: var(--secondary); }
.tb-detail-sub { font-size: 13px; color: var(--text-muted); }
.tb-detail-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* Ride cards (expanded view) */
.ride-card {
    background: white; border-radius: var(--radius-xl); padding: 16px 20px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    cursor: pointer; transition: all 0.15s; border-left: 4px solid transparent;
}
.ride-card:hover { box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1); transform: translateY(-1px); }

/* Ride row (inspired listing) */
.ride-row {
    display: flex; align-items: center; gap: 16px; padding: 14px 18px;
    background: white; border-radius: var(--radius-xl);
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border: 1px solid var(--border-color);
    border-left: 5px solid #e5e7eb;
    cursor: pointer; transition: all 0.15s;
}
.ride-row:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); transform: translateY(-1px); }
.ride-row-source { display: flex; align-items: center; gap: 4px; min-width: 70px; flex-shrink: 0; }
.ride-row-info { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.ride-row-date { flex-shrink: 0; text-align: center; }
.ride-date-badge {
    display: inline-block; padding: 4px 10px; border-radius: 6px;
    color: #fff; font-size: 11px; font-weight: 700; white-space: nowrap;
}
.ride-row-status { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 110px; flex-shrink: 0; }
.ride-row-ago { min-width: 80px; text-align: center; flex-shrink: 0; }
.ride-row-actions { display: flex; gap: 6px; flex-shrink: 0; }
.ride-action-btn {
    width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 14px;
    background: #f3f4f6; transition: all 0.15s;
}
.ride-action-btn:hover { background: #e5e7eb; transform: scale(1.1); }
.ride-tag {
    display: inline-flex; align-items: center; padding: 1px 7px;
    border-radius: 4px; font-size: 10px; font-weight: 700; white-space: nowrap;
}

@media (max-width: 1024px) {
    .ride-row { flex-wrap: wrap; gap: 10px; }
    .ride-row-ago { display: none; }
    .ride-row-source { min-width: auto; }
}

.ride-card.s-pending { border-left-color: #f59e0b; }
.ride-card.s-searching { border-left-color: #8b5cf6; }
.ride-card.s-accepted, .ride-card.s-driver_arriving { border-left-color: #3b82f6; }
.ride-card.s-in_progress { border-left-color: #10b981; }
.ride-card.s-completed { border-left-color: #6b7280; }
.ride-card.s-cancelled { border-left-color: #ef4444; }

/* Empty state */
.empty-state { padding: 60px 20px; text-align: center; }
.empty-state-icon { font-size: 48px; color: #d1d5db; margin-bottom: 16px; }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--secondary); margin-bottom: 4px; }
.empty-state-desc { font-size: 13px; color: var(--text-muted); }

/* Toast */
.tb-toast {
    position: fixed; bottom: 24px; right: 24px; z-index: 9999;
    padding: 12px 20px; border-radius: var(--radius-lg);
    color: white; font-weight: 600; font-size: 13px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2); animation: slideUp 0.3s;
}
.tb-toast.success { background: var(--success); }
.tb-toast.error { background: var(--danger); }
.tb-toast.info { background: var(--info); }

/* Animations */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.loading-spinner {
    width: 2.5rem; height: 2.5rem; border: 3px solid var(--border-color);
    border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite;
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* Split button + dropdown */
.btn-split { display: inline-flex; position: relative; }
.btn-split-main {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; padding: 0.6rem 1.25rem; border-radius: var(--radius-lg) 0 0 var(--radius-lg);
    font-weight: 600; border: none; cursor: pointer; display: inline-flex;
    align-items: center; gap: 0.5rem; font-size: 13px; font-family: inherit;
    transition: all 0.15s;
}
.btn-split-main:hover { filter: brightness(1.05); }
.btn-split-toggle {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff; padding: 0.6rem 0.75rem; border-radius: 0 var(--radius-lg) var(--radius-lg) 0;
    border: none; cursor: pointer; border-left: 1px solid rgba(0,0,0,0.1);
    font-family: inherit; transition: all 0.15s;
}
.btn-split-toggle:hover { filter: brightness(1.05); }
.btn-dropdown {
    position: absolute; top: 100%; right: 0; margin-top: 4px; min-width: 200px;
    background: white; border-radius: var(--radius-lg); border: 1px solid var(--border-color);
    box-shadow: 0 10px 25px rgba(0,0,0,0.15); z-index: 40; overflow: hidden;
    animation: scaleIn 0.15s;
}
.btn-dropdown-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 14px;
    font-size: 13px; color: var(--text-primary); cursor: pointer;
    transition: background 0.1s; width: 100%; border: none; background: none;
    font-family: inherit; text-align: left;
}
.btn-dropdown-item:hover { background: #f3f4f6; }
.btn-dropdown-item.danger { color: var(--danger); }
.btn-dropdown-item.danger:hover { background: #fef2f2; }
.btn-dropdown-sep { height: 1px; background: var(--border-color); margin: 4px 0; }

/* Leaflet map overrides */
.leaflet-container { border-radius: var(--radius-xl); }

/* ============================================================ */
/* COMMAND PALETTE (CMD+K)                                       */
/* ============================================================ */
.cp-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px); z-index: 99999;
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 15vh; animation: fadeIn 0.1s;
}
.cp-modal {
    width: 560px; max-width: 95vw; background: white; border-radius: 16px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.25); overflow: hidden;
    animation: scaleIn 0.15s;
}
.cp-search-bar {
    display: flex; align-items: center; gap: 12px;
    padding: 16px 20px; border-bottom: 1px solid #e5e7eb;
}
.cp-search-icon { color: #9ca3af; font-size: 16px; }
.cp-input {
    flex: 1; border: none; outline: none; font-size: 15px;
    font-family: inherit; color: #1f2937; background: transparent;
}
.cp-input::placeholder { color: #9ca3af; }
.cp-shortcuts { display: flex; gap: 4px; }
.cp-shortcuts kbd, .cp-footer kbd {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 22px; height: 22px; padding: 0 6px;
    background: #f3f4f6; border: 1px solid #e5e7eb; border-radius: 5px;
    font-size: 11px; font-family: inherit; color: #6b7280;
}
.cp-results {
    max-height: 400px; overflow-y: auto; padding: 8px;
}
.cp-group-label {
    font-size: 11px; font-weight: 700; color: #9ca3af;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 8px 12px 4px;
}
.cp-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 10px; cursor: pointer;
    transition: background 0.1s;
}
.cp-item:hover, .cp-active { background: #f3f4f6; }
.cp-item-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; flex-shrink: 0;
}
.cp-item-text { flex: 1; min-width: 0; }
.cp-item-label { font-size: 13px; font-weight: 600; color: #374151; flex: 1; }
.cp-item-sub { font-size: 11px; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cp-item-type { font-size: 10px; color: #9ca3af; background: #f3f4f6; padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.cp-item-arrow { font-size: 10px; color: #d1d5db; margin-left: 4px; }
.cp-footer {
    display: flex; gap: 16px; padding: 10px 20px;
    border-top: 1px solid #f3f4f6; background: #fafafa;
    font-size: 11px; color: #9ca3af;
}
.cp-footer span { display: flex; align-items: center; gap: 4px; }
.cp-loading, .cp-empty, .cp-hint { text-align: center; padding: 24px; color: #9ca3af; font-size: 13px; }
.cp-hint-row { margin-bottom: 16px; }
.cp-recent-label { font-size: 11px; font-weight: 700; color: #9ca3af; text-transform: uppercase; letter-spacing: 0.05em; text-align: left; padding: 0 12px 8px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ============================================================ */
/* FLOATING WIDGETS                                              */
/* ============================================================ */
/* ---- Top bar (action buttons) ---- */
.fw-topbar {
    position: relative; flex-shrink: 0;
}
.fw-topbar-inner {
    display: flex; align-items: center; justify-content: flex-end;
    padding: 10px 24px; border-bottom: 1px solid var(--border-color);
    background: #fff;
}
.fw-topbar-buttons {
    display: flex; align-items: center; gap: 6px;
}
.fw-tb-btn {
    height: 34px; border-radius: 10px; border: none; cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 14px; transition: all .15s; position: relative;
    background: #f3f4f6; color: #64748b; padding: 0 10px;
    font-family: inherit; font-weight: 500;
}
.fw-tb-btn:hover { background: #e5e7eb; color: #374151; }
.fw-tb-btn.active { background: var(--primary); color: #1f2937; }
.fw-tb-btn-primary {
    background: linear-gradient(135deg, #FDB813, #E09400); color: #fff;
    font-size: 13px; font-weight: 600; padding: 0 14px;
}
.fw-tb-btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, #FDB813, #E09400); color: #fff; }
.fw-tb-sep { width: 1px; height: 20px; background: #e5e7eb; margin: 0 4px; }

.btn-back-modules {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: 10px; border: none; cursor: pointer;
    background: #f3f4f6; color: #64748B; font-size: 13px; font-weight: 600;
    font-family: inherit; transition: all 0.15s;
}
.btn-back-modules:hover { background: #e5e7eb; color: #1f2937; }

.addr-suggestions {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 0.75rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12); margin-top: 4px;
    max-height: 260px; overflow-y: auto;
}
.addr-suggestion-item {
    padding: 10px 14px; cursor: pointer; font-size: 13px; color: #374151;
    display: flex; align-items: center; transition: background 0.15s;
}
.addr-suggestion-item:first-child { border-radius: 0.75rem 0.75rem 0 0; }
.addr-suggestion-item:last-child { border-radius: 0 0 0.75rem 0.75rem; }
.addr-suggestion-item:hover { background: #FFF8E1; }

.fw-container { position: relative; }

@keyframes fw-ring { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }

.fw-panel {
    position: absolute; top: 100%; right: 24px; width: 360px;
    margin-top: 4px;
    background: white; border-radius: 16px; overflow: hidden;
    box-shadow: 0 10px 40px rgba(0,0,0,0.15); border: 1px solid #e5e7eb;
    display: flex; flex-direction: column; max-height: 500px;
    animation: scaleIn 0.15s; z-index: 9999;
}
.fw-panel-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 16px; border-bottom: 1px solid #f3f4f6;
    background: #fafafa;
}
.fw-panel-tabs { display: flex; gap: 0; }
.fw-ptab {
    padding: 6px 10px; font-size: 11px; font-weight: 600;
    background: none; border: none; cursor: pointer; color: #6b7280;
    border-radius: 6px; transition: all 0.15s; font-family: inherit;
}
.fw-ptab.active { background: var(--primary); color: #1f2937; }
.fw-ptab:not(.active):hover { background: #f3f4f6; }
.fw-close {
    width: 28px; height: 28px; border-radius: 8px; background: none;
    border: none; cursor: pointer; color: #9ca3af; font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.fw-close:hover { background: #f3f4f6; color: #374151; }

.fw-panel-body { flex: 1; overflow-y: auto; padding: 12px; max-height: 380px; }
.fw-empty { text-center; padding: 24px; color: #9ca3af; font-size: 13px; text-align: center; }

.fw-user-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px;
    border-radius: 10px; margin-bottom: 4px; transition: background 0.1s;
}
.fw-user-item.clickable { cursor: pointer; }
.fw-user-item.clickable:hover { background: #f3f4f6; }
.fw-user-avatar-wrap { position: relative; flex-shrink: 0; }
.chat-status-dot {
    position: absolute; bottom: -1px; right: -1px; width: 10px; height: 10px;
    border-radius: 50%; border: 2px solid #fff;
}
.fw-user-avatar-sm {
    width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 11px; font-weight: 700;
}
.fw-user-avatar {
    width: 34px; height: 34px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: white; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.fw-user-info { flex: 1; min-width: 0; }
.fw-user-name { font-size: 13px; font-weight: 600; color: #374151; display: flex; align-items: center; gap: 6px; }
.fw-user-meta { font-size: 11px; color: #9ca3af; }
.fw-you { font-size: 9px; background: #ecfdf5; color: #059669; padding: 1px 6px; border-radius: 8px; font-weight: 600; }
.fw-role { font-size: 9px; padding: 1px 6px; border-radius: 8px; font-weight: 600; margin-left: 4px; }
.fw-role-admin { background: #fef2f2; color: #ef4444; }
.fw-role-manager { background: #eff6ff; color: #3b82f6; }
.fw-chat-action { color: var(--primary); cursor: pointer; font-size: 14px; }

.fw-chat-body { display: flex; flex-direction: column; padding: 0; }
.fw-chat-header-sub { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid #f3f4f6; }
.fw-back-btn { background: none; border: none; cursor: pointer; color: #6b7280; font-size: 14px; padding: 4px; }
.fw-back-btn:hover { color: #374151; }
.fw-messages { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.fw-panel-chat .fw-messages { max-height: 310px; }
.fw-panel-chat-open .fw-messages { max-height: 440px; }
.fw-msg { display: flex; flex-direction: column; max-width: 85%; }
.fw-msg-me { align-self: flex-end; }
.fw-msg-other { align-self: flex-start; }
.fw-msg-bubble { padding: 8px 12px; border-radius: 12px; font-size: 13px; line-height: 1.4; word-break: break-word; }
.fw-msg-me .fw-msg-bubble { background: var(--primary); color: #1f2937; border-bottom-right-radius: 4px; }
.fw-msg-other .fw-msg-bubble { background: #f3f4f6; color: #374151; border-bottom-left-radius: 4px; }
.fw-msg-time { font-size: 10px; color: #9ca3af; margin-top: 2px; }
.fw-msg-me .fw-msg-time { text-align: right; }

.fw-chat-input {
    display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid #f3f4f6;
    background: #fafafa;
}

/* Chat panel - larger when conversation is open */
.fw-panel-chat-open { max-height: 600px; width: 400px; }

/* Chat presence */
.chat-presence-label { font-size: 11px; display: flex; align-items: center; gap: 4px; }
.chat-presence-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.chat-conv-header { display: flex; align-items: center; gap: 8px; flex: 1; }

/* Chat online badge in tab */
.chat-online-badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
    font-size: 10px; font-weight: 700; background: #10b981; color: #fff; margin-left: 4px;
}

/* Conversation preview */
.chat-convo-preview { font-size: 11px; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }

/* Unread badge in conversation list */
.chat-unread-badge {
    min-width: 20px; height: 20px; border-radius: 10px; padding: 0 6px;
    background: #ef4444; color: #fff; font-size: 11px; font-weight: 700;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Unread badge on topbar chat button */
.fw-tb-badge {
    position: absolute; top: -4px; right: -4px;
    min-width: 16px; height: 16px; border-radius: 8px; padding: 0 4px;
    background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    line-height: 1;
}

/* Date separator in chat */
.chat-date-separator {
    text-align: center; padding: 8px 0; font-size: 10px; color: #9ca3af;
}
.chat-date-separator span {
    background: #f3f4f6; padding: 2px 10px; border-radius: 10px;
}
.fw-input {
    flex: 1; padding: 8px 12px; border: 1px solid #e5e7eb;
    border-radius: 10px; font-size: 13px; outline: none;
    font-family: inherit; transition: border 0.15s;
}
.fw-input:focus { border-color: var(--primary); }
.fw-send-btn {
    width: 36px; height: 36px; border-radius: 10px; border: none;
    background: var(--primary); color: #1f2937; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    font-size: 14px; transition: all 0.15s;
}
.fw-send-btn:hover { filter: brightness(1.1); }

.fw-ticket-item {
    display: flex; align-items: center; gap: 10px; padding: 10px;
    border-radius: 10px; cursor: pointer; transition: background 0.1s;
    margin-bottom: 4px;
}
.fw-ticket-item:hover { background: #f3f4f6; }
.fw-ticket-icon {
    width: 34px; height: 34px; border-radius: 10px; background: #fef3c7;
    display: flex; align-items: center; justify-content: center;
    color: #d97706; font-size: 14px; flex-shrink: 0;
}
.fw-ticket-info { flex: 1; min-width: 0; }
.fw-ticket-subject { font-size: 13px; font-weight: 600; color: #374151; }
.fw-ticket-meta { font-size: 11px; color: #9ca3af; }

.fw-session-info { padding: 8px; }
.fw-session-active { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #10b981; margin-bottom: 8px; }
.fw-session-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; animation: pulse 2s infinite; }

.fw-status-dot { width: 8px; height: 8px; border-radius: 50%; }
.fw-status-idle { background: #9ca3af; }
.fw-status-ringing { background: #ef4444; animation: pulse 1s infinite; }
.fw-status-connected { background: #10b981; animation: pulse 2s infinite; }

.fw-incoming-call { text-align: center; padding: 20px; }
.fw-call-animation { position: relative; width: 80px; height: 80px; margin: 0 auto 16px; }
.fw-call-ring { position: absolute; inset: 0; border: 3px solid #ef4444; border-radius: 50%; animation: fw-expand 1.5s ease infinite; opacity: 0; }
.fw-ring-2 { animation-delay: 0.5s; }
@keyframes fw-expand { 0% { transform: scale(0.5); opacity: 0.8; } 100% { transform: scale(1.5); opacity: 0; } }
.fw-call-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 28px; color: #ef4444; animation: fw-ring 0.5s ease infinite; }
.fw-caller-id { font-size: 16px; font-weight: 700; color: #374151; margin-bottom: 16px; }
.fw-call-actions { display: flex; justify-content: center; gap: 16px; }
.fw-answer-btn, .fw-reject-btn {
    width: 52px; height: 52px; border-radius: 50%; border: none;
    cursor: pointer; color: white; font-size: 20px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.fw-answer-btn { background: #10b981; }
.fw-answer-btn:hover { background: #059669; }
.fw-reject-btn { background: #ef4444; }
.fw-reject-btn:hover { background: #dc2626; }

.fw-active-call { text-align: center; padding: 16px; }
.fw-connected-indicator { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; font-weight: 600; color: #10b981; margin-bottom: 8px; }
.fw-pulse-dot { width: 8px; height: 8px; border-radius: 50%; background: #10b981; animation: pulse 2s infinite; }
.fw-call-controls { display: flex; justify-content: center; gap: 12px; margin-top: 16px; }
.fw-ctrl-btn {
    width: 44px; height: 44px; border-radius: 50%; border: 2px solid #e5e7eb;
    background: white; cursor: pointer; color: #374151; font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.15s;
}
.fw-ctrl-btn:hover { background: #f3f4f6; }
.fw-ctrl-btn.fw-ctrl-active { background: #fef2f2; border-color: #ef4444; color: #ef4444; }
.fw-ctrl-btn.fw-ctrl-danger { background: #ef4444; border-color: #ef4444; color: white; }
.fw-ctrl-btn.fw-ctrl-danger:hover { background: #dc2626; }

.fw-call-log-item {
    display: flex; align-items: center; gap: 8px; padding: 6px 8px;
    border-radius: 8px; font-size: 12px;
}
.fw-call-log-item:hover { background: #f3f4f6; }

/* Pagination */
.tb-pagination {
    display: flex; align-items: center; justify-content: flex-start; gap: 12px;
    padding: 12px 16px; border-top: 1px solid #e5e7eb; background: #fafbfc;
}
.tb-pagination-info {
    font-size: 13px; color: #6b7280;
}
.tb-pagination-controls {
    display: flex; align-items: center; gap: 4px;
}
.tb-pagination-btn {
    min-width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid #e5e7eb; border-radius: 8px; background: #fff; color: #374151;
    font-size: 13px; font-weight: 500; cursor: pointer; transition: all .15s;
    padding: 0 8px;
}
.tb-pagination-btn:hover:not(:disabled):not(.active) {
    background: #f3f4f6; border-color: #d1d5db;
}
.tb-pagination-btn.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
}
.tb-pagination-btn:disabled {
    opacity: 0.4; cursor: not-allowed;
}
.tb-pagination-ellipsis {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; font-size: 13px; color: #9ca3af;
}

/* Toggle Switch */
.tb-toggle-group { }
.tb-toggle-group-title {
    display: flex; align-items: center; font-size: 13px; font-weight: 600;
    color: #6b7280; text-transform: uppercase; letter-spacing: .04em;
    padding: 0 0 10px; margin-bottom: 4px; border-bottom: 1px solid #f3f4f6;
}
.tb-toggle-group-list { display: flex; flex-direction: column; }
.tb-toggle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid #f3f4f6;
}
.tb-toggle-row:last-child { border-bottom: none; }
.tb-toggle-info { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.tb-toggle-icon { font-size: 14px; color: var(--primary); width: 18px; text-align: center; flex-shrink: 0; }
.tb-toggle-label { font-size: 13.5px; font-weight: 500; color: #1f2937; }
.tb-toggle-desc { font-size: 12px; color: #9ca3af; margin-top: 2px; }
.tb-toggle-btn {
    position: relative; display: inline-flex; height: 24px; width: 44px;
    align-items: center; border-radius: 12px; border: none; cursor: pointer;
    background: #d1d5db; transition: background .2s, opacity .2s;
    flex-shrink: 0; padding: 0;
}
.tb-toggle-btn.active { background: var(--primary); }
.tb-toggle-btn:disabled { opacity: .5; cursor: not-allowed; }
.tb-toggle-btn.loading { opacity: .6; }
.tb-toggle-knob {
    display: block; height: 18px; width: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.15);
    transition: transform .2s; transform: translateX(3px);
}
.tb-toggle-btn.active .tb-toggle-knob { transform: translateX(23px); }

/* ---- Price Calculator Widget ---- */
.fw-panel-calc { width: 400px; max-height: 600px; }
.calc-body { padding: 14px !important; display: flex; flex-direction: column; gap: 10px; }
.calc-field { position: relative; display: flex; align-items: center; gap: 0; }
.calc-field-icon {
    position: absolute; left: 12px; top: 10px; z-index: 1; width: 16px; text-align: center;
}
.calc-input {
    width: 100%; padding: 9px 12px 9px 34px; border: 1px solid #e5e7eb;
    border-radius: 10px; font-size: 13px; font-family: inherit; color: #1f2937;
    outline: none; transition: border .15s;
}
.calc-input:focus { border-color: var(--primary); }
.calc-input::placeholder { color: #9ca3af; }
.calc-suggestions {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 50;
    background: #fff; border: 1px solid #e5e7eb; border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0,0,0,.1); margin-top: 4px;
    max-height: 180px; overflow-y: auto;
}
.calc-sugg-item {
    padding: 8px 12px; cursor: pointer; font-size: 12px; color: #374151;
    display: flex; align-items: center; transition: background .1s;
}
.calc-sugg-item:hover { background: #fff8e1; }
.calc-recalc-btn {
    width: 100%; padding: 7px; border: none; border-radius: 8px;
    background: #f3f4f6; color: #374151; font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit; transition: background .15s;
}
.calc-recalc-btn:hover { background: #e5e7eb; }
.calc-loading { text-align: center; padding: 16px; color: #6b7280; font-size: 13px; }
.calc-route-info {
    display: flex; gap: 16px; justify-content: center; padding: 8px;
    background: #f9fafb; border-radius: 8px; font-size: 12px; color: #6b7280;
}
.calc-route-info span { display: flex; align-items: center; gap: 4px; }
.calc-route-info i { color: var(--primary); }
.calc-promo-banner {
    display: flex; align-items: center; padding: 8px 12px; background: #d1fae5;
    border-radius: 8px; font-size: 12px; font-weight: 600; color: #065f46;
}
.calc-vehicles { display: flex; flex-direction: column; gap: 0; }
.calc-vehicle-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 0; border-bottom: 1px solid #f3f4f6;
}
.calc-vehicle-row:last-child { border-bottom: none; }
.calc-vehicle-left { display: flex; align-items: center; gap: 10px; }
.calc-vehicle-img {
    width: 52px; height: 36px; display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; border-radius: 8px; background: #f8fafc; overflow: hidden;
}
.calc-vehicle-img img { width: 100%; height: 100%; object-fit: contain; }
.calc-vehicle-name { font-size: 13px; font-weight: 600; color: #1f2937; }
.calc-vehicle-cap { font-size: 11px; color: #9ca3af; }
.calc-vehicle-right { text-align: right; }
.calc-vehicle-price { font-size: 16px; font-weight: 700; color: #1f2937; }
.calc-badges { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; margin-top: 2px; }
.calc-badge {
    font-size: 9px; font-weight: 600; padding: 2px 5px; border-radius: 4px;
    text-transform: uppercase; letter-spacing: .02em;
}
.calc-badge-surge { background: #fef3c7; color: #d97706; }
.calc-badge-promo { background: #d1fae5; color: #059669; }
.calc-badge-special { background: #ede9fe; color: #7c3aed; }
.calc-badge-slot { background: #fed7aa; color: #c2410c; }
.calc-empty { text-align: center; padding: 24px; color: #9ca3af; font-size: 13px; }

/* ---- Call Cards Bar ---- */
.tb-call-cards-bar {
    position: fixed; bottom: 16px; left: 80px; z-index: 900;
    display: flex; gap: 12px; align-items: flex-end;
    animation: slideUpIn .3s ease;
}
@keyframes slideUpIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
.tb-call-card {
    width: 220px; background: #fff; border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,.12), 0 2px 6px rgba(0,0,0,.06);
    border: 1px solid #e5e7eb; overflow: hidden;
    animation: slideUpIn .3s ease;
}
.tb-call-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; background: linear-gradient(135deg, #FDB813, #E09400);
}
.tb-call-card-icon { color: #fff; font-size: 14px; }
.tb-call-card-close {
    background: none; border: none; color: rgba(255,255,255,.7); cursor: pointer;
    font-size: 12px; padding: 2px 4px; border-radius: 4px;
}
.tb-call-card-close:hover { color: #fff; background: rgba(255,255,255,.2); }
.tb-call-card-body { padding: 10px 12px; cursor: pointer; }
.tb-call-card-body:hover { background: #f9fafb; }
.tb-call-card-phone { font-size: 14px; font-weight: 700; color: #1f2937; }
.tb-call-card-name { font-size: 12px; color: #6b7280; margin-top: 2px; }
.tb-call-card-addr { font-size: 11px; color: #9ca3af; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-call-card-action {
    margin-top: 8px; padding: 6px 0; text-align: center;
    font-size: 12px; font-weight: 600; color: var(--primary);
    border-top: 1px solid #f3f4f6;
}

/* ---- Live View (split map + list) ---- */
.live-layout { display: flex; flex-direction: column; height: calc(100vh - 0px); margin: -24px; }
.live-split { display: flex; flex: 1; min-height: 0; }
.live-map-container { flex: 1; min-width: 0; position: relative; }
.live-map-container .leaflet-container { border-radius: 0; }
.live-list-container {
    width: 380px; flex-shrink: 0; display: flex; flex-direction: column;
    border-left: 1px solid #e5e7eb; background: #fff;
}
.live-list-filters {
    display: flex; gap: 4px; padding: 10px 12px; border-bottom: 1px solid #f3f4f6;
    flex-shrink: 0; overflow-x: auto;
}
.live-filter-btn {
    font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 8px;
    border: 1px solid #e5e7eb; background: #fff; color: #6b7280; cursor: pointer;
    white-space: nowrap; transition: all .15s;
}
.live-filter-btn:hover { background: #f9fafb; }
.live-filter-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.live-list-scroll { flex: 1; overflow-y: auto; }

.live-list-item {
    padding: 12px 14px; border-bottom: 1px solid #f3f4f6; cursor: pointer;
    transition: background .15s;
}
.live-list-item:hover { background: #f9fafb; }
.live-list-item.active { background: #fffbeb; border-left: 3px solid var(--primary); }
.live-list-item.highlighted { background: #fef3c7; }
.live-list-item-top { display: flex; align-items: center; gap: 10px; }
.live-status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.live-list-item-name { font-size: 13px; font-weight: 600; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-list-item-addr { font-size: 11px; color: #9ca3af; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.live-list-item-meta { text-align: right; flex-shrink: 0; }
.live-list-item-status { display: block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.live-list-item-time { display: block; font-size: 10px; color: #9ca3af; margin-top: 2px; }

.live-list-item-detail {
    margin-top: 10px; padding-top: 10px; border-top: 1px solid #f3f4f6;
}
.live-list-detail-row { font-size: 12px; color: #4b5563; margin-bottom: 4px; display: flex; align-items: center; }
.live-list-detail-actions { display: flex; gap: 6px; margin-top: 8px; }

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}
.live-pulse { animation: livePulse 1.5s ease-in-out infinite; }
.sidebar-badge {
    font-size: 10px; font-weight: 700; background: #ef4444; color: #fff;
    border-radius: 10px; padding: 1px 6px; margin-left: auto;
}
@media (max-width: 768px) {
    .live-split { flex-direction: column-reverse; }
    .live-list-container { width: 100%; height: 50%; border-left: none; border-top: 1px solid #e5e7eb; }
    .live-map-container { height: 50%; }
}

/* Fleet cards */
.fleet-card { overflow: hidden; border-radius: 14px; }
.fleet-card-img {
    position: relative; background: #f8fafc; display: flex; align-items: center; justify-content: center;
    height: 160px; overflow: hidden;
}
.fleet-card-img img { width: 100%; height: 100%; object-fit: contain; padding: 12px; }
.fleet-card-placeholder { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; }
.fleet-card-img-btn {
    position: absolute; bottom: 8px; right: 8px; width: 32px; height: 32px; border-radius: 50%;
    background: rgba(255,255,255,.9); border: 1px solid #e5e7eb; color: #6b7280; cursor: pointer;
    display: flex; align-items: center; justify-content: center; font-size: 13px;
    opacity: 0; transition: opacity .2s;
}
.fleet-card:hover .fleet-card-img-btn { opacity: 1; }
.fleet-card-img-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
