:root {
  --blue: #0d6efd;
  --blue-dark: #0647a9;
  --cyan: #0ea5e9;
  --text: #142033;
  --muted: #64748b;
  --line: #dbe7f4;
  --soft: #f3f7fc;
  --card: #ffffff;
  --danger: #dc2626;
  --green: #16a34a;
  --shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  background: var(--soft);
  font-family: "Segoe UI", Roboto, Arial, sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.web-app-shell {
  display: block;
  height: 100vh;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 19;
  display: none;
  background: rgba(7, 21, 39, 0.32);
}

.sidebar-backdrop.open {
  display: block;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(82vw, 310px);
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
  transform: translateX(-105%);
  transition: transform 0.2s ease;
  z-index: 20;
}

.app-sidebar.open {
  transform: translateX(0);
}

.sidebar-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--text);
  background: #eef5ff;
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
}

.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.avatar,
.profile-button span {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--cyan));
  font-weight: 900;
}

.avatar img,
.profile-button img,
.driver-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-profile strong,
.sidebar-profile span {
  display: block;
}

.sidebar-profile span {
  max-width: 170px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-nav {
  display: grid;
  gap: 8px;
}

.sidebar-nav a,
.sidebar-logout {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  text-decoration: none;
  font-weight: 800;
  cursor: pointer;
}

.sidebar-nav a.active,
.sidebar-nav a:hover {
  color: var(--blue);
  background: #eaf3ff;
}

.sidebar-logout {
  margin-top: auto;
  color: var(--danger);
}

.app-main {
  min-width: 0;
  display: block;
  height: 100vh;
}

.map-area {
  position: relative;
  min-width: 0;
  height: 100%;
}

.map-canvas {
  position: absolute;
  inset: 0;
}

.top-card {
  position: absolute;
  top: max(18px, env(safe-area-inset-top));
  left: 18px;
  right: 18px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 640px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.icon-button,
.profile-button,
.locate-button {
  border: 0;
  background: #fff;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.16);
  cursor: pointer;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  gap: 5px;
  place-content: center;
  border-radius: 12px;
}

.icon-button span {
  width: 20px;
  height: 2px;
  background: var(--text);
}

.profile-button {
  padding: 0;
  border-radius: 50%;
}

.greeting {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.greeting span {
  color: #6b46a2;
  font-size: 14px;
  font-weight: 800;
}

.greeting strong {
  font-size: clamp(21px, 3vw, 30px);
}

.locate-button {
  position: absolute;
  right: 22px;
  bottom: 330px;
  z-index: 5;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  color: var(--blue);
  font-size: 26px;
  font-weight: 900;
}

.ride-panel {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: max(18px, calc(env(safe-area-inset-bottom) + 18px));
  z-index: 6;
  max-width: 720px;
  max-height: min(72vh, 680px);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.grabber {
  width: 48px;
  height: 5px;
  margin: 10px auto 4px;
  border-radius: 999px;
  background: #dbe4ef;
}

.panel-scroll {
  max-height: calc(min(72vh, 680px) - 18px);
  overflow: auto;
  padding: 10px 20px 20px;
}

.location-permission {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  background: #eff6ff;
}

.location-permission strong,
.location-permission span {
  display: block;
}

.location-permission span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.location-permission button {
  min-height: 38px;
  border: 0;
  border-radius: 999px;
  padding: 0 15px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
  cursor: pointer;
}

.route-form {
  display: grid;
  gap: 10px;
}

.ride-active .route-form,
.ride-active .quick-addresses,
.ride-active .route-summary,
.ride-active .category-payment {
  display: none !important;
}

.address-field {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}

.address-field span {
  color: #6b46a2;
  font-size: 13px;
  font-weight: 800;
}

.address-field input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
  font-size: 18px;
  font-weight: 700;
}

.destination-field {
  padding-right: 56px;
}

.add-stop {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: 22px;
  font-weight: 900;
  transform: translateY(-50%);
  cursor: pointer;
}

.stop-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.remove-stop {
  width: 38px;
  border: 0;
  border-radius: 12px;
  color: var(--danger);
  background: #fee2e2;
  font-weight: 900;
  cursor: pointer;
}

.quick-addresses {
  margin-top: 14px;
}

.quick-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
  color: var(--text);
}

.quick-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.recent-head {
  margin-top: 14px;
}

.quick-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(92px, 1fr));
  gap: 8px;
  overflow-x: auto;
}

