*{
  margin:0;
  padding:0;
  box-sizing:border-box;
  font-family:'Inter',sans-serif;
}

:root{
  --primary:#1e88ff;
  --primary-light:#eef7ff;
  --dark:#0f172a;
  --text:#475569;
  --border:#e5edf6;
  --white:#ffffff;
  --bg:#f6fbffeb;
  --bg-image:url("assets/image/bg/pexels-codioful-7135020.jpg");
  --bg-overlay:rgba(246,251,255,.93);
  --surface-soft:#f8fbff;
  --surface-muted:#eef4fb;
  --donut-inner:#ffffff;
  --chart-light:#dff0ff;
  --shadow:0 18px 45px rgba(15,23,42,.08);
  --radius:22px;
}

html.dark-theme{
  --primary-light:rgba(30,136,255,.14);
  --dark:#f1f5f9;
  --text:#94a3b8;
  --border:#243044;
  --white:rgba(17,24,39,.94);
  --bg:#0b1220;
  --bg-overlay:rgba(11,18,32,.9);
  --surface-soft:rgba(26,35,50,.92);
  --surface-muted:#243044;
  --donut-inner:#111827;
  --chart-light:#243044;
  --shadow:0 18px 45px rgba(0,0,0,.35);
}

body{
  color:var(--dark);
  overflow-x:hidden;
  transition:color .3s ease;
  min-height:100vh;
  background:
    linear-gradient(180deg, var(--bg-overlay), var(--bg-overlay)),
    var(--bg-image) center/cover no-repeat fixed;
}

.dashboard{
  display:flex;
  min-height:100vh;
}

/* Sidebar */
.sidebar{
  width:280px;
  background:var(--white);
  border-right:1px solid var(--border);
  padding:24px 18px;
  position:fixed;
  inset:0 auto 0 0;
  z-index:100;
  transition:.35s ease, background .3s ease, border-color .3s ease;
  display:flex;
  flex-direction:column;
  height:100vh;
  -webkit-backdrop-filter:blur(12px);
  backdrop-filter:blur(12px);
}

.logo{
  display:flex;
  align-items:center;
  gap:12px;
  margin-bottom:30px;
  padding:10px;
}

.logo-icon{
  width:44px;
  height:44px;
  background:linear-gradient(135deg,#1e88ff,#74c7ff);
  border-radius:15px;
  display:grid;
  place-items:center;
  color:white;
  font-size:20px;
}

.logo h2{
  font-size:21px;
  font-weight:800;
}

.menu{
  display:flex;
  flex-direction:column;
  gap:7px;
  flex:1;
  overflow-y:auto;
  padding-right:4px;
}

.menu a{
  text-decoration:none;
  color:var(--text);
  padding:13px 15px;
  border-radius:15px;
  display:flex;
  align-items:center;
  gap:13px;
  font-size:14px;
  font-weight:600;
  transition:.25s;
}

.menu a i{
  width:20px;
}

.menu-label{
  min-width:0;
  flex:1;
}

.menu-count{
  min-width:22px;
  height:22px;
  padding:0 7px;
  border-radius:999px;
  background:var(--primary);
  color:#fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size:12px;
  font-weight:800;
  line-height:1;
  margin-left:auto;
}

.menu-count[hidden]{
  display:none;
}

.menu a:hover,
.menu a.active{
  background:var(--primary-light);
  color:var(--primary);
}

.menu-logout{
  margin-top:auto;
  padding-top:15px;
  border-top:1px solid var(--border);
  flex-shrink:0;
}

.menu-logout button{
  width:100%;
  border:none;
  background:transparent;
  cursor:pointer;
  font-family:inherit;
  text-decoration:none;
  color:var(--text);
  padding:13px 15px;
  border-radius:15px;
  display:flex;
  align-items:center;
  gap:13px;
  font-size:14px;
  font-weight:600;
  transition:.25s;
}

.menu-logout button i{
  width:20px;
}

.menu-logout button:hover{
  background:#fff1f2;
  color:#e11d48;
}

/* Main */
.main{
  flex:1;
  margin-left:280px;
  padding:24px;
  min-width:0;
}

/* Topbar */
.topbar{
  background:var(--white);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:16px 20px;
  box-shadow:var(--shadow);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  margin-bottom:24px;
  -webkit-backdrop-filter:blur(10px);
  backdrop-filter:blur(10px);
}

.menu-toggle{
  display:none;
  border:none;
  background:var(--primary-light);
  color:var(--primary);
  width:42px;
  height:42px;
  border-radius:13px;
  font-size:18px;
}

.search{
  flex:1;
  max-width:430px;
  background:var(--surface-soft);
  border:1px solid var(--border);
  border-radius:15px;
  padding:12px 15px;
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--text);
  transition:background .3s ease, border-color .3s ease;
}

.search input{
  border:none;
  background:transparent;
  outline:none;
  width:100%;
  color:var(--dark);
}

.top-actions{
  display:flex;
  align-items:center;
  gap:12px;
  min-width:0;
}

.date-box,
.icon-btn,
.admin{
  background:var(--surface-soft);
  border:1px solid var(--border);
  border-radius:15px;
  padding:11px 14px;
  color:var(--text);
  font-weight:600;
  font-size:13px;
  transition:background .3s ease, border-color .3s ease, color .3s ease;
}

.icon-btn{
  width:44px;
  height:44px;
  display:grid;
  place-items:center;
  color:var(--primary);
  cursor:pointer;
}

.theme-toggle.active-theme{
  background:var(--primary-light);
  color:var(--primary);
}

