/* ══════════════════════════════════════════════════════════════
   MCZ Sat — app do cliente
   O app é sempre renderizado em dimensões de celular (428 × 908).
   Em telas grandes, as laterais ficam em branco para deixar claro
   que se trata de um layout de aplicativo móvel.
   ══════════════════════════════════════════════════════════════ */

:root {
  --app-w: 428px;
  --app-h: 908px;

  --navy: #2b2b52;
  --ink: #1e2130;
  --ink-2: #3a3f4d;
  --muted: #7a7f8c;
  --muted-2: #9aa0ac;
  --muted-3: #b0b5c0;
  --blue: #19a9dd;
  --blue-dark: #0e6f9c;
  --blue-soft: #e2f2fa;
  --green: #1f8a54;
  --green-soft: #e7f6ee;
  --red: #c23b3b;
  --red-dark: #a82c2c;
  --red-soft: #fdeaea;
  --bg: #f4f5f8;
  --surface: #fff;
  --line: #f0f1f4;
  --shadow-sm: 0 1px 3px rgba(43, 43, 82, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: #fff;             /* espaços laterais em branco */
  color: var(--ink);
  font-family: 'Instrument Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

/* ── Palco (desktop) ─────────────────────────────────────────── */

.stage {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 24px;
}

.device {
  width: var(--app-w);
  height: min(var(--app-h), calc(100vh - 170px));
  flex: none;
  background: #10101f;
  border-radius: 46px;
  padding: 11px;
  box-shadow:
    0 0 0 1px rgba(16, 16, 31, .06),
    0 30px 70px -20px rgba(43, 43, 82, .38);
}

.device__screen {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 36px;
  background: var(--bg);
}

.stage__caption {
  margin: 0;
  font-size: 12.5px;
  letter-spacing: .04em;
  color: #b6bac4;
  text-transform: uppercase;
}

/* ── Atalho para o portal web ────────────────────────────────── */

.stage__top {
  width: var(--app-w);
  max-width: 100%;
  flex: none;
  display: flex;
}

.tosite {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px 9px 12px;
  border: 1px solid #e6e8ee;
  border-radius: 100px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: 13.5px;
  font-weight: 600;
  color: #1499cf;
  text-decoration: none;
}

.tosite:hover { background: var(--blue-soft); border-color: #cfe7f4; }

/* ── Modo celular real: ocupa a tela inteira ─────────────────── */

@media (max-width: 520px), (max-height: 620px) {
  .stage { padding: 0; gap: 0; min-height: 100vh; min-height: 100dvh; }
  .device {
    width: 100%;
    height: 100vh;
    height: 100dvh;
    padding: 0;
    border-radius: 0;
    background: var(--bg);
    box-shadow: none;
  }
  .device__screen { border-radius: 0; }
  .stage__caption { display: none; }

  /* O atalho vira uma faixa no topo e o app ocupa o resto da tela. */
  .stage__top {
    width: 100%;
    padding: calc(8px + env(safe-area-inset-top)) 14px 8px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
  }

  .device { flex: 1 1 auto; height: auto; min-height: 0; display: flex; }
  .device__screen { flex: 1; height: auto; min-height: 0; }

  /* A faixa já respeita o notch; evita somar duas vezes. */
  .screen { padding-top: 0; }
}

/* ── Telas ───────────────────────────────────────────────────── */

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
}

.screen.is-active { display: flex; }

/* ── Barra superior ──────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 12px;
  flex: none;
}

.topbar__title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
}

.spacer { flex: 1; }

.brand { height: 36px; border-radius: 8px; }

.icon-btn {
  position: relative;
  width: 42px;
  height: 42px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(43, 43, 82, .10);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .12s ease;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn--dark { background: var(--navy); box-shadow: none; }

.icon-btn .dot {
  position: absolute;
  top: 9px;
  right: 10px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e05252;
  border: 2px solid #fff;
}
.icon-btn .dot[hidden] { display: none; }

.link-btn {
  border: none;
  background: none;
  font-size: 13.5px;
  font-weight: 600;
  color: #1499cf;
  cursor: pointer;
  padding: 4px;
}

/* ── Mapa ────────────────────────────────────────────────────── */

.map {
  position: relative;
  flex: 1;
  min-height: 240px;
  margin: 0 12px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(43, 43, 82, .12);
  background: #cfd4dc;
}

.map__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.marker {
  position: absolute;
  left: 50%;
  top: 44%;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
}
.marker__plate {
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 4px 9px;
  border-radius: 7px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}
.marker__stem { width: 2px; height: 8px; background: var(--navy); }
.marker__dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--blue);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .4);
}

