:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --ink: #0b1220;
  --muted: #667085;
  --line: #e4e7ec;
  --brand: #f5a623;
  --brand-dark: #c86f00;
  --success: #079455;
  --warning: #dc6803;
  --danger: #d92d20;
  --whatsapp: #128c7e;
  --shadow: 0 16px 42px rgba(11, 18, 32, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  overscroll-behavior-y: none;
  background:
    radial-gradient(circle at top right, rgba(245, 166, 35, 0.14), transparent 32%),
    linear-gradient(180deg, #f9fafb 0%, var(--bg) 36%);
}
button, input { font: inherit; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

.shell {
  width: min(720px, 100%);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px max(28px, env(safe-area-inset-bottom));
}

.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  margin-bottom: 18px;
}
.brand img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  padding: 5px;
  border-radius: 17px;
  background: #fff;
  box-shadow: var(--shadow);
}
.brand > div { min-width: 0; flex: 1; }
.brand p, .brand h1 { margin: 0; }
.brand p {
  color: var(--brand-dark);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.brand h1 { margin-top: 2px; font-size: clamp(1.35rem, 5vw, 1.75rem); line-height: 1.1; }
.app-mode {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255,255,255,.78);
  font-size: .72rem;
  font-weight: 900;
}

.card {
  margin-bottom: 14px;
  padding: 18px;
  border: 1px solid rgba(228,231,236,.92);
  border-radius: 23px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.card h1, .card h2, .card p { margin-top: 0; }
.card h2 { margin-bottom: 7px; font-size: 1.38rem; letter-spacing: -.02em; }
.card p { color: var(--muted); line-height: 1.5; }
.compact-card { padding-bottom: 14px; }
.eyebrow {
  display: block;
  margin-bottom: 6px;
  color: var(--brand-dark);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .1em;
  text-transform: uppercase;
}

label { display: block; margin: 14px 0 6px; font-weight: 800; }
input {
  width: 100%;
  min-height: 54px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  color: var(--ink);
  background: #fff;
}
#pinInput {
  text-align: center;
  font-size: 1.55rem;
  font-weight: 900;
  letter-spacing: .32em;
}
.field-help {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: .8rem;
}

