/* styles.css */
:root {
  --primary-color: #1976d2;
  --secondary-color: #f8f8f8;
  --text-color: #333;
  --border-color: #ddd;
  --header-height: 56px;
  --nav-height: 56px;
}

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

body {
  font-family: "Roboto", sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f4f6f8;
  color: #333;
  overscroll-behavior-x: none; /* Prevent horizontal swipe navigation */
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 100vw;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--secondary-color);
  position: relative;
  overflow: hidden;
}

.main-header {
  height: var(--header-height);
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.header-center {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: bold;
}

.header-icon {
  width: 28px;
  height: 28px;
  stroke: white;
}

.header-left,
.header-right {
  min-width: 60px;
  text-align: center;
  font-family: monospace;
  font-size: 1rem;
}

main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  position: relative;
  min-height: 0;
  margin-top: var(--header-height);
  margin-bottom: var(--nav-height);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.tab-panel {
  display: none;
  height: 100%;
  width: 100%;
  position: relative;
  overflow-y: auto;
  background: transparent;
  padding-bottom: 1rem;
}

.tab-panel.active {
  display: block;
}

/* Add specific styles for map tab */
#tab-map.tab-panel {
  overflow: hidden; /* Prevent scrolling on map tab */
  padding-bottom: 0; /* Remove padding for map tab */
}

.delivery-card {
  margin: 2rem 1rem 0 1rem;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  padding: 2rem 1.5rem 1.5rem 1.5rem;
  text-align: center;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin-bottom: 70px;
}

.delivery-card .delivery-info {
  font-size: 1.1rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
}

.delivery-card .no-delivery {
  font-size: 1.1rem;
  color: #888;
  font-weight: 500;
}

.delivery-card .action-btn,
.delivery-actions .action-btn {
  width: 100%;
  padding: 1.05rem 0;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #1856b3 60%, #2196f3 100%);
  color: #fff;
  font-size: 1.13rem;
  font-weight: 700;
  margin-top: 0.5rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(25, 86, 179, 0.1), 0 1.5px 4px rgba(0, 0, 0, 0.07);
  letter-spacing: 0.01em;
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
  outline: none;
}
.delivery-card .action-btn:hover,
.delivery-actions .action-btn:hover {
  background: linear-gradient(90deg, #1560a8 60%, #1976d2 100%);
  box-shadow: 0 4px 16px rgba(25, 86, 179, 0.13);
  transform: translateY(-1px) scale(1.01);
}
.delivery-card .action-btn:active,
.delivery-actions .action-btn:active {
  background: linear-gradient(90deg, #144a8a 60%, #1856b3 100%);
  box-shadow: 0 2px 8px rgba(25, 86, 179, 0.12);
  transform: scale(0.98);
}
.delivery-card .action-btn:disabled,
.delivery-actions .action-btn:disabled {
  background: #e0e0e0;
  color: #b0b0b0;
  cursor: not-allowed;
  box-shadow: none;
}
.delivery-actions .cancel-btn {
  width: 75% !important;
  padding: 1.05rem 0;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #d32f2f 60%, #ff5252 100%);
  color: #fff;
  font-size: 1.13rem;
  font-weight: 700;
  margin-top: 1.5rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(211, 47, 47, 0.1), 0 1.5px 4px rgba(0, 0, 0, 0.07);
  letter-spacing: 0.01em;
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
  outline: none;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  min-height: 44px !important;
}
.delivery-actions .cancel-btn:hover {
  background: linear-gradient(90deg, #b71c1c 60%, #d32f2f 100%);
  box-shadow: 0 4px 16px rgba(211, 47, 47, 0.13);
  transform: translateY(-1px) scale(1.01);
}
.delivery-actions .cancel-btn:active {
  background: linear-gradient(90deg, #a31515 60%, #b71c1c 100%);
  box-shadow: 0 2px 8px rgba(211, 47, 47, 0.12);
  transform: scale(0.98);
}
.delivery-actions .cancel-btn:disabled {
  background: #e0e0e0;
  color: #b0b0b0;
  cursor: not-allowed;
  box-shadow: none;
}

.delivery-card .timer {
  font-family: monospace;
  font-size: 1.1rem;
  color: var(--primary-color);
  margin-top: 0.5rem;
}

.map-container {
  width: 100vw;
  height: calc(100vh - var(--header-height) - var(--nav-height));
  min-height: 300px;
  border-radius: 0;
  overflow: hidden;
  box-shadow: none;
  margin: 0;
  position: relative; /* Ensure proper positioning */
}

#map {
  height: 100%;
  width: 100vw;
  min-height: 300px;
  touch-action: pan-x pan-y; /* Enable natural touch movement */
}

.delivery-log {
  background: #f4f7fb;
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(25, 118, 210, 0.13),
    0 1.5px 4px rgba(0, 0, 0, 0.08);
  padding: 2rem 1.5rem 1.5rem 1.5rem;
  margin: 2rem 1rem 0 1rem;
  margin-bottom: 2.1rem;
}

.log-entry {
  background: #f4f7fb;
  border-radius: 14px;
  box-shadow: 0 4px 18px rgba(25, 118, 210, 0.13),
    0 1.5px 4px rgba(0, 0, 0, 0.08);
  padding: 1.2rem 1rem 1.1rem 1rem;
  margin-bottom: 2.1rem;
  position: relative;
  transition: box-shadow 0.18s, background 0.18s;
}
.log-entry:hover {
  box-shadow: 0 8px 28px rgba(25, 118, 210, 0.18), 0 2px 8px rgba(0, 0, 0, 0.1);
  background: #e9f1fa;
}

.log-entry:last-child {
  border-bottom: none;
}

.bottom-nav {
  height: var(--nav-height);
  background: #fff;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: space-around;
  align-items: center;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
}

.nav-btn {
  flex: 1 1 0;
  background: none;
  border: none;
  outline: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  color: #888;
  font-size: 0.85rem;
  padding: 0.3rem 0 0.1rem 0;
  cursor: pointer;
  transition: color 0.2s;
}

.nav-btn.active {
  color: var(--primary-color);
  font-weight: bold;
}

.nav-icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
}

@media (min-width: 768px) {
  /* Remove desktop-specific styles */
}

.options-section {
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 10px;
  margin: 1rem 0;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.settings-title {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: #1976d2;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  width: 100%;
}

.toggle-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0.5rem 0;
  cursor: pointer;
  transition: background-color 0.2s;
  border-radius: 6px;
}

.toggle-label:hover {
  background-color: rgba(25, 118, 210, 0.05);
}

.toggle-label .setting-label {
  font-size: 1rem;
  color: #333;
  margin-left: 0.5rem;
  flex: 1;
}

.switch {
  position: relative;
  display: inline-block;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 22px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

input:checked + .slider {
  background-color: #1976d2;
}

input:checked + .slider:before {
  transform: translateX(16px);
}

.app-version {
  font-size: 0.9rem;
  color: #666;
  margin-top: 1rem;
  text-align: center;
}

.settings-divider {
  margin: 1rem 0;
  border: none;
  border-top: 1px solid #e0e0e0;
}

.dev-settings-group {
  margin-top: 0.5rem;
}

.location-status {
  font-size: 0.95rem;
  margin: 0.8rem 0;
  padding: 0.6rem;
  border-radius: 8px;
  background: #f0f0f0;
  color: #444;
}

.options-section:focus-within,
.options-section:hover {
  box-shadow: 0 6px 24px rgba(25, 118, 210, 0.13);
}
.options-section h3 {
  font-size: 1.1rem;
  margin-bottom: 0.7rem;
}
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-size: 1rem;
  cursor: pointer;
  margin-bottom: 0.5rem;
}
.toggle-label:hover,
.toggle-label:focus-within {
  /* Remove hover feedback for mobile */
  background: none;
  box-shadow: none;
  transform: none;
}

.slip-section {
  margin: 1.5rem 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
}
#slipPreview img {
  max-width: 220px;
  max-height: 180px;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  margin-top: 0.3rem;
}
.ocr-result {
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  font-size: 0.875rem;
  color: #6c757d;
  white-space: pre-wrap;
  max-height: 100px;
  overflow-y: auto;
  position: relative;
}

.ocr-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: 2px dashed #1976d2;
  background: #e3f2fd;
}