.admin{
  display:flex;
  align-items:center;
  gap:10px;
}

.avatar{
  width:34px;
  height:34px;
  border-radius:50%;
  background:linear-gradient(135deg,#1e88ff,#8fd3ff);
  display:grid;
  place-items:center;
  color:white;
  font-weight:800;
}

/* Cards */
.cards{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:18px;
  margin-bottom:24px;
}

.card{
  background:var(--white);
  border:1px solid var(--border);
  border-radius:var(--radius);
  padding:22px;
  box-shadow:var(--shadow);
  transition:background .3s ease, border-color .3s ease, box-shadow .3s ease;
  -webkit-backdrop-filter:blur(10px);
  backdrop-filter:blur(10px);
}

.stat-card{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
}

.stat-card-clickable{
  cursor:pointer;
  transition:transform .25s ease, box-shadow .25s ease;
}

.stat-card-clickable:hover{
  transform:translateY(-3px);
  box-shadow:0 22px 50px rgba(15,23,42,.12);
}

.stat-card-clickable.active-stat{
  border-color:#cfe4ff;
  background:var(--surface-soft);
}

.stat-card h4{
  color:var(--text);
  font-size:14px;
  margin-bottom:12px;
}

.stat-card h2{
  font-size:28px;
  font-weight:800;
}

.stat-icon{
  width:50px;
  height:50px;
  border-radius:17px;
  background:var(--primary-light);
  color:var(--primary);
  display:grid;
  place-items:center;
  font-size:20px;
}

/* Grid */
.grid{
  display:grid;
  grid-template-columns:2fr 1fr;
  gap:18px;
  margin-bottom:24px;
}

.section-title{
  display:flex;
  justify-content:space-between;
  align-items:center;
  margin-bottom:20px;
}

.section-title h3{
  font-size:18px;
}

.section-title span{
  color:var(--primary);
  font-size:13px;
  font-weight:700;
}

.view-all-btn{
  cursor:pointer;
  transition:opacity .25s;
}

.view-all-btn:hover{
  opacity:.75;
}

/* Bar Chart */
.chart{
  height:260px;
  display:flex;
  align-items:end;
  gap:16px;
  padding-top:20px;
}

.bar-box{
  flex:1;
  text-align:center;
}

.bar{
  height:0;
  border-radius:14px 14px 4px 4px;
  background:linear-gradient(180deg,#56b8ff,#1e88ff);
  transition:1s ease;
}

.bar-box small{
  display:block;
  margin-top:10px;
  color:var(--text);
  font-weight:600;
}

/* Donut */
.donut-wrap{
  display:grid;
  place-items:center;
  padding:20px 0;
}

.donut{
  width:180px;
  height:180px;
  border-radius:50%;
  background:conic-gradient(#1e88ff 0deg, #1e88ff 0deg, #dff0ff 0deg);
  display:grid;
  place-items:center;
  transition:1.2s ease;
}

.donut::before{
  content:"";
  width:118px;
  height:118px;
  background:var(--donut-inner);
  border-radius:50%;
  position:absolute;
  transition:background .3s ease;
}

.donut span{
  position:relative;
  font-size:28px;
  font-weight:800;
  color:var(--primary);
}

.legend{
  display:flex;
  justify-content:center;
  gap:16px;
  color:var(--text);
  font-size:13px;
  font-weight:600;
}

.dot{
  width:10px;
  height:10px;
  display:inline-block;
  border-radius:50%;
  margin-right:6px;
}

.blue{background:#1e88ff}
.light{background:var(--chart-light)}

/* Mini Sections */
.mini-grid{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:18px;
  margin-bottom:24px;
}

.info-list{
  display:flex;
  flex-direction:column;
  gap:13px;
}

.info-item{
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:12px;
  background:var(--surface-soft);
  border-radius:14px;
  color:var(--text);
  font-size:14px;
  font-weight:600;
  transition:background .3s ease;
}

.info-item strong{
  color:var(--dark);
}

/* Table */
.table-card{
  overflow:hidden;
}

.table-wrap{
  overflow:auto;
  width:100%;
  max-height:340px;
  -webkit-overflow-scrolling:touch;
  scrollbar-gutter:stable;
}

.table-wrap thead th{
  position:sticky;
  top:0;
  z-index:2;
}

.recent-visitors-scroll{
  max-height:340px;
  overflow:auto;
}

.recent-visitors-scroll thead th{
  position:sticky;
  top:0;
  z-index:2;
}

table{
  width:100%;
  border-collapse:collapse;
  min-width:700px;
}

#assignedTripsTableBody{
  white-space:nowrap;
}

#assignedTripsSection table{
  min-width:1180px;
}

#bookingsSection table{
  min-width:980px;
}

.booking-section-search{
  margin:0 0 14px;
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--surface-soft);
  border:1px solid var(--border);
  border-radius:14px;
  padding:11px 14px;
  color:var(--text);
}

.booking-section-search input{
  width:100%;
  min-width:0;
  border:none;
  outline:none;
  background:transparent;
  color:var(--dark);
  font:inherit;
  font-size:14px;
}

#bookingsTableBody tr.booking-search-match{
  background:var(--primary-light);
}

#driversTableBody,
#applicationsTableBody,
#customersTableBody,
#loginUsersTableBody{
  white-space:nowrap;
}

#activeDriversSection table,
#driverApplicationsSection table,
#customersSection table,
#loginUsersSection table{
  min-width:900px;
}

th,td{
  text-align:left;
  padding:15px;
  border-bottom:1px solid var(--border);
  font-size:14px;
}

