* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #0d9488;
  --primary-dark: #0b7c72;
  --primary-light: #e6f7f4;
  --secondary: #6C757D;
  --success: #28A745;
  --danger: #DC3545;
  --warning: #FFC107;
  --white: #FFFFFF;
  --light: #F8F9FA;
  --border: #DEE2E6;
  --text: #212529;
  --text-light: #6C757D;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--white);
  color: var(--text);
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.screen {
  display: none;
  flex: 1;
  overflow: auto;
}

.screen.active {
  display: flex;
  flex-direction: column;
}

/* Login */
.login-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: linear-gradient(135deg, #0d9488 0%, #0b7c72 100%);
  color: white;
}

.login-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
}

.login-container h1 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  text-align: center;
}

.login-container p {
  font-size: 1rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

#login-form {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  color: var(--text);
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

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

.hint {
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 1rem;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

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

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: var(--secondary);
  color: white;
}

.btn-secondary:hover {
  background: #5A6268;
}

.btn-logout {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 4px;
  font-size: 0.9rem;
}

.btn-logout:hover {
  background: var(--light);
}

#login-form .btn {
  width: 100%;
  margin-top: 1rem;
}

/* Navbar */
.navbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  flex-wrap: wrap;
}

.logo {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary);
  white-space: nowrap;
}

.nav-left {
  flex: 0 0 auto;
}

.nav-center {
  flex: 1;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.nav-right {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
}

#user-display {
  font-size: 0.9rem;
  color: var(--text-light);
}

.nav-btn {
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-btn:hover,
.nav-btn.active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 500;
}

/* Container */
.container {
  flex: 1;
  overflow: auto;
  padding: 2rem;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

/* Views */
.view-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.controls {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.controls input[type="text"] {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  width: 250px;
}

h2 {
  color: var(--primary);
  margin-bottom: 1.5rem;
  font-size: 2rem;
}

h3 {
  color: var(--text);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

/* Tabs */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  padding: 0.75rem 1.5rem;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  transition: all 0.2s;
}

.tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

/* Tables */
.customers-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  table-layout: fixed;
}

/* Column widths */
.customers-table th:nth-child(1) { width: 16%; }  /* Name */
.customers-table th:nth-child(2) { width: 9%; }   /* Mode */
.customers-table th:nth-child(3) { width: 13%; white-space: nowrap; }  /* Phone */
.customers-table th:nth-child(4) { width: 14%; }  /* Truck Type */
.customers-table th:nth-child(5) { width: 11%; }  /* Schedule */
.customers-table th:nth-child(6) { width: 17%; }  /* Next Load */
.customers-table th:nth-child(7) { width: 20%; }  /* Actions */

.customers-table td:nth-child(3) { white-space: nowrap; }  /* Phone never wraps */

.customers-table thead {
  background: var(--light);
}

.customers-table th {
  padding: 0.75rem 0.6rem;
  text-align: left;
  font-weight: 600;
  color: var(--text);
  border-bottom: 2px solid var(--border);
}

.customers-table td {
  padding: 0.75rem 0.6rem;
  border-bottom: 1px solid var(--border);
}

.customers-table tr:hover {
  background: var(--primary-light);
}

.action-btns {
  display: flex;
  gap: 0.5rem;
}

.action-btns button {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: white;
  border-radius: 4px;
  transition: all 0.2s;
}

.action-btns button:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* Dashboard Stats */
.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  text-align: center;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: bold;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.stat-label {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Lookup */
.lookup-container {
  max-width: 600px;
  margin: 0 auto;
}

#lookup-search {
  width: 100%;
  padding: 1rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: 4px;
  margin-bottom: 2rem;
}

.lookup-card {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.lookup-name {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.lookup-info {
  display: grid;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text);
}

.lookup-info-row {
  display: flex;
  justify-content: space-between;
}

/* Week View */
#week-container {
  display: grid;
  gap: 2rem;
}

.day-section {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
}

.day-header {
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 1rem;
  border-bottom: 2px solid var(--primary-light);
  padding-bottom: 0.5rem;
}

.delivery-item {
  padding: 1rem;
  border-left: 4px solid var(--primary);
  background: var(--primary-light);
  margin-bottom: 0.75rem;
  border-radius: 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.delivery-item.Done {
  border-left-color: var(--success);
  background: #D4EDDA;
}

.delivery-item.Canceled {
  border-left-color: var(--danger);
  background: #F8D7DA;
}

.delivery-info {
  flex: 1;
}

.delivery-customer {
  font-weight: 600;
  color: var(--text);
}

.delivery-details {
  font-size: 0.85rem;
  color: var(--text-light);
}

.delivery-status {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 500;
}

.delivery-status.Scheduled {
  background: var(--primary-light);
  color: var(--primary);
}

.delivery-status.Done {
  background: #D4EDDA;
  color: var(--success);
}

.delivery-status.Moved {
  background: #FFF3CD;
  color: #856404;
}

.delivery-status.Canceled {
  background: #F8D7DA;
  color: var(--danger);
}

/* Daily View */
.daily-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  gap: 1rem;
}

#daily-date-picker {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1rem;
}

