* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: #f2f6fb;
  color: #1f2937;
  line-height: 1.5;
}

.footer-watermark {
  text-align: center;
  color: #64748b;
  font-size: 0.82rem;
  padding: 12px 10px 18px;
}

header {
  background: #0f4c81;
  color: white;
  padding: 20px 16px;
  text-align: center;
  position: relative;
}

header h1 {
  margin: 0 0 8px;
  font-size: 1.5rem;
}

header nav {
  margin-top: 10px;
}

.header-actions {
  position: absolute;
  top: 12px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-link {
  color: white;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  transition: background-color 0.2s;
}

.role-indicator {
  display: inline-block;
  margin-right: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
}

.header-actions .role-indicator {
  margin-right: 0;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.3);
}

.public-portal-links {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid #e2e8f0;
}

.public-portal-links p {
  margin: 0 0 8px;
  font-size: 0.85rem;
  color: #475569;
  font-weight: 600;
}

.public-portal-links-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.public-portal-link {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #0f4c81;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
}

.public-portal-link:hover {
  background: #eef4ff;
}

.nav-btn {
  border: none;
  cursor: pointer;
  font: inherit;
}

button.is-busy {
  position: relative;
  opacity: 0.85;
  cursor: not-allowed;
}

button.is-busy::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-top-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  vertical-align: -2px;
}

.global-toast-wrap {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.global-toast {
  min-width: 220px;
  max-width: 360px;
  padding: 10px 12px;
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  box-shadow: 0 8px 20px rgba(2, 6, 23, 0.22);
  opacity: 0;
  transform: translateY(-8px);
  transition: all 180ms ease;
}

.global-toast.show { opacity: 1; transform: translateY(0); }
.global-toast.success { background: #0a7a2f; }
.global-toast.error { background: #b91c1c; }

.global-feedback-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 11000;
  padding: 16px;
}

.global-feedback-modal-card {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.25);
  padding: 16px;
}

.global-feedback-modal-card h3 {
  margin: 0 0 8px;
  color: #0f4c81;
}

.global-feedback-modal-card p {
  margin: 0;
  color: #334155;
}

.global-feedback-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}

.global-feedback-actions button {
  border: none;
  border-radius: 8px;
  background: #0f4c81;
  color: #fff;
  padding: 8px 14px;
  cursor: pointer;
}

.global-page-loading {
  position: fixed;
  inset: 0;
  background: rgba(248, 250, 252, 0.75);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10900;
}

.global-page-loading-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border-radius: 10px;
  border: 1px solid #dbe5f0;
  background: #fff;
  padding: 10px 14px;
  color: #0f4c81;
  font-weight: 600;
  box-shadow: 0 10px 24px rgba(15, 76, 129, 0.16);
}

.global-page-loading .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(15, 76, 129, 0.3);
  border-top-color: #0f4c81;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.report-graph-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.report-graph-card {
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fbfdff;
  padding: 10px;
}

.report-graph-card h3 {
  margin: 0 0 8px;
  font-size: 0.96rem;
  color: #0f4c81;
}

.report-chart {
  min-height: 220px;
}

.mini-bars {
  display: grid;
  gap: 8px;
}

.mini-bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 64px;
  gap: 8px;
  align-items: center;
}

.mini-bar-label {
  font-size: 0.82rem;
  color: #1e293b;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-bar-track {
  background: #e6eef8;
  border-radius: 999px;
  overflow: hidden;
  height: 10px;
}

.mini-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2f80ed, #34c6ff);
}

.mini-bar-value {
  text-align: right;
  font-size: 0.8rem;
  color: #334155;
}

@media (max-width: 900px) {
  .report-graph-grid {
    grid-template-columns: 1fr;
  }

  .header-actions {
    position: static;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
  }

  header nav {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }
}

.rv-shell {
  background: #fff;
}

