:root {
  --white: #FDFDFF;
  --surface: #FFFFFF;
  --page: #F5F5F7;
  --ink: #12130F;
  --muted: rgba(18, 19, 15, 0.56);
  --body: rgba(18, 19, 15, 0.78);
  --soft: rgba(18, 19, 15, 0.06);
  --line: rgba(18, 19, 15, 0.08);
  --brand: #8806CE;
  --brand-dark: #6E06A6;
  --green: #08A045;
  --red: #E23009;
  --yellow: #FFCC00;
  --shadow: 2px 4px 24px rgba(0, 0, 0, 0.08);
}

@font-face { font-family: 'General Sans'; src: url('./fonts/GeneralSans/GeneralSans-Regular.otf') format('opentype'); font-weight: 400; }
@font-face { font-family: 'General Sans'; src: url('./fonts/GeneralSans/GeneralSans-Medium.otf') format('opentype'); font-weight: 500; }
@font-face { font-family: 'General Sans'; src: url('./fonts/GeneralSans/GeneralSans-Semibold.otf') format('opentype'); font-weight: 600; }
@font-face { font-family: 'General Sans'; src: url('./fonts/GeneralSans/GeneralSans-Bold.otf') format('opentype'); font-weight: 700; }
@font-face { font-family: 'Chillax'; src: url('./fonts/Chillax/Chillax-Bold.otf') format('opentype'); font-weight: 700; }

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

*::-webkit-scrollbar { display: none; }
html, body { width: 100%; min-height: 100%; }
body {
  background: var(--page);
  color: var(--ink);
  font-family: 'General Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  display: flex;
  justify-content: center;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; }
button { border: 0; cursor: pointer; }