.ocr-loading::after {
  content: "";
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid #1976d2;
  border-top-color: transparent;
  border-radius: 50%;
  animation: ocr-spin 0.8s linear infinite;
  background: #fff;
  margin-left: 0.5rem;
}

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

.ocr-success {
  color: #28a745;
  background: #f1f8e9;
  border-color: #d4edda;
}

.ocr-error {
  color: #dc3545;
  background: #f8d7da;
  color: #33691e;
  font-size: 0.98rem;
  padding: 0.7rem 1rem;
  border-radius: 8px;
  margin-top: 0.5rem;
  width: 100%;
  max-width: 320px;
  word-break: break-word;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
  display: none;
}

.address-section {
  margin: 1.2rem 1rem 0 1rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: stretch;
}
.address-section label {
  font-size: 1rem;
  font-weight: 500;
}
.address-section input {
  padding: 0.7rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
}
.delivery-actions {
  position: static;
  left: auto;
  right: auto;
  bottom: auto;
  z-index: auto;
  background: none;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 70px;
}
.delivery-actions .action-btn {
  width: calc(100vw - 2rem);
  max-width: 480px;
  margin: 0 auto;
  pointer-events: auto;
}
@media (min-width: 768px) {
  .delivery-actions .action-btn {
    width: 400px;
  }
}

.clear-log-btn {
  margin-top: 1rem;
  background: linear-gradient(90deg, #e53935 60%, #ff5252 100%);
  color: #fff;
  font-weight: bold;
  border: none;
  border-radius: 32px;
  padding: 0.9rem 1.5rem;
  font-size: 1rem;
  box-shadow: 0 2px 8px rgba(229, 57, 53, 0.1);
  cursor: pointer;
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
  border-bottom: 3px solid #b71c1c;
}
.clear-log-btn:active {
  background: linear-gradient(90deg, #b71c1c 60%, #e53935 100%);
  box-shadow: 0 1px 4px rgba(229, 57, 53, 0.12);
  transform: scale(0.98);
}
.dev-hide {
  display: none !important;
}

.hustle-avg {
  margin-top: 1.5rem;
  padding: 1rem;
  background: #f8f8f8;
  border-radius: 10px;
  position: relative;
}
.clear-log-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.dev-options-section {
  margin: 1.2rem 1rem 1rem 1rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  align-items: stretch;
  border: 1px dashed #b0b0b0;
  margin-bottom: 70px;
}

.confirm-btn {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.6rem 1.2rem;
  background: #fff;
  color: #1976d2;
  border: 2px solid #1976d2;
  border-radius: 24px;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 1px 4px rgba(25, 118, 210, 0.06);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border 0.15s;
}
.confirm-btn:hover,
.confirm-btn:focus {
  background: #e3f2fd;
  color: #0d47a1;
  border-color: #0d47a1;
}
.confirm-btn:active {
  background: #bbdefb;
  color: #0d47a1;
  border-color: #1565c0;
}
.confirm-btn:disabled {
  background: #f5f5f5;
  color: #b0b0b0;
  border-color: #b0b0b0;
  cursor: not-allowed;
}

.slip-preview {
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 1rem;
  overflow: hidden;
}

.slip-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.slip-preview-header h3 {
  margin: 0;
  font-size: 1rem;
  color: #495057;
}

.clear-slip-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #6c757d;
  cursor: pointer;
  padding: 0 0.5rem;
  line-height: 1;
}

.clear-slip-btn:hover {
  color: #dc3545;
}

.slip-preview-content {
  padding: 1rem;
  text-align: center;
}

.slip-preview-content img {
  max-width: 100%;
  max-height: 200px;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.ocr-result {
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  font-size: 0.875rem;
  color: #6c757d;
  white-space: pre-wrap;
  max-height: 100px;
  overflow-y: auto;
}

.eta-spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2.5px solid #1976d2;
  border-top: 2.5px solid transparent;
  border-radius: 50%;
  animation: eta-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-left: 0.3em;
}
@keyframes eta-spin {
  to {
    transform: rotate(360deg);
  }
}

.action-btn.dev {
  background: linear-gradient(90deg, #43a047 60%, #66bb6a 100%) !important;
  border-bottom: 3px solid #2e7031 !important;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(67, 160, 71, 0.12);
  margin-top: 0.5rem;
  border-radius: 32px;
  padding: 1.1rem;
  width: 100%;
  font-size: 1.08rem;
}
.action-btn.dev:active {
  background: linear-gradient(90deg, #2e7031 60%, #43a047 100%) !important;
}
.action-btn.danger {
  background: linear-gradient(90deg, #e53935 60%, #ff5252 100%) !important;
  border-bottom: 3px solid #b71c1c !important;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(229, 57, 53, 0.12);
  margin-top: 0.5rem;
  border-radius: 32px;
  padding: 1.1rem;
  width: 100%;
  font-size: 1.08rem;
}
.action-btn.danger:active {
  background: linear-gradient(90deg, #b71c1c 60%, #e53935 100%) !important;
}

.delivery-type-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.delivery-type-modal-content {
  background: #fff;
  padding: 2rem 1.5rem 1.5rem 1.5rem;
  border-radius: 12px;
  text-align: center;
  max-width: 90vw;
  width: 320px;
  position: relative;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.18);
  animation: modal-pop 0.18s cubic-bezier(0.4, 1.6, 0.6, 1) 1;
}
@keyframes modal-pop {
  0% {
    transform: scale(0.92);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
.modal-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.7rem;
  background: none;
  border: none;
  font-size: 1.7rem;
  color: #888;
  cursor: pointer;
  z-index: 10;
  transition: color 0.15s;
}
.modal-close-btn:hover {
  color: #e53935;
}

.map-delivery-info-box {
  position: absolute;
  top: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  min-width: 380px;
  max-width: 99vw;
  background: #23272b;
  color: #fff;
  border-radius: 18px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.22);
  padding: 1.4rem 2.1rem 1.3rem 2.1rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 1.13rem;
  font-weight: 500;
  gap: 0.7rem;
  opacity: 0.98;
}
.map-delivery-info-box .address-row {
  display: flex;
  align-items: center;
  gap: 0.5em;
  flex-wrap: nowrap;
  width: 100%;
  overflow: hidden;
}
.map-delivery-info-box .address-label {
  white-space: nowrap;
  flex-shrink: 0;
}
.map-delivery-info-box .address-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1 1 0;
  min-width: 0;
}
.map-delivery-info-box .new-badge {
  background: #43a047;
  color: #fff;
  font-size: 0.92rem;
  font-weight: bold;
  border-radius: 6px;
  padding: 0.18em 0.7em;
  margin-right: 0.5em;
  letter-spacing: 0.03em;
}
.map-delivery-info-box .map-eta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 1.5rem;
  margin-top: 0.5rem;
  font-size: 1.08rem;
  width: 100%;
}
.map-delivery-info-box .eta-label {
  color: #b0bec5;
  font-size: 0.98em;
  margin-right: 0.2em;
}
.map-delivery-info-box .eta-value {
  color: #fff;
  font-weight: 600;
  margin-right: 1.2em;
  font-size: 1.08em;
}

.toggle-row {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}
.toggle-btn {
  background: none;
  border: none;
  color: #1976d2;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.2rem 0.9rem;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
  outline: none;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  opacity: 0.7;
}
.toggle-btn.active {
  background: #e3f2fd;
  color: #0d47a1;
  opacity: 1;
}
.toggle-btn .arrow {
  font-size: 1.1em;
  margin-left: 0.2em;
}

/* --- Delivery Stats Section --- */
.delivery-stats-section {
  background: #f8f9fa;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.07);
  padding: 1.2rem 1.2rem 1.1rem 1.2rem;
  margin: 1.2rem 0 1.2rem 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.1rem 1.5rem;
  align-items: center;
  justify-items: center;
}
.delivery-timer-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  margin-bottom: 0.2rem;
}
.timer-label {
  color: #1976d2;
  font-weight: 600;
  font-size: 1.08rem;
  letter-spacing: 0.01em;
}
.timer-value {
  font-family: monospace;
  font-size: 1.25rem;
  font-weight: bold;
  color: #1976d2;
  background: #fff;
  border-radius: 8px;
  padding: 0.18em 0.7em;
  box-shadow: 0 1px 4px rgba(25, 118, 210, 0.07);
  border: 1px solid #e3eaf3;
}
.stats-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(25, 118, 210, 0.06);
  padding: 0.5rem 0.7rem;
  min-width: 120px;
}
.stats-label {
  color: #888;
  font-size: 0.98rem;
  font-weight: 500;
  margin-bottom: 0.1em;
}
.stats-value {
  color: #1976d2;
  font-size: 1.13rem;
  font-weight: bold;
  letter-spacing: 0.01em;
}