th{
  color:var(--text);
  font-weight:700;
  background:var(--surface-soft);
}

td{
  color:var(--dark);
  font-weight:600;
}

.badge{
  padding:7px 11px;
  border-radius:30px;
  font-size:12px;
  font-weight:800;
}

.completed{
  background:#dcfce7;
  color:#15803d;
}

.ongoing{
  background:#dbeafe;
  color:#1d4ed8;
}

.pending{
  background:#fef3c7;
  color:#b45309;
}

.online{
  background:#dcfce7;
  color:#15803d;
}

.offline{
  background:#f1f5f9;
  color:#64748b;
}

.on-trip{
  background:#dbeafe;
  color:#1d4ed8;
}

.approved{
  background:#dcfce7;
  color:#15803d;
}

.rejected{
  background:#fee2e2;
  color:#b91c1c;
}

/* Page Views */
.page-view{
  display:none;
}

.page-view.active{
  display:block;
}

.page-header{
  margin-bottom:24px;
  min-width:0;
}

.page-header h1{
  font-size:28px;
  font-weight:800;
  margin-bottom:6px;
}

.page-header p{
  color:var(--text);
  font-size:14px;
  font-weight:600;
}

.filter-bar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:20px;
}

.filter-btn{
  border:1px solid var(--border);
  background:var(--white);
  color:var(--text);
  padding:10px 16px;
  border-radius:12px;
  font-size:13px;
  font-weight:700;
  cursor:pointer;
  transition:.25s;
}

.filter-btn:hover,
.filter-btn.active{
  background:var(--primary-light);
  color:var(--primary);
  border-color:#cfe4ff;
}

.driver-cell{
  display:flex;
  align-items:center;
  gap:12px;
}

.driver-avatar{
  width:38px;
  height:38px;
  border-radius:12px;
  background:linear-gradient(135deg,#1e88ff,#8fd3ff);
  color:white;
  display:grid;
  place-items:center;
  font-size:13px;
  font-weight:800;
  flex-shrink:0;
}

.driver-meta span{
  display:block;
  color:var(--text);
  font-size:12px;
  font-weight:600;
  margin-top:2px;
}

.action-btn{
  width:34px;
  height:34px;
  border:none;
  border-radius:10px;
  background:var(--primary-light);
  color:var(--primary);
  cursor:pointer;
  transition:.25s;
}

.action-btn:hover{
  background:var(--primary);
  color:white;
}

.booking-action-cell{
  display:flex;
  align-items:center;
  gap:8px;
}

.accept-cancel-btn{
  background:#ecfdf3;
  color:#027a48;
}

.accept-cancel-btn:hover{
  background:#027a48;
  color:#fff;
}

.reject-cancel-btn{
  background:#fff1f2;
  color:#be123c;
}

.reject-cancel-btn:hover{
  background:#be123c;
  color:#fff;
}

.request-cancel-btn{
  background:#fff7ed;
  color:#c2410c;
}

.request-cancel-btn:hover{
  background:#c2410c;
  color:#fff;
}

.dashboard-primary{
  border:none;
  border-radius:12px;
  background:var(--primary);
  color:#fff;
  padding:12px 14px;
  font:inherit;
  font-weight:800;
  cursor:pointer;
  transition:.25s;
}

.dashboard-primary:hover{
  filter:brightness(.94);
}

.dashboard-primary:disabled{
  cursor:not-allowed;
  opacity:.7;
}

.payment-status-btn{
  border:none;
  border-radius:999px;
  background:#fff7ed;
  color:#c2410c;
  padding:8px 12px;
  font:inherit;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
  white-space:nowrap;
  transition:.25s;
}

.payment-status-btn:hover{
  background:#c2410c;
  color:white;
}

.payment-status-btn:disabled{
  cursor:not-allowed;
  opacity:.65;
}

.amount-payment-cell{
  display:flex;
  flex-direction:column;
  align-items:flex-start;
  gap:8px;
}

.amount-payment-cell strong{
  color:var(--dark);
  font-size:14px;
}

td{
  overflow-wrap:anywhere;
}

.visitor-row{
  cursor:pointer;
  transition:background .2s ease;
}

.visitor-row:hover{
  background:rgba(30,136,255,.06);
}

.application-doc-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}

.doc-preview{
  background:var(--surface-soft);
  border:1px dashed #cfe4ff;
  border-radius:16px;
  padding:16px;
  text-align:center;
  transition:background .3s ease;
}

html.dark-theme .doc-preview{
  border-color:#243044;
}

.doc-preview i{
  font-size:28px;
  color:var(--primary);
  margin-bottom:10px;
}

.doc-preview strong{
  display:block;
  font-size:14px;
  margin-bottom:6px;
}

.doc-preview span{
  display:block;
  color:var(--text);
  font-size:12px;
  font-weight:600;
  margin-bottom:12px;
  word-break:break-word;
}

.doc-view-btn{
  border:none;
  background:var(--primary-light);
  color:var(--primary);
  padding:8px 12px;
  border-radius:10px;
  font-size:12px;
  font-weight:700;
  cursor:pointer;
  transition:.25s;
}

.doc-view-btn:hover{
  background:var(--primary);
  color:white;
}

.application-info-grid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:10px;
  margin-bottom:16px;
  min-width:0;
}

.message-layout{
  display:grid;
  grid-template-columns:minmax(280px, .9fr) minmax(360px, 1.4fr);
  gap:18px;
  margin-bottom:24px;
}