.app-shell {
  width: 390px;
  max-width: 100vw;
  min-height: 100dvh;
  background: var(--surface);
  padding: calc(32px + env(safe-area-inset-top)) 24px calc(32px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.top-bar,
.section-head,
.profile-card,
.profile-main,
.online-card,
.order-top,
.row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  line-height: 14px;
  margin-bottom: 4px;
}

.brand-title {
  color: var(--ink);
  font-family: 'Chillax', 'General Sans', sans-serif;
  font-size: 34px;
  line-height: 36px;
  font-weight: 700;
  letter-spacing: -1px;
}

.brand-title span,
.section-title {
  background: linear-gradient(90deg, #8806CE 0%, #E23009 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-title.green {
  background: linear-gradient(90deg, #08A045 0%, #B6FF4D 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.section-title.red {
  background: linear-gradient(90deg, #E23009 0%, #FF7A00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.muted {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}

.tiny-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 15px;
}

main,
.rider-panel,
.phone-screen,
.otp-screen,
.name-screen,
.tab-section,
.stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card,
.login-card,
.profile-card,
.online-card,
.stat-card,
.order-card {
  background: var(--surface);
  border-radius: 40px;
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-card { margin-top: 52px; }
.profile-card,
.online-card { flex-direction: row; align-items: center; }
.profile-main { align-items: center; justify-content: flex-start; min-width: 0; }

.rider-avatar {
  width: 54px;
  height: 54px;
  border-radius: 36px;
  background: linear-gradient(135deg, var(--brand), var(--green));
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 950;
  flex-shrink: 0;
  box-shadow: 0 12px 28px rgba(136, 6, 206, 0.20);
}

.rider-name {
  color: var(--ink);
  font-size: 18px;
  font-weight: 950;
  line-height: 22px;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-title {
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
  line-height: 18px;
}

.section-title {
  font-family: 'Chillax', 'General Sans', sans-serif;
  font-size: 22px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  line-height: 12px;
}

.input,
.phone-box,
.textarea,
select.input {
  width: 100%;
  border: 1px solid rgba(18, 19, 15, 0.10);
  outline: none;
  background: #FDFDFF;
  border-radius: 28px;
  padding: 12px 13px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  line-height: 16px;
}

.phone-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(18, 19, 15, 0.02);
}

.country {
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
  line-height: 26px;
}
.country.dash { opacity: .12; }
.phone-input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 26px;
}
.phone-input::placeholder,
.input::placeholder { color: rgba(18, 19, 15, .25); }
.big-input { font-size: 20px; line-height: 26px; padding: 15px 16px; }
.readonly { background: rgba(18, 19, 15, 0.04); color: rgba(18, 19, 15, 0.72); }

.input:focus,
.phone-box:focus-within,
.textarea:focus {
  border-color: rgba(136, 6, 206, 0.42);
  box-shadow: 0 0 0 4px rgba(136, 6, 206, 0.08);
}

.btn,
.icon-btn,
.tab {
  min-height: 42px;
  border-radius: 28px;
  background: var(--green);
  color: var(--white);
  font-size: 13px;
  font-weight: 950;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  transition: transform .12s ease, opacity .12s ease;
}
.btn:active,
.icon-btn:active,
.tab:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn.brand { background: var(--brand); }
.btn.red { background: var(--red); }
.btn.soft,
.icon-btn,
.back-link {
  background: rgba(18, 19, 15, 0.06);
  color: var(--ink);
}
.btn.small { min-height: 34px; font-size: 11px; padding: 0 11px; }
.icon-btn { width: 42px; height: 42px; padding: 0; font-size: 18px; flex-shrink: 0; }
.back-link {
  width: fit-content;
  min-height: 36px;
  border-radius: 28px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.notice,
.empty-card {
  padding: 14px;
  border-radius: 32px;
  background: #F7F7F9;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 17px;
  text-align: center;
}

.switch {
  width: 54px;
  height: 32px;
  position: relative;
  flex-shrink: 0;
}
.switch input { display: none; }
.switch span {
  position: absolute;
  inset: 0;
  background: rgba(18, 19, 15, 0.12);
  border-radius: 1998px;
  transition: .2s ease;
}
.switch span::after {
  content: "";
  width: 26px;
  height: 26px;
  position: absolute;
  top: 3px;
  left: 3px;
  background: var(--white);
  border-radius: 1998px;
  box-shadow: 0 3px 10px rgba(0,0,0,.12);
  transition: .2s ease;
}
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(22px); }

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-card {
  min-height: 82px;
  background: #F7F7F9;
  box-shadow: none;
  padding: 12px;
  justify-content: space-between;
}
.stat-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 13px;
}
.stat-card strong {
  color: var(--ink);
  font-size: 22px;
  font-weight: 950;
  line-height: 26px;
}

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 8px 0;
  background: linear-gradient(180deg, #FFFFFF 68%, rgba(255,255,255,0));
}
.tab {
  min-height: 38px;
  background: rgba(18, 19, 15, 0.06);
  color: var(--ink);
  font-size: 11px;
  padding: 0 6px;
}
.tab.active { background: var(--brand); color: var(--white); }
.tab-section { display: none; }
.tab-section.active { display: flex; }

.order-card {
  border: 1px solid rgba(18, 19, 15, 0.08);
  border-radius: 36px;
  box-shadow: none;
  background: #FDFDFF;
}
.order-id,
.item-name {
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
  line-height: 19px;
}
.price {
  color: var(--green);
  font-size: 17px;
  font-weight: 950;
  line-height: 20px;
  white-space: nowrap;
}
.status-pill {
  width: fit-content;
  border-radius: 1998px;
  padding: 7px 10px;
  background: rgba(136, 6, 206, .10);
  color: var(--brand);
  font-size: 11px;
  font-weight: 950;
  line-height: 12px;
}
.status-pill.preparing { background: rgba(255, 204, 0, .22); color: #9A6A00; }
.status-pill.out_for_delivery { background: rgba(136, 6, 206, .12); color: var(--brand); }
.status-pill.delivered { background: rgba(8, 160, 69, .12); color: var(--green); }
.status-pill.cancelled,
.status-pill.payment_failed { background: rgba(226, 48, 9, .12); color: var(--red); }

.row {
  color: rgba(18, 19, 15, .74);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
}
.row strong {
  color: var(--ink);
  text-align: right;
  font-size: 12px;
  font-weight: 800;
  word-break: break-word;
}
.item-list {
  padding: 10px 12px;
  border-radius: 28px;
  background: #F7F7F9;
  color: var(--body);
  font-size: 12px;
  font-weight: 700;
  line-height: 17px;
}
.actions-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.actions-grid.three { grid-template-columns: 1fr 1fr 1fr; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: 342px;
  max-width: calc(100vw - 32px);
  padding: 12px 14px;
  border-radius: 28px;
  background: #12130F;
  color: #FDFDFF;
  font-size: 12px;
  font-weight: 800;
  z-index: 50;
  display: none;
  text-align: center;
  box-shadow: 0 12px 34px rgba(0,0,0,.22);
}

[hidden] { display: none !important; }

@supports (corner-shape: squircle) {
  .card,
  .login-card,
  .profile-card,
  .online-card,
  .stat-card,
  .order-card,
  .input,
  .phone-box,
  .btn,
  .icon-btn,
  .tab,
  .notice,
  .empty-card,
  .toast,
  .status-pill,
  .rider-avatar,
  .back-link,
  .item-list,
  .switch span,
  .switch span::after {
    corner-shape: squircle;
  }
}


.rider-order-map {
  width: 100%;
  height: 190px;
  border-radius: 32px;
  background: linear-gradient(135deg, rgba(8,160,69,.12), rgba(136,6,206,.12)), #F7F7F9;
  overflow: hidden;
  border: 1px solid rgba(18, 19, 15, 0.08);
}
.map-note {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 14px;
}
@supports (corner-shape: squircle) {
  .rider-order-map { corner-shape: squircle; }
}

/* =========================
   RIDER LIVE NAVIGATION V2
========================= */
.actions-grid.four {
  grid-template-columns: repeat(4, 1fr);
}

.delivery-nav-modal {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(18, 19, 15, 0.54);
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.delivery-nav-modal.is-open { display: flex; }
.delivery-nav-sheet {
  width: 390px;
  max-width: 100vw;
  height: 94dvh;
  background: #FDFDFF;
  color: #12130F;
  border-radius: 42px 42px 0 0;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 -18px 48px rgba(0, 0, 0, 0.28);
}
.nav-sheet-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 2px 2px 0;
}
.nav-kicker {
  color: var(--green);
  font-size: 11px;
  font-weight: 950;
  line-height: 12px;
  text-transform: uppercase;
  letter-spacing: .2px;
}
.nav-title {
  color: var(--ink);
  font-size: 22px;
  font-weight: 950;
  line-height: 26px;
  margin-top: 3px;
}
.nav-subtitle {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 16px;
  max-width: 270px;
  margin-top: 2px;
}
.nav-map-wrap {
  flex: 1;
  min-height: 360px;
  position: relative;
  overflow: hidden;
  border-radius: 34px;
  background: #F5F5F7;
  border: 1px solid rgba(18, 19, 15, 0.08);
}
.nav-live-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.nav-map-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 22px;
  color: rgba(18, 19, 15, 0.70);
  font-size: 12px;
  font-weight: 800;
  background: linear-gradient(135deg, rgba(253, 253, 255, .92), rgba(247, 247, 249, .82));
  z-index: 2;
}
.nav-map-wrap .maplibregl-ctrl-bottom-left,
.nav-map-wrap .maplibregl-ctrl-bottom-right {
  display: none;
}
.nav-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.nav-metrics > div {
  border-radius: 28px;
  background: #F7F7F9;
  border: 1px solid rgba(18, 19, 15, 0.06);
  padding: 10px;
}
.nav-metrics span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  line-height: 12px;
}
.nav-metrics strong {
  display: block;
  color: var(--ink);
  font-size: 15px;
  font-weight: 950;
  line-height: 18px;
  margin-top: 3px;
}
.nav-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
@media (max-width: 389px) {
  .delivery-nav-sheet { width: 100vw; }
  .actions-grid.four { grid-template-columns: repeat(2, 1fr); }
}

@supports (corner-shape: squircle) {
  .delivery-nav-sheet,
  .nav-map-wrap,
  .nav-metrics > div,
  .delivery-nav-modal .btn {
    corner-shape: squircle;
  }
}