/* --- Cancel Button Timer --- */
.cancel-section {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cancel-btn .countdown-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  background: #fff;
  color: #e53935;
  font-weight: bold;
  font-size: 1.1em;
  margin-left: 0.7em;
  box-shadow: 0 1px 4px rgba(229, 57, 53, 0.1);
  border: 2px solid #ffcdd2;
  transition: background 0.18s, color 0.18s;
}
.cancel-btn:disabled .countdown-circle {
  background: #f5f5f5;
  color: #aaa;
  border-color: #eee;
}

/* --- Map Info Box --- */
@media (max-width: 480px) {
  .map-delivery-info-box {
    min-width: 95vw;
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }
}

@media (max-width: 600px) {
  .container {
    max-width: 100vw;
    min-height: 100vh;
    height: 100vh;
    overflow: hidden;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
  }

  main {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    position: relative;
    min-height: 0;
    margin-top: var(--header-height);
    margin-bottom: var(--nav-height);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    height: calc(100vh - var(--header-height) - var(--nav-height));
  }

  .tab-panel {
    height: 100%;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .main-header {
    height: 52px;
  }
  .bottom-nav {
    height: 54px;
  }
  .delivery-card {
    margin: 1.1rem 0.3rem 0 0.3rem;
    padding: 1.2rem 0.7rem 1rem 0.7rem;
    border-radius: 12px;
    min-height: 120px;
    margin-bottom: 70px;
  }
  .delivery-card .action-btn,
  .delivery-actions .action-btn {
    width: 100%;
    padding: 1.05rem 0;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, #1856b3 60%, #2196f3 100%);
    color: #fff;
    font-size: 1.13rem;
    font-weight: 700;
    margin-top: 0.5rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(25, 86, 179, 0.1),
      0 1.5px 4px rgba(0, 0, 0, 0.07);
    letter-spacing: 0.01em;
    transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
    outline: none;
  }
  .delivery-card .action-btn:hover,
  .delivery-actions .action-btn:hover {
    background: linear-gradient(90deg, #1560a8 60%, #1976d2 100%);
    box-shadow: 0 4px 16px rgba(25, 86, 179, 0.13);
    transform: translateY(-1px) scale(1.01);
  }
  .delivery-card .action-btn:active,
  .delivery-actions .action-btn:active {
    background: linear-gradient(90deg, #144a8a 60%, #1856b3 100%);
    box-shadow: 0 2px 8px rgba(25, 86, 179, 0.12);
    transform: scale(0.98);
  }
  .delivery-card .action-btn:disabled,
  .delivery-actions .action-btn:disabled {
    background: #e0e0e0;
    color: #b0b0b0;
    cursor: not-allowed;
    box-shadow: none;
  }
  .delivery-actions .cancel-btn {
    width: 75% !important;
    padding: 1.05rem 0;
    border: none;
    border-radius: 8px;
    background: linear-gradient(90deg, #d32f2f 60%, #ff5252 100%);
    color: #fff;
    font-size: 1.13rem;
    font-weight: 700;
    margin-top: 1.5rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.1),
      0 1.5px 4px rgba(0, 0, 0, 0.07);
    letter-spacing: 0.01em;
    transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
    outline: none;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: 44px !important;
  }
  .delivery-actions .cancel-btn:hover {
    background: linear-gradient(90deg, #b71c1c 60%, #d32f2f 100%);
    box-shadow: 0 4px 16px rgba(211, 47, 47, 0.13);
    transform: translateY(-1px) scale(1.01);
  }
  .delivery-actions .cancel-btn:active {
    background: linear-gradient(90deg, #a31515 60%, #b71c1c 100%);
    box-shadow: 0 2px 8px rgba(211, 47, 47, 0.12);
    transform: scale(0.98);
  }
  .delivery-actions .cancel-btn:disabled {
    background: #e0e0e0;
    color: #b0b0b0;
    cursor: not-allowed;
    box-shadow: none;
  }
  .address-section {
    margin: 0.7rem 0.3rem 0 0.3rem;
    padding: 0.7rem;
    border-radius: 8px;
  }
  .options-section {
    margin: 1.1rem 0.3rem 1rem 0.3rem;
    padding: 0.8rem 0.5rem 0.8rem 0.5rem;
    border-radius: 10px;
    margin-bottom: 70px;
  }
  .dev-options-section {
    margin: 1.1rem 0.3rem 1rem 0.3rem;
    padding: 0.8rem 0.5rem 0.8rem 0.5rem;
    border-radius: 10px;
    margin-bottom: 70px;
  }
  .delivery-log {
    margin: 1.1rem 0.3rem 0 0.3rem;
    padding: 1rem 0.5rem;
    border-radius: 10px;
  }
  .month-group-block {
    margin-bottom: 1.2rem;
    padding-bottom: 0.2rem;
    border-radius: 10px;
  }
  .section-header {
    font-size: 1.08rem;
    padding: 0.5rem 0.7rem;
    border-radius: 8px;
  }
  .averages-section {
    padding: 0.7rem 0.5rem 1rem 0.5rem;
    border-radius: 10px;
    margin-bottom: 1rem;
  }
  .weekly-totals {
    padding: 0.7rem;
    border-radius: 8px;
    margin-top: 1.1rem;
  }
  .collapsible-log-header,
  .month-group-header {
    padding: 0.7rem 0.7rem;
    font-size: 1rem;
    border-radius: 8px;
  }
  .day-header {
    padding: 0.6rem 0.7rem;
    font-size: 0.98rem;
    border-radius: 7px;
  }
  .log-entry {
    padding: 0.4rem 0;
    font-size: 0.97rem;
    border-radius: 7px;
  }
  .pro-delivery-log {
    padding: 0.7rem 0.7rem 0.5rem 0.7rem;
    border-radius: 8px;
    max-width: 100vw;
  }
  .slip-preview {
    margin: 0.5rem;
    border-radius: 7px;
  }
  .slip-preview-content img {
    max-width: 98vw;
    max-height: 120px;
    border-radius: 4px;
  }
  .ocr-result {
    padding: 0.5rem 0.7rem;
    font-size: 0.85rem;
    max-width: 98vw;
  }
  .bottom-nav {
    height: 54px;
    border-radius: 0;
    font-size: 0.97rem;
    box-shadow: 0 -2px 8px rgba(25, 118, 210, 0.07);
  }
  .nav-btn {
    font-size: 0.93rem;
    padding: 0.2rem 0 0.1rem 0;
    min-width: 0;
  }
  .map-container,
  #map {
    min-height: 220px;
    height: calc(100vh - 52px - 54px);
    border-radius: 0;
    margin: 0;
    width: 100vw;
    max-width: 100vw;
    overflow: hidden;
  }
  .map-delivery-info-box {
    min-width: 95vw;
    max-width: 99vw;
    padding: 0.7rem 0.5rem;
    font-size: 1.01rem;
    border-radius: 10px;
    left: 50%;
    transform: translateX(-50%);
  }
  .dev-controls,
  .backup-restore-card {
    padding: 0.5rem 0.3rem 0.5rem 0.3rem !important;
    border-radius: 7px !important;
  }
  .dev-btn {
    font-size: 0.97rem !important;
    padding: 0.5rem 0.7rem !important;
    border-radius: 8px !important;
  }
  .toggle-label {
    font-size: 0.97rem;
    gap: 0.4rem;
    padding: 0.2rem 0;
  }
  .switch {
    width: 36px;
    height: 20px;
  }
  .slider:before {
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
  }
  input:checked + .slider:before {
    transform: translateX(16px);
  }
  .app-version {
    font-size: 0.85rem;
    color: #666;
    margin-top: 0.8rem;
    text-align: center;
  }
  html,
  body {
    max-width: 100vw;
    overflow-x: hidden;
    font-size: 16px;
  }
  .map-delivery-info-box .address-text {
    font-size: 0.97rem;
  }
}

/* Collapsible Delivery Log Styles */
.delivery-log-collapsible {
  margin: 1.5rem 1rem 0 1rem;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
  background: #fff;
}
.collapsible-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1rem 1.2rem;
  cursor: pointer;
  border-radius: 12px 12px 0 0;
  background: #f8f9fa;
  font-weight: 600;
  font-size: 1.1rem;
  user-select: none;
  transition: background 0.18s;
}
.collapsible-header:hover {
  background: #e3eaf6;
}
.collapsible-logo {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(25, 118, 210, 0.08);
}
.collapsible-arrow {
  margin-left: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.collapsible-header.expanded .collapsible-arrow {
  transform: rotate(180deg);
}
.collapsible-content {
  padding: 0 1.2rem 1.2rem 1.2rem;
  background: #fff;
  border-radius: 0 0 12px 12px;
  box-shadow: none;
}

/* Averages Section Modern Look */
.averages-section {
  background: #f8f9fa;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(25, 118, 210, 0.08);
  border: 1.5px solid #e3eaf6;
  margin-bottom: 1.5rem;
  padding: 0.9em 1.1em 0.7em 1.1em;
}
.averages-section h3 {
  font-size: 1.07em;
  font-weight: 700;
  color: #1976d2;
  margin-bottom: 0.5em;
  display: flex;
  align-items: center;
  gap: 0.5em;
  letter-spacing: 0.01em;
}
.averages-section .avg-row,
.averages-section .stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.7em 1.1em;
  margin-top: 0.5em;
}
.averages-section .avg-col,
.averages-section .stats-item {
  background: #fff;
  padding: 0.7em 0.9em;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e3eaf6;
  text-align: center;
}
.averages-section .avg-label,
.averages-section .stats-label {
  color: #666;
  font-size: 0.9em;
  font-weight: 600;
  margin-bottom: 0.2em;
  display: block;
}
.averages-section .avg-value,
.averages-section .stats-value {
  color: #1976d2;
  font-weight: 700;
  font-size: 1.13em;
  display: block;
  margin-top: 0.2em;
}

.mini-delivery-log {
  background: #f8f9fa;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(25, 118, 210, 0.07);
  padding: 0.7rem 1rem 0.7rem 1rem;
  margin: 0.7rem 0 0.2rem 0;
  font-size: 1.01rem;
  color: #1976d2;
  text-align: left;
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.mini-log-title {
  font-size: 0.98rem;
  font-weight: 600;
  color: #1976d2;
  margin-bottom: 0.2rem;
  letter-spacing: 0.01em;
}

.mini-delivery-log-collapsible {
  background: #f8f9fa;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(25, 118, 210, 0.07);
  padding: 0.2rem 0.7rem 0.2rem 0.7rem;
  margin: 0.7rem 0 0.2rem 0;
  width: 100%;
  max-width: 340px;
}
.mini-log-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.01rem;
  font-weight: 600;
  color: #1976d2;
  cursor: pointer;
  user-select: none;
  padding: 0.5rem 0.2rem;
  border-radius: 6px;
  transition: background 0.15s;
}
.mini-log-toggle:hover {
  background: #e3eaf6;
}
.mini-log-arrow {
  margin-left: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.mini-log-toggle.expanded .mini-log-arrow {
  transform: rotate(180deg);
}
.mini-log-content {
  font-size: 0.98rem;
  color: #1976d2;
  padding: 0.2rem 0.2rem 0.5rem 0.2rem;
  text-align: left;
  transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.pro-delivery-log {
  background: #f8f9fa;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(25, 118, 210, 0.08);
  padding: 0.9rem 1.1rem 0.7rem 1.1rem;
  margin: 1.1rem 0 0.2rem 0;
  width: 100%;
  max-width: 350px;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.pro-log-title {
  font-size: 1.01rem;
  font-weight: 700;
  color: #1976d2;
  margin-bottom: 0.4rem;
  letter-spacing: 0.01em;
  text-align: left;
}
.pro-log-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.99rem;
  color: #1976d2;
  padding: 0.18rem 0;
  border-bottom: 1px solid #e3eaf6;
}
.pro-log-row:last-child {
  border-bottom: none;
}
.pro-log-icon {
  font-size: 1.13em;
  margin-right: 0.2em;
  opacity: 0.85;
}
.pro-log-label {
  flex: 1 1 0;
  font-weight: 500;
  color: #1976d2;
  letter-spacing: 0.01em;
}
.pro-log-time {
  font-family: monospace;
  font-size: 1.01em;
  color: #222;
  font-weight: 600;
  background: #fff;
  border-radius: 6px;
  padding: 0.08em 0.7em;
  box-shadow: 0 1px 2px rgba(25, 118, 210, 0.04);
  border: 1px solid #e3eaf3;
}

.collapsible-log-header {
  display: flex;
  align-items: center;
  background: #f3f4f7;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(25, 118, 210, 0.08);
  border: 1.5px solid #e3eaf6;
  color: #1976d2;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.2rem;
  margin-top: 0;
  width: 100%;
  text-align: center;
  font-size: 1.08rem;
  display: block;
  transition: background 0.18s, box-shadow 0.18s;
}
.collapsible-log-header > * {
  white-space: nowrap;
  min-width: 0;
}
.collapsible-log-title {
  font-weight: 700;
  font-size: 1.08rem;
  color: #1976d2;
  margin-right: 0.7em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
  max-width: 40vw;
}

.month-group-block {
  margin-bottom: 2.5rem;
  padding-bottom: 0.5rem;
  border-radius: 12px;
  background: none;
}
.month-group-header {
  background: #e3eaf0;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(25, 118, 210, 0.08);
  border: 1.5px solid #e3eaf6;
  color: #1976d2;
  font-weight: 800;
  letter-spacing: 0.01em;
  padding: 1.1rem 1.3rem;
  margin-bottom: 1.1rem;
  margin-top: 0.7rem;
  width: 100%;
  text-align: center;
  font-size: 1.13rem;
  display: block;
}
.collapsible-log-header {
  background: #f3f4f7;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(25, 118, 210, 0.08);
  border: 1.5px solid #e3eaf6;
  color: #1976d2;
  font-weight: 700;
  letter-spacing: 0.01em;
  padding: 1.1rem 1.3rem;
  margin-bottom: 0.2rem;
  margin-top: 0;
  width: 100%;
  text-align: center;
  font-size: 1.08rem;
  display: block;
  transition: background 0.18s, box-shadow 0.18s;
}
.collapsible-log-header.expanded {
  background: #d1e3fa;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.1);
}
.day-header {
  background: #f8f9fa;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(25, 118, 210, 0.08);
  border: 1.5px solid #e3eaf6;
  color: #1976d2;
  font-weight: 600;
  letter-spacing: 0.01em;
  padding: 1rem 1.2rem;
  margin-bottom: 0.7rem;
  width: 100%;
  text-align: center;
  font-size: 1.07rem;
  display: block;
}

.log-day-ordinal {
  font-size: inherit;
  font-weight: 700;
  color: #1565c0;
  margin-left: 0.25em;
  letter-spacing: 0.01em;
}

.section-header {
  background: #f3f4f7;
  border-radius: 10px;
  box-shadow: 0 1px 6px rgba(25, 118, 210, 0.08);
  border: 1.5px solid #e3eaf6;
  color: #1976d2;
  font-weight: 800;
  letter-spacing: 0.01em;
  padding: 0.9rem 1.2rem;
  margin: 1.2rem 0 1.1rem 0;
  width: 100%;
  text-align: center;
  font-size: 1.25rem;
  display: block;
}

.delivery-stats-block {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 0.9em 1.1em 0.7em 1.1em;
  margin-bottom: 0.7em;
  margin-top: 0.2em;
  box-shadow: 0 1px 6px rgba(25, 118, 210, 0.08);
  border: 1.5px solid #e3eaf6;
}

.delivery-stats-title {
  font-size: 1.07em;
  font-weight: 700;
  color: #1976d2;
  margin-bottom: 0.5em;
  display: flex;
  align-items: center;
  gap: 0.5em;
  letter-spacing: 0.01em;
}

.stats-icon {
  font-size: 1.15em;
  margin-right: 0.2em;
}

.delivery-timer-row {
  background: #fff;
  padding: 0.7em 0.9em;
  border-radius: 8px;
  margin-bottom: 0.8em;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e3eaf6;
}

.timer-label {
  color: #666;
  font-weight: 600;
  font-size: 0.95em;
}

.timer-value {
  color: #1976d2;
  font-weight: 700;
  font-size: 1.1em;
}

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

.stats-item {
  background: #fff;
  padding: 0.7em 0.9em;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid #e3eaf6;
}

.stats-item .stats-label {
  color: #666;
  font-size: 0.9em;
  font-weight: 600;
  margin-bottom: 0.2em;
}

.stats-item .stats-value {
  color: #1976d2;
  font-weight: 700;
  font-size: 1.05em;
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

.double-delivery-time {
  grid-column: 1 / -1;
}

.editable-address {
  cursor: text;
  outline: none;
  border-bottom: 1px dashed transparent;
  transition: border-color 0.15s;
}
.editable-address.editing {
  border-bottom: 1px dashed #1976d2;
}
.edit-pencil {
  visibility: hidden;
  transition: visibility 0.15s;
}
.editable-address.editing + .edit-pencil {
  visibility: visible;
}

.small-cancel-btn {
  background: linear-gradient(90deg, #e53935 60%, #ff5252 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.97rem;
  font-weight: 700;
  padding: 0.35rem 1.1rem;
  box-shadow: 0 2px 8px rgba(229, 57, 53, 0.1);
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
  outline: none;
  display: block;
  margin: 0 auto 0.7rem auto;
}
.small-cancel-btn:hover {
  background: linear-gradient(90deg, #b71c1c 60%, #e53935 100%);
  box-shadow: 0 4px 16px rgba(229, 57, 53, 0.13);
  transform: translateY(-1px) scale(1.01);
}
.small-cancel-btn:active {
  background: linear-gradient(90deg, #a31515 60%, #b71c1c 100%);
  box-shadow: 0 2px 8px rgba(229, 57, 53, 0.12);
  transform: scale(0.98);
}
.small-cancel-btn:disabled {
  background: #e0e0e0;
  color: #b0b0b0;
  cursor: not-allowed;
  box-shadow: none;
}

.delivery-actions-bottom {
  position: static;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  padding: 0.5rem 0 0.2rem 0; /* reduce bottom padding */
  width: 100%;
  margin: 0 auto 0 auto; /* remove bottom margin */
  background: none;
}
.delivery-actions-bottom .action-btn {
  width: 90%;
  max-width: 320px;
  margin: 0 auto;
  pointer-events: auto;
  border-radius: 12px;
}
@media (max-width: 600px) {
  .delivery-actions-bottom {
    padding: 0.3rem 0 0.1rem 0; /* reduce bottom padding */
    margin-bottom: 0;
  }
  .delivery-actions-bottom .action-btn {
    font-size: 1.01rem;
    padding: 0.8rem;
    border-radius: 18px;
    max-width: 95vw;
  }
}

.action-box {
  background: #f8f9fa;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.1);
  padding: 1.1rem 1rem 1rem 1rem; /* reduce bottom padding */
  max-width: 420px;
  width: 100%;
  border-top: 2.5px solid #e3eaf6;
  border-bottom: none;
  z-index: 110;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  margin: 0 auto 0 auto; /* remove bottom margin */
}
.action-box-title {
  font-size: 1.13rem;
  font-weight: 800;
  color: #888;
  margin-bottom: 0.5rem;
  letter-spacing: 0.02em;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: relative;
}
.action-box-title::after {
  content: "";
  display: block;
  margin: 0.6em auto 0 auto;
  width: 60%;
  height: 2.5px;
  background: linear-gradient(90deg, #e3eaf6 0%, #cfd8dc 100%);
  border-radius: 2px;
  opacity: 0.8;
}
.action-box-btns {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
@media (max-width: 600px) {
  .action-box {
    max-width: 98vw;
    padding: 0.8rem 0.5rem 1.1rem 0.5rem;
    border-radius: 10px;
    margin: 0 auto;
  }
  .action-box-title {
    font-size: 1.04rem;
    margin-bottom: 0.4rem;
  }
  .action-box-title::after {
    margin: 0.5em auto 0 auto;
    width: 70%;
    height: 2px;
  }
  .action-box-btns {
    gap: 0.5rem;
  }
}

#confirmAddressBtn {
  width: 100%;
  padding: 1.05rem 0;
  border: none;
  border-radius: 8px;
  background: linear-gradient(90deg, #1856b3 60%, #2196f3 100%);
  color: #fff;
  font-size: 1.13rem;
  font-weight: 700;
  margin-top: 0.5rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(25, 86, 179, 0.1), 0 1.5px 4px rgba(0, 0, 0, 0.07);
  letter-spacing: 0.01em;
  transition: background 0.18s, box-shadow 0.18s, transform 0.12s;
  outline: none;
}
#confirmAddressBtn:hover {
  background: linear-gradient(90deg, #1560a8 60%, #1976d2 100%);
  box-shadow: 0 4px 16px rgba(25, 86, 179, 0.13);
  transform: translateY(-1px) scale(1.01);
}
#confirmAddressBtn:active {
  background: linear-gradient(90deg, #144a8a 60%, #1856b3 100%);
  box-shadow: 0 2px 8px rgba(25, 86, 179, 0.12);
  transform: scale(0.98);
}
#confirmAddressBtn:disabled {
  background: #e0e0e0;
  color: #b0b0b0;
  cursor: not-allowed;
  box-shadow: none;
}

.map-eta-row.single-line {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.35em;
  margin-top: 0.1rem;
  font-size: 0.93rem;
  width: 100%;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  padding: 0.1em 0.2em;
}
.map-eta-row .eta-label {
  color: #b0bec5;
  font-size: 0.91em;
  margin-right: 0.12em;
}
.map-eta-row .eta-value {
  color: #1976d2;
  font-weight: 700;
  margin-right: 0.4em;
  font-size: 0.97em;
}
@media (max-width: 600px) {
  .map-eta-row.single-line {
    font-size: 0.89rem;
    gap: 0.22em;
    padding: 0.05em 0.1em;
  }
  .map-eta-row .eta-label {
    font-size: 0.89em;
  }
  .map-eta-row .eta-value {
    font-size: 0.93em;
  }
}

.weekly-stats-section {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 1.5rem;
  margin: 1rem 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.stats-table-container {
  overflow-x: auto;
  margin-top: 1rem;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
  background: var(--bg-color);
  border-radius: 8px;
  overflow: hidden;
}

.stats-table th,
.stats-table td {
  padding: 0.75rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border-color);
}

.stats-table th {
  background: var(--primary-color);
  color: white;
  font-weight: 600;
  white-space: nowrap;
}

.stats-table th:first-child {
  text-align: left;
}

.stats-table td:first-child {
  text-align: left;
  font-weight: 500;
}

.stats-table tbody tr:hover {
  background: var(--hover-bg);
}

.table-icon {
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-bottom: 2px;
}

.table-label {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.9);
}

.stats-key {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1rem;
  padding: 0.75rem;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

.key-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.key-label {
  font-weight: 600;
  color: var(--primary-color);
}

.key-value {
  color: var(--text-secondary);
}

@media (max-width: 600px) {
  .weekly-stats-section {
    padding: 1rem;
    margin: 0.5rem 0;
  }

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

  .stats-table th,
  .stats-table td {
    padding: 0.6rem 0.8rem;
  }

  .table-icon {
    width: 18px;
    height: 18px;
  }

  .table-label {
    font-size: 0.8rem;
  }

  .stats-key {
    padding: 0.6rem;
    gap: 0.75rem;
  }

  .key-item {
    font-size: 0.85rem;
  }
}

.settings-divider {
  border: none;
  border-top: 1.5px solid #e3eaf6;
  margin: 1.2em 0 1.2em 0;
}
.dev-settings-group {
  margin-top: 0.5em;
  padding-top: 0.5em;
}

.mobile-settings {
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(25, 118, 210, 0.1);
  padding: 1.2rem 1.1rem 1.2rem 1.1rem;
  margin: 1.5rem 0.7rem 1.5rem 0.7rem;
  background: #fff;
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}
@media (max-width: 600px) {
  .mobile-settings {
    padding: 1.1rem 0.3rem 1.1rem 0.3rem;
    margin: 1.1rem 0.1rem 1.1rem 0.1rem;
    border-radius: 12px;
    width: 100%;
    max-width: none;
  }
}
.settings-title {
  font-size: 1.18rem;
  font-weight: 800;
  color: #1976d2;
  margin-bottom: 1.1rem;
  letter-spacing: 0.01em;
  text-align: center;
}
.settings-group {
  display: flex;
  flex-direction: column;
  gap: 0.6em;
  margin-bottom: 0.7em;
}
.setting-label {
  margin-left: 0.9em;
  font-size: 1.07em;
  color: #222;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.app-version {
  margin-top: 1.1rem;
  color: #b0b0b0;
  font-size: 0.98rem;
  text-align: right;
  letter-spacing: 0.01em;
}
.toggle-label {
  min-height: 48px;
  align-items: center;
  padding: 0.2em 0.7em 0.2em 0.2em;
  font-size: 1.07em;
  border-radius: 10px;
  transition: background 0.15s;
}
.toggle-label:active {
  background: #e3f2fd;
}
.settings-divider {
  border: none;
  border-top: 1.5px solid #e3eaf6;
  margin: 1.2em 0 1.2em 0;
}
.dev-settings-group {
  margin-top: 0.5em;
  padding-top: 0.5em;
  display: flex;
  flex-direction: column;
  gap: 0.6em;
}
@media (max-width: 600px) {
  .mobile-settings {
    padding: 1.1rem 0.3rem 1.1rem 0.3rem;
    margin: 1.1rem 0.1rem 1.1rem 0.1rem;
    border-radius: 12px;
    max-width: none;
  }
  .settings-title {
    font-size: 1.09rem;
    margin-bottom: 0.7rem;
  }
  .toggle-label {
    min-height: 44px;
    font-size: 1.01em;
    border-radius: 8px;
  }
}

.quick-deliveries-section {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.08);
  padding: 1em 0.5em 1em 0.5em;
  margin: 1em 0.2em 1em 0.2em;
  display: flex;
  flex-direction: column;
  gap: 1em;
  align-items: stretch;
}
.quick-deliveries-title {
  font-size: 1.13em;
  font-weight: 700;
  color: #1976d2;
  margin-bottom: 0.7em;
  text-align: center;
  letter-spacing: 0.01em;
}
.quick-delivery-group {
  background: #f8fafd;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(25, 118, 210, 0.07);
  padding: 0.7em 0.5em;
  margin-bottom: 0.5em;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}
.quick-delivery-group-title {
  font-size: 1.07em;
  font-weight: 600;
  margin-bottom: 0.3em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4em;
}
.quick-delivery-group-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
  width: 100%; /* Added to ensure the grid takes full width */
}
.quick-delivery-btn-square {
  background: #e3f2fd;
  color: #1976d2;
  font-size: 1.09em;
  font-weight: 600;
  border: 1.5px solid #e3eaf6;
  border-radius: 9px;
  padding: 1em 1.2em;
  min-width: 0;
  min-height: 44px;
  box-shadow: 0 1px 3px rgba(25, 118, 210, 0.05);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5em;
  width: 100%;
}
.quick-delivery-btn-square:active {
  background: #bbdefb;
}
.quick-btn-icon {
  font-size: 1.2em;
  margin-bottom: 0;
}
.quick-btn-title {
  font-weight: 700;
  font-size: 1.09em;
  color: #1976d2;
}
.quick-btn-subtitle {
  font-size: 0.97em;
  color: #666;
  margin-left: 0.2em;
  font-weight: 400;
}
@media (max-width: 600px) {
  .quick-deliveries-section {
    padding: 0.7em 0.1em 0.7em 0.1em;
    border-radius: 10px;
    margin: 0.7em 0.1em 0.7em 0.1em;
    gap: 0.7em;
  }
  .quick-delivery-group {
    padding: 0.5em 0.2em;
    border-radius: 8px;
    margin-bottom: 0.3em;
  }
  .quick-delivery-group-grid {
    gap: 0.3em;
  }
  .quick-delivery-btn-square {
    font-size: 1em;
    padding: 0.7em 0.7em;
    border-radius: 8px;
    min-width: 0;
    min-height: 44px;
    width: 100%;
  }
  .quick-btn-icon {
    font-size: 1.1em;
  }
  .quick-btn-title {
    font-size: 1em;
  }
}

.quick-deliveries-card {
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(25, 118, 210, 0.07);
  padding: 1.1em 1.2em 1.3em 1.2em;
  margin: 2em 0 0.7em 0; /* Adjusted margin to remove auto centering */
  width: 100%; /* Added to stretch to full width */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1em;
}
.quick-deliveries-header {
  display: flex;
  align-items: center;
  gap: 0.7em;
  margin-bottom: 0.7em;
  margin-top: 1em; /* Added for spacing */
}
.quick-deliveries-bar-icon {
  font-size: 1.3em;
  color: #1976d2;
  margin-right: 0.5em;
}
.quick-deliveries-bar-title {
  font-size: 1.13em;
  font-weight: 700;
  color: #1976d2;
  letter-spacing: 0.01em;
}
.quick-deliveries-divider {
  border: none;
  height: 2px;
  background: linear-gradient(to right, #e3eaf6, #1976d2, #e3eaf6);
  box-shadow: 0 1px 3px rgba(25, 118, 210, 0.1);
  margin: 0.5em 0 1.5em 0; /* Adjusted to remove auto centering and ensure it's full width under the header */
  width: 100%;
}
.quick-deliveries-grid {
  display: flex;
  flex-direction: column;
  gap: 1.2em;
}
.quick-delivery-group {
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}
.quick-delivery-group-title {
  font-size: 1.01em;
  font-weight: 600;
  margin-bottom: 0.3em;
  display: flex;
  align-items: center;
  gap: 0.4em;
}
.quick-delivery-group-icon {
  font-size: 1.1em;
}
.quick-delivery-group-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7em;
}
.quick-delivery-btn-square {
  background: #f8fafd;
  color: #1976d2;
  font-size: 1.05em;
  font-weight: 600;
  border: 1.5px solid #e3eaf6;
  border-radius: 10px;
  padding: 1em 1.2em;
  width: 100%;
  flex: 1 1 100%;
  min-height: 70px;
  box-shadow: 0 1px 3px rgba(25, 118, 210, 0.05);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  flex-direction: column;
  align-items: center; /* Changed to center horizontally */
  justify-content: center; /* Centers vertically */
  gap: 0.2em;
  text-align: center; /* Ensures text inside is centered */
}
.quick-delivery-btn-square:hover {
  background: #f0f7ff;
  border-color: #1976d2;
  transform: translateY(-1px);
  box-shadow: 0 2px 6px rgba(25, 118, 210, 0.1);
}
.quick-delivery-btn-square:active {
  background: #e3f2fd;
  transform: scale(0.98);
}
.quick-btn-icon {
  font-size: 1.1em;
  margin-bottom: 0.2em;
}
.quick-btn-title {
  font-weight: 700;
  font-size: 1.05em;
  color: #1976d2;
}
.quick-btn-subtitle {
  font-size: 0.93em;
  color: #666;
  margin-left: 0.2em;
  font-weight: 400;
}
@media (max-width: 600px) {
  .quick-deliveries-card {
    padding: 1em 0.7em 1.1em 0.7em;
    border-radius: 12px;
    margin: 1em 0 0.7em 0;
    max-width: 99vw;
  }
  .quick-delivery-btn-square {
    font-size: 1em;
    padding: 0.8em 0.7em;
    border-radius: 8px;
    min-width: 110px;
    min-height: 60px;
  }
  .quick-deliveries-divider {
    max-width: 99vw;
  }
}

.stats-toggle-pro {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 340px;
  max-width: 95vw;
  height: 48px;
  background: #f3f6fa;
  border-radius: 28px;
  box-shadow: 0 2px 12px rgba(25, 118, 210, 0.07);
  margin: 1.2em auto 1.2em auto;
  font-size: 1.13em;
  font-weight: 700;
  user-select: none;
}

.stats-toggle-pro .toggle-option {
  flex: 1 1 0;
  text-align: center;
  z-index: 2;
  cursor: pointer;
  color: #888;
  transition: color 0.22s;
  padding: 0.7em 0 0.7em 0;
  border-radius: 28px;
  position: relative;
}

.stats-toggle-pro .toggle-option.active {
  color: #1976d2;
}

.stats-toggle-pro .toggle-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 8px);
  height: 40px;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.1);
  transition: left 0.22s cubic-bezier(0.4, 0.6, 0.2, 1), background 0.18s;
  z-index: 1;
}

.stats-toggle-pro.dominos .toggle-indicator {
  left: calc(50% + 4px);
  background: #e3eaf6;
}

.stats-toggle-pro .toggle-option:first-child {
  margin-right: 0.2em;
}

.stats-toggle-pro .toggle-option:last-child {
  margin-left: 0.2em;
}

@media (max-width: 600px) {
  .stats-toggle-pro {
    width: 98vw;
    height: 40px;
    font-size: 1em;
  }
  .stats-toggle-pro .toggle-indicator {
    height: 32px;
    top: 4px;
    left: 4px;
    width: calc(50% - 8px);
  }
  .stats-toggle-pro.dominos .toggle-indicator {
    left: calc(50% + 4px);
  }
}

/* Ensure all tap targets are at least 44px tall */
.action-btn,
.delivery-actions .action-btn,
.delivery-actions .cancel-btn,
.clear-log-btn,
.small-cancel-btn,
.quick-delivery-btn,
.quick-delivery-btn-square {
  min-height: 44px;
}

/* Remove desktop min-widths/max-widths */
.container,
.map-container,
#map,
.delivery-card,
.quick-deliveries-card,
.pro-delivery-log,
.mini-delivery-log,
.mini-delivery-log-collapsible {
  max-width: 100vw !important;
  min-width: 0 !important;
}

/* Make scrollbars mobile-friendly */
::-webkit-scrollbar {
  width: 0;
  background: transparent;
}

/* Remove any desktop-only overflow */
body,
html,
.container,
main {
  overflow-x: hidden !important;
}

.weekly-stats-cards {
  display: flex;
  flex-direction: column;
  gap: 1.1em;
  margin-top: 0.7em;
}
.weekly-stats-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.09);
  padding: 1.1em 1em 1em 1em;
  display: flex;
  flex-direction: column;
  gap: 0.7em;
  align-items: stretch;
}
.weekly-stats-card .week-label {
  font-size: 1.09em;
  font-weight: 700;
  color: #1976d2;
  margin-bottom: 0.3em;
  letter-spacing: 0.01em;
}
.weekly-stats-card .stats-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 1.01em;
  padding: 0.4em 0;
  border-bottom: 1px solid #e3eaf6;
}
.weekly-stats-card .stats-row:last-child {
  border-bottom: none;
}
.weekly-stats-card .stats-label {
  color: #888;
  font-size: 0.98em;
  font-weight: 500;
}
.weekly-stats-card .stats-value {
  color: #1976d2;
  font-weight: 700;
  font-size: 1.09em;
}
@media (max-width: 600px) {
  .weekly-stats-cards {
    gap: 0.7em;
  }
  .weekly-stats-card {
    padding: 0.8em 0.5em 0.8em 0.5em;
    border-radius: 9px;
  }
  .weekly-stats-card .week-label {
    font-size: 1em;
  }
}

.mobile-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1.01em;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.07);
  margin-bottom: 1em;
}
.mobile-stats-table th,
.mobile-stats-table td {
  padding: 0.85em 0.5em;
  text-align: center;
  border-bottom: 1px solid #e3eaf6;
  font-weight: 500;
}
.mobile-stats-table th {
  background: #f3f6fa;
  color: #1976d2;
  font-weight: 700;
  font-size: 1.07em;
  letter-spacing: 0.01em;
}
.mobile-stats-table td:first-child,
.mobile-stats-table th:first-child {
  text-align: left;
  font-weight: 700;
  color: #1976d2;
  min-width: 90px;
}
.mobile-stats-table tr:last-child td {
  border-bottom: none;
}
@media (max-width: 600px) {
  .mobile-stats-table th,
  .mobile-stats-table td {
    padding: 0.65em 0.3em;
    font-size: 0.97em;
  }
  .mobile-stats-table th {
    font-size: 1em;
  }
  .mobile-stats-table td:first-child,
  .mobile-stats-table th:first-child {
    min-width: 70px;
    font-size: 0.98em;
  }
}