/* Calendar */
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 10px;
  background: white;
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.calendar-day-header {
  text-align: center;
  font-weight: 600;
  color: var(--primary);
  padding: 0.5rem;
  border-bottom: 2px solid var(--primary-light);
}

.calendar-cell {
  aspect-ratio: 1;
  border: 1px solid var(--border);
  padding: 0.75rem;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s;
}

.calendar-cell:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.calendar-day-number {
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.25rem;
}

.calendar-day-count {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 500;
}

.calendar-cell.other-month {
  background: var(--light);
  color: var(--text-light);
}

/* Settings */
.settings-section {
  margin-bottom: 3rem;
}

#holidays-list {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.holiday-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border);
}

.holiday-item:last-child {
  border-bottom: none;
}

.holiday-date {
  font-weight: 600;
  color: var(--primary);
}

.stub-card {
  background: white;
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  margin-bottom: 1.5rem;
}

.stub-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.stub-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.stub-card p {
  color: var(--text-light);
  font-size: 0.9rem;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: white;
  border-radius: 8px;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  margin: 0;
  color: var(--text);
}

.modal-close {
  background: transparent;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-light);
}

.modal-close:hover {
  color: var(--text);
}

#customer-form,
#delivery-form,
#holiday-form {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1.5rem;
  border-top: 1px solid var(--border);
  margin-top: 1rem;
}

/* Print styles */
@media print {
  body {
    background: white;
  }

  .navbar,
  .view-header,
  #add-manual-delivery-btn,
  .action-btns,
  .controls {
    display: none !important;
  }

  .calendar-grid {
    page-break-inside: avoid;
    border: 1px solid black;
  }

  .modal {
    display: none !important;
  }

  @page {
    size: landscape;
    margin: 0;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .navbar {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
  }

  .nav-center {
    justify-content: flex-start;
    overflow-x: auto;
  }

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

  .dashboard-stats {
    grid-template-columns: 1fr;
  }

  .controls {
    flex-direction: column;
  }

  .controls input[type="text"] {
    width: 100%;
  }

  .customers-table {
    font-size: 0.9rem;
  }

  .customers-table th,
  .customers-table td {
    padding: 0.75rem;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 5px;
    padding: 0.5rem;
  }

  .calendar-cell {
    padding: 0.5rem;
    font-size: 0.8rem;
  }

  .delivery-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .delivery-status {
    margin-top: 0.5rem;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 1rem;
  }

  .login-container {
    padding: 1rem;
  }

  #login-form {
    padding: 1rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .stat-card {
    padding: 1rem;
  }

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

  .lookup-search {
    padding: 0.75rem;
  }
}

/* ===== CALENDAR OVERRIDES ===== */
.calendar-nav {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 20px !important;
  padding: 0 4px !important;
}
.calendar-month-heading {
  font-size: 26px !important;
  font-weight: 700 !important;
  color: #0d9488 !important;
  margin: 0 !important;
  text-align: center !important;
  flex: 1 !important;
}
.calendar-nav-btn {
  background: #0d9488 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 10px 22px !important;
  font-size: 20px !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  line-height: 1 !important;
}
.calendar-nav-btn:hover {
  background: #0b7c72 !important;
}
.calendar-cell {
  min-height: 200px !important;
  height: auto !important;
  overflow: visible !important;
  vertical-align: top !important;
}
.calendar-day-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 2px !important;
  overflow: visible !important;
}
.calendar-entry {
  font-size: 11px !important;
  line-height: 1.4 !important;
  color: #0d9488 !important;
  padding: 2px 4px !important;
  border-radius: 3px !important;
  background: #d5f0ec !important;
  word-break: break-word !important;
  white-space: normal !important;
  overflow: visible !important;
}
@media print {
  .calendar-nav-btn { display: none !important; }
  .calendar-month-heading { font-size: 18px !important; color: #000 !important; }
  .calendar-cell { min-height: 100px !important; }
  .calendar-entry { font-size: 8px !important; background: none !important; color: #000 !important; }
}

/* ===== CALENDAR FINAL FIX ===== */
#calendar-view {
  overflow-x: auto !important;
}
#calendar-container {
  min-width: 1100px !important;
  width: 100% !important;
}
.calendar-nav {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 16px !important;
  padding: 0 !important;
}
.calendar-month-heading {
  font-size: 24px !important;
  font-weight: 700 !important;
  color: #0d9488 !important;
  margin: 0 !important;
  text-align: center !important;
  flex: 1 !important;
}
.calendar-nav-btn {
  background: #0d9488 !important;
  color: #fff !important;
  border: none !important;
  border-radius: 8px !important;
  padding: 8px 20px !important;
  font-size: 22px !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}
