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

html, body {
  height: 100%;
  overflow: hidden;
}

/* ==================== LOGIN PAGE ==================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #FF6600 0%, #ff8533 100%);
  background-image: url('../images/fleet.jpg');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: scroll;
}

.login-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: -1;
}

.login-card {
  background: white;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 500px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.login-logo {
  height: 120px;
  display: block;
  margin: 0 auto 15px;
}

.login-drhi {
  height: 90px;
  display: block;
  margin: 0 auto 50px;
}

.login-field {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.field-icon {
  font-size: 18px;
  width: 20px;
  text-align: center;
}

.login-field input {
  flex: 1;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
}

.login-field input:focus {
  outline: none;
  border-color: #ff5a00;
  box-shadow: 0 0 0 3px rgba(255, 90, 0, 0.1);
}

.btn-login {
  width: 100%;
  padding: 12px;
  background: #ff5a00;
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 20px;
  transition: background 0.3s;
}

.btn-login:hover {
  background: #e64d00;
}

.login-footer {
  text-align: center;
  color: #999;
  font-size: 12px;
  margin-top: 30px;
}

.login-footer strong {
  color: #ff5a00;
}

/* ==================== NAVBAR ==================== */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 50px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 15px;
  text-decoration: none;
}

.dispatch-logo,
.drhi-logo {
  height: 55px;
}

.nav-divider {
  width: 1px;
  height: 35px;
  background: #eee;
}

.nav-links {
  display: flex;
  gap: 30px;
}

.nav-links a {
  text-decoration: none;
  color: #333;
  font-weight: 500;
  font-size: 14px;
  padding-bottom: 8px;
  border-bottom: 3px solid transparent;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links a:hover {
  color: #ff5a00;
}

.nav-links a.active {
  color: #ff5a00;
  border-bottom-color: #ff5a00;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.notification-bell {
  position: relative;
  font-size: 20px;
  cursor: pointer;
}

.notification-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background: #ff5a00;
  color: white;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #ff5a00;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
}

.user-details {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.user-name {
  font-weight: 600;
  font-size: 13px;
  color: #333;
}

.user-role {
  font-size: 11px;
  color: #999;
}

.btn-logout {
  padding: 8px 16px;
  background: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.btn-logout:hover {
  background: #e8e8e8;
}

/* ==================== HERO ==================== */
.hero {
  position: relative;
  height: 100vh;
  background-color: #FF6600;
  background-image: url('../images/fleet.jpg');
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  background-attachment: scroll;
  overflow: hidden;
  display: flex;
  align-items: center;
  image-rendering: crisp-edges;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(0,0,0,0.85), rgba(0,0,0,0.4), rgba(255,120,0,0.3), rgba(255,140,0,0.65));
  z-index: 1;
}

.hero-content {
  position: absolute;
  top: 80px;
  left: 60px;
  color: white;
  z-index: 2;
}

.hero-content h1 {
  font-size: 42px;
  margin-bottom: 10px;
  font-weight: 700;
}

.hero-content p {
  font-size: 16px;
  opacity: 0.95;
}

/* ==================== CONTAINER ==================== */
.container {
  max-width: 90%;
  margin: 0 auto;
  padding: 0 50px;
}

.content {
  margin-top: -500px;
  padding-bottom: 80px;
  position: relative;
  z-index: 10;
}

/* ==================== STATS ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 30px;
  margin-bottom: 60px;
}

.stat-card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-icon {
  width: 80px;
  height: 80px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  flex-shrink: 0;
}

.stat-icon.orange {
  background: #ffe5d3;
  color: #ff5a00;
}

.stat-icon.blue {
  background: #dce8ff;
  color: #2b6ef5;
}

.stat-icon.green {
  background: #dff3e3;
  color: #2ea44f;
}

.stat-icon.red {
  background: #ffdede;
  color: #d93025;
}

.stat-info h3 {
  font-size: 13px;
  color: #999;
  font-weight: 500;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 32px;
  font-weight: 700;
  color: #333;
}

.stat-sub {
  font-size: 12px;
  color: #999;
  margin-top: 4px;
}

/* ==================== CARDS ==================== */
.card {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
  margin-bottom: 40px;
  max-height: 600px;
  overflow-y: auto;
}

.card h2 {
  font-size: 20px;
  font-weight: 700;
  color: #333;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #f0f0f0;
}

.card h3 {
  font-size: 16px;
  font-weight: 700;
  color: #333;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 1px solid #f0f0f0;
}

.card-header h2 {
  margin: 0;
  border: none;
  padding: 0;
}

/* ==================== FORMS ==================== */
.form-section {
  margin-bottom: 40px;
}

.form-section-title {
  font-size: 15px;
  font-weight: 700;
  color: #333;
  padding-left: 15px;
  border-left: 4px solid #ff5a00;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 8px;
}

.form-group label .required {
  color: #d93025;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.form-row.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.3s;
}

input::placeholder,
textarea::placeholder {
  color: #999;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #ff5a00;
  box-shadow: 0 0 0 3px rgba(255, 90, 0, 0.1);
}

/* ==================== BUTTONS ==================== */
.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: #ff5a00;
  color: white;
}