#rv-branding {
  border: 1px solid #dbe7f4;
  border-radius: 10px;
  padding: 10px 12px;
  background: #f9fcff;
  margin-bottom: 10px;
}

.rv-brand-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.rv-company-name {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f4c81;
}

.rv-brand-right {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.rv-logo {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 6px;
  border: 1px solid #d7e2f0;
  background: #fff;
}

.rv-logo-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 800;
  color: #0f4c81;
}

.rv-brand-legal {
  font-size: 0.8rem;
  line-height: 1.4;
  color: #334155;
}

#rv-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.rv-summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 0.9rem;
}

.rv-chart-wrap {
  border: 1px solid #dbe5f0;
  border-radius: 10px;
  background: #fbfdff;
  padding: 10px;
  margin-top: 12px;
}

.rv-chart-wrap h3 {
  margin: 0 0 8px;
  color: #0f4c81;
  font-size: 0.95rem;
}

.rv-sieve-chart {
  min-height: 170px;
}

.rv-line-chart {
  width: 100%;
  height: auto;
  display: block;
}

.rv-axis-text {
  font-size: 10px;
  fill: #475569;
  font-family: Arial, sans-serif;
}

.rv-axis-label {
  font-size: 11px;
  fill: #0f172a;
  font-family: Arial, sans-serif;
  font-weight: 600;
}

.rv-axis-note {
  margin-top: 6px;
  font-size: 0.78rem;
  color: #64748b;
}

.rv-contact-footer {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
}

.rv-footer-note {
  color: #64748b;
}

@media (max-width: 900px) {
  #rv-meta,
  .rv-summary-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .rv-brand-head {
    flex-direction: column;
  }
}

@media print {
  body {
    background: #fff;
  }

  .rv-shell {
    margin: 0;
    padding: 8px;
    border: none;
    box-shadow: none;
  }

  .rv-shell .workflow-row:first-child button,
  .rv-shell .workflow-row:first-child a {
    display: none !important;
  }

  #rv-branding,
  .rv-summary-strip,
  .rv-chart-wrap,
  .rv-contact-footer {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .table-container table th,
  .table-container table td {
    font-size: 11px;
    padding: 4px;
  }

  .rv-chart-wrap {
    margin-top: 6px;
    padding: 6px;
  }

  #rv-meta {
    margin-bottom: 4px;
    gap: 4px;
  }

  .rv-summary-strip {
    margin-bottom: 6px;
    padding: 6px 8px;
    font-size: 0.82rem;
  }

  .rv-contact-footer {
    margin-top: 8px;
    padding-top: 6px;
    font-size: 0.82rem;
    gap: 10px;
  }

  .rv-axis-label {
    font-size: 10px;
  }

  .rv-axis-text {
    font-size: 9px;
  }
}

.notif-badge {
  display: inline-block;
  margin-left: 6px;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.72rem;
  line-height: 20px;
  text-align: center;
  font-weight: 700;
}

.header-bell-btn {
  padding: 8px 10px;
  min-width: 42px;
}

.bell-icon {
  font-size: 1.05rem;
  line-height: 1;
}

/* Tablet-safe header layout: prevent title/nav overlap with action controls */
@media (max-width: 1024px) {
  header {
    padding-top: 16px;
    padding-bottom: 16px;
  }

  .header-actions {
    position: static;
    justify-content: flex-end;
    width: 100%;
    margin-top: 10px;
    margin-bottom: 2px;
    padding-right: 0;
  }

  header nav {
    margin-top: 8px;
  }
}

.truck-link-btn {
  border: none;
  background: transparent;
  color: #0f4c81;
  text-decoration: underline;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  min-width: 0;
  flex: none;
  font-size: 0.92rem;
}

.truck-link-btn.mobile {
  font-size: 1rem;
}

/* Role and PIN Modals */
#role-modal,
#pin-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.timeline-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.56);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1100;
  padding: 16px;
}

.timeline-modal-content {
  width: min(740px, 96vw);
  max-height: 86vh;
  overflow: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.24);
  padding: 16px;
}