.map__refresh {
  position: absolute;
  right: 12px;
  bottom: 14px;
  width: 46px;
  height: 46px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.map__refresh:active { transform: scale(.94); }
.map__refresh .gps[hidden],
.map__refresh .spinner[hidden] { display: none; }

.spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2.5px solid #cfe9f5;
  border-top-color: var(--blue);
  animation: mczspin .8s linear infinite;
}
@keyframes mczspin { to { transform: rotate(360deg); } }

/* ── Cartão do veículo ───────────────────────────────────────── */

.sheet {
  flex: none;
  background: var(--surface);
  border-radius: 24px 24px 0 0;
  margin-top: 14px;
  padding: 20px 20px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 20px rgba(43, 43, 82, .10);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sheet__head { display: flex; align-items: flex-start; gap: 12px; }

.vehicle { flex: 1; min-width: 0; }
.vehicle__plate { font-size: 24px; font-weight: 700; letter-spacing: .04em; }
.vehicle__model { font-size: 14px; color: var(--muted); margin-top: 2px; }

.pill {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 12px;
  border-radius: 100px;
  white-space: nowrap;
}
.pill[hidden] { display: none; }
.pill--ok { background: var(--green-soft); color: var(--green); }
.pill--danger { background: var(--red-soft); color: var(--red); }
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

.location { display: flex; align-items: flex-start; gap: 9px; }
.location svg { margin-top: 2px; flex: none; }
.location__name { font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
.location__time { font-size: 12.5px; color: var(--muted-2); margin-top: 1px; }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat {
  background: #f2f3f6;
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #8b909c;
}
.stat__label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: .05em;
}
.stat__value { font-size: 15px; font-weight: 700; color: var(--ink); }
#statIgnition .stat__value { color: #5a5f6b; }
#statIgnition.is-on { background: #e8f7ee; color: var(--green); }
#statIgnition.is-on .stat__label { color: #5f9c7c; }
#statIgnition.is-on .stat__value { color: var(--green); }

/* ── Botão “segurar 2s” ──────────────────────────────────────── */

.hold {
  position: relative;
  overflow: hidden;
  border: none;
  border-radius: 16px;
  height: 56px;
  cursor: pointer;
  background: var(--red-soft);
  color: var(--red-dark);
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}
.hold__fill {
  position: absolute;
  inset: 0;
  width: 0;
  background: #f3b1b1;
}
.hold__content {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  height: 100%;
  font-size: 15.5px;
  font-weight: 700;
  color: inherit;
}
.hold.is-blocked { background: var(--blue-soft); color: var(--blue-dark); }
.hold.is-blocked .hold__fill { background: #a3d9ef; }

.hint {
  margin: -4px 0 0;
  font-size: 11.5px;
  color: var(--muted-3);
  text-align: center;
}

/* ── Modal de pesquisa ───────────────────────────────────────── */

.search {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
}
.search[hidden] { display: none; }

.search__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30, 33, 48, .32);
  animation: fadeIn .16s ease;
}

.search__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  max-height: 100%;
  background: var(--bg);
  border-radius: 0 0 24px 24px;
  box-shadow: 0 12px 32px rgba(43, 43, 82, .22);
  padding-top: env(safe-area-inset-top);
  animation: slideDown .2s cubic-bezier(.22, .8, .3, 1);
}