.btn-primary:hover {
  background: #e64d00;
}

.btn-secondary {
  background: #f0f0f0;
  color: #333;
  border: 1px solid #ddd;
}

.btn-secondary:hover {
  background: #e8e8e8;
}

.btn-block {
  width: 100%;
  display: block;
  text-align: center;
}

.cancel {
  background: #ccc;
  color: black;
}

.cancel:hover {
  background: #bbb;
}

/* ==================== TABLES ==================== */
table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 20px;
}

thead {
  background: #f8f8f8;
}

th,
td {
  padding: 14px;
  text-align: left;
  border-bottom: 1px solid #eee;
  font-size: 14px;
}

th {
  font-weight: 600;
  color: #333;
}

tbody tr:hover {
  background: #f8f8f8;
}

/* ==================== BADGES ==================== */
.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-success {
  background: #d4f3e0;
  color: #2ea44f;
}

.badge-warning {
  background: #ffe5d3;
  color: #ff5a00;
}

.badge-danger {
  background: #ffd5d5;
  color: #d93025;
}

.badge-info {
  background: #dce8ff;
  color: #2b6ef5;
}

.badge-pending {
  background: #ffe5d3;
  color: #ff5a00;
}

/* ==================== PAGINATION ==================== */
.pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid #f0f0f0;
}

.pagination-info {
  font-size: 13px;
  color: #666;
}

.pagination-controls {
  display: flex;
  gap: 8px;
}

.pagination-btn {
  width: 36px;
  height: 36px;
  border: 1px solid #ddd;
  border-radius: 6px;
  background: white;
  cursor: pointer;
  font-weight: 600;
}

.pagination-btn:hover {
  background: #f0f0f0;
}

.pagination-btn.active {
  background: #ff5a00;
  color: white;
  border-color: #ff5a00;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  background: white;
}

.pagination-gap {
  align-self: center;
  color: #999;
  padding: 0 2px;
}

/* ==================== GRID ==================== */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

/* ==================== MODAL ==================== */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 12px;
  padding: 40px;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #f0f0f0;
}

.modal-header h2 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
}