.tasks-modal-content {
  width: min(980px, 98vw);
}

.task-id-link {
  border: none;
  background: transparent;
  color: #0f4c81;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font: inherit;
  font-weight: 700;
}

.task-status-chip {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  padding: 2px 8px;
  font-size: 0.74rem;
  font-weight: 700;
}

.task-status-open { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.task-status-in-progress { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.task-status-blocked { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.task-status-done { background: #dcfce7; border-color: #86efac; color: #166534; }
.task-status-cancelled { background: #e5e7eb; border-color: #cbd5e1; color: #374151; }

.task-detail-grid {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  margin-bottom: 10px;
}

.task-comments-wrap,
.task-activity-wrap {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
  margin-bottom: 10px;
}

.task-comments-wrap h4,
.task-activity-wrap h4 {
  margin: 0 0 8px;
  color: #0f4c81;
  font-size: 0.92rem;
}

.task-comment-item,
.task-activity-item {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 0;
}

.task-comment-item:last-child,
.task-activity-item:last-child {
  border-bottom: none;
}

.timeline-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.timeline-modal-header h3 {
  margin: 0;
  color: #0f4c81;
}

.timeline-close-btn {
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1f2937;
  border-radius: 8px;
  min-width: 86px;
  flex: none;
  padding: 8px 12px;
}

.timeline-meta {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  font-size: 0.88rem;
}

.timeline-list {
  display: grid;
  gap: 8px;
}

.timeline-stage-summary {
  border: 1px solid #dbe4f0;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
  background: #f8fbff;
}

.timeline-stage-summary h4 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: #0f4c81;
}

.timeline-summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.timeline-summary-chip {
  font-size: 0.76rem;
  color: #1f2937;
  background: #e6f0ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 3px 8px;
}

.timeline-item {
  border-left: 4px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 8px;
  padding: 10px 12px;
  display: grid;
  gap: 4px;
}

.timeline-item-current {
  border-left-color: #0f4c81;
  background: #eff6ff;
}

.timeline-item-status {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1f2937;
}

.timeline-item-times {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.82rem;
  color: #334155;
}

.timeline-item-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.timeline-detail-chip {
  font-size: 0.76rem;
  color: #1f2937;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  border-radius: 999px;
  padding: 2px 8px;
}

.role-modal-content,
.pin-modal-content {
  background: white;
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.role-modal-content h2,
.pin-modal-content h2 {
  margin-top: 0;
  color: #0f4c81;
  font-size: 1.5rem;
}

.role-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 20px;
}

.role-btn {
  padding: 12px 16px;
  border: 2px solid #0f4c81;
  background: white;
  color: #0f4c81;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
  font-size: 1rem;
}

.role-btn:hover {
  background: #0f4c81;
  color: white;
}

.pin-modal-content p {
  margin: 12px 0;
  font-size: 0.95rem;
}

#pin-role-label {
  font-weight: 600;
  color: #0f4c81;
  margin-bottom: 16px;
}

#pin-input {
  width: 100%;
  padding: 12px;
  font-size: 1.5rem;
  text-align: center;
  letter-spacing: 8px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  margin: 16px 0;
  font-family: monospace;
}

#pin-input:focus {
  outline: none;
  border-color: #0f4c81;
}

#pin-submit-btn,
#pin-cancel-btn {
  padding: 10px 20px;
  margin: 8px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s;
}

#pin-submit-btn {
  background: #047857;
  color: white;
}

#pin-submit-btn:hover {
  background: #065f46;
}

#pin-cancel-btn {
  background: #e5e7eb;
  color: #1f2937;
}

#pin-cancel-btn:hover {
  background: #d1d5db;
}

@media (max-width: 600px) {
  .role-buttons {
    grid-template-columns: 1fr;
  }
}