.joystick-container {
  position: absolute;
  right: 80px; /* Move it left of the button stack */
  bottom: 18px;
  z-index: 1001;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.13);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 120px;
}

.joystick-title {
  font-size: 0.9em;
  font-weight: 600;
  color: #1976d2;
  text-align: center;
  margin-bottom: 4px;
}

.joystick-base {
  width: 100px;
  height: 100px;
  background: #f5f5f5;
  border-radius: 50%;
  position: relative;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  margin: 0 auto;
}

.joystick-stick {
  width: 40px;
  height: 40px;
  background: #1976d2;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  cursor: grab;
  transition: background 0.15s;
}

.joystick-stick:active {
  background: #1565c0;
  cursor: grabbing;
}

.joystick-instructions {
  font-size: 0.8em;
  color: #666;
  text-align: center;
  margin-top: 4px;
  line-height: 1.3;
}

@media (max-width: 600px) {
  .joystick-container {
    left: 12px;
    bottom: 12px;
    padding: 8px;
  }

  .joystick-base {
    width: 80px;
    height: 80px;
  }

  .joystick-stick {
    width: 32px;
    height: 32px;
  }

  .joystick-title {
    font-size: 0.85em;
  }

  .joystick-instructions {
    font-size: 0.75em;
  }
}

.version-selector {
  padding: 6px 12px;
  border: 1px solid #1976d2;
  border-radius: 4px;
  background-color: white;
  color: #1976d2;
  font-size: 14px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.version-selector:hover {
  background-color: #f5f5f5;
}

.version-selector:focus {
  box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.beta-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #ff9800;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.radius-control {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
}

.radius-control input[type="number"] {
  width: 100px;
  padding: 5px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

.radius-control span {
  color: #666;
  font-size: 0.9em;
}

.radius-control-container {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 15px;
  margin: 10px 0;
}

.radius-control-container h4 {
  color: #d32f2f;
  font-size: 1.08rem;
  font-weight: 700;
  margin: 0 0 10px 0;
  letter-spacing: 0.01em;
  text-align: left;
  padding-left: 2px;
}

.radius-control {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.radius-control input[type="range"] {
  width: 100%;
  height: 6px;
  background: #ddd;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

.radius-control input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: #4caf50;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.radius-control input[type="range"]::-webkit-slider-thumb:hover {
  background: #45a049;
}

.radius-value-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.radius-value-display input[type="number"] {
  width: 80px;
  padding: 4px 8px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
  text-align: right;
}

.radius-value-display span {
  color: #666;
  font-size: 14px;
}

.radius-presets {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.radius-preset-btn {
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.radius-preset-btn:hover {
  background: #f0f0f0;
  border-color: #ccc;
}

.radius-preset-btn:active {
  background: #e0e0e0;
}

@media (max-width: 600px) {
  .radius-control-container {
    padding: 10px;
  }

  .radius-control-container h4 {
    font-size: 13px;
  }

  .radius-preset-btn {
    padding: 4px 8px;
    font-size: 11px;
  }
}

/* Map Provider Toggle Styles */
.map-provider-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: 18px 0 8px 0;
  padding: 8px 0;
  background: #f3f6fa;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(25, 118, 210, 0.04);
}
.map-provider-toggle label {
  font-weight: 600;
  color: #1976d2;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}
.map-provider-toggle input[type="radio"] {
  accent-color: #1976d2;
  width: 18px;
  height: 18px;
  margin: 0 4px 0 0;
}
.map-provider-toggle .toggle-title {
  color: #333;
  font-size: 1.01rem;
  font-weight: 700;
  margin-right: 12px;
  letter-spacing: 0.01em;
}

@media (max-width: 600px) {
  .map-provider-toggle {
    flex-direction: column;
    gap: 8px;
    padding: 6px 0;
  }
  .map-provider-toggle label {
    font-size: 0.97rem;
  }
}