.action-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 30px;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 1024px) {
  .container {
    padding: 0 30px;
  }

  .navbar {
    padding: 12px 30px;
  }

  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  * {
    font-size: 24px;
  }

  html, body {
    overflow: auto;
  }

  /* Login Page Mobile */
  .login-page {
    padding: 15px;
  }

  .login-card {
    padding: 25px;
    max-width: 100%;
  }

  .login-logo {
    height: 80px;
    margin-bottom: 10px;
  }

  .login-drhi {
    height: 60px;
    margin-bottom: 30px;
  }

  .login-field {
    margin-bottom: 12px;
  }

  .login-field input,
  .login-field select {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .btn-login {
    padding: 10px;
    font-size: 14px;
    margin-top: 15px;
  }

  /* Navbar Mobile */
  .navbar {
    padding: 10px 15px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .nav-left {
    gap: 10px;
  }

  .dispatch-logo,
  .drhi-logo {
    height: 40px;
  }

  .nav-links {
    gap: 15px;
    flex-wrap: wrap;
    width: 100%;
  }

  .nav-links a {
    font-size: 12px;
    padding: 5px;
  }

  .nav-right {
    gap: 10px;
    width: 100%;
    justify-content: space-between;
  }

  .user-avatar {
    width: 32px;
    height: 32px;
    font-size: 12px;
  }

  .user-name {
    font-size: 11px;
  }

  .user-role {
    font-size: 10px;
  }

  .btn-logout {
    padding: 6px 12px;
    font-size: 11px;
  }

  /* Hero Mobile */
  .hero {
    height: 250px;
  }

  .hero-content {
    top: 50px;
    left: 20px;
  }

  .hero-content h1 {
    font-size: 24px;
  }

  .hero-content p {
    font-size: 12px;
  }

  /* Container Mobile */
  .container {
    padding: 0 15px;
  }

  .content {
    margin-top: -100px !important;
    padding-bottom: 40px;
  }

  /* Stats Grid Mobile */
  .stats-grid {
    grid-template-columns: 1fr;
    gap: 15px;
    margin-bottom: 30px;
  }

  .stat-card {
    padding: 20px;
    gap: 15px;
  }

  .stat-icon {
    width: 60px;
    height: 60px;
    font-size: 28px;
  }

  .stat-value {
    font-size: 24px;
  }

  /* Cards Mobile */
  .card {
    padding: 15px;
    margin-bottom: 20px;
    max-height: none;
  }

  .card h2 {
    font-size: 16px;
    margin-bottom: 15px;
  }

  .card h3 {
    font-size: 14px;
  }

  /* Forms Mobile */
  .form-section-title {
    font-size: 13px;
    padding-left: 12px;
  }

  .form-group {
    margin-bottom: 15px;
  }

  .form-group label {
    font-size: 12px;
    margin-bottom: 6px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 12px;
  }

  .form-row.grid-2 {
    grid-template-columns: 1fr;
  }

  input[type="text"],
  input[type="email"],
  input[type="password"],
  input[type="date"],
  input[type="number"],
  select,
  textarea {
    padding: 10px 12px;
    font-size: 14px;
  }

  /* Buttons Mobile */
  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .btn-block {
    width: 100%;
    display: block;
  }

  /* Tables Mobile */
  table {
    font-size: 12px;
  }

  th,
  td {
    padding: 8px;
  }

  /* Modal Mobile */
  .modal-content {
    padding: 20px;
    max-width: 90%;
  }

  .action-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .action-buttons button {
    width: 100%;
  }

  /* Grids Mobile */
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  /* Badge Mobile */
  .badge {
    font-size: 10px;
    padding: 4px 8px;
  }

  /* Pagination Mobile */
  .pagination {
    flex-direction: column;
    gap: 10px;
  }

  .pagination-controls {
    width: 100%;
    justify-content: center;
  }
}

body[data-page="dashboard"] .content {
    margin-top: -80px !important;
  }

@media (max-width: 480px) {
  .login-card {
    padding: 20px;
  }

  .login-logo {
    height: 60px;
  }

  .login-drhi {
    height: 45px;
  }

  .navbar {
    padding: 8px 10px;
  }

  .nav-links {
    gap: 10px;
  }

  .nav-links a {
    font-size: 11px;
  }

  .hero {
    height: 200px;
  }

  .hero-content {
    top: 30px;
    left: 15px;
  }

  .hero-content h1 {
    font-size: 18px;
  }

  .hero-content p {
    font-size: 11px;
  }

  .container {
    padding: 0 10px;
  }

  .card {
    padding: 12px;
  }

  .stat-card {
    flex-direction: column;
    text-align: center;
  }

  table {
    font-size: 11px;
  }

  th,
  td {
    padding: 6px;
  }
}

/* Page-specific positioning */
/* ========================================= */
/* PAGE-SPECIFIC POSITIONING OVERRIDES       */
/* ========================================= */

/* Dispatcher Dashboard (Centered) */
/* ========================================= */
/* DESKTOP-ONLY SCALING (769px and up)       */
/* ========================================= */
/* ========================================= */
/* DESKTOP FLUID SCALING (769px and up)      */
/* ========================================= */
@media (min-width: 769px) {
  
  /* 1. Turn the entire page into a flexible column */
  html, body {
    min-height: 100vh;
    overflow: auto !important; 
    display: flex;
    flex-direction: column;
  }

  /* 2. Decouple the background completely (like a wallpaper) */
  .hero {
    position: fixed !important;
    inset: 0; 
    height: 100vh !important;
    z-index: -1;
  }

  /* 3. Let Flexbox perfectly center the content vertically */
  .content {
    flex: 1; /* Takes up all remaining space below the navbar */
    display: flex;
    flex-direction: column;
    justify-content: center; /* The magic rule for vertical centering */
    margin-top: 0 !important; /* Erase all negative margins */
    padding: 60px 50px !important;
  }

  /* 4. Flow the greeting text naturally above the cards */
  .hero-content {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    margin-bottom: 30px;
  }

  /* Dashboard is taller than the screen now (Driver Queue): centre it when
     it fits, but never push the top up behind the navbar when it doesn't */
  body[data-page="dashboard"] .content,
  body[data-page="schedule"] .content {
    justify-content: flex-start;
    margin-top: 0 !important; /* undo the old -80px pull-up (it hid the title) */
  }
  body[data-page="dashboard"] .content > :first-child,
  body[data-page="schedule"] .content > :first-child {
    margin-top: auto;
  }
  body[data-page="dashboard"] .content > :last-child,
  body[data-page="schedule"] .content > :last-child {
    margin-bottom: auto;
  }

  /* 5. Keep driver cards parallel */
  body[data-page="driver-dashboard"] .grid-2 .card {
    max-height: none;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
}

/* ==================== DRIVER QUEUE (dashboard) ==================== */
.queue-card {
  max-height: none;
  overflow: visible;
}
.queue-header {
  flex-wrap: wrap;
  gap: 12px;
}
.queue-header h2 {
  padding-bottom: 0;
  margin-bottom: 4px;
}
.queue-sub {
  font-size: 13px;
  color: #777;
}
.queue-date-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
.queue-date-nav input[type="date"] {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}
.queue-date-nav .btn {
  padding: 8px 14px;
  font-size: 14px;
}
.queue-date-nav .btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.queue-day-btn {
  font-weight: 700;
}
.queue-coding {
  background: #fff1f0;
  color: #b3261e;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}
.queue-coding-off {
  background: #e9f7ee;
  color: #1f7a3a;
}
.queue-coding-closed {
  background: #f1f1f1;
  color: #555;
}
.queue-link-btn {
  background: none;
  border: none;
  padding: 0;
  margin-left: 4px;
  color: #2b6ef5;
  font-weight: 600;
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
}
.queue-table-wrap {
  overflow-x: auto;
}
.queue-table {
  margin-top: 0;
}
.queue-table td {
  vertical-align: middle;
}
.queue-pos {
  font-weight: 700;
  font-size: 16px;
  color: #333;
  width: 40px;
}
.queue-next td {
  background: #f3fbf5;
}
.queue-next .queue-pos {
  color: #2ea44f;
}
.queue-blocked td {
  color: #888;
}
.queue-blocked .queue-avatar {
  opacity: 0.6;
}
.queue-driver {
  display: flex;
  align-items: center;
  gap: 10px;
}
.queue-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  font-size: 12px;
  background: #ff5a00;
  flex-shrink: 0;
}
.queue-plate {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}
.queue-coded-day {
  color: #d93025;
  font-weight: 700;
}
.badge-muted {
  background: #eee;
  color: #777;
}
.badge-trip {
  background: #ede4ff;
  color: #6a3fc8;
}
.queue-phone-only {
  display: none;
}
.queue-note {
  font-size: 12px;
  color: #999;
  margin-top: 14px;
}

/* ==================== CHANGE PASSWORD ==================== */
.btn-password {
  margin-right: 8px;
}
.cp-rules {
  list-style: none;
  padding: 10px 12px;
  margin: 0 0 14px;
  background: #f8f9fa;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.8;
}
.cp-rules li::before {
  content: '❌ ';
}
.cp-rules li.ok {
  color: #1f7a3a;
}
.cp-rules li.ok::before {
  content: '✅ ';
}

/* ==================== SCHEDULE TAB ==================== */
.schedule-card {
  max-height: none;
  overflow: visible;
}
.schedule-header {
  flex-wrap: wrap;
  gap: 12px;
}
.schedule-header h2 {
  padding-bottom: 0;
  margin-bottom: 4px;
}
.schedule-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.schedule-toolbar .btn {
  padding: 9px 14px;
  font-size: 14px;
}
.schedule-toolbar #scheduleSaveBtn {
  margin-left: auto;
}
.schedule-toolbar .btn:disabled {
  opacity: 0.5;
  cursor: default;
}
.btn-confirm {
  background: #ffd5d5 !important;
  color: #b3261e !important;
}
.schedule-dirty {
  color: #ff5a00;
  font-size: 13px;
  font-weight: 600;
}
.schedule-table-wrap {
  overflow-x: auto;
}
.schedule-table {
  margin-top: 0;
  min-width: 760px;
}
.schedule-table th,
.schedule-table td {
  vertical-align: middle;
}
.sched-driver-col {
  min-width: 210px;
}
.sched-day {
  text-align: center;
  min-width: 96px;
  font-weight: 600;
}
.sched-day-unset {
  background: #fafafa;
}
.sched-day-name span {
  font-weight: 400;
  color: #888;
  font-size: 12px;
}
.sched-day-meta {
  font-size: 11px;
  color: #b3261e;
  font-weight: 600;
  margin-top: 2px;
}
.sched-day-count {
  font-size: 11px;
  color: #888;
  font-weight: 400;
  margin-top: 2px;
}
.sched-col-actions {
  margin-top: 4px;
  display: flex;
  justify-content: center;
  gap: 4px;
}
.sched-col-actions button {
  border: 1px solid #ddd;
  background: white;
  border-radius: 6px;
  font-size: 11px;
  padding: 2px 6px;
  cursor: pointer;
  color: #555;
}
.sched-col-actions button:hover {
  background: #f2f2f2;
}
.sched-cell {
  text-align: center;
}
.sched-pill {
  display: inline-block;
  min-width: 70px;
  padding: 6px 10px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  border: 1.5px solid transparent;
}
button.sched-pill {
  cursor: pointer;
}
.sched-on {
  background: #d4f3e0;
  color: #1f7a3a;
  border-color: #b5e6c6;
}
.sched-off {
  background: #f3f3f3;
  color: #999;
  border-color: #e6e6e6;
}
.sched-unset.sched-on {
  background: #f1fbf4;
  border-style: dashed;
  border-color: #9fd8b2;
}
.sched-coded {
  background: #fff1f0;
  color: #b3261e;
  font-size: 11px;
}
.sched-order-btn {
  color: #2b6ef5 !important;
  font-weight: 600;
}
.order-help {
  font-size: 13px;
  color: #666;
  margin-bottom: 12px;
}
.order-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 55vh;
  overflow-y: auto;
}
.order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #eee;
  border-radius: 10px;
  margin-bottom: 8px;
  background: white;
  cursor: grab;
}
.order-item:active {
  cursor: grabbing;
}
.order-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ff5a00;
  color: white;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.order-handle {
  color: #bbb;
  font-size: 16px;
}
.order-name {
  flex: 1;
  font-weight: 600;
  font-size: 14px;
  color: #333;
}
.order-name small {
  display: block;
  font-weight: 400;
  font-size: 12px;
  color: #999;
}
.order-move {
  border: 1px solid #ddd;
  background: #f7f7f7;
  border-radius: 6px;
  width: 32px;
  height: 30px;
  cursor: pointer;
  font-size: 12px;
  color: #555;
}
.order-move:disabled {
  opacity: 0.35;
  cursor: default;
}
.order-empty {
  color: #999;
  font-size: 13px;
  padding: 10px 0;
}
.sched-total {
  text-align: center;
  font-weight: 700;
  width: 60px;
}
.queue-roster {
  font-size: 13px;
  color: #555;
  margin: -6px 0 14px 2px;
}
.queue-roster a {
  color: #2b6ef5;
  font-weight: 600;
}

