* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #fdf6ee;
  color: #333;
}
.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background: #fdf6ee;
}
.login-box {
  background: #fff;
  padding: 28px 32px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  width: 100%;
  max-width: 400px;
  text-align: center;
  max-height: 95vh;
  overflow-y: auto;
}
.login-box h1 { color: #e0673f; margin-bottom: 0; font-size: 32px; font-weight: 800; letter-spacing: 0.5px; }
.login-logo { width: 100%; max-width: 320px; margin: 0 auto 0; display: block; }
.subtitle { color: #888; margin-top: 4px; margin-bottom: 20px; }
.security-note {
  font-size: 12px;
  color: #7a4a34;
  background: #fdece3;
  border: 1px solid #f3d3c2;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 18px;
  line-height: 17px;
}

.role-page-label {
  text-align: center;
  font-weight: 800;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 10px;
  margin: 0 16px 18px;
  letter-spacing: 0.3px;
}
.role-page-label.super-admin-label {
  background: linear-gradient(135deg, #e0673f, #c9552f);
  color: #fff;
  box-shadow: 0 2px 8px rgba(224, 103, 63, 0.35);
}
.role-page-label.city-admin-label {
  background: linear-gradient(135deg, #4caf7c, #3d9366);
  color: #fff;
  box-shadow: 0 2px 8px rgba(76, 175, 124, 0.35);
}
.city-boundary-label {
  background: rgba(63, 143, 224, 0.85);
  color: #fff;
  font-weight: 700;
  font-size: 11px;
  border: none;
  border-radius: 6px;
  padding: 2px 6px;
}
.login-box input {
  width: 100%;
  padding: 12px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid #e5e0d8;
  font-size: 14px;
}
.login-box button {
  width: 100%;
  padding: 12px;
  background: #e0673f;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 15px;
}
.login-box button:hover { background: #c9552f; }
.error { color: #d9534f; margin-top: 10px; font-size: 13px; min-height: 16px; }

.mode-switch {
  display: flex;
  background: #f7f7f7;
  border-radius: 10px;
  border: 1px solid #e5e0d8;
  margin-bottom: 18px;
  overflow: hidden;
}
.mode-btn {
  flex: 1;
  padding: 10px 6px;
  border: none;
  background: none;
  color: #e0673f;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.mode-btn.active { background: #e0673f; color: #fff; }

.password-wrapper {
  position: relative;
  margin-bottom: 12px;
}
.password-wrapper input {
  margin-bottom: 0 !important;
  width: 100%;
  padding-right: 50px !important;
}
.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #e0673f;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.link-text {
  color: #e0673f;
  font-weight: 600;
  font-size: 13px;
  text-align: center;
  margin-top: 14px;
  cursor: pointer;
}
.link-text:hover { text-decoration: underline; }
.otp-box {
  background: #fdece3;
  border: 1px solid #f3d3c2;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
  text-align: center;
}
.otp-box .otp-label { font-size: 11px; color: #7a4a34; margin-bottom: 4px; }
.otp-box .otp-value { font-size: 22px; font-weight: bold; color: #e0673f; letter-spacing: 4px; }

/* ---- App layout: sidebar + main content ---- */
.app-layout {
  display: flex;
  height: 100vh;
}

.sidebar {
  width: 250px;
  background: #fff;
  border-right: 1px solid #f0ece5;
  display: flex;
  flex-direction: column;
  padding: 24px 14px;
  flex-shrink: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-title {
  color: #e0673f;
  margin: 0 0 4px 10px;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: 0.3px;
}
.sidebar-menu { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.sidebar-section-label {
  margin: 18px 10px 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #c7bfb3;
}
.sidebar-section-label:first-of-type { margin-top: 14px; }
.menu-btn {
  text-align: left;
  background: none;
  border: none;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: #666;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}
.menu-btn:hover { background: #faf3ea; color: #444; }
.menu-btn:active { transform: scale(0.98); }
.menu-btn.active {
  background: linear-gradient(135deg, #e0673f, #c9552f);
  color: #fff;
  box-shadow: 0 3px 10px rgba(224, 103, 63, 0.3);
}
.logout-btn {
  background: none;
  border: 1.5px solid #e0673f;
  color: #e0673f;
  padding: 11px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  margin-top: 18px;
  transition: background 0.15s ease, color 0.15s ease;
}
.logout-btn:hover { background: #e0673f; color: #fff; }

.main-content {
  flex: 1;
  padding: 30px 40px;
  overflow-y: auto;
  height: 100vh;
}
.view-title { color: #e0673f; margin-top: 0; font-weight: 800; letter-spacing: 0.2px; }
.view-subtitle { color: #888; margin-top: -10px; margin-bottom: 20px; font-size: 14px; }

.remove-city-btn {
  background: none;
  border: 1px solid #d9534f;
  color: #d9534f;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.remove-city-btn:hover { background: #fdecec; }

.shop-thumb, .product-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background: #f5f5f5;
}
.map-link { color: #e0673f; font-weight: 600; font-size: 13px; }
.approval-pending { color: #e0a63f; font-weight: 600; }
.approval-approved { color: #4caf7c; font-weight: 600; }
.approval-rejected { color: #d9534f; font-weight: 600; }

.approval-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #eee;
  padding: 18px;
  margin-bottom: 14px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.approval-card img {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  object-fit: cover;
  background: #f5f5f5;
  flex-shrink: 0;
}
.approval-card .details { flex: 1; }
.approval-card .details h3 { margin: 0 0 4px; }
.approval-card .details p { margin: 2px 0; color: #666; font-size: 14px; }
.approval-actions { display: flex; gap: 10px; margin-top: 10px; }
.approve-btn, .reject-btn {
  padding: 8px 18px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}
.approve-btn { background: #4caf7c; color: #fff; }
.reject-btn { background: #d9534f; color: #fff; }
.empty-message { color: #999; font-style: italic; padding: 20px; text-align: center; }

.bulk-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.select-all-label {
  font-size: 13px;
  color: #666;
  display: flex;
  align-items: center;
  gap: 6px;
}
.approval-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #555;
  margin: 20px 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.shop-open-toggle {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.shop-open-toggle.is-open { background: #4caf7c; color: #fff; }
.shop-open-toggle.is-closed { background: #d9534f; color: #fff; }

.banner-card {
  display: flex;
  gap: 16px;
  align-items: center;
  background: #fff;
  border: 1px solid #eee;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}
.banner-card img { width: 180px; height: 60px; object-fit: cover; border-radius: 8px; background: #f5f5f5; }
.banner-card .details { flex: 1; }
.banner-card .details h4 { margin: 0 0 4px; }
.banner-card .details p { margin: 2px 0; color: #888; font-size: 13px; }
.banner-actions { display: flex; gap: 8px; }
.visibility-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.visibility-btn.visible { background: #4caf7c; color: #fff; }
.visibility-btn.hidden-state { background: #999; color: #fff; }
.delete-btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid #d9534f;
  background: none;
  color: #d9534f;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}

.status-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}
.status-badge.online { background: #eaf7f0; color: #2f7a52; }
.status-badge.offline { background: #f2f2f2; color: #888; }
.status-badge.idle { background: #fff6ef; color: #b06a2f; }
.status-badge.in_delivery { background: #eaf1fb; color: #2f5f9e; }

.notif-badge {
  background: #d9534f;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  padding: 1px 7px;
  margin-left: 6px;
}
.notification-item {
  background: #fff;
  border: 1px solid #eee;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.notification-item.unread { border-left: 4px solid #d9534f; }
.notification-text { color: #444; font-size: 14px; flex: 1; }
.notification-time { color: #999; font-size: 11px; margin-top: 4px; }

.notif-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #333;
  color: #fff;
  padding: 14px 18px;
  border-radius: 10px;
  max-width: 320px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  z-index: 9999;
  animation: notif-toast-in 0.3s ease-out;
}
.notif-toast b { display: block; margin-bottom: 4px; color: #ffb199; }
.notif-toast div { font-size: 13px; line-height: 18px; }
.notif-toast-hide { opacity: 0; transform: translateY(10px); transition: all 0.4s ease; }

.dashboard-hero {
  background: linear-gradient(135deg, #e0673f 0%, #f0925f 100%);
  border-radius: 18px;
  padding: 28px 26px;
  margin-bottom: 24px;
  color: #fff;
  box-shadow: 0 8px 24px rgba(224, 103, 63, 0.25);
}
.dashboard-hero-title { font-size: 24px; font-weight: 800; margin: 0 0 6px; }
.dashboard-hero-subtitle { font-size: 14px; opacity: 0.92; margin: 0; }

.dashboard-period-card {
  background: #fff;
  border: 1px solid #f0ebe3;
  border-radius: 16px;
  padding: 18px 20px 20px;
  margin-bottom: 18px;
}
.dashboard-period-card-highlight {
  background: #fff9f4;
  border: 1px solid #f3d9c9;
}
.dashboard-period-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.dashboard-period-icon { font-size: 20px; }
.dashboard-period-title {
  font-size: 15px;
  font-weight: 800;
  color: #333;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.dashboard-period-sub {
  font-size: 12px;
  font-weight: 500;
  color: #aaa;
  text-transform: none;
  letter-spacing: normal;
  margin-left: 4px;
}

.dashboard-period-card .stats { margin-top: 0; }

.map-btn {
  background: #e0673f;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
}
.map-btn:hover { background: #c9552f; }

.tracking-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.tracking-modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  width: 90%;
  max-width: 640px;
}
.tracking-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.tracking-modal-header h3 { margin: 0; color: #e0673f; }
.tracking-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: #999;
  cursor: pointer;
}
.tracking-status-text { color: #777; font-size: 13px; margin-bottom: 10px; }
#tracking-map { width: 100%; height: 400px; border-radius: 10px; }
.tracking-legend {
  display: flex;
  gap: 18px;
  margin-top: 12px;
  font-size: 12px;
  color: #555;
}
.legend-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-right: 5px;
}
.legend-shop { background: #3f8fe0; }
.legend-delivery { background: #d9534f; }
.legend-rider { background: #4caf7c; }

.current-rate-display {
  background: #fff6ef;
  border: 1px solid #f3d9c9;
  border-radius: 10px;
  padding: 14px;
  font-size: 22px;
  font-weight: 800;
  color: #e0673f;
  text-align: center;
  margin-bottom: 16px;
}
@keyframes notif-toast-in {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 16px;
  margin-top: 20px;
}
.stat-card {
  background: #fff;
  padding: 18px;
  border-radius: 14px;
  text-align: center;
  border: 1px solid #f0ece5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.03);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(224, 103, 63, 0.12); }
.stat-card .value { font-size: 26px; font-weight: bold; color: #e0673f; }
.stat-card .label { color: #888; font-size: 13px; margin-top: 4px; }

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
}
th { background: #faf3ea; color: #555; }
tr:last-child td { border-bottom: none; }

.create-user-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  max-width: 400px;
  border: 1px solid #eee;
}
.create-user-box label { display: block; font-size: 13px; color: #888; margin-bottom: 6px; margin-top: 10px; }
.create-user-box input, .create-user-box select {
  width: 100%;
  padding: 10px;
  margin-bottom: 12px;
  border-radius: 8px;
  border: 1px solid #e5e0d8;
  font-size: 14px;
}
.create-user-box button {
  width: 100%;
  padding: 12px;
  background: #4caf7c;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  font-size: 15px;
}
.create-user-box button:hover { background: #3d9c68; }
.create-user-box p { font-size: 13px; margin-top: 10px; min-height: 16px; }

.filters {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}
.filters select, .filters input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e5e0d8;
  font-size: 14px;
  background: #fff;
}
.filters input { flex: 1; max-width: 260px; }
.clear-filter-btn {
  background: none;
  border: 1px solid #ccc;
  color: #666;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}
.clear-filter-btn:hover { background: #f5f5f5; }