.quick-card,
.quick-address {
  min-height: 74px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
  color: var(--text);
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.quick-card strong,
.quick-card span,
.quick-address strong,
.quick-address span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-card span,
.quick-address span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.quick-empty {
  color: var(--muted);
  background: #f8fafc;
}

.route-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--blue), var(--cyan));
}

.route-summary strong,
.route-summary span {
  display: block;
}

.category-payment {
  margin-top: 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-title button {
  border: 0;
  color: var(--danger);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.payment-title {
  margin-top: 16px;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.option-card {
  min-height: 92px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.option-card.active,
.option-card.selected {
  border-color: #6b46a2;
  background: #f3efff;
  box-shadow: inset 0 0 0 1px #6b46a2;
}

.option-card:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.option-card strong,
.option-card span,
.option-card small {
  display: block;
}

.option-card strong {
  margin-top: 10px;
}

.option-card span {
  margin-top: 5px;
  color: #6b46a2;
  font-weight: 900;
}

.option-card small {
  margin-top: 4px;
  color: var(--muted);
}

.option-card em {
  display: block;
  margin-top: 6px;
  color: #6b46a2;
  font-style: normal;
  font-weight: 900;
}

.primary-action,
.danger-action {
  width: 100%;
  min-height: 52px;
  margin-top: 16px;
  border: 0;
  border-radius: 16px;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.primary-action {
  background: #6b46a2;
  box-shadow: 0 14px 26px rgba(107, 70, 162, 0.24);
}

.danger-action {
  color: var(--danger);
  border: 1px solid #fecaca;
  background: #fff;
}

.active-ride {
  margin-top: 8px;
}

.active-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.active-head strong,
.active-head span {
  display: block;
}

.active-head span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.collapse-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #eef4ff;
  font-size: 18px;
  cursor: pointer;
}

.active-body {
  margin-top: 14px;
}

.driver-card {
  width: 100%;
  display: flex;
  align-items: center;
  text-align: left;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: inherit;
  background: #fff;
  cursor: pointer;
}

.driver-card:hover {
  border-color: rgba(13, 110, 253, 0.34);
  background: #f8fbff;
}

.driver-card img {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: #e2e8f0;
}

.driver-card span,
.driver-card small {
  display: block;
  color: var(--muted);
}

.ride-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding: 12px;
  border-radius: 16px;
  color: #fff;
  background: #0f172a;
}

.ride-code strong {
  font-size: 22px;
  letter-spacing: 2px;
}

.status-message {
  margin-top: 12px;
  color: var(--muted);
  line-height: 1.45;
}

.chat-action {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 16px;
  padding: 0 14px;
  color: var(--blue);
  background: #eff6ff;
  font-weight: 900;
  cursor: pointer;
}

.chat-action::before {
  content: "✉";
}

.chat-action span {
  margin-right: auto;
}

.chat-action strong {
  min-width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--danger);
  font-size: 12px;
}

.rating-box {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fbff;
}

.rating-box > strong {
  font-size: 18px;
}

.star-row {
  display: flex;
  gap: 6px;
}

.star-row button {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #cbd5e1;
  background: #fff;
  font-size: 24px;
  cursor: pointer;
}

.star-row button.selected {
  color: #f59e0b;
  background: #fffbeb;
}

.rating-good,
.rating-bad {
  display: grid;
  gap: 8px;
}

.rating-good label,
.rating-bad span {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-weight: 800;
}

.rating-good select,
.rating-good textarea,
.rating-bad textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px;
  background: #fff;
}

.rating-good textarea,
.rating-bad textarea {
  min-height: 76px;
  resize: vertical;
}

.rating-bad label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 24px;
  z-index: 50;
  max-width: min(520px, calc(100% - 32px));
  display: none;
  padding: 13px 16px;
  border-radius: 14px;
  color: #fff;
  background: #0f172a;
  box-shadow: var(--shadow);
  transform: translateX(-50%);
}

.toast.show {
  display: block;
}

.desktop-info {
  display: none;
  align-content: start;
  gap: 16px;
  padding: 18px;
  border-left: 1px solid var(--line);
  background: #f8fbff;
  overflow: auto;
}

.info-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.08);
}

.info-card h1,
.info-card h2,
.info-card p {
  margin: 0;
}