/* ========================================= */
/* PHONE BACKGROUND (768px and below)        */
/* The truck photo becomes a full-screen,    */
/* dimmed wallpaper behind the whole page    */
/* (instead of a short strip with plain      */
/* white below it).                          */
/* ========================================= */
@media (max-width: 768px) {
  body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    /* Fixed height = the screen WITH the address bar hidden. Phones show/hide
       the address bar while scrolling; if the wallpaper followed that, the
       photo would re-zoom and jump on every scroll. */
    height: 100vh;
    height: 100lvh;
    z-index: -1;
    pointer-events: none;
    background:
      linear-gradient(to bottom, rgba(0,0,0,0.70) 0%, rgba(0,0,0,0.45) 45%, rgba(120,45,0,0.55) 100%),
      #3a2a1f url('../images/fleet.jpg') center / cover no-repeat;
  }

  /* The photo strip itself is no longer needed; only its title (if any) stays */
  .hero {
    position: static;
    height: auto;
    background: none;
    display: block;
    overflow: visible;
  }
  .hero-overlay {
    display: none;
  }
  .hero > .hero-content {
    position: relative;
    top: auto;
    left: auto;
    padding: 22px 15px 0;
  }

  /* Content starts right under the navbar / title — no overlap tricks */
  body .content,
  body[data-page] .content {
    margin-top: 18px !important;
    padding-bottom: 40px;
  }

  .hero-content h1,
  .hero-content p {
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  }

  /* Driver's name in the greeting matches the rest of the line */
  .hero-content h1 * {
    font-size: inherit;
  }

  /* Live Monitoring page: breathing room from the screen edges */
  .monitoring-wrapper {
    padding: 18px 15px 40px;
  }
  .monitoring-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 14px;
  }

  /* First-login "change your password" box: normal phone-sized text so the
     whole box fits on screen (the 24px rule above made it taller than
     smaller phones, hiding the title and the Update button) */
  #passwordChangeModal .pwd-box {
    padding: 22px 18px;
    font-size: 15px;
  }
  #passwordChangeModal .pwd-box * {
    font-size: inherit;
  }
  #passwordChangeModal .pwd-box h3 {
    font-size: 20px;
  }
  #passwordChangeModal .pwd-box p,
  #passwordChangeModal #pwdRequirements,
  #passwordChangeModal #reqMatch {
    font-size: 13px;
  }
  #passwordChangeModal .pwd-box input {
    font-size: 16px; /* 16px+ stops iPhones from zooming in when typing */
  }

  /* Driver Queue card: phone-sized text, scrolls sideways if needed */
  .queue-card,
  .queue-card * {
    font-size: 13px;
  }
  .queue-card h2 {
    font-size: 17px;
  }
  .queue-card .queue-pos {
    font-size: 15px;
  }
  .queue-date-nav {
    width: 100%;
    gap: 6px;
  }
  .queue-date-nav input[type="date"] {
    flex: 1;
    min-width: 0;
    width: 100%;
    font-size: 16px;
    padding: 7px 6px;
  }
  .queue-date-nav .btn {
    padding: 7px 10px;
    flex-shrink: 0;
  }
  /* Phone: truck, plate and coding day go under the driver's name */
  .queue-table .queue-desk-only {
    display: none;
  }
  .queue-table .queue-phone-only {
    display: block;
    font-size: 11px;
  }
  .queue-table .queue-phone-only * {
    font-size: 11px;
  }
  .queue-table th,
  .queue-table td {
    padding: 8px 6px;
  }
  .queue-table .badge {
    white-space: nowrap;
    font-size: 11px;
    padding: 4px 8px;
  }
  .queue-coding {
    margin-bottom: 10px;
  }
  .queue-header {
    margin-bottom: 14px;
  }

  /* Schedule tab on phones: normal text, grid scrolls sideways, names stay put */
  .schedule-card,
  .schedule-card * {
    font-size: 13px;
  }
  .schedule-card h2 {
    font-size: 17px;
  }
  .schedule-card .sched-day-meta,
  .schedule-card .sched-day-count,
  .schedule-card .sched-col-actions button,
  .schedule-card .queue-plate {
    font-size: 11px;
  }
  .schedule-table .sched-driver-col {
    position: sticky;
    left: 0;
    background: white;
    z-index: 1;
    min-width: 150px;
  }
  .schedule-toolbar #scheduleSaveBtn {
    margin-left: 0;
    width: 100%;
  }
  #scheduleOrderModal .order-name,
  #scheduleOrderModal .order-help,
  #scheduleOrderModal .order-item * {
    font-size: 13px;
  }
  #scheduleOrderModal .order-name small {
    font-size: 11px;
  }
  .schedule-card .sched-pill {
    font-size: 11px;
    padding: 5px 8px;
    min-width: 58px;
    white-space: nowrap;
  }
  .schedule-card .schedule-toolbar .btn,
  .schedule-card .queue-date-nav .btn {
    padding: 7px 10px;
  }
  .queue-roster,
  .queue-roster * {
    font-size: 12px;
  }

  /* Change password: icon only in the phone navbar; normal-size window */
  .btn-password-label {
    display: none;
  }
  .btn-password {
    margin-right: 0;
  }
  #changePwdModal .modal-content,
  #changePwdModal .modal-content * {
    font-size: 14px;
  }
  #changePwdModal h2 {
    font-size: 18px;
  }
  #changePwdModal input {
    font-size: 16px;
  }

  /* Map credit line stays small */
  .leaflet-control-attribution,
  .leaflet-control-attribution * {
    font-size: 10px;
  }
}