.panel {
  background: white;
  margin: 16px auto;
  padding: 20px;
  border-radius: 12px;
  max-width: 800px;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

@media (min-width: 1024px) {
  .panel.wide-panel {
    max-width: 1100px;
  }
}

.panel h2 {
  margin-top: 0;
  font-size: 1.25rem;
  color: #0f4c81;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 600px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

label {
  display: flex;
  flex-direction: column;
  font-size: 0.95rem;
  font-weight: 500;
}

input,
select {
  width: 100%;
  margin-top: 6px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 1rem;
  transition: border-color 0.2s;
}

input:focus,
select:focus {
  outline: none;
  border-color: #0f4c81;
}

.typeahead-wrap {
  position: relative;
  width: 100%;
}

.typeahead-list {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 1200;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.12);
  max-height: 220px;
  overflow-y: auto;
  display: none;
}

.typeahead-option {
  width: 100%;
  text-align: left;
  border: none;
  background: #fff;
  padding: 10px 12px;
  font-size: 0.95rem;
  border-radius: 0;
}

.typeahead-option + .typeahead-option {
  border-top: 1px solid #e2e8f0;
}

.typeahead-option:hover,
.typeahead-option:focus {
  background: #eff6ff;
}

.actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  border: none;
  border-radius: 8px;
  padding: 12px 20px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 500;
  transition: background-color 0.2s;
  flex: 1;
  min-width: 120px;
}

@media (min-width: 600px) {
  .actions {
    justify-content: flex-start;
  }

  button {
    flex: none;
  }
}

button#save-button {
  background: #0f4c81;
  color: white;
}

button#save-button:hover {
  background: #0a3d6a;
}

button#clear-button {
  background: #e2e8f0;
  color: #374151;
}

button#clear-button:hover {
  background: #cbd5e1;
}

.table-container {
  overflow-x: auto;
}

.mobile-only {
  display: none;
}

.desktop-only {
  display: block;
}

.mobile-trip-list {
  display: none;
}

