:root {
  --ink: #14221c;
  --muted: #5d6f66;
  --line: #e4ebe6;
  --paper: #f6f3ee;
  --card: #ffffff;
  --green: #0f6e56;
  --green-dark: #0a4d3c;
  --green-soft: #e6f4ee;
  --gold: #e3a12b;
  --gold-soft: #fff4dc;
  --danger: #c4452d;
  --danger-soft: #fdecea;
  --ok: #1b8a5a;
  --ok-soft: #e8f7ef;
  --warn: #c47b12;
  --shadow: 0 10px 30px rgba(20, 34, 28, 0.08);
  --radius: 22px;
  --nav-h: 76px;
  --header-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: #d9cfc0;
  color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
}

button, input, select, textarea {
  font-family: inherit;
}

img { max-width: 100%; }

.phone-shell {
  min-height: 100%;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  position: relative;
}

.status-bar {
  display: none;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: var(--header-h);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #0f6e56 0%, #0c5c48 100%);
  color: #fff;
}

.header-title-wrap { flex: 1; min-width: 0; }
.header-kicker {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.75;
}
.header-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-btn {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 14px;
  background: rgba(255,255,255,0.12);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.app-main {
  flex: 1;
  padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 16px);
  min-height: 0;
}

.app-main.auth-screen {
  padding: 0;
  background: var(--green-dark);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + var(--safe-b));
  padding: 8px 8px var(--safe-b);
  background: #fff;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  z-index: 30;
}

.nav-item {
  position: relative;
  border: 0;
  background: transparent;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 600;
  min-height: 52px;
}

.nav-item i { font-size: 20px; }
.nav-item.active { color: var(--green); }

.nav-badge {
  position: absolute;
  top: 2px;
  right: calc(50% - 22px);
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 99px;
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  display: grid;
  place-items: center;
}

.auth-hero {
  padding: 48px 24px 28px;
  color: #fff;
}
.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  background: var(--gold);
  color: var(--ink);
  display: grid;
  place-items: center;
  font-size: 28px;
  margin-bottom: 18px;
}
.auth-hero h1 {
  font-size: 32px;
  font-weight: 800;
  margin: 0 0 8px;
}
.auth-hero p {
  margin: 0;
  opacity: 0.82;
  font-size: 15px;
}

.auth-sheet {
  background: var(--paper);
  border-radius: 28px 28px 0 0;
  padding: 24px 16px 32px;
  min-height: 62vh;
}

.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}
.field .form-control,
.field .form-select {
  min-height: 52px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 16px;
  padding: 12px 14px;
}
.field .form-control:focus,
.field .form-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(15, 110, 86, 0.12);
}

.input-with-icon {
  position: relative;
}
.input-with-icon i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--green);
  font-size: 18px;
}
.input-with-icon .form-control {
  padding-left: 44px;
}

.btn-main {
  min-height: 54px;
  border: 0;
  border-radius: 16px;
  background: var(--green);
  color: #fff;
  font-weight: 700;
  font-size: 16px;
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn-main:disabled { opacity: 0.6; }
.btn-main.gold { background: var(--gold); color: var(--ink); }

.btn-ghost {
  min-height: 48px;
  border: 0;
  background: transparent;
  color: var(--green);
  font-weight: 700;
  width: 100%;
}

.btn-soft {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 700;
  padding: 0 16px;
}

.btn-danger-soft {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--danger-soft);
  color: var(--danger);
  font-weight: 700;
  width: 100%;
}

.btn-ok {
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--ok);
  color: #fff;
  font-weight: 700;
}

.demo-box {
  background: #fff;
  border: 1px dashed #c9d8cf;
  border-radius: 16px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font-size: 13px;
}
.demo-box strong { display: block; margin-bottom: 4px; }
.demo-box button {
  border: 0;
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
  margin: 6px 6px 0 0;
}

.card-soft {
  background: var(--card);
  border: 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.search-card {
  background: #fff;
  border-radius: 24px;
  padding: 18px 16px;
  box-shadow: var(--shadow);
}

.route-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
}
.route-dots {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 16px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
}
.dot.end { background: var(--gold); }
.dot-line {
  width: 2px;
  flex: 1;
  min-height: 28px;
  background: #cfe0d7;
  margin: 4px 0;
}