.info-card p {
  margin-top: 8px;
  color: var(--muted);
  line-height: 1.55;
}

.metric-list {
  display: grid;
  gap: 10px;
}

.metric-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  background: #eef6ff;
}

.metric-list span {
  color: var(--muted);
  font-weight: 800;
}

.desktop-links {
  display: grid;
  gap: 8px;
}

.desktop-links a {
  padding: 12px;
  border-radius: 12px;
  color: var(--blue);
  background: #eef6ff;
  text-decoration: none;
  font-weight: 900;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.6);
}

.modal-card {
  width: min(460px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  border-radius: 20px;
  background: #fff;
}

.chat-modal-card {
  height: min(640px, calc(100vh - 48px));
  grid-template-rows: auto 1fr auto;
}

.chat-head {
  align-items: center;
  justify-content: space-between;
}

.chat-head h2 {
  margin: 0;
}

.chat-list {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 220px;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fafc;
}

.chat-message {
  max-width: 82%;
  justify-self: start;
  padding: 10px 12px;
  border-radius: 16px 16px 16px 4px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.chat-message.mine {
  justify-self: end;
  color: #fff;
  border-radius: 16px 16px 4px 16px;
  background: var(--blue);
}

.chat-message strong,
.chat-message span {
  display: block;
}

.chat-message strong {
  margin-bottom: 4px;
  font-size: 12px;
  opacity: 0.75;
}

.empty-chat {
  color: var(--muted);
  text-align: center;
  padding: 30px 10px;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.chat-form input {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 15px;
}

.chat-form button {
  min-height: 46px;
  border: 0;
  border-radius: 999px;
  padding: 0 18px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
  cursor: pointer;
}

.driver-profile-modal-card {
  width: min(520px, 100%);
}

.driver-profile-body {
  display: grid;
  gap: 14px;
}

.driver-profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbff;
}

.driver-profile-head img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  background: #e2e8f0;
}

.driver-profile-head strong,
.driver-profile-head span {
  display: block;
}

.driver-profile-head strong {
  color: var(--text);
  font-size: 20px;
}

.driver-profile-head span {
  color: var(--muted);
}

.driver-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.driver-profile-stats div,
.driver-profile-section {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.driver-profile-stats span,
.driver-profile-stats strong {
  display: block;
}

.driver-profile-stats span {
  color: var(--muted);
  font-size: 12px;
}

.driver-profile-stats strong {
  color: var(--text);
  font-size: 18px;
}

.driver-profile-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.driver-profile-badges span {
  padding: 7px 10px;
  border-radius: 999px;
  color: #075985;
  background: #e0f2fe;
  font-size: 12px;
  font-weight: 900;
}

.driver-profile-comments {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.driver-profile-comments p {
  margin: 0;
  color: var(--muted);
}

.modal-card h2,
.modal-card p {
  margin: 0;
}

.modal-card p {
  color: var(--muted);
}

.modal-card select,
.modal-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.modal-card textarea {
  min-height: 94px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-actions button {
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  font-weight: 900;
  cursor: pointer;
}

.modal-actions button:last-child {
  color: #fff;
  background: var(--danger);
}

.desktop-hidden {
  display: grid;
}

@media (max-width: 1100px) {
  .desktop-info {
    display: none;
  }
}

@media (max-width: 760px) {
  html,
  body {
    position: fixed;
    inset: 0;
  }

  .app-main,
  .map-area {
    height: 100%;
  }

  .mobile-profile {
    display: inline-grid;
  }

  .top-card {
    left: 14px;
    right: 14px;
    padding: 12px;
  }

  .greeting strong {
    font-size: 22px;
  }

  .ride-panel {
    left: 0;
    right: 0;
    bottom: max(12px, env(safe-area-inset-bottom));
    max-height: 62vh;
    border-radius: 22px 22px 0 0;
  }

  .panel-scroll {
    max-height: calc(62vh - 18px);
    padding: 8px 14px 24px;
  }

  .locate-button {
    right: 18px;
    bottom: calc(62vh + 18px);
  }

  .quick-row {
    grid-template-columns: repeat(5, 112px);
  }

  .option-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .option-card {
    min-height: 82px;
    padding: 10px;
  }

  .option-card strong {
    font-size: 14px;
  }

  .option-card small {
    display: none;
  }
}