.calendar-grid {
  display: grid !important;
  grid-template-columns: repeat(7, minmax(140px, 1fr)) !important;
  gap: 4px !important;
}
.calendar-cell {
  min-height: 180px !important;
  height: auto !important;
  overflow: visible !important;
}
.calendar-entry {
  white-space: normal !important;
  word-break: break-word !important;
  overflow: visible !important;
  font-size: 11px !important;
  background: #d5f0ec !important;
  color: #0d9488 !important;
  padding: 2px 4px !important;
  border-radius: 3px !important;
  margin-bottom: 2px !important;
  display: block !important;
}

/* ===== CALENDAR SATURDAY FIX + CELL HEIGHT ===== */
#calendar-view {
  overflow-x: scroll !important;
  -webkit-overflow-scrolling: touch !important;
}
#calendar-container {
  width: max-content !important;
  min-width: 100% !important;
}
.calendar-grid {
  grid-template-columns: repeat(7, 160px) !important;
  gap: 4px !important;
  width: max-content !important;
}
.calendar-cell {
  width: 160px !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  overflow: visible !important;
}
.calendar-entry {
  font-size: 12px !important;
  white-space: normal !important;
  word-break: break-word !important;
  overflow: visible !important;
  background: #d5f0ec !important;
  color: #0b7c72 !important;
  padding: 3px 5px !important;
  margin-bottom: 3px !important;
  border-radius: 3px !important;
  display: block !important;
  line-height: 1.5 !important;
}

/* ===== PRINT LAYOUT - ONE PAGE LANDSCAPE ===== */
@page {
  size: A4 landscape;
  margin: 8mm;
}
@media print {
  /* Hide everything except the calendar */
  .navbar, .view:not(#calendar-view), #calendar-view .calendar-header,
  .calendar-nav-btn, button, nav, header, footer,
  #calendar-view h1, #calendar-view .btn {
    display: none !important;
  }
  body {
    margin: 0 !important;
    padding: 0 !important;
    background: white !important;
  }
  #app {
    padding: 0 !important;
    margin: 0 !important;
  }
  #calendar-view {
    display: block !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 100% !important;
  }
  #calendar-container {
    width: 100% !important;
    min-width: unset !important;
  }
  .calendar-nav {
    display: flex !important;
    justify-content: center !important;
    margin-bottom: 6px !important;
  }
  .calendar-month-heading {
    font-size: 16pt !important;
    font-weight: bold !important;
    color: black !important;
    text-align: center !important;
  }
  .calendar-grid {
    display: grid !important;
    grid-template-columns: repeat(7, 1fr) !important;
    width: 100% !important;
    gap: 2px !important;
  }
  .calendar-day-header {
    font-size: 9pt !important;
    font-weight: bold !important;
    text-align: center !important;
    background: #ddd !important;
    padding: 3px !important;
    border: 0.5px solid #999 !important;
  }
  .calendar-cell {
    border: 0.5px solid #999 !important;
    padding: 3px !important;
    width: auto !important;
    min-height: 60px !important;
    height: auto !important;
    overflow: visible !important;
    page-break-inside: avoid !important;
    background: white !important;
  }
  .calendar-cell.other-month {
    background: #f5f5f5 !important;
  }
  .calendar-day-number {
    font-size: 9pt !important;
    font-weight: bold !important;
    color: black !important;
    margin-bottom: 2px !important;
  }
  .calendar-entry {
    font-size: 7pt !important;
    line-height: 1.3 !important;
    background: none !important;
    color: black !important;
    padding: 0 !important;
    margin-bottom: 1px !important;
    border-radius: 0 !important;
    display: block !important;
    white-space: normal !important;
    word-break: break-word !important;
  }
}