.button {
  width: 100%;
  min-height: 56px;
  margin-top: 10px;
  padding: 13px 16px;
  border: 0;
  border-radius: 17px;
  font-weight: 900;
  cursor: pointer;
  transition: transform 120ms ease, opacity 120ms ease;
}
.button:active, .status-button:active { transform: scale(.985); }
.button:disabled, .status-button:disabled { cursor: not-allowed; opacity: .55; }
.button.primary { color: #111827; background: var(--brand); }
.button.secondary { color: var(--ink); background: #eef2f6; }
.button.whatsapp { color: #fff; background: var(--whatsapp); }
.button.danger { color: var(--danger); background: #fff1f0; }
.button.large { min-height: 84px; text-align: left; }
.button.large span, .button.large small { display: block; }
.button.large span { font-size: 1.12rem; }
.button.large small { margin-top: 5px; font-weight: 700; opacity: .7; }

.hero-card { padding-top: 22px; }
.web-limit {
  display: grid;
  gap: 3px;
  margin-top: 15px;
  padding: 13px 14px;
  border-radius: 15px;
  color: #93370d;
  background: #fffaeb;
  font-size: .87rem;
  line-height: 1.35;
}
.web-limit span { color: #a15c07; }

.install-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f8fafc;
}
.install-card > div { flex: 1; }
.install-card h2 { font-size: 1.05rem; }
.install-card p { margin-bottom: 0; font-size: .88rem; }
.icon-button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: #eaecf0;
  font-size: 1.3rem;
}

.tracking-health, .freshness-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid transparent;
  border-radius: 18px;
  background: #ecfdf3;
}
.tracking-health strong, .tracking-health span,
.freshness-card strong, .freshness-card span { display: block; }
.tracking-health span:not(.live-dot), .freshness-card span:not(.live-dot) {
  margin-top: 2px;
  color: var(--muted);
  font-size: .8rem;
}
.tracking-health.warning, .freshness-card.warning { border-color: #fedf89; background: #fffaeb; }
.tracking-health.paused, .freshness-card.paused { border-color: #fecdca; background: #fff6f5; }
.freshness-card.waiting { border-color: var(--line); background: #f8fafc; }
.live-dot {
  width: 11px;
  height: 11px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 6px rgba(7,148,85,.12);
}
.warning .live-dot { background: var(--warning); box-shadow: 0 0 0 6px rgba(220,104,3,.12); }
.paused .live-dot { background: var(--danger); box-shadow: 0 0 0 6px rgba(217,45,32,.12); }
.waiting .live-dot { background: #98a2b3; box-shadow: 0 0 0 6px rgba(152,162,179,.12); }

.status-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.status-card p { margin-bottom: 0; }
.badge {
  flex: 0 0 auto;
  padding: 8px 10px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 900;
}
.badge.waiting { color: #93370d; background: #fffaeb; }
.badge.live { color: #05603a; background: #ecfdf3; }
.badge.paused { color: #b42318; background: #fff1f0; }

.map-card { padding: 0; overflow: hidden; }
#driverMap, #publicMap {
  width: 100%;
  height: min(46vh, 390px);
  min-height: 300px;
  background: #e9eef3;
}
.map-footer {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  color: var(--muted);
  font-size: .83rem;
}
.map-link { flex: 0 0 auto; color: var(--brand-dark); font-weight: 900; text-decoration: none; }

.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.status-button {
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 17px;
  color: var(--ink);
  background: #fff;
  text-align: left;
  cursor: pointer;
}
.status-button strong, .status-button small { display: block; }
.status-button strong { font-size: .96rem; }
.status-button small { margin-top: 6px; color: var(--muted); line-height: 1.3; }
.status-button.active { border-color: var(--brand); background: #fffaeb; box-shadow: 0 0 0 2px rgba(245,166,35,.15); }
.actions-card { padding-top: 8px; }

.return-notice {
  position: fixed;
  z-index: 9999;
  top: max(12px, env(safe-area-inset-top));
  right: 12px;
  left: 12px;
  width: min(620px, calc(100% - 24px));
  margin: auto;
  padding: 14px 16px;
  border: 1px solid #fedf89;
  border-radius: 17px;
  color: #7a2e0e;
  background: #fffaeb;
  box-shadow: 0 16px 44px rgba(11,18,32,.18);
}
.return-notice strong, .return-notice span { display: block; }
.return-notice span { margin-top: 3px; font-size: .82rem; }
.toast {
  position: fixed;
  z-index: 10000;
  right: 16px;
  bottom: max(18px, env(safe-area-inset-bottom));
  left: 16px;
  width: min(560px, calc(100% - 32px));
  margin: auto;
  padding: 14px 16px;
  border-radius: 16px;
  color: #fff;
  background: var(--ink);
  box-shadow: 0 18px 48px rgba(11,18,32,.24);
  font-weight: 800;
  text-align: center;
}

footer { display: flex; justify-content: space-between; gap: 10px; padding: 8px 4px; color: var(--muted); font-size: .73rem; }
.public-status h2 { margin-bottom: 8px; }
.progress { display: grid; grid-template-columns: repeat(4,1fr); gap: 6px; margin-top: 16px; }
.progress-step { height: 7px; border-radius: 99px; background: #e4e7ec; }
.progress-step.active { background: var(--brand); }
.privacy-card { font-size: .93rem; }
.privacy-card p { margin: 4px 0 0; }
.error-card { border-color: #fecdca; background: #fff6f5; }
.centered { display: grid; min-height: 100vh; align-items: center; }
.hidden { display: none !important; }

@media (max-width: 520px) {
  .shell { padding-right: 12px; padding-left: 12px; }
  .card { padding: 16px; border-radius: 20px; }
  .status-grid { grid-template-columns: 1fr; }
  .status-button { min-height: 74px; }
  footer { flex-direction: column; text-align: center; }
}