.gps-btn {
  border: 0;
  background: var(--gold-soft);
  color: #8a5a00;
  font-weight: 700;
  font-size: 13px;
  border-radius: 12px;
  min-height: 40px;
  width: 100%;
  margin-bottom: 14px;
}

.ride-card {
  background: #fff;
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  text-align: left;
  width: 100%;
  border: 0;
}
.ride-card .time {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1;
}
.ride-card .route {
  font-size: 16px;
  font-weight: 700;
  margin: 8px 0 12px;
}
.meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 12px;
}
.price {
  font-size: 18px;
  font-weight: 800;
  color: var(--green-dark);
}
.seats-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 700;
}
.seats-pill.low { background: var(--gold-soft); color: #8a5a00; }

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
}
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }

.stars { color: var(--gold); letter-spacing: 1px; font-size: 13px; }

.state-box {
  text-align: center;
  padding: 48px 16px;
}
.state-box i {
  font-size: 42px;
  color: var(--green);
  display: block;
  margin-bottom: 12px;
}
.state-box h2 { font-size: 20px; margin-bottom: 8px; }
.state-box p { color: var(--muted); margin-bottom: 18px; }

.detail-hero {
  background: #fff;
  border-radius: 24px;
  padding: 20px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}
.info-list {
  background: #fff;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.info-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.info-row:last-child { border-bottom: 0; }
.info-row span { color: var(--muted); }
.info-row strong { text-align: right; }

.badge-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}
.badge-PENDENTE { background: var(--gold-soft); color: #8a5a00; }
.badge-ACEITE { background: var(--ok-soft); color: var(--ok); }
.badge-REJEITADA,
.badge-CANCELADA { background: var(--danger-soft); color: var(--danger); }
.badge-CONCLUIDA { background: var(--green-soft); color: var(--green-dark); }

.success-panel {
  background: #fff;
  border-radius: 24px;
  padding: 28px 18px;
  text-align: center;
  box-shadow: var(--shadow);
}
.success-panel .icon-circle {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--ok-soft);
  color: var(--ok);
  display: grid;
  place-items: center;
  font-size: 32px;
}

.action-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

.note-card {
  background: #fff;
  border-radius: 18px;
  padding: 14px;
  box-shadow: var(--shadow);
  margin-bottom: 10px;
  text-align: left;
  width: 100%;
  border: 0;
}
.note-card.unread { border-left: 4px solid var(--gold); }
.note-card small { color: var(--muted); }

.toast-stack {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(var(--nav-h) + 16px);
  z-index: 80;
  display: grid;
  gap: 8px;
  pointer-events: none;
}
.toast-msg {
  pointer-events: auto;
  background: var(--ink);
  color: #fff;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: var(--shadow);
}
.toast-msg.error { background: var(--danger); }
.toast-msg.ok { background: var(--ok); }

.skeleton {
  background: linear-gradient(90deg, #eee 25%, #f7f7f7 37%, #eee 63%);
  background-size: 400% 100%;
  animation: shine 1.2s ease infinite;
  border-radius: 18px;
  height: 128px;
  margin-bottom: 12px;
}

@keyframes shine {
  0% { background-position: 100% 0; }
  100% { background-position: 0 0; }
}

.sticky-cta {
  position: sticky;
  bottom: calc(var(--nav-h) + var(--safe-b) + 8px);
  margin-top: 16px;
}

.profile-head {
  background: #fff;
  border-radius: 24px;
  padding: 22px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.role-chip {
  display: inline-block;
  margin-top: 8px;
  background: var(--green-soft);
  color: var(--green-dark);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 800;
}

@media (min-width: 768px) {
  body {
    display: grid;
    place-items: center;
    padding: 24px 12px;
  }
  .phone-shell {
    width: 390px;
    height: min(860px, 92vh);
    min-height: unset;
    border-radius: 36px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(20, 34, 28, 0.22);
    border: 10px solid #1b1b1b;
  }
  .status-bar {
    display: flex;
    justify-content: space-between;
    padding: 8px 22px 0;
    font-size: 12px;
    font-weight: 700;
    background: var(--green-dark);
    color: #fff;
  }
  .bottom-nav {
    position: absolute;
    left: 0;
    right: 0;
  }
  .toast-stack {
    left: calc(50% - 183px);
    right: auto;
    width: 358px;
    bottom: 110px;
  }
}

@media (min-width: 1024px) {
  .phone-shell { width: 430px; }
  .toast-stack { left: calc(50% - 203px); width: 390px; }
}