.message-inbox,
.message-thread{
  min-height:520px;
}

.message-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.message-item{
  width:100%;
  border:1px solid transparent;
  background:var(--surface-soft);
  color:var(--dark);
  border-radius:14px;
  padding:12px;
  display:grid;
  grid-template-columns:42px minmax(0, 1fr) auto;
  align-items:center;
  gap:12px;
  text-align:left;
  cursor:pointer;
  font-family:inherit;
  transition:.25s;
}

.message-item:hover,
.message-item.active{
  border-color:#cfe4ff;
  background:var(--primary-light);
}

.message-item.unread .message-copy strong::after{
  content:"";
  width:8px;
  height:8px;
  display:inline-block;
  margin-left:8px;
  border-radius:50%;
  background:var(--primary);
}

.message-avatar{
  width:42px;
  height:42px;
  border-radius:14px;
  background:linear-gradient(135deg,#1e88ff,#8fd3ff);
  color:white;
  display:grid;
  place-items:center;
  font-size:13px;
  font-weight:800;
}

.message-copy{
  min-width:0;
}

.message-copy strong,
.message-copy small{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.message-copy strong{
  font-size:14px;
  margin-bottom:4px;
}

.message-copy small,
.message-time,
.message-thread-header p,
.message-thread-label,
.chat-bubble span{
  color:var(--text);
  font-size:12px;
  font-weight:700;
}

.message-time{
  align-self:start;
  padding-top:2px;
}

.message-empty{
  display:grid;
  place-items:center;
  gap:8px;
  padding:36px 20px;
  text-align:center;
  color:var(--text-muted);
}

.message-empty i{
  font-size:28px;
  color:var(--primary);
  opacity:.75;
}

.message-empty p{
  margin:0;
  font-size:15px;
  font-weight:600;
  color:var(--text);
}

.message-empty small{
  font-size:12px;
  line-height:1.5;
}

.message-empty.thread-empty{
  min-height:220px;
}

.message-thread{
  display:flex;
  flex-direction:column;
}

.message-thread-header{
  display:flex;
  justify-content:space-between;
  gap:14px;
  padding-bottom:18px;
  border-bottom:1px solid var(--border);
}

.message-thread-header h3{
  font-size:22px;
  margin:4px 0 6px;
}

.message-thread-label{
  color:var(--primary);
  text-transform:uppercase;
  letter-spacing:.04em;
}

.message-thread-body{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:14px;
  padding:20px 0;
}

.chat-bubble{
  max-width:78%;
  padding:14px;
  border-radius:16px;
}

.chat-bubble p{
  color:var(--dark);
  font-size:14px;
  font-weight:600;
  line-height:1.5;
  margin-top:6px;
}

.chat-bubble.incoming{
  align-self:flex-start;
  background:var(--surface-soft);
}

.chat-bubble.outgoing{
  align-self:flex-end;
  background:var(--primary-light);
}

.message-reply{
  display:grid;
  grid-template-columns:1fr auto;
  gap:12px;
  align-items:end;
  padding-top:16px;
  border-top:1px solid var(--border);
}

.message-reply textarea{
  width:100%;
  resize:none;
  border:1px solid var(--border);
  background:var(--surface-soft);
  color:var(--dark);
  border-radius:14px;
  padding:12px;
  font-family:inherit;
  font-size:14px;
  font-weight:600;
  outline:none;
}

.message-reply textarea:focus{
  border-color:#cfe4ff;
}

.reply-send-btn{
  border:none;
  background:var(--primary);
  color:white;
  border-radius:12px;
  padding:13px 16px;
  font-family:inherit;
  font-size:13px;
  font-weight:800;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  gap:8px;
}

@media(max-width:480px){
  .application-doc-grid,
  .application-info-grid{
    grid-template-columns:1fr;
  }
}

.coming-soon{
  min-height:420px;
  display:grid;
  place-items:center;
  text-align:center;
}

.coming-soon i{
  font-size:48px;
  color:var(--primary);
  margin-bottom:16px;
}

.coming-soon h2{
  font-size:24px;
  margin-bottom:8px;
}

.coming-soon p{
  color:var(--text);
  font-weight:600;
}

/* Stat Detail Panel */
.stat-panel-overlay{
  position:fixed;
  inset:0;
  background:rgba(15,23,42,.35);
  display:flex;
  align-items:center;
  justify-content:center;
  padding:20px;
  z-index:1000;
  opacity:0;
  visibility:hidden;
  transition:.3s ease;
}

.stat-panel-overlay.open{
  opacity:1;
  visibility:visible;
}

.stat-panel{
  width:100%;
  max-width:420px;
  min-width:0;
  max-height:85vh;
  background:var(--white);
  border:1px solid var(--border);
  border-radius:20px;
  box-shadow:0 24px 60px rgba(15,23,42,.18);
  overflow:hidden;
  transform:translateY(20px) scale(.96);
  transition:.3s ease;
}

.stat-panel *{
  max-width:100%;
}

.stat-panel-overlay.open .stat-panel{
  transform:translateY(0) scale(1);
}

.stat-panel-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:18px 20px;
  border-bottom:1px solid var(--border);
  background:var(--surface-soft);
}

.stat-panel-header h3{
  font-size:18px;
  font-weight:800;
}

.stat-panel-close{
  width:36px;
  height:36px;
  border:none;
  border-radius:10px;
  background:var(--white);
  color:var(--text);
  cursor:pointer;
  transition:.25s;
}

.stat-panel-close:hover{
  background:#fff1f2;
  color:#e11d48;
}

.stat-panel-body{
  padding:18px 20px 22px;
  overflow-y:auto;
  overflow-x:hidden;
  max-height:calc(85vh - 72px);
}

.stat-panel-summary{
  background:var(--primary-light);
  border-radius:16px;
  padding:16px;
  margin-bottom:16px;
}

.stat-panel-summary strong{
  display:block;
  font-size:28px;
  font-weight:800;
  color:var(--primary);
  margin-top:6px;
  overflow-wrap:anywhere;
}

.stat-panel-summary span{
  color:var(--text);
  font-size:13px;
  font-weight:700;
}

.stat-detail-list{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.stat-detail-item{
  display:flex;
  justify-content:space-between;
  align-items:flex-start;
  gap:12px;
  padding:12px 14px;
  background:var(--surface-soft);
  border-radius:14px;
  font-size:14px;
  font-weight:600;
  color:var(--text);
  transition:background .3s ease;
  min-width:0;
}

.stat-detail-item span,
.stat-detail-item strong{
  min-width:0;
  overflow-wrap:anywhere;
}

.stat-detail-item span{
  flex:0 1 auto;
}

.stat-detail-item strong{
  flex:1 1 auto;
  color:var(--dark);
  text-align:right;
}

.stat-detail-divider{
  margin:16px 0 12px;
  font-size:13px;
  font-weight:800;
  color:var(--primary);
  text-transform:uppercase;
  letter-spacing:.04em;
  overflow-wrap:anywhere;
}

.stat-panel .dashboard-field{
  display:flex;
  flex-direction:column;
  gap:8px;
  width:100%;
  min-width:0;
  color:var(--text);
  font-size:14px;
  font-weight:700;
}

.stat-panel .dashboard-field select{
  width:100%;
  min-width:0;
  border:1px solid var(--border);
  border-radius:10px;
  background:var(--white);
  color:var(--dark);
  padding:10px 12px;
  font:inherit;
}

.stat-panel .dashboard-primary{
  max-width:100%;
  white-space:normal;
  text-align:center;
  justify-content:center;
}

.stat-panel-table{
  overflow-x:auto;
}

.stat-panel-table table{
  min-width:100%;
}

.stat-panel-table th,
.stat-panel-table td{
  padding:10px 8px;
  font-size:12px;
}

@media(max-width:520px){
  .stat-panel-overlay{
    padding:10px;
    align-items:flex-start;
  }

  .stat-panel{
    max-width:none;
    width:100%;
    max-height:calc(100vh - 20px);
    border-radius:16px;
  }

  .stat-panel-body{
    padding:14px;
    max-height:calc(100vh - 88px);
  }

  .stat-panel-header{
    padding:14px;
  }

  .stat-panel .application-info-grid{
    grid-template-columns:1fr;
  }

  .stat-panel .stat-detail-item{
    gap:8px;
    padding:11px 12px;
  }
}

.analytics-metric{
  display:flex;
  align-items:center;
  gap:12px;
}

.analytics-metric-icon{
  width:42px;
  height:42px;
  border-radius:14px;
  background:var(--primary-light);
  color:var(--primary);
  display:grid;
  place-items:center;
  flex-shrink:0;
}

.progress-track{
  width:100%;
  height:10px;
  background:var(--surface-muted);
  border-radius:999px;
  overflow:hidden;
  margin-top:8px;
}

.progress-fill{
  height:100%;
  border-radius:999px;
  background:linear-gradient(90deg,#56b8ff,#1e88ff);
  width:0;
  transition:1s ease;
}

.analytics-change{
  font-size:12px;
  font-weight:700;
  color:#15803d;
}

.analytics-change.down{
  color:#b91c1c;
}

.route-search-analytics{
  display:grid;
  gap:18px;
  margin-bottom:18px;
}

.route-search-metrics{
  display:grid;
  grid-template-columns:repeat(5,minmax(0,1fr));
  gap:14px;
}

.glass-card{
  background:linear-gradient(135deg, rgba(255,255,255,.82), rgba(238,247,255,.72));
  border:1px solid rgba(30,136,255,.14);
  box-shadow:0 18px 40px rgba(15,23,42,.08);
  -webkit-backdrop-filter:blur(16px);
  backdrop-filter:blur(16px);
}

html.dark-theme .glass-card{
  background:linear-gradient(135deg, rgba(17,24,39,.88), rgba(30,41,59,.72));
  border-color:rgba(86,184,255,.18);
  box-shadow:0 20px 45px rgba(0,0,0,.28);
}

.route-metric-card{
  display:flex;
  align-items:flex-start;
  gap:14px;
  padding:18px;
  border-radius:18px;
  min-height:108px;
}

.route-metric-card span{
  display:block;
  font-size:12px;
  font-weight:600;
  color:var(--text);
  margin-bottom:8px;
}

.route-metric-card strong{
  display:block;
  font-size:15px;
  line-height:1.45;
  color:var(--dark);
}

.route-metric-icon{
  width:42px;
  height:42px;
  border-radius:14px;
  display:grid;
  place-items:center;
  background:linear-gradient(135deg, rgba(30,136,255,.18), rgba(86,184,255,.08));
  color:var(--primary);
  flex-shrink:0;
}

.route-search-table-card{
  overflow:hidden;
}

.route-search-table-wrap{
  max-height:340px;
  overflow:auto;
  scrollbar-gutter:stable;
}

.route-search-table{
  width:100%;
  min-width:980px;
  border-collapse:separate;
  border-spacing:0;
}

.route-search-table thead th{
  position:sticky;
  top:0;
  z-index:1;
  background:linear-gradient(180deg, rgba(30,136,255,.12), rgba(30,136,255,.04));
  color:var(--dark);
  font-size:12px;
  text-transform:uppercase;
  letter-spacing:.04em;
  padding:14px 12px;
  border-bottom:1px solid rgba(30,136,255,.12);
}

.route-search-table tbody td{
  padding:16px 12px;
  border-bottom:1px solid var(--border);
  vertical-align:middle;
  font-size:13px;
}

.route-search-table tbody tr{
  transition:background .2s ease, transform .2s ease;
}

.route-search-table tbody tr:hover{
  background:rgba(30,136,255,.05);
}

.route-cell{
  display:grid;
  gap:4px;
}

.route-cell strong{
  color:var(--dark);
  font-size:14px;
}

.route-cell span{
  color:var(--text);
  font-size:12px;
}

.service-type-pill,
.search-count-pill{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:8px 12px;
  border-radius:999px;
  background:rgba(30,136,255,.08);
  color:var(--dark);
  font-size:12px;
  font-weight:700;
  white-space:nowrap;
}

.route-status{
  display:inline-flex;
  align-items:center;
  padding:8px 12px;
  border-radius:999px;
  font-size:12px;
  font-weight:800;
  white-space:nowrap;
}

.route-status.trending{
  background:rgba(249,115,22,.14);
  color:#ea580c;
}

.route-status.popular{
  background:rgba(30,136,255,.14);
  color:#1d4ed8;
}

.route-status.new{
  background:rgba(34,197,94,.14);
  color:#15803d;
}

html.dark-theme .route-search-table thead th{
  background:linear-gradient(180deg, rgba(30,136,255,.18), rgba(30,136,255,.06));
}

html.dark-theme .route-status.trending{
  color:#fb923c;
}

html.dark-theme .route-status.popular{
  color:#60a5fa;
}

html.dark-theme .route-status.new{
  color:#4ade80;
}

/* Responsive */
@media(max-width:1150px){
  .cards,.mini-grid{
    grid-template-columns:repeat(2,1fr);
  }

  .topbar{
    align-items:flex-start;
    flex-wrap:wrap;
  }

  .top-actions{
    flex:1 1 auto;
    justify-content:flex-end;
    flex-wrap:wrap;
  }

  .route-search-metrics{
    grid-template-columns:repeat(3,minmax(0,1fr));
  }

  .grid,
  .message-layout{
    grid-template-columns:1fr;
  }

}

@media(max-width:768px){
  .sidebar{
    transform:translateX(-110%);
  }

  .sidebar.open{
    transform:translateX(0);
  }

  .main{
    margin-left:0;
    padding:16px;
  }

  .page-header h1{
    font-size:24px;
  }

  .page-header p{
    line-height:1.5;
  }

  .menu-toggle{
    display:grid;
    place-items:center;
  }

  .topbar{
    flex-wrap:wrap;
    align-items:center;
    border-radius:18px;
    padding:14px;
  }

  .top-actions{
    margin-left:auto;
    gap:8px;
  }

  .icon-btn,
  .admin{
    min-height:42px;
  }

  .admin{
    padding:8px 10px;
  }

  .search{
    order:3;
    max-width:100%;
    width:100%;
  }

  .date-box{
    display:none;
  }

  .cards,.mini-grid{
    grid-template-columns:1fr;
    gap:14px;
    margin-bottom:18px;
  }

  .card{
    border-radius:18px;
  }

  .section-title{
    align-items:flex-start;
    gap:10px;
  }

  .section-title h3{
    font-size:16px;
  }

  .filter-bar{
    overflow-x:auto;
    flex-wrap:nowrap;
    padding-bottom:4px;
    -webkit-overflow-scrolling:touch;
  }

  .filter-btn{
    flex:0 0 auto;
    white-space:nowrap;
  }

  th,td{
    padding:12px;
    font-size:13px;
  }

  .route-search-metrics{
    grid-template-columns:repeat(2,minmax(0,1fr));
  }

  .stat-card h2{
    font-size:25px;
  }

  .route-search-metrics{
    grid-template-columns:1fr;
  }

  .route-search-table{
    min-width:760px;
  }

  .route-search-table-wrap{
    max-height:340px;
  }

  .message-inbox,
  .message-thread{
    min-height:auto;
  }

  .message-reply{
    grid-template-columns:1fr;
  }

  .reply-send-btn{
    justify-content:center;
  }
}

@media(max-width:480px){
  .main{
    padding:12px;
  }

  .topbar{
    gap:10px;
    margin-bottom:18px;
  }

  .icon-btn{
    width:40px;
    height:40px;
    border-radius:13px;
  }

  .top-actions #messageBtn{
    display:none;
  }

  .top-actions{
    width:auto;
  }

  .date-box{
    display:none;
  }

  .admin span{
    display:none;
  }

  .card{
    padding:16px;
  }

  .stat-card{
    align-items:center;
  }

  .stat-icon{
    width:44px;
    height:44px;
    border-radius:14px;
  }

  .page-header{
    margin-bottom:18px;
  }

  .page-header h1{
    font-size:22px;
  }

  .table-wrap{
    margin:0 -2px;
  }

  th,td{
    padding:10px;
    font-size:12px;
  }

  .payment-status-btn,
  .badge{
    font-size:11px;
    padding:7px 10px;
  }

  .amount-payment-cell{
    gap:6px;
  }

  .message-item{
    grid-template-columns:38px minmax(0, 1fr);
  }

  .message-avatar{
    width:38px;
    height:38px;
    border-radius:12px;
  }

  .message-time{
    grid-column:2;
    padding-top:0;
  }

  .message-thread-header{
    flex-direction:column;
  }

  .chat-bubble{
    max-width:100%;
  }
}

/* Auth + Firebase */
.auth-page{
  min-height:100vh;
  display:grid;
  place-items:center;
  padding:24px;
}

.auth-shell{
  width:100%;
  max-width:460px;
}

.auth-card{
  background:var(--white);
  border:1px solid var(--border);
  border-radius:24px;
  padding:32px 28px;
  box-shadow:var(--shadow);
}

.auth-card h1{
  font-size:28px;
  margin-bottom:8px;
}

.auth-subtitle{
  color:var(--text);
  font-size:14px;
  font-weight:600;
  margin-bottom:24px;
}

.auth-logo{
  display:flex;
  justify-content:center;
  margin-bottom:18px;
}

.email-login-form{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.email-login-form label{
  display:flex;
  flex-direction:column;
  gap:8px;
}

.email-login-form span{
  font-size:13px;
  font-weight:700;
  color:var(--text);
}

.auth-field{
  display:flex;
  align-items:center;
  gap:10px;
  background:var(--surface-soft);
  border:1px solid var(--border);
  border-radius:14px;
  padding:12px 14px;
}

.auth-field input{
  border:none;
  background:transparent;
  outline:none;
  width:100%;
  color:var(--dark);
}

.email-login-btn{
  margin-top:8px;
  border:none;
  border-radius:14px;
  padding:14px 16px;
  background:var(--primary);
  color:white;
  font-weight:700;
  cursor:pointer;
}

.auth-status{
  margin-top:16px;
  font-size:13px;
  font-weight:600;
  color:#b91c1c;
}

.auth-status.success{
  color:#15803d;
}

.firebase-status{
  display:none;
  margin-top:12px;
  font-size:12px;
  font-weight:700;
  color:#15803d;
  width:100%;
  padding:10px 12px;
  border-radius:10px;
  background:#ecfdf3;
  border:1px solid #bbf7d0;
}

.firebase-status.offline{
  display:block;
  color:#b91c1c;
  background:#fff1f2;
  border-color:#fecdd3;
}

.doc-view-btn[disabled]{
  opacity:.55;
  cursor:not-allowed;
}

a.doc-view-btn{
  display:inline-block;
  text-decoration:none;
}

/* UI Refresh Overrides - content and structure unchanged */
:root{
  --primary:#5b5bd6;
  --primary-2:#7a6ff2;
  --primary-light:#f1efff;
  --dark:#171a2c;
  --text:#646b86;
  --text-muted:#8e95ae;
  --border:#e8ebf5;
  --white:#ffffff;
  --bg:#f4f5fb;
  --surface-soft:#f8f9fe;
  --surface-muted:#ebeef8;
  --donut-inner:#ffffff;
  --chart-light:#dee4fb;
  --shadow:0 16px 38px rgba(22,27,49,.08);
  --radius:18px;
}

html.dark-theme{
  --primary:#9094ff;
  --primary-2:#afa5ff;
  --primary-light:rgba(144,148,255,.18);
  --dark:#eef2ff;
  --text:#a8b0ce;
  --text-muted:#8690b4;
  --border:#283252;
  --white:#141b31;
  --bg:#0b1020;
  --surface-soft:#18213a;
  --surface-muted:#222f51;
  --donut-inner:#10182e;
  --chart-light:#29365a;
  --shadow:0 20px 44px rgba(0,0,0,.32);
}

*{
  font-family:'Manrope',sans-serif;
}

body{
  background:
    radial-gradient(1000px 500px at 8% 2%, rgba(167,154,255,.26) 0%, rgba(167,154,255,0) 60%),
    radial-gradient(840px 420px at 98% 0%, rgba(119,220,255,.2) 0%, rgba(119,220,255,0) 62%),
    linear-gradient(180deg, rgba(255,255,255,.93), rgba(245,247,255,.96)),
    var(--bg-image) center/cover no-repeat fixed;
}

html.dark-theme body{
  background:
    radial-gradient(1000px 500px at 8% 2%, rgba(131,102,255,.2) 0%, rgba(131,102,255,0) 60%),
    radial-gradient(840px 420px at 98% 0%, rgba(70,132,255,.16) 0%, rgba(70,132,255,0) 62%),
    linear-gradient(180deg, rgba(13,18,36,.95), rgba(11,16,32,.96)),
    var(--bg-image) center/cover no-repeat fixed;
}

.sidebar{
  width:272px;
  background:linear-gradient(170deg, rgba(255,255,255,.88), rgba(248,249,255,.8));
  border-right:1px solid rgba(255,255,255,.8);
  box-shadow:inset -1px 0 0 rgba(232,235,245,.9), 10px 0 30px rgba(24,32,57,.08);
  -webkit-backdrop-filter:blur(14px);
  backdrop-filter:blur(14px);
}

html.dark-theme .sidebar{
  background:linear-gradient(170deg, rgba(20,27,49,.92), rgba(17,24,44,.88));
  border-right:1px solid rgba(88,102,140,.25);
  box-shadow:inset -1px 0 0 rgba(52,66,104,.6), 10px 0 32px rgba(0,0,0,.32);
}

.logo{
  padding:12px;
  border-radius:16px;
  background:rgba(255,255,255,.7);
  border:1px solid rgba(232,235,245,.9);
}

html.dark-theme .logo{
  background:rgba(25,34,60,.66);
  border-color:#2d3b63;
}

.logo-icon{
  width:46px;
  height:46px;
  border-radius:14px;
  background:linear-gradient(140deg, var(--primary), var(--primary-2));
  box-shadow:0 10px 22px rgba(90,91,214,.35);
}

.menu{
  gap:8px;
}

.menu a,
.menu-logout button{
  border:1px solid transparent;
  border-radius:12px;
  padding:11px 12px;
}

.menu a:hover,
.menu a.active{
  color:var(--primary);
  background:linear-gradient(135deg, rgba(91,91,214,.12), rgba(122,111,242,.08));
  border-color:rgba(91,91,214,.18);
}

.menu-count{
  background:linear-gradient(135deg, var(--primary), var(--primary-2));
}

.menu-logout button:hover{
  background:#fff1f5;
  border-color:#ffd5e0;
  color:#db3069;
}

.main{
  margin-left:272px;
  padding:20px;
}

.topbar{
  border-radius:18px;
  background:linear-gradient(180deg, rgba(255,255,255,.93), rgba(248,250,255,.9));
  border:1px solid rgba(232,235,245,.95);
  box-shadow:0 12px 28px rgba(22,27,49,.08);
  padding:14px 16px;
}

html.dark-theme .topbar{
  background:linear-gradient(180deg, rgba(20,27,49,.94), rgba(18,25,45,.9));
  border-color:#2a3658;
}

.search{
  border-radius:12px;
  background:rgba(248,250,255,.86);
  border-color:#e6e9f3;
  min-height:44px;
}

html.dark-theme .search{
  background:#1a2440;
  border-color:#2a3658;
}

.date-box,
.icon-btn,
.admin{
  border-radius:12px;
  background:rgba(248,250,255,.86);
}

html.dark-theme .date-box,
html.dark-theme .icon-btn,
html.dark-theme .admin{
  background:#1a2440;
}

.icon-btn{
  color:var(--primary);
}

.avatar{
  background:linear-gradient(145deg, var(--primary), var(--primary-2));
}

.cards{
  gap:14px;
}

.card{
  border-radius:16px;
  border:1px solid #e8ebf5;
  background:linear-gradient(170deg, rgba(255,255,255,.95), rgba(250,252,255,.9));
  box-shadow:0 12px 28px rgba(22,27,49,.07);
  padding:18px;
}

html.dark-theme .card{
  border-color:#2a3658;
  background:linear-gradient(170deg, rgba(20,27,49,.96), rgba(17,24,44,.9));
}

.stat-card{
  position:relative;
  overflow:hidden;
}

.stat-card::after{
  content:"";
  position:absolute;
  width:120px;
  height:120px;
  right:-42px;
  top:-42px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(122,111,242,.16), rgba(122,111,242,0));
  pointer-events:none;
}

.stat-card h4{
  font-size:12px;
  letter-spacing:.02em;
  margin-bottom:8px;
  color:var(--text-muted);
}

.stat-card h2{
  font-size:30px;
  letter-spacing:-.02em;
}

.stat-icon{
  border-radius:13px;
  width:46px;
  height:46px;
  background:linear-gradient(145deg, rgba(91,91,214,.16), rgba(122,111,242,.1));
  border:1px solid rgba(91,91,214,.18);
}

.section-title h3{
  font-size:17px;
  letter-spacing:-.01em;
}

.section-title span{
  color:var(--text);
  font-size:12px;
  font-weight:700;
}

.view-all-btn{
  padding:6px 10px;
  border-radius:999px;
  background:var(--primary-light);
  color:var(--primary);
}

.table-wrap{
  border:1px solid var(--border);
  border-radius:12px;
}

table{
  min-width:720px;
}

th{
  font-size:12px;
  letter-spacing:.03em;
  text-transform:uppercase;
  color:var(--text-muted);
  background:var(--surface-soft);
}

td{
  font-weight:700;
}

tbody tr:hover{
  background:rgba(91,91,214,.05);
}

.donut{
  background:conic-gradient(var(--primary) 0deg, var(--primary-2) 0deg, var(--chart-light) 0deg);
}

.donut::before{
  box-shadow:inset 0 0 0 1px var(--border);
}

.info-item{
  border:1px solid var(--border);
  border-radius:12px;
  background:var(--surface-soft);
  padding:10px 12px;
}

.bar{
  background:linear-gradient(180deg, var(--primary-2), var(--primary));
}

.badge,
.payment-status-btn,
.route-status,
.service-type-pill,
.search-count-pill{
  border:1px solid transparent;
}

.firebase-status{
  border-radius:10px;
  font-size:11px;
}

.filter-btn,
.action-btn,
.dashboard-primary,
.doc-view-btn,
.reply-send-btn{
  border-radius:10px;
}

.dashboard-primary,
.reply-send-btn{
  background:linear-gradient(145deg, var(--primary), var(--primary-2));
  box-shadow:0 10px 20px rgba(90,91,214,.28);
}

.dashboard-primary:hover,
.reply-send-btn:hover{
  filter:brightness(.98);
  transform:translateY(-1px);
}

.theme-toggle.active-theme{
  background:rgba(91,91,214,.16);
}

@media(max-width:768px){
  .main{
    margin-left:0;
    padding:14px;
  }

  .sidebar{
    width:260px;
  }

  .topbar{
    padding:12px;
    border-radius:15px;
  }

  .card{
    border-radius:14px;
    padding:14px;
  }

  .stat-card h2{
    font-size:26px;
  }
}
