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

html { font-size: 16px; -webkit-tap-highlight-color: transparent; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
}

/* ---- Login ---- */

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: #1a1a2e;
}

.login-box {
  background: #fff;
  border-radius: 20px;
  padding: 36px 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, .35);
}

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

.login-logo .icon { font-size: 52px; display: block; }
.login-logo h1 { font-size: 22px; font-weight: 700; margin-top: 10px; color: #1a1a2e; }
.login-logo p  { color: #888; font-size: 14px; margin-top: 4px; }

.field { margin-bottom: 18px; }

.field label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #666;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .6px;
}

.field input {
  width: 100%;
  border: 2px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 16px;
  outline: none;
  transition: border-color .2s;
  background: #fafafa;
}

.field input:focus { border-color: #1a1a2e; background: #fff; }

.error-msg {
  color: #dc2626;
  font-size: 14px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 16px;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s;
  text-decoration: none;
  white-space: nowrap;
  touch-action: manipulation;
}

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

.btn-primary  { background: #1a1a2e; color: #fff; border-color: #1a1a2e; }
.btn-primary:hover:not(:disabled)  { background: #2d2d5e; border-color: #2d2d5e; }

.btn-success  { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover:not(:disabled)  { background: #15803d; }

.btn-warning  { background: #d97706; color: #fff; border-color: #d97706; }
.btn-warning:hover:not(:disabled)  { background: #b45309; }

.btn-outline  { background: transparent; color: #374151; border-color: #d1d5db; }
.btn-outline:hover { background: #f9fafb; }

.btn-release  { background: transparent; color: #6b7280; border-color: #d1d5db; font-size: 13px; }
.btn-release:hover { background: #fef2f2; color: #dc2626; border-color: #fca5a5; }

.btn-danger   { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover:not(:disabled) { background: #b91c1c; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px;
}
.modal-overlay[hidden] { display: none; }
.modal-box {
  background: #fff; border-radius: 16px; padding: 28px 24px;
  width: 100%; max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.25);
}
.modal-title { font-size: 18px; font-weight: 700; color: #1a1a2e; margin-bottom: 8px; }
.modal-desc  { font-size: 14px; color: #6b7280; margin-bottom: 20px; line-height: 1.5; }
.modal-options { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.reason-option {
  display: flex; align-items: center; gap: 10px;
  font-size: 14px; color: #374151; cursor: pointer;
  padding: 10px 14px; border: 1.5px solid #e5e7eb; border-radius: 8px;
}
.reason-option:has(input:checked) { border-color: #1a1a2e; background: #f0f2f5; font-weight: 600; }
.reason-option input { accent-color: #1a1a2e; }
.modal-actions { display: flex; gap: 10px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }
.error-msg { color: #dc2626; font-size: 13px; margin-top: -8px; }

.btn-full { width: 100%; }

/* ---- App layout ---- */

.app-header {
  background: #1a1a2e;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .driver-name { font-weight: 600; font-size: 15px; }

.btn-logout {
  background: transparent;
  color: rgba(255, 255, 255, .7);
  border: 1px solid rgba(255, 255, 255, .3);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}

.btn-logout:hover { color: #fff; border-color: rgba(255, 255, 255, .6); }

.tab-nav {
  display: flex;
  background: #fff;
  border-bottom: 2px solid #e5e7eb;
  position: sticky;
  top: 52px;
  z-index: 99;
}

.tab {
  flex: 1;
  padding: 14px 8px;
  font-size: 15px;
  font-weight: 600;
  background: none;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}

.tab.active { color: #1a1a2e; border-bottom-color: #1a1a2e; }

.app-main { padding: 16px; max-width: 640px; margin: 0 auto; }

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

/* ---- Order cards ---- */

.order-list { display: flex; flex-direction: column; gap: 12px; }

.order-card {
  background: #fff;
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  border: 1px solid #e5e7eb;
}

.order-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.order-header strong { font-size: 16px; }
.order-customer { font-size: 15px; font-weight: 600; margin-bottom: 8px; color: #111; }

.order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 10px;
}

.order-items {
  background: #f9fafb;
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.item-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 3px 0;
  color: #4b5563;
}

.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.order-actions .btn {
  flex: 1 1 auto;
  white-space: nowrap;
  font-size: 13px;
  padding: 10px 14px;
}

/* ---- Badges ---- */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
}

.badge-grey   { background: #f3f4f6; color: #6b7280; }
.badge-orange { background: #fff7ed; color: #c2410c; }
.badge-blue   { background: #eff6ff; color: #1d4ed8; }
.badge-green  { background: #f0fdf4; color: #16a34a; }

/* ---- Toast ---- */

.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  z-index: 9999;
  box-shadow: 0 4px 20px rgba(0, 0, 0, .2);
  pointer-events: none;
  white-space: nowrap;
}

.toast-success { background: #16a34a; }
.toast-error   { background: #dc2626; }

/* ---- Empty / loading states ---- */

.state-msg {
  text-align: center;
  padding: 48px 20px;
  color: #9ca3af;
  font-size: 15px;
}
