:root {
  --ad-red: #199b4e;
  --ad-red-dark: #137e3e;
  --brand-bus-color: #1d2939;
  --brand-driv-color: #199b4e;
  --ad-bg: #f4f8f5;
  --ad-sidebar: linear-gradient(180deg, #ffffff 0%, #edf8f1 100%);
  --ad-sidebar-hover: #e1f4e8;
  --ad-card: #ffffff;
  --ad-border: #e5e7eb;
  --ad-text: #111827;
  --ad-muted: #6b7280;
  --ad-green: #059669;
  --ad-amber: #d97706;
  --ad-blue: #2563eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--ad-bg);
  color: var(--ad-text);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.ad-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

.ad-sidebar {
  background: var(--ad-sidebar);
  color: #344054;
  border-right: 1px solid #d5ebde;
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  box-shadow: 2px 0 14px rgba(16, 24, 40, 0.04);
}

.ad-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 16px;
  border-bottom: 1px solid #d9ede1;
  margin-bottom: 10px;
  font-weight: 800;
  font-size: 18px;
  color: #1d2939;
}

.ad-brand-badge {
  width: 34px; height: 34px; border-radius: 9px;
  background: var(--ad-red); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 17px;
}

.brand-wordmark {
  font-family: 'Outfit', 'Inter', sans-serif;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -1.1px;
  line-height: 1;
  display: inline-flex;
}
.brand-wordmark .brand-bus { color: var(--brand-bus-color); }
.brand-wordmark .brand-driv { color: var(--brand-driv-color); }

.ad-nav-group {
  font-size: 10.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.75px;
  color: #199b4e;
  padding: 12px 10px 4px;
}

.ad-nav-item {
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  color: #344054;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  transition: 0.16s;
}
.ad-nav-item:hover { background: var(--ad-sidebar-hover); color: #12743a; }
.ad-nav-item.active { background: var(--ad-red); color: #fff; box-shadow: 0 4px 12px rgba(25, 155, 78, 0.28); }

.ad-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.ad-topbar {
  background: #fff;
  border-bottom: 1px solid var(--ad-border);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 30;
  flex-wrap: wrap;
}

.ad-content {
  padding: 24px;
  max-width: 1360px;
  width: 100%;
}

.ad-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.ad-kpi {
  background: #fff;
  border: 1px solid var(--ad-border);
  border-radius: 14px;
  padding: 16px 18px;
}
.ad-kpi small { font-size: 12px; color: var(--ad-muted); font-weight: 600; display: block; }
.ad-kpi strong { font-size: 24px; font-weight: 800; color: var(--ad-text); display: block; margin-top: 4px; }

.ad-card {
  background: #fff;
  border: 1px solid var(--ad-border);
  border-radius: 14px;
  padding: 18px 20px;
  margin-bottom: 18px;
}

.ad-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ad-card-head h3 { font-size: 16px; font-weight: 800; }

.ad-table-wrap { overflow-x: auto; }
.ad-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ad-table th {
  text-align: left;
  padding: 10px 12px;
  background: #f9fafb;
  border-bottom: 1px solid var(--ad-border);
  color: var(--ad-muted);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.ad-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
}

.ad-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  border: 1px solid var(--ad-border);
  background: #fff;
  color: var(--ad-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.ad-btn:hover { background: #f9fafb; }
.ad-btn.primary { background: var(--ad-red); color: #fff; border-color: var(--ad-red); }
.ad-btn.primary:hover { background: var(--ad-red-dark); }
.ad-btn.green { background: var(--ad-green); color: #fff; border-color: var(--ad-green); }
.ad-btn.sm { padding: 5px 10px; font-size: 12px; }

.ad-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}
.ad-badge.green { background: #d1fae5; color: #065f46; }
.ad-badge.red { background: #fee2e2; color: #991b1b; }
.ad-badge.amber { background: #fef3c7; color: #92400e; }
.ad-badge.blue { background: #dbeafe; color: #1e40af; }
.ad-badge.gray { background: #f3f4f6; color: #374151; }

.ad-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
}
.ad-field label { display: block; font-size: 12px; font-weight: 700; color: #374151; margin-bottom: 4px; }
.ad-input, .ad-select, .ad-textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  font-size: 13.5px;
  background: #fff;
  outline: none;
}
.ad-input:focus, .ad-select:focus, .ad-textarea:focus {
  border-color: var(--ad-red);
  box-shadow: 0 0 0 3px rgba(216, 78, 85, 0.14);
}

.ad-dropzone {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  background: #f9fafb;
  cursor: pointer;
  transition: 0.15s;
}
.ad-dropzone.dragover { border-color: var(--ad-red); background: #fff1f2; }

.ad-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 400;
  background: #111827;
  color: #fff;
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  display: none;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
.ad-toast.show { display: block; }
.ad-toast.error { background: #b91c1c; }
.ad-toast.success { background: #047857; }

.ad-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.56);
  backdrop-filter: blur(3px);
  z-index: 350;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
}
.ad-modal-backdrop.open { display: flex; }
.ad-modal {
  background: #fff;
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(16, 24, 40, 0.28);
  border: 1px solid #d9ede1;
}
.ad-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 20px;
  border-bottom: 1px solid var(--ad-border);
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.ad-modal-body { padding: 20px; }
.ad-close-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--ad-border);
  background: #f9fafb;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: #344054;
}
.ad-close-btn:hover { background: #fee2e2; color: #b42318; border-color: #fecaca; }

@media print {
  body * { visibility: hidden; }
  #dashEticketPrintArea, #dashEticketPrintArea * { visibility: visible; }
  #dashEticketPrintArea { position: fixed; inset: 0; padding: 20px; background: #fff; }
}

.ad-mobile-menu-btn {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid #ccebd8;
  background: #e8f7ee;
  color: #137e3e;
  font-size: 20px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.ad-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(16, 24, 40, 0.45);
  backdrop-filter: blur(2px);
  z-index: 290;
}
.ad-sidebar-backdrop.open { display: block; }
.ad-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ================= HEADER NOTIFICATION BELL ================= */
.ad-notif-wrap { position: relative; display: inline-flex; align-items: center; }
.ad-notif-btn {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid #cde9d8;
  background: #f3fbf6;
  color: #137e3e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: 0.18s;
}
.ad-notif-btn:hover { background: #e1f5e9; border-color: #199b4e; transform: translateY(-1px); }
.ad-notif-btn.has-live { animation: bellGlow 2s infinite; }
@keyframes bellGlow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(25, 155, 78, 0.35); }
  50% { box-shadow: 0 0 0 7px rgba(25, 155, 78, 0); }
}
.ad-notif-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
}
.ad-notif-badge.show { display: inline-flex; }
.ad-notif-dropdown {
  position: absolute;
  top: 48px;
  right: 0;
  width: 375px;
  max-width: calc(100vw - 24px);
  max-height: 74vh;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #d5ebde;
  border-radius: 16px;
  box-shadow: 0 18px 46px rgba(16, 24, 40, 0.18);
  z-index: 320;
  display: none;
}
.ad-notif-dropdown.open { display: block; }
.ad-notif-head {
  padding: 13px 15px;
  border-bottom: 1px solid #e5efe9;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  position: sticky;
  top: 0;
  background: #fff;
  z-index: 2;
}
.ad-notif-list { padding: 10px; display: flex; flex-direction: column; gap: 9px; }
.ad-notif-item {
  border-radius: 12px;
  padding: 11px 12px;
  border: 1px solid #e2ece6;
  background: #f9fcfa;
  font-size: 12.5px;
  line-height: 1.45;
}
.ad-notif-item.eta {
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdf4 100%);
  border-color: #86efac;
}
.ad-notif-item.tripday {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.ad-notif-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  background: #199b4e;
  color: #fff;
}
.ad-notif-item.tripday .ad-notif-pill { background: #2563eb; }
@media (max-width: 600px) {
  .ad-notif-dropdown { position: fixed; top: 64px; left: 10px; right: 10px; width: auto; max-width: none; }
}

@media (max-width: 900px) {
  .ad-shell { grid-template-columns: 1fr; }
  .ad-mobile-menu-btn { display: inline-flex; }
  .ad-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 272px;
    max-width: 82vw;
    height: 100vh;
    z-index: 300;
    transform: translateX(-105%);
    transition: transform 0.24s ease;
    box-shadow: 8px 0 32px rgba(16, 24, 40, 0.22);
  }
  .ad-sidebar.open { transform: translateX(0); }
  .ad-topbar { padding: 12px 14px; flex-wrap: wrap; gap: 10px; }
  .ad-content { padding: 14px; }
  .ad-card { padding: 14px; border-radius: 12px; }
  .ad-card-head { flex-wrap: wrap; gap: 8px; }
  .ad-kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ad-kpi { padding: 13px 14px; }
  .ad-kpi strong { font-size: 22px; }
}

@media (max-width: 600px) {
  body { overflow-x: hidden; }
  .ad-topbar h2 { font-size: 16.5px !important; }
  .ad-topbar small { font-size: 11.5px; }
  .ad-form-grid { grid-template-columns: 1fr; }
  .ad-input, .ad-select, .ad-textarea { font-size: 16px; }
  .ad-modal-backdrop { padding: 8px; align-items: flex-end; }
  .ad-modal { max-height: 92vh; border-radius: 16px 16px 10px 10px; }
  .ad-modal-head { padding: 13px 14px; }
  .ad-modal-body { padding: 14px; }
  #dashEticketPrintArea [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  .ad-toast { top: 14px; right: 12px; left: 12px; text-align: center; }
}