.mobile-trip-card {
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.mobile-trip-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.mobile-trip-truck {
  font-size: 1rem;
  font-weight: 700;
}

.mobile-trip-grid {
  display: grid;
  gap: 6px;
  font-size: 0.86rem;
  color: #334155;
}

.mobile-trip-actions {
  margin-top: 10px;
}

@media (max-width: 768px) {
  .table-container {
    font-size: 0.75rem;
  }

  th,
  td {
    padding: 6px 4px;
    white-space: nowrap;
  }

  .weight-inputs {
    flex-direction: column;
    gap: 2px;
  }

  .weight-input,
  .weight-operator-select,
  .weight-operator-other {
    font-size: 0.75rem;
    padding: 3px 4px;
  }

  .save-weight-btn {
    padding: 3px 6px;
    font-size: 0.7rem;
  }

  .action-buttons {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    margin-bottom: 1px;
    font-size: 0.7rem;
    padding: 3px 4px;
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  font-size: 0.9rem;
}

thead {
  background: #0f4c81;
  color: white;
}

th,
td {
  padding: 12px 8px;
  border: 1px solid #e2e8f0;
  text-align: left;
}

th {
  font-weight: 600;
}

tr:nth-child(even) {
  background: #f8fafc;
}

.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
  text-transform: uppercase;
}

.status-cell {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  max-width: 220px;
}

.cancel-reason-text {
  font-size: 0.75rem;
  color: #991b1b;
  background: #fef2f2;
  border-radius: 4px;
  padding: 2px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.status-in_gate {
  background: #e5e7eb;
  color: #374151;
}

.status-in-gate {
  background: #e5e7eb;
  color: #374151;
}

.status-at-dispatch,
.status-at_dispatch {
  background: #dbeafe;
  color: #1e40af;
}

.status-waiting {
  background: #ede9fe;
  color: #5b21b6;
}

.status-sent-for-tare-weight {
  background: #e0f2fe;
  color: #075985;
}

.status-tare-weight-done,
.status-tare_weight_done {
  background: #fef3c7;
  color: #92400e;
}

.status-ready-for-loading {
  background: #cffafe;
  color: #155e75;
}

.status-loading-in-progress,
.status-loading_in_progress {
  background: #fed7aa;
  color: #9a3412;
}

.status-loading-completed {
  background: #fde68a;
  color: #92400e;
}

.status-loaded {
  background: #fde68a;
  color: #92400e;
}

.status-gross-weight-pending {
  background: #ede9fe;
  color: #6d28d9;
}

.status-gross-weight-done,
.status-gross_weight_done {
  background: #d1fae5;
  color: #065f46;
}

.status-billing-pending {
  background: #f3e8ff;
  color: #7e22ce;
}

.status-billing-completed {
  background: #e9d5ff;
  color: #6b21a8;
}

.status-completed {
  background: #d1fae5;
  color: #065f46;
}

.status-cancelled {
  background: #fee2e2;
  color: #991b1b;
}

.status-exited {
  background: #dcfce7;
  color: #166534;
}

/* Delayed truck highlighting */
.truck-delayed-warning {
  background-color: #fefce8; /* Light yellow */
}

.truck-delayed-critical {
  background-color: #fef2f2; /* Light red */
}

.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

@media (max-width: 768px) {
  .action-buttons {
    flex-direction: column;
  }

  .action-btn {
    width: 100%;
    margin-bottom: 2px;
  }
}

.action-btn {
  padding: 4px 8px;
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  background: #e5e7eb;
  color: #374151;
  transition: background-color 0.2s;
}

.action-btn:hover {
  background: #d1d5db;
}

.status-action-select {
  min-width: 150px;
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  background: #ffffff;
}

.status-action-select:disabled {
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
}

.weight-inputs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: stretch;
}

.weight-readonly {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.mini-muted {
  font-size: 0.76rem;
  color: #6b7280;
}

.workflow-details {
  margin-bottom: 6px;
  font-size: 0.78rem;
  color: #334155;
  display: grid;
  gap: 2px;
}

.workflow-container {
  min-width: 220px;
  display: grid;
  gap: 6px;
}

.workflow-group {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.admin-editor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px 8px;
}

.admin-edit-input {
  margin-top: 4px;
  padding: 6px 8px;
  font-size: 0.78rem;
}

.workflow-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.workflow-btn {
  flex: 0 0 auto;
  min-width: 120px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #fff;
  color: #1f2937;
  font-size: 0.78rem;
}

.workflow-btn.primary {
  background: #0f4c81;
  color: white;
  border-color: #0f4c81;
}

.workflow-btn.danger {
  background: #fee2e2;
  color: #991b1b;
  border-color: #fecaca;
}

.workflow-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.dispatch-editor {
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
}

.dispatch-editor label {
  font-size: 0.8rem;
  font-weight: 600;
  gap: 4px;
}

.dispatch-input,
.dispatch-other-input {
  margin-top: 4px;
  padding: 6px 8px;
  font-size: 0.8rem;
  border-radius: 6px;
}

.reason-chip {
  font-size: 0.72rem;
  background: #f8fafc;
  border: 1px solid #dbeafe;
  border-radius: 6px;
  padding: 3px 6px;
  color: #334155;
}

.reason-chip-error {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.weight-input {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.weight-input.net-weight {
  background: #f8fafc;
  color: #374151;
}

.weight-operator-select,
.weight-operator-other {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 0.85rem;
  width: 100%;
  box-sizing: border-box;
}

.save-weight-btn {
  padding: 6px 12px;
  background: #059669;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 4px;
  transition: background-color 0.2s;
}

.save-weight-btn:hover {
  background: #047857;
}

@media (max-width: 768px) {
  .weight-inputs {
    flex-direction: column;
  }

  .weight-input,
  .weight-operator-select,
  .weight-operator-other {
    font-size: 0.8rem;
    padding: 4px 6px;
  }

  .save-weight-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }
}

.filters {
  margin-bottom: 16px;
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
}

.filter-group {
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}

.filter-group label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  font-weight: 500;
  min-width: 150px;
}

.filter-group input,
.filter-group select {
  margin-top: 4px;
  padding: 8px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .filter-group {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group label {
    min-width: auto;
  }
}

.summary-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  border-left: 4px solid;
}

.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.sales-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
  margin-bottom: 16px;
}

.sales-chart-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px;
}

