:root {
  --primary: #6366F1;
  --primary-dark: #4F46E5;
  --primary-light: #818CF8;
  --success: #10B981;
  --success-dark: #059669;
  --warning: #F59E0B;
  --danger: #EF4444;
  --bg: #F8FAFC;
  --card: #FFFFFF;
  --text: #0F172A;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --border: #E2E8F0;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 12px;
  --safe-top: 24px;
  --safe-bottom: 34px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
}

/* Status bar gradient overlay - subtle like Maxim */
#status-bar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 30px;
  background: linear-gradient(to bottom, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0.2) 60%, rgba(0,0,0,0) 100%);
  z-index: 50;
  pointer-events: none;
}

/* Map */
#map {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}

/* Top bar */
#top-bar {
  position: fixed;
  top: calc(var(--safe-top) + 8px);
  left: 0;
  right: 0;
  padding: 0 16px;
  z-index: 100;
  pointer-events: none;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  padding: 8px 14px;
  border-radius: 50px;
  box-shadow: var(--shadow);
  pointer-events: auto;
}

#user-name {
  font-weight: 600;
  font-size: 14px;
}

.role-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 50px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.role-badge.client {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
}

.role-badge.driver {
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  color: white;
}

/* Selection mode indicator */
#select-mode {
  position: fixed;
  top: calc(var(--safe-top) + 60px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 150;
  transition: opacity 0.3s, transform 0.3s;
}

#select-mode.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
  pointer-events: none;
}

.select-mode-content {
  background: var(--text);
  color: white;
  padding: 10px 20px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
}

/* Map buttons */
.map-btn {
  position: fixed;
  width: 48px;
  height: 48px;
  background: var(--card);
  border: none;
  border-radius: 50%;
  box-shadow: var(--shadow);
  cursor: pointer;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: transform 0.2s, box-shadow 0.2s;
}

.map-btn:active {
  transform: scale(0.95);
}

#btn-locate {
  right: 16px;
  bottom: 240px;
}

/* Bottom Sheet */
#sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.1);
  z-index: 200;
  max-height: 85vh;
  min-height: 80px;
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}

#sheet:active {
  cursor: grabbing;
}

.sheet-header {
  padding: 16px 0;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
}

.sheet-handle {
  width: 48px;
  height: 5px;
  background: var(--border);
  border-radius: 3px;
}

#sheet-content {
  padding: 0 20px 24px;
  padding-bottom: calc(24px + var(--safe-bottom));
  overflow-y: auto;
  max-height: calc(85vh - 70px);
  touch-action: pan-y;
}

/* Route inputs */
.route-inputs {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: relative;
  margin-bottom: 20px;
}

.route-input {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.2s;
}

.route-input:last-child {
  border-bottom: none;
}

.route-input:active {
  background: var(--bg);
  margin: 0 -20px;
  padding: 16px 20px;
}

.route-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}

.route-dot.from {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.2);
}

.route-dot.to {
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
}

.route-input-text {
  flex: 1;
  font-size: 15px;
  color: var(--text);
}

.route-input-text.placeholder {
  color: var(--text-muted);
}

.route-line {
  position: absolute;
  left: 6px;
  top: 30px;
  bottom: 30px;
  width: 2px;
  background: linear-gradient(to bottom, var(--success), var(--primary));
  border-radius: 1px;
}

/* Route info */
.route-info {
  display: flex;
  gap: 16px;
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}

.route-info-item {
  flex: 1;
  text-align: center;
}

.route-info-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.route-info-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Price input */
.price-section {
  margin-bottom: 20px;
}

.price-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.price-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.price-input-wrap input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 28px;
  font-weight: 700;
  text-align: center;
  color: var(--text);
  padding: 12px;
  outline: none;
  min-width: 0;
}

.price-input-wrap input::placeholder {
  color: var(--text-muted);
}

.price-currency {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-secondary);
  padding-right: 16px;
}

.price-buttons {
  display: flex;
  gap: 8px;
}

.price-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.price-btn:active {
  background: var(--border);
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:active {
  transform: scale(0.98);
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
}

.btn-primary:disabled {
  background: var(--border);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
}

.btn-success {
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

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

.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text-secondary);
}

.btn-outline:active {
  background: var(--bg);
}

.btn-sm {
  padding: 10px 16px;
  font-size: 14px;
}

/* Status card */
.status-card {
  text-align: center;
  padding: 30px 0;
}

.status-icon {
  font-size: 56px;
  margin-bottom: 16px;
}

.status-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.status-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
}

/* Offers */
.offers-section {
  margin-top: 20px;
}

.offers-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 12px;
}

.offer-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  transition: all 0.2s;
}

.offer-card:active {
  transform: scale(0.99);
}

.offer-avatar {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 600;
  color: white;
}

.offer-info {
  flex: 1;
  min-width: 0;
}

.offer-name {
  font-weight: 600;
  font-size: 15px;
  margin-bottom: 2px;
}

.offer-rating {
  font-size: 13px;
  color: var(--text-secondary);
}

.offer-rating::before {
  content: '★ ';
  color: var(--warning);
}

.offer-car {
  font-size: 12px;
  color: var(--text-muted);
}

.offer-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--success);
}

.offer-accept {
  padding: 10px 16px;
  background: var(--success);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Driver card */
.driver-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: linear-gradient(135deg, #F0FDF4, #ECFDF5);
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.driver-avatar-lg {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--success), var(--success-dark));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 600;
  color: white;
}

.driver-details {
  flex: 1;
}

.driver-name-lg {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.driver-rating-lg {
  font-size: 14px;
  color: var(--text-secondary);
}

.driver-car-lg {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.driver-eta {
  text-align: right;
}

.driver-eta-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--success);
}

.driver-eta-label {
  font-size: 12px;
  color: var(--text-muted);
}

/* Orders list (for drivers) */
.orders-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.order-card {
  padding: 16px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
}

.order-card:active {
  transform: scale(0.98);
}

.order-route {
  margin-bottom: 12px;
}

.order-point {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  margin-bottom: 6px;
}

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

.order-point-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.order-point-dot.from { background: var(--success); }
.order-point-dot.to { background: var(--primary); }

.order-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.order-price {
  font-size: 22px;
  font-weight: 700;
}

.order-distance {
  font-size: 13px;
  color: var(--text-muted);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 40px 20px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-text {
  color: var(--text-muted);
  font-size: 15px;
}

/* Actions row */
.actions-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.actions-row .btn {
  flex: 1;
}

/* Rating */
.rating-stars {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 24px 0;
}

.rating-star {
  font-size: 40px;
  color: var(--border);
  cursor: pointer;
  transition: all 0.2s;
}

.rating-star.active {
  color: var(--warning);
  transform: scale(1.1);
}

/* Price offer */
.price-offer-input {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.price-offer-input input {
  flex: 1;
  padding: 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.price-offer-input input:focus {
  border-color: var(--primary);
}

/* Toast */
#toast {
  position: fixed;
  bottom: 260px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 500;
  z-index: 500;
  transition: opacity 0.3s, transform 0.3s;
}

#toast.hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(20px);
  pointer-events: none;
}

/* Pulse animation */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.pulse {
  animation: pulse 2s ease-in-out infinite;
}

/* Loading spinner */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

/* Hidden utility */
.hidden {
  display: none !important;
}
