:root {
  --bg: #fafbfc;
  --card: #ffffff;
  --accent: #2563eb;
  --accent-light: #3b82f6;
  --accent-dark: #1e40af;
  --muted: #64748b;
  --text: #0f172a;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

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

html, body {
  height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 24px 16px;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.hero {
  text-align: center;
  margin-bottom: 32px;
}

.hero h1 {
  font-size: 32px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.subtitle {
  color: var(--muted);
  font-size: 15px;
  font-weight: 400;
}

.card {
  background: var(--card);
  padding: 32px;
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.form {
  display: grid;
  grid-template-columns: repeat(2, 1fr) auto;
  gap: 16px;
  align-items: end;
}

.form .inputs {
  display: contents;
}

.form .row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.row label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

input, textarea, select {
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  outline: none;
  transition: all 0.2s ease;
}

input:hover {
  border-color: var(--accent-light);
}

input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

input::placeholder {
  color: #94a3b8;
}

.actions {
  display: flex;
  gap: 12px;
}

.actions button {
  min-width: 120px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  padding: 12px 24px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

button:hover {
  background: var(--accent-dark);
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

button[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.notice {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  background: #eff6ff;
  color: var(--accent-dark);
  border: 1px solid #bfdbfe;
  font-size: 14px;
}

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

.results {
  margin-top: 24px;
}

.order {
  background: var(--card);
  padding: 24px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}

.order:last-child {
  margin-bottom: 0;
}

.order-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.order-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.meta {
  color: var(--muted);
  font-size: 14px;
  margin-top: 8px;
}

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

.panel {
  padding: 20px;
  border-radius: 8px;
  background: #f8fafc;
  border: 1px solid var(--border);
}

.panel h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.stops ul {
  list-style: none;
}

.stops li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.6;
}

.stops li:last-child {
  border-bottom: none;
}

.stops strong {
  color: var(--accent);
  font-weight: 600;
}

.stops small {
  color: var(--muted);
  font-size: 13px;
}

.job {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.job:last-child {
  border-bottom: none;
}

.job-stops {
  margin-top: 12px;
}

.job-stop {
  padding: 12px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  font-size: 14px;
}

.job-stop:last-child {
  margin-bottom: 0;
}

.job-stop strong {
  color: var(--accent);
  font-weight: 600;
}

/* Events Timeline - Card Design */
.events {
  grid-column: 1 / -1;
  background: transparent;
  padding: 0;
  border-radius: 0;
  border: none;
}

.events h3 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.events ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.events li {
  position: relative;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s ease;
}

.events li:hover {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateX(2px);
}

.ev-time {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.ev-time::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

.ev-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ev-title {
  font-weight: 600;
  color: var(--text);
  font-size: 15px;
}

.ev-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.empty {
  margin-top: 24px;
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

/* Helpers */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--muted);
}

.muted small {
  color: var(--muted);
}

/* Responsive Design */
@media (max-width: 1024px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  body {
    padding: 12px;
  }
  
  .card {
    padding: 20px;
    border-radius: 12px;
  }
  
  .form {
    grid-template-columns: 1fr;
  }
  
  .form .inputs {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }
  
  .actions {
    margin-top: 4px;
  }
  
  .actions button {
    width: 100%;
    padding: 14px 24px;
  }
  
  .hero {
    margin-bottom: 24px;
  }
  
  .hero h1 {
    font-size: 24px;
  }
  
  .subtitle {
    font-size: 14px;
  }
  
  .order {
    padding: 16px;
    border-radius: 10px;
  }
  
  .order-header {
    padding-bottom: 16px;
    margin-bottom: 16px;
  }
  
  .order-header h2 {
    font-size: 18px;
  }
  
  .meta {
    font-size: 13px;
  }
  
  .panel {
    padding: 14px;
  }
  
  .panel h3 {
    font-size: 15px;
    margin-bottom: 12px;
  }
  
  .grid {
    gap: 12px;
    margin-bottom: 12px;
  }
  
  .events h3 {
    font-size: 15px;
    margin-bottom: 12px;
  }
  
  .events ol {
    gap: 6px;
  }
  
  .events li {
    padding: 12px;
  }
  
  .ev-time {
    font-size: 11px;
    margin-bottom: 4px;
  }
  
  .ev-title {
    font-size: 14px;
  }
  
  .ev-desc {
    font-size: 13px;
  }
  
  .job-stop {
    padding: 10px;
    font-size: 13px;
  }
  
  .stops li {
    padding: 10px 0;
  }
  
  .stops small {
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 8px;
  }
  
  .card {
    padding: 16px;
  }
  
  .hero h1 {
    font-size: 22px;
  }
  
  .order {
    padding: 14px;
  }
  
  .order-header {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .panel {
    padding: 12px;
  }
  
  input {
    font-size: 16px;
  }
}


/* Spinner */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Focus Styles */
button:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

input:focus-visible {
  outline: none;
}

/* Status Badges */
.status.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 12px;
  color: #fff;
  text-transform: capitalize;
}

.status.badge.delivered {
  background: var(--success);
}

.status.badge.in-transit {
  background: var(--accent);
}

.status.badge.exception {
  background: var(--warning);
}

.status.badge.success {
  background: var(--success);
}

.status.badge.unknown {
  background: var(--muted);
}