.sales-chart-card h3 {
  margin: 0 0 10px;
  font-size: 0.98rem;
  color: #0f172a;
}

.sales-bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
}

.sales-bar-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(120px, 3fr) minmax(80px, 1fr);
  align-items: center;
  gap: 8px;
}

.sales-bar-label {
  font-size: 0.78rem;
  color: #334155;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sales-bar-track {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.sales-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #0f4c81, #38bdf8);
}

.sales-bar-value {
  font-size: 0.78rem;
  color: #0f172a;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.sales-empty {
  color: #64748b;
  font-size: 0.85rem;
  padding: 8px 4px;
}

.analytics-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.analytics-tab.active {
  background: #0f4c81;
  color: #fff;
}

.analytics-module-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.analytics-module-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
}

.analytics-modules {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.analytics-module {
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.analytics-module-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.analytics-module-header h3 {
  margin: 0;
}

.analytics-module-actions {
  display: flex;
  gap: 6px;
}

.card-blue {
  border-left-color: #0f4c81;
}

.card-light-blue {
  border-left-color: #38bdf8;
}

.card-gray {
  border-left-color: #6b7280;
}

.card-orange {
  border-left-color: #f59e0b;
}

.card-green {
  border-left-color: #10b981;
}

.card-red {
  border-left-color: #ef4444;
}

.card-purple {
  border-left-color: #8b5cf6;
}

.card-yellow {
  border-left-color: #facc15;
}

.card-number {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.card-title {
  font-size: 0.9rem;
  color: #6b7280;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-trucks {
  margin-top: 8px;
  font-size: 0.74rem;
  color: #475569;
  line-height: 1.35;
  word-break: break-word;
}

@media (max-width: 768px) {
  .summary-cards {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .sales-chart-grid {
    grid-template-columns: 1fr;
  }

  .sales-bar-row {
    grid-template-columns: minmax(80px, 1fr) minmax(100px, 2fr) minmax(72px, 1fr);
  }

  .summary-card {
    padding: 16px;
  }

  .card-number {
    font-size: 2rem;
  }

  .card-title {
    font-size: 0.8rem;
  }

  .card-trucks {
    font-size: 0.68rem;
  }
}

/* Mobile field mode */
@media (max-width: 768px) {
  header {
    padding: 14px 12px;
  }

  header h1 {
    font-size: 1.2rem;
    margin-bottom: 4px;
  }

  header p {
    margin: 0;
    font-size: 0.88rem;
  }

  header nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 12px;
  }

  .header-actions {
    position: static;
    margin-top: 10px;
    justify-content: flex-end;
  }

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

  .header-actions .nav-link {
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .panel {
    margin: 10px;
    padding: 14px;
    border-radius: 10px;
  }

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

  label {
    width: 100%;
  }

  input,
  select,
  textarea,
  .filter-group input,
  .filter-group select {
    width: 100%;
    font-size: 1rem;
    padding: 12px;
  }

  .filters {
    padding: 12px;
    margin-bottom: 12px;
  }

  .filter-group {
    gap: 10px;
  }

  .actions {
    gap: 10px;
  }

  .actions button {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
  }

  .desktop-only {
    display: none !important;
  }

  .mobile-only,
  .mobile-trip-list {
    display: block !important;
  }

  .summary-cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .summary-card {
    padding: 14px;
  }

  .card-number {
    font-size: 1.6rem;
    margin-bottom: 4px;
  }
}