/* Call-in schedule / unschedule buttons */
.btn-schedule-callin {
  background: #e8f5e9;
  color: #2e7d32;
  border: 1px solid #a5d6a7;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-schedule-callin:hover { background: #c8e6c9; }

.btn-unschedule {
  background: #fdecea;
  color: #c62828;
  border: 1px solid #ef9a9a;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.8rem;
  cursor: pointer;
}
.btn-unschedule:hover { background: #ffcdd2; }

.lookup-actions {
  margin-top: 0.75rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* LucasFlow — compact icon action buttons (customers table) */
.action-btns {
  flex-wrap: wrap;
}
.action-btns .icon-btn {
  width: 32px;
  height: 30px;
  padding: 0;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  color: inherit;
}
.action-btns .icon-btn:hover { background: var(--primary-light); border-color: var(--primary); color: inherit; }
.action-btns .icon-btn.btn-profile { background: #e6f7f4; border-color: #99e3d8; }
.action-btns .icon-btn.btn-profile:hover { background: #ccefe9; }
.action-btns .icon-btn.btn-schedule-callin { background: #e8f5e9; border-color: #a5d6a7; }
.action-btns .icon-btn.btn-unschedule { background: #fdecea; border-color: #ef9a9a; }
.action-btns .icon-btn.icon-btn-danger:hover { background: #fdecea; border-color: #ef9a9a; }

/* Profile button (Quick Lookup keeps the labeled version) */
.lookup-actions .btn-profile {
  background: #e6f7f4;
  color: #0d9488;
  border: 1px solid #99e3d8;
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 0.8rem;
  cursor: pointer;
}
.lookup-actions .btn-profile:hover { background: #ccefe9; }

/* LucasFlow — daily-view driver/truck/date assignment row */
.delivery-assign {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.6rem;
}
.delivery-assign label {
  display: flex;
  flex-direction: column;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-light);
  gap: 3px;
}
.delivery-assign select,
.delivery-assign input {
  font-size: 0.85rem;
  padding: 4px 6px;
  border: 1px solid #ced4da;
  border-radius: 4px;
}

/* LucasFlow — richer dashboard */
.stat-sub {
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--text-light);
}
.stat-card-alert .stat-number { color: #c0392b; }
.dash-section {
  margin-top: 2rem;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
}
.dash-section h3 { margin-bottom: 1rem; color: var(--primary); }
.forecast { display: flex; flex-direction: column; gap: 0.5rem; }
.forecast-row { display: flex; align-items: center; gap: 0.75rem; }
.forecast-day { width: 110px; font-size: 0.85rem; color: var(--text); flex-shrink: 0; }
.forecast-bar-wrap { flex: 1; background: var(--light); border-radius: 5px; height: 18px; overflow: hidden; }
.forecast-bar { height: 100%; background: var(--primary); border-radius: 5px; min-width: 2px; transition: width 0.3s; }
.forecast-count { width: 32px; text-align: right; font-weight: 600; font-size: 0.85rem; color: var(--text); flex-shrink: 0; }

/* LucasFlow — Dispatch Board */
.dispatch-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 0.5rem; }
.dispatch-controls { display: flex; align-items: center; gap: 0.5rem; }
.dispatch-controls #dispatch-date { padding: 0.5rem; border: 1px solid var(--border); border-radius: 6px; font-size: 0.95rem; }
.dispatch-hint { color: var(--text-light); font-size: 0.85rem; margin-bottom: 1rem; }
.dispatch-board { display: flex; gap: 1rem; overflow-x: auto; padding-bottom: 1rem; align-items: flex-start; }
.disp-col { flex: 0 0 270px; background: var(--light); border: 1px solid var(--border); border-radius: 10px; display: flex; flex-direction: column; max-height: 70vh; }
.disp-col-unassigned { background: #fff7ed; border-color: #fed7aa; }
.disp-col-head { display: flex; justify-content: space-between; align-items: center; padding: 0.75rem 1rem; font-weight: 600; color: var(--text); border-bottom: 1px solid var(--border); position: sticky; top: 0; }
.disp-count { background: var(--primary); color: #fff; border-radius: 999px; font-size: 0.75rem; padding: 1px 9px; font-weight: 700; }
.disp-head-right { display: inline-flex; align-items: center; gap: 6px; }
.disp-notify { background: none; border: none; cursor: pointer; font-size: 0.95rem; padding: 0 2px; line-height: 1; opacity: 0.7; }
.disp-notify:hover { opacity: 1; }

/* LucasFlow — Map view */
.map-header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; margin-bottom: 0.5rem; }
.map-header-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.map-frame-wrap { height: 72vh; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--light); position: relative; }
#prrd-frame, .prrd-frame { width: 100%; height: 100%; border: 0; }
.cust-map { width: 100%; height: 100%; }
.map-toolbar { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.map-filters { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.map-filter-btn { background: white; border: none; padding: 7px 14px; font-size: 0.85rem; font-weight: 600; color: var(--text-light); cursor: pointer; border-right: 1px solid var(--border); }
.map-filter-btn:last-child { border-right: none; }
.map-filter-btn.active { background: var(--primary); color: #fff; }
.map-legend { display: flex; gap: 0.9rem; font-size: 0.82rem; color: var(--text-light); align-items: center; }
.map-legend .dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.map-legend .dot-scheduled { background: #0d9488; }
.map-legend .dot-callin { background: #f59e0b; }
.map-unset { color: #b45309; font-weight: 600; }
#prrd-toggle.active { background: var(--primary); color: #fff; }
.lucas-pin { background: transparent; border: 0; }
.map-popup .mp-name { font-weight: 700; font-size: 0.95rem; }
.map-popup .mp-addr { color: #475569; font-size: 0.82rem; margin-top: 2px; }
.map-popup .mp-meta { color: #64748b; font-size: 0.78rem; margin-top: 3px; }
.map-popup .mp-actions { display: flex; gap: 0.8rem; margin-top: 7px; }
.map-popup .mp-actions a { color: var(--primary); font-weight: 600; font-size: 0.82rem; text-decoration: none; }

/* Splash (prevents the login-screen flash on load/back-navigation) */
.splash { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; background: linear-gradient(180deg, #0d9488, #0b7c72); color: #fff; }
.splash-cookie { font-size: 64px; animation: splashpulse 1.2s ease-in-out infinite; }
.splash-name { font-weight: 700; opacity: .92; letter-spacing: .01em; }
@keyframes splashpulse { 0%,100% { transform: scale(1); opacity: .85; } 50% { transform: scale(1.08); opacity: 1; } }

/* Dispatch pin-health badge + sort-by-nearest */
.disp-pin { margin-top: 6px; font-size: 0.7rem; font-weight: 700; border-radius: 5px; padding: 2px 6px; display: inline-block; }
.disp-pin.warn { color: #b91c1c; background: #fee2e2; }
.disp-pin.approx { color: #92400e; background: #fef3c7; }
.disp-sort { background: rgba(255,255,255,0.16); border: 1px solid rgba(255,255,255,0.25); color: #fff; border-radius: 6px; font-size: 0.7rem; font-weight: 600; padding: 3px 8px; cursor: pointer; }
.disp-sort:hover { background: rgba(255,255,255,0.3); }
.map-popup .mp-approx { color: #b45309; font-size: 0.76rem; font-weight: 600; margin-top: 3px; }
.map-filter-btn[data-mapfilter="verify"].active { background: #dc2626; }

/* Holidays — inline add + condensed chips */
.holiday-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.holiday-add input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; font-family: inherit; }
.holiday-add input[type="text"] { flex: 1; min-width: 180px; }
.holiday-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.holiday-chip { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--border); border-radius: 999px; padding: 5px 6px 5px 13px; font-size: 0.85rem; }
.holiday-chip b { color: var(--primary); font-weight: 700; }
.holiday-x { background: #f1f5f9; border: none; border-radius: 50%; width: 20px; height: 20px; cursor: pointer; color: #64748b; font-size: 0.68rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.holiday-x:hover { background: #fee2e2; color: #b91c1c; }
.holiday-empty { color: #94a3b8; font-size: 0.85rem; }

/* User accounts */
.user-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.user-add input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 6px; font-size: 0.9rem; font-family: inherit; flex: 1; min-width: 140px; }
.users-list { display: flex; flex-direction: column; gap: 8px; }
.user-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; background: #fff; }
.user-info { display: flex; flex-direction: column; }
.user-name { font-weight: 600; }
.user-username { color: var(--text-light); font-size: 0.82rem; }
.user-actions { display: flex; gap: 7px; }
.btn-tiny { padding: 5px 10px; font-size: 0.78rem; }
.user-del { background: transparent; color: #b91c1c; border: 1px solid #fecaca; }
.user-del:hover { background: #fee2e2; }
.disp-col-body { padding: 0.6rem; overflow-y: auto; flex: 1; min-height: 80px; }
.disp-empty { color: #b0b8bf; font-size: 0.85rem; text-align: center; padding: 1.5rem 0.5rem; border: 2px dashed var(--border); border-radius: 8px; }
.disp-no-drivers { flex: 1; color: var(--text-light); padding: 1.5rem; }
.disp-no-drivers a { color: var(--primary); }
.disp-card { background: white; border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 8px; padding: 0.6rem 0.7rem; margin-bottom: 0.6rem; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.disp-card:active { cursor: grabbing; }
.disp-card.dragging { opacity: 0.5; }
.disp-card[data-status="Done"] { border-left-color: var(--success); background: #f6fdf8; }
.disp-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; }
.disp-name { font-weight: 600; font-size: 0.95rem; }
.truck-badge { font-size: 0.65rem; font-weight: 700; padding: 2px 7px; border-radius: 999px; white-space: nowrap; text-transform: uppercase; }
.truck-badge.single { background: var(--primary-light); color: var(--primary-dark); }
.truck-badge.tandem { background: #fee2e2; color: #b91c1c; }
.disp-addr { font-size: 0.8rem; color: var(--text-light); margin-top: 0.25rem; }
.disp-station { font-size: 0.8rem; font-weight: 600; color: var(--text); margin-top: 0.25rem; }
.disp-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 0.4rem; font-size: 0.8rem; color: var(--text-light); }
.disp-flags { display: inline-flex; gap: 3px; }

/* Friendly dispatch date label (Today · Mon Jun 2) */
.dispatch-date-label { font-weight: 700; color: var(--text); margin: 0 0.4rem 0 0.2rem; white-space: nowrap; }

/* Fill-station down-for-maintenance banner on the dispatch board */
#dispatch-maint-banner:not(:empty) { margin: 0 0 0.75rem; }
.maint-banner { background: #fef2f2; border: 1px solid #fca5a5; color: #991b1b; border-radius: 8px; padding: 0.6rem 0.85rem; font-size: 0.9rem; font-weight: 600; margin-bottom: 0.5rem; }
.maint-banner b { color: #7f1d1d; }

/* Small hint under a form field */
.field-hint { display: block; color: var(--text-light); font-size: 0.75rem; margin-top: 0.25rem; }

/* LucasFlow — Call-in modal */
.callin-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.callin-tab { flex: 1; padding: 0.6rem; border: 1px solid var(--border); background: white; border-radius: 6px; cursor: pointer; font-weight: 600; color: var(--text-light); }
.callin-tab.active { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.callin-results { border: 1px solid var(--border); border-radius: 6px; margin-top: 0.4rem; max-height: 220px; overflow-y: auto; }
.callin-results:empty { display: none; }
.callin-result { padding: 0.6rem 0.75rem; cursor: pointer; border-bottom: 1px solid var(--border); }
.callin-result:last-child { border-bottom: none; }
.callin-result:hover { background: var(--primary-light); }
.callin-result-sub { color: var(--text-light); font-size: 0.85rem; }
.callin-result-empty { padding: 0.6rem 0.75rem; color: var(--text-light); }
.callin-selected { background: var(--primary-light); border-radius: 6px; padding: 0.75rem; margin-top: 0.5rem; font-size: 0.9rem; }
.callin-areahint { margin-top: 0.75rem; }
.areahint-title { font-size: 0.85rem; color: var(--text); margin-bottom: 0.4rem; }
.areahint-none { font-size: 0.85rem; color: var(--text-light); }
.areahint-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.areahint-chip { background: white; border: 1px solid var(--primary); color: var(--primary-dark); border-radius: 999px; padding: 4px 10px; font-size: 0.8rem; cursor: pointer; }
.areahint-chip:hover { background: var(--primary-light); }
