/* Estilo comum do prototipo (Dashboard, Historico...): cores, menu lateral, cards. */
:root {
  --bg: #06070d;
  --panel: rgba(255, 255, 255, 0.035);
  --panel-2: rgba(255, 255, 255, 0.055);
  --line: rgba(255, 255, 255, 0.08);
  --text: #eceef6;
  --muted: #8b90a7;
  --faint: #5c6178;
  --violet: #a855f7;
  --indigo: #6366f1;
  --blue: #3b82f6;
  --magenta: #e040fb;
  --pink: #f0509a;
  --ok: #22d07a;
  --warn: #f5a524;
  --bad: #ff4d6a;
  --gray: #5c6178;
  --radius: 18px;
  color-scheme: dark; /* lista aberta dos combobox, barras de rolagem e calendario no tema escuro */
}
* { box-sizing: border-box; }
/* Itens da lista dos combobox: o Windows abre a lista com fundo branco e o texto herdava o branco do tema */
select option, select optgroup { background: #14161f; color: var(--text); }
html, body { margin: 0; min-height: 100%; }
body {
  background:
    radial-gradient(900px 500px at 38% 42%, rgba(124, 58, 237, 0.16), transparent 70%),
    radial-gradient(700px 400px at 60% 60%, rgba(59, 130, 246, 0.10), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 14px/1.4 Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

/* ---------- Menu lateral ---------- */
aside {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.01));
  padding: 26px 18px; display: flex; flex-direction: column; gap: 28px;
  position: sticky; top: 0; height: 100vh;
}
.logo { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 700; letter-spacing: 0.06em; font-size: 17px; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--magenta), var(--indigo) 60%, var(--blue));
  box-shadow: 0 0 18px rgba(168, 85, 247, 0.55);
}
.logo-mark svg { width: 17px; height: 17px; color: #fff; }
nav { display: grid; gap: 4px; }
nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: #b9bdd0; text-decoration: none; font-weight: 500; border: 1px solid transparent;
}
nav a svg { width: 18px; height: 18px; color: var(--muted); }
nav a:hover { background: var(--panel); color: var(--text); }
nav a.active {
  color: #fff; border-color: rgba(168, 85, 247, 0.55);
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.55), rgba(99, 102, 241, 0.35));
  box-shadow: 0 0 22px rgba(168, 85, 247, 0.35), inset 0 0 12px rgba(255, 255, 255, 0.06);
}
nav a.active svg { color: #fff; }
nav a.back { color: #c9cce0; border-color: var(--line); margin-bottom: 10px; }
nav a .soon { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.car-pick {
  margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel); position: relative;
}
.car-pick img { width: 64px; height: 32px; object-fit: contain; }
.car-pick .thumb-blank { width: 64px; height: 32px; display: grid; place-items: center; color: var(--muted); }
.car-pick strong { display: block; font-size: 13px; }
.car-pick small { color: var(--muted); font-size: 11px; }
.car-pick select { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.car-pick svg.chev { margin-left: auto; width: 16px; color: var(--muted); }
/* Usuario logado no rodape do menu */
.me { display: flex; align-items: center; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); margin-top: -14px; }
aside > .me:nth-child(3) { margin-top: auto; }
.me:empty { display: none; }
nav a[hidden] { display: none; }
.logo-sub { display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--violet); margin-top: 1px; }
.empty-cars { max-width: 560px; margin: 60px auto 0; text-align: center; padding: 34px 28px; display: grid; gap: 10px; justify-items: center; }
.empty-cars svg { width: 40px; height: 40px; color: var(--violet); }
.empty-cars p { margin: 0; }
/* Pedido de transferencia esperando o dono */
#tr-banner, #dr-banner { display: grid; gap: 10px; }
a.tr-btn { text-decoration: none; display: inline-block; }
.tr-req { display: flex; gap: 14px; align-items: flex-start; border-color: rgba(245, 165, 36, .45); background: rgba(245, 165, 36, .07); }
.tr-req > svg { width: 22px; height: 22px; color: var(--warn); flex: none; margin-top: 2px; }
.tr-req > div:nth-child(2) { flex: 1; min-width: 0; }
.tr-req p { margin: 6px 0; color: #c9cce0; font-size: 13px; }
.tr-req small { color: var(--muted); }
.tr-acts { display: flex; gap: 8px; flex: none; }
.tr-btn { font: 600 13px Inter, sans-serif; border-radius: 10px; padding: 8px 14px; cursor: pointer; border: 1px solid var(--line);
  background: transparent; color: #c9cce0; }
.tr-btn.ok { background: var(--ok); border-color: var(--ok); color: #06120b; }
@media (max-width: 700px) { .tr-req { flex-wrap: wrap; } }
.me-who { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; color: var(--text); text-decoration: none; padding: 4px 6px; border-radius: 12px; }
.me-who:hover { background: var(--panel); }
.me-who > span { min-width: 0; }
.me-who strong { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-who small { color: var(--muted); font-size: 11px; }
.me-av { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; }
.ini { display: grid; place-items: center; font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--magenta), var(--indigo)); }
.me-out { background: none; border: 1px solid var(--line); border-radius: 10px; width: 34px; height: 34px; display: grid; place-items: center;
  color: var(--muted); cursor: pointer; flex: none; }
.me-out:hover { color: var(--text); background: var(--panel); }
.me-out svg { width: 16px; height: 16px; }

/* ---------- Conteudo ---------- */
main { padding: 30px 34px 40px; display: grid; gap: 20px; align-content: start; min-width: 0; }
header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
h1 { margin: 0; font-size: 30px; font-weight: 600; letter-spacing: -0.01em; }
.online-line { margin-top: 6px; color: #c9cce0; display: flex; align-items: center; gap: 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.off { background: var(--gray); }
.online-line b.ok { color: var(--ok); font-weight: 600; }
.online-line b.off { color: var(--muted); font-weight: 600; }
.weather { text-align: right; color: #c9cce0; }
.weather .row { display: flex; align-items: center; gap: 10px; justify-content: flex-end; font-size: 15px; }
.weather svg { width: 22px; height: 22px; color: #c9cce0; }
.weather small { display: block; color: var(--muted); margin-top: 4px; font-size: 12px; }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04), 0 10px 40px rgba(0, 0, 0, 0.35);
  padding: 18px 20px; min-width: 0;
}
.card h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head a, .link { color: #b8a4ff; text-decoration: none; font-size: 12px; font-weight: 500; }
.muted { color: var(--muted); }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }

.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.pill.ok { color: var(--ok); background: rgba(34, 208, 122, 0.12); }
.pill.warn { color: var(--warn); background: rgba(245, 165, 36, 0.12); }
.pill.bad { color: var(--bad); background: rgba(255, 77, 106, 0.12); }
.hint { color: var(--faint); font-size: 11px; margin: 10px 0 0; }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  aside { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  nav { display: flex; flex-wrap: wrap; }
  .car-pick { margin-top: 0; }
  main { padding: 20px 16px; }
}

/* Paineis lado a lado num quadro so (graficos do acelerometro: laboratorio, Dados Online, Historico). Empilham em telas menores. */
.panels { display: grid; gap: 14px; align-items: start; }
.panels.p4 { grid-template-columns: 1fr 1.25fr 1fr 1fr; }
.panels.p3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.panels.p2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panels figure { margin: 0; min-width: 0; background: var(--panel-2); border-radius: 14px; padding: 10px 10px 6px; }
.panels figcaption { font-size: 12px; color: #c9cce0; margin-bottom: 4px; }
.panels svg { display: block; width: 100%; max-height: 300px; }
.panels canvas { display: block; width: 100%; }
.panels svg text { font-family: Inter, system-ui, sans-serif; }
@media (max-width: 1300px) { .panels.p4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) { .panels.p3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .panels.p4, .panels.p3, .panels.p2 { grid-template-columns: 1fr; } }

/* Mapa do GPS (map.js): Dados Online e Historico. OpenStreetMap escurecido para o tema */
.trackmap { height: 320px; border-radius: 14px; background: #0b0d16; z-index: 0; }
.trackmap .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.75) contrast(.95) saturate(.6); }
.map-foot { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin-top: 10px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 12px; }
.map-legend i { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }
.car-dot i { display: block; width: 14px; height: 14px; margin: 4px; border-radius: 50%; background: #6366f1; border: 2px solid #fff;
  box-shadow: 0 0 0 0 rgba(99, 102, 241, .6); }
.car-dot.moving i { animation: car-pulse 1.6s infinite; }
@keyframes car-pulse { 0% { box-shadow: 0 0 0 0 rgba(99, 102, 241, .6); } 100% { box-shadow: 0 0 0 16px rgba(99, 102, 241, 0); } }
.map-btn { font: 500 12.5px Inter, sans-serif; color: var(--text, #e6e7f0); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line, rgba(255,255,255,.1));
  border-radius: 8px; padding: 6px 12px; cursor: pointer; }
.map-btn:hover { background: rgba(255, 255, 255, 0.1); }

/* Botao com cara de link (ex.: "Gerar token de novo" em Configuracoes -> Aparelhos) */
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--violet); cursor: pointer; text-decoration: underline; }
.link-btn:hover { color: var(--text); }