/* ==================== DRIVER FORM: plate hint + photo adjuster ==================== */
.plate-hint {
  display: block;
  margin-top: 6px;
  color: #8a5a00;
  background: #fff8e1;
  border-left: 3px solid #f0b400;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12.5px;
  line-height: 1.45;
}
.plate-hint.plate-hint-ok { color: #6b3d00; background: #fff3e0; border-left-color: #ff5a00; }
.plate-hint.plate-hint-warn { color: #8b1a1a; background: #fdecea; border-left-color: #d93025; }

#photoPreviewWrapper, #editPhotoPreviewWrapper { cursor: pointer; }
.photo-adjust-btn { padding: 6px 14px; font-size: 13px; }

.photo-crop-modal { z-index: 1100; } /* above the Create/Edit window */
.photo-crop-content { max-width: 380px; padding: 24px; }
.photo-crop-view {
  position: relative;
  width: min(300px, 100%);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  overflow: hidden;
  background: #1f1f1f;
  border-radius: 6px;
  touch-action: none;           /* fingers move/zoom the photo, not the page */
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.photo-crop-view.dragging { cursor: grabbing; }
.photo-crop-view img {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  transform-origin: 0 0;
  pointer-events: none;
  -webkit-user-drag: none;
}
/* Circle guide: how the photo looks in lists (the whole square is still saved) */
.photo-crop-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(255, 255, 255, 0.85);
  pointer-events: none;
}
.photo-crop-zoom {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px auto 0;
  width: min(300px, 100%);
}
.photo-crop-zoom input[type="range"] { flex: 1; accent-color: #ff5a00; }
.photo-crop-zbtn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid #ddd;
  background: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.photo-crop-help { margin: 10px 0 0; font-size: 12.5px; color: #777; text-align: center; line-height: 1.45; }
@media (max-width: 480px) {
  .photo-crop-content { padding: 18px; width: 94%; }
  .photo-crop-content .action-buttons { flex-wrap: wrap; }
  .photo-crop-content .action-buttons .btn { flex: 1; }
}
@media (max-width: 768px) {
  /* The phone rule "* { font-size: 24px }" made hint lines under form fields huge */
  .modal .form-group small,
  .modal .form-group small *,
  .plate-hint, .plate-hint * { font-size: 13px; }
  .photo-crop-help { font-size: 13px; }
  .photo-crop-zbtn { font-size: 18px; }
  .photo-adjust-btn { font-size: 14px; }
}

/* ==================== PASSWORD RECOVERY ==================== */
/* One-time code box (Forgot password, recovery code; the Drivers page has its own copy) */
.cred-box { background: #f8f9fa; border: 1px solid #e5e5e5; border-radius: 10px; padding: 14px 16px; margin: 6px 0 14px; }
.cred-row { display: flex; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 6px 0; flex-wrap: wrap; }
.cred-row + .cred-row { border-top: 1px dashed #e0e0e0; }
.cred-label { color: #777; font-size: 13px; min-width: 110px; }
.cred-value { font-family: Consolas, 'Courier New', monospace; font-size: 16px; font-weight: 700; color: #222; flex: 1; user-select: all; white-space: nowrap; }
.cred-copy { background: none; border: 1px solid #ddd; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-size: 13px; }
.cred-copy:hover { background: #f0f0f0; }
.cred-note { background: #fff8e1; border: 1px solid #f3dc8b; color: #6b5300; border-radius: 8px; padding: 12px 14px; font-size: 14px; line-height: 1.5; }
.cred-check { display: flex; gap: 8px; align-items: center; margin: 14px 0 4px; cursor: pointer; }
.form-group small { display: block; margin-top: 5px; color: #888; font-size: 12.5px; }

/* 🔑 Password window: recovery code section */
.cp-recovery { margin-top: 22px; padding-top: 16px; border-top: 1px solid #eee; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
.cp-recovery-text { font-size: 13.5px; color: #555; line-height: 1.5; flex: 1 1 220px; }
.cp-recovery-status { display: block; font-weight: 600; color: #1e7e34; }
.cp-recovery-status.missing { color: #b26a00; }
.cp-recovery-btn { padding: 8px 14px; font-size: 13px; }
#changePwdModal.cp-forced .cp-recovery { display: none; }

/* Forced "set your own password" (temporary password) — can't be closed */
.cp-forced-note { margin: -6px 0 14px; color: #6b5300; background: #fff8e1; border: 1px solid #f3dc8b; border-radius: 8px; padding: 10px 12px; font-size: 14px; }
#changePwdModal.cp-forced .modal-close,
#changePwdModal.cp-forced .action-buttons .btn-secondary:not(.cp-forced-logout) { display: none; }

/* Login page */
.login-forgot { display: block; margin: 14px auto 0; background: none; border: none; color: #ff5a00; font-size: 14px; cursor: pointer; text-decoration: underline; }
.forgot-help { margin: 0 0 14px; font-size: 13.5px; color: #555; line-height: 1.6; background: #f8f9fa; border-radius: 8px; padding: 10px 12px; }
.forgot-ok { margin: 0 0 12px; color: #1e7e34; font-weight: 600; }

@media (max-width: 768px) {
  .cred-note, .cred-note *, .forgot-help, .forgot-help *, .cp-forced-note, .cred-label, .cred-copy,
  .cred-check, .login-forgot, .cp-recovery-text, .cp-recovery-text *, .cp-recovery-btn, .cp-rules li { font-size: 13px; }
  .cred-value { font-size: 15px; }
}

/* Laptop widths: keep the top bar on one line */
@media (min-width: 769px) and (max-width: 1440px) {
  .navbar { padding: 15px 28px; }
  .nav-links { gap: 20px; }
  .nav-links a { white-space: nowrap; }
  .nav-right { gap: 14px; }
}
@media (min-width: 769px) and (max-width: 1240px) {
  .navbar { padding: 12px 18px; }
  .nav-left { gap: 14px; }
  .dispatch-logo, .drhi-logo { height: 42px; }
  .nav-links { gap: 14px; }
  .nav-links a { font-size: 13px; }
  .btn-password-label { display: none; } /* 🔑 icon only */
}
@media (min-width: 769px) and (max-width: 1000px) {
  .navbar { flex-wrap: wrap; row-gap: 6px; }
  .nav-right { margin-left: auto; }
}