@keyframes fadeIn { from { opacity: 0; } }
@keyframes slideDown { from { transform: translateY(-14px); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .search__backdrop, .search__panel { animation: none; }
}

.search__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 12px;
  flex: none;
}

.search__field {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 42px;
  padding: 0 12px;
  background: var(--surface);
  border-radius: 100px;
  box-shadow: 0 1px 3px rgba(43, 43, 82, .10);
}
.search__field svg { flex: none; }

.search__field input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: none;
  font-family: inherit;
  font-size: 15px;
  color: var(--ink);
}
.search__field input::placeholder { color: var(--muted-2); }
.search__field input::-webkit-search-cancel-button { display: none; }

.search__clear {
  border: none;
  background: none;
  padding: 2px;
  display: flex;
  cursor: pointer;
  flex: none;
}
.search__clear[hidden] { display: none; }

.search__body {
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 16px;
}

.search__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.search__head[hidden] { display: none; }
.search__head .list__group { margin: 6px 2px; }
.search__head .link-btn { padding: 4px 2px; }

.search__empty {
  margin: 18px 2px 6px;
  font-size: 13.5px;
  color: var(--muted-2);
  text-align: center;
}
.search__empty[hidden] { display: none; }

.results {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.result {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border-radius: 14px;
  padding: 11px 12px;
  box-shadow: var(--shadow-sm);
}

.result__main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  border: none;
  background: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.result__icon {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  background: #f2f3f6;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.result__icon--blue { background: var(--blue-soft); }

.result__title {
  display: block;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.result__title mark { background: none; color: var(--blue-dark); }
.result__sub {
  display: block;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result__remove {
  border: none;
  background: none;
  padding: 6px;
  display: flex;
  cursor: pointer;
  flex: none;
}

/* ── Listas (notificações / conta) ───────────────────────────── */

.list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 16px calc(16px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.list__group {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: .08em;
  margin: 6px 2px 0;
}

.card {
  background: var(--surface);
  border-radius: 16px;
  padding: 14px;
  display: flex;
  gap: 12px;
  box-shadow: var(--shadow-sm);
}
.card--vehicle { align-items: center; gap: 13px; padding: 16px; }
.card.is-read { opacity: .55; }

.card__icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.card__icon--lg { width: 44px; height: 44px; }
.card__icon--blue { background: var(--blue-soft); }
.card__icon--gray { background: #f2f3f6; }
.card__icon--red { background: var(--red-soft); }

.card__title { font-size: 14.5px; font-weight: 600; }
.card__title--plate { font-size: 15px; font-weight: 700; letter-spacing: .03em; }
.card__text { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card__time { font-size: 12px; color: var(--muted-3); margin-top: 4px; }

.grow { flex: 1; min-width: 0; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }

/* ── Perfil ──────────────────────────────────────────────────── */

.profile {
  background: var(--navy);
  border-radius: 20px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}
.profile__avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.profile__name { font-size: 17px; font-weight: 700; color: #fff; }
.profile__since { font-size: 13px; color: #aeb3d6; margin-top: 2px; }

/* ── Menu ────────────────────────────────────────────────────── */

.menu {
  background: var(--surface);
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.menu__item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 15px 16px;
  border: none;
  background: none;
  text-align: left;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.menu__item:last-child { border-bottom: none; }
.menu__item:active { background: #fafbfc; }
/* Suporte via WhatsApp — mesmo item, mas é um link. */
.menu__item--wa { text-decoration: none; }
.menu__item--wa .menu__value { color: #1eae55; font-weight: 600; }
.menu__label { flex: 1; font-size: 14.5px; font-weight: 500; color: var(--ink-2); }
.menu__value { font-size: 13px; color: var(--muted-2); }
.menu__chevron { flex: none; }

.logout {
  border: none;
  background: var(--surface);
  border-radius: 16px;
  padding: 15px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--red);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.version { text-align: center; font-size: 12px; color: var(--muted-3); margin: 0; }
