:root {
  --ink: #172a3a;
  --muted: #6b7b89;
  --line: #e4e9ed;
  --paper: #ffffff;
  --canvas: #f4f7f9;
  --navy: #203b4d;
  --teal: #0e9587;
  --teal-dark: #087568;
  --orange: #e1a23a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--canvas); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.topbar { height: 72px; display: flex; align-items: center; gap: 40px; padding: 0 5vw; background: var(--paper); border-bottom: 1px solid var(--line); }
.brand, .login-brand { display: flex; align-items: center; gap: 11px; color: var(--navy); font-weight: 800; letter-spacing: -.02em; }
.brand em { color: var(--teal); font-style: normal; font-weight: 500; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: white; background: linear-gradient(135deg, var(--teal), #23b6a4); font-size: 11px; letter-spacing: .02em; box-shadow: 0 7px 15px #0e95872b; }
.nav-links { display: flex; gap: 26px; height: 100%; align-items: center; flex: 1; }
.nav-links a { color: var(--muted); font-size: 14px; font-weight: 700; }
.nav-links a:hover { color: var(--teal-dark); }
.account { display: flex; align-items: center; gap: 16px; color: var(--muted); font-size: 13px; }
.link-button { border: 0; background: transparent; padding: 0; color: var(--teal-dark); font-weight: 800; cursor: pointer; }
.page-wrap { width: min(1180px, 90vw); margin: 0 auto; padding: 48px 0 70px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 30px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 9px; justify-content: end; }
.hero.compact { align-items: center; }
.hero h1 { margin: 7px 0 9px; font-size: clamp(30px, 4vw, 46px); letter-spacing: -.045em; line-height: 1.04; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }
.eyebrow { color: var(--teal-dark); font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.outline-button, .primary-button, .primary-small, .table-button { border: 0; border-radius: 10px; cursor: pointer; font-weight: 800; transition: transform .15s ease, background .15s ease, box-shadow .15s ease; }
.outline-button { padding: 12px 15px; border: 1px solid #b8d9d5; color: var(--teal-dark); background: transparent; font-size: 13px; }
.outline-button:hover, .primary-small:hover, .primary-button:hover { transform: translateY(-1px); }
.overview { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; margin-bottom: 38px; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--line); }
.overview > div { min-height: 108px; padding: 21px 24px; background: var(--paper); }
.overview span, .metric span { display: block; color: var(--muted); font-size: 12px; }
.overview strong { display: block; margin-top: 9px; color: var(--navy); font-size: 26px; letter-spacing: -.03em; }
.section-heading, .panel-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; margin-bottom: 15px; }
.section-heading h2, .panel-heading h2, .admin-action h2 { margin: 6px 0 0; color: var(--navy); font-size: 20px; letter-spacing: -.03em; }
.muted { color: var(--muted); font-size: 13px; }
.reports-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.report-card, .panel, .admin-action { border: 1px solid var(--line); border-radius: 14px; background: var(--paper); box-shadow: 0 8px 26px #203b4d08; }
.report-card { overflow: hidden; }
.report-card-head { display: flex; align-items: start; justify-content: space-between; padding: 21px 22px 17px; border-bottom: 1px solid #edf0f2; }
.report-card h3 { margin: 6px 0 0; color: var(--navy); font-size: 23px; letter-spacing: -.03em; }
.report-status { padding: 5px 9px; border-radius: 99px; background: #e9f7f2; color: #13816f; font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.eyebrow.support { color: #a26a10; }
.eyebrow.client { color: var(--teal-dark); }
.report-metrics { display: grid; grid-template-columns: repeat(4, 1fr); padding: 18px 22px 20px; gap: 8px; }
.metric { min-width: 0; }
.metric strong { display: block; margin-top: 5px; color: var(--navy); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.report-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 14px 22px; background: #fbfcfd; border-top: 1px solid #edf0f2; }
.primary-small { display: inline-flex; align-items: center; gap: 9px; padding: 10px 13px; color: white; background: var(--teal); font-size: 12px; }
.primary-small:hover { background: var(--teal-dark); }
.downloads { display: flex; gap: 12px; }
.download-link { color: var(--muted); font-size: 11px; font-weight: 800; }
.download-link:hover { color: var(--teal-dark); }
.admin-action { display: flex; align-items: center; justify-content: space-between; gap: 25px; padding: 20px 22px; margin: 0 0 38px; border-left: 4px solid var(--orange); }
.admin-action p { margin: 7px 0 0; color: var(--muted); font-size: 13px; }
.generate-form { display: flex; gap: 9px; align-items: center; }
input, select { width: 100%; padding: 11px 12px; color: var(--ink); background: #fbfcfd; border: 1px solid #d7e0e5; border-radius: 9px; outline: none; }
input:focus { border-color: var(--teal); box-shadow: 0 0 0 3px #0e958718; }
select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px #0e958718; }
input[type=date] { width: 155px; }
.primary-button { display: inline-flex; justify-content: center; align-items: center; gap: 11px; padding: 12px 16px; color: white; background: var(--teal); box-shadow: 0 8px 16px #0e958729; }
.primary-button:hover { background: var(--teal-dark); }
.empty-state { display: grid; grid-column: 1 / -1; justify-items: center; gap: 7px; padding: 60px 20px; color: var(--muted); border: 1px dashed #cdd9de; border-radius: 14px; background: #fbfcfd; }
.empty-state strong { color: var(--navy); }
.large { min-height: 240px; }
.auth-body { display: grid; min-height: 100vh; place-items: center; background: radial-gradient(circle at 12% 5%, #d9f3ee, transparent 35%), var(--canvas); }
.auth-body .page-wrap { width: min(430px, 90vw); padding: 30px 0; }
.login-card { padding: 38px; border: 1px solid var(--line); border-radius: 17px; background: var(--paper); box-shadow: 0 22px 70px #203b4d17; }
.login-brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: .01em; }
.login-card h1 { margin: 38px 0 9px; color: var(--navy); font-size: 28px; letter-spacing: -.045em; }
.login-card .muted { line-height: 1.5; }
.stack-form { display: grid; gap: 15px; margin-top: 27px; }
label { display: grid; gap: 7px; color: var(--navy); font-size: 12px; font-weight: 800; }
label small, .optional { color: var(--muted); font-size: 11px; font-weight: 500; }
.error-box, .notice { margin-top: 18px; padding: 11px 13px; border-radius: 9px; color: #934036; background: #fff0ed; border: 1px solid #f3c7bf; font-size: 13px; }
.notice { margin: 0 0 22px; color: #146f5e; background: #eaf8f4; border-color: #b9e6dc; }
.user-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 18px; align-items: start; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
.compact-form { margin-top: 18px !important; padding-top: 18px; border-top: 1px solid var(--line); }
.error-text { color: #a63d35 !important; }
.panel { padding: 23px; }
.report-builder { margin-bottom: 18px; }
.report-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; margin-top: 20px; }
.report-form .only-speeding { display: flex; align-items: center; gap: 8px; align-self: center; }
.report-form .only-speeding input { width: auto; accent-color: var(--teal); }
.report-form small { color: var(--muted); font-size: 11px; font-weight: 500; }
.form-actions { display: flex; align-items: end; justify-content: end; }
.type-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.type-card { display: grid; gap: 6px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; background: #fbfcfd; }
.type-card strong { color: var(--navy); font-size: 13px; }
.type-card span { color: var(--muted); font-size: 11px; line-height: 1.4; }
.results-panel { padding: 0; overflow: hidden; }
.results-table { min-width: 900px; }
.results-table td { white-space: nowrap; }
.results-table tr.speeding td { background: #fff5e5; color: #87520c; }
.vehicle-overview { grid-template-columns: repeat(3, 1fr); }
.report-visuals, .live-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 18px; margin: 0 0 18px; }
.map-widget, .speed-widget, .live-map-panel, .live-vehicles-panel { min-width: 0; }
.report-map, .live-map { height: 370px; overflow: hidden; border-radius: 10px; background: #eaf0f2; }
.live-map { height: 560px; }
.map-error { display: grid; place-items: center; padding: 20px; color: var(--muted); text-align: center; }
.replay-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(150px, auto); align-items: center; gap: 12px; padding-top: 14px; }
.replay-bar input[type=range] { padding: 0; accent-color: var(--teal); }
.speed-chart { display: block; width: 100%; height: 190px; }
.chart-legend { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); font-size: 11px; }
.chart-legend i { display: inline-block; width: 9px; height: 9px; margin-right: 4px; border-radius: 50%; background: var(--teal); }
.technician-share { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.technician-share h2 { margin: 6px 0; color: var(--navy); font-size: 18px; }
.technician-share p { margin: 0; }
.share-form { display: grid; grid-template-columns: minmax(170px, 1fr) minmax(180px, 1fr) auto; gap: 8px; align-items: center; min-width: min(620px, 100%); }
.live-status { display: flex; align-items: center; gap: 9px; margin: -12px 0 22px; color: var(--navy); font-size: 13px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #bdc7cd; }
.status-dot.online { background: #18a57c; box-shadow: 0 0 0 5px #18a57c22; }
.map-note { margin: 10px 0 0; color: var(--muted); font-size: 11px; }
.live-vehicles { display: grid; gap: 2px; max-height: 608px; overflow-y: auto; }
.live-vehicle-row { display: grid; gap: 4px; padding: 13px 0; border-bottom: 1px solid #edf0f2; }
.live-vehicle-row strong { color: var(--navy); font-size: 13px; }
.live-vehicle-row span, .live-vehicle-row small { color: var(--muted); font-size: 11px; }
.panel .stack-form { margin-top: 20px; }
fieldset { display: grid; gap: 9px; padding: 14px; border: 1px solid var(--line); border-radius: 10px; }
legend { padding: 0 5px; color: var(--muted); font-size: 11px; font-weight: 800; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.check input { width: auto; accent-color: var(--teal); }
.table-panel { overflow: hidden; padding-bottom: 0; }
.table-scroll { overflow-x: auto; margin: 0 -23px; }
table { width: 100%; border-collapse: collapse; min-width: 650px; }
th, td { padding: 13px 23px; text-align: left; border-top: 1px solid #edf0f2; vertical-align: middle; font-size: 12px; }
th { color: var(--muted); background: #fbfcfd; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: var(--muted); }
.permission-pill { display: inline-block; margin: 2px 4px 2px 0; padding: 4px 7px; border-radius: 99px; color: var(--teal-dark); background: #e9f7f3; font-size: 10px; font-weight: 800; }
.state { font-size: 11px; font-weight: 800; }
.state.active { color: #168267; }
.state.inactive { color: #a16b12; }
.row-actions { display: flex; flex-wrap: wrap; gap: 7px; }
.table-button { padding: 8px 9px; color: var(--teal-dark); background: #eef8f6; font-size: 11px; }
.inline-password { display: flex; gap: 5px; }
.inline-password input { width: 120px; padding: 8px; font-size: 11px; }
.empty-table { padding: 35px 23px; color: var(--muted); text-align: center; }
@media (max-width: 850px) {
  .topbar { gap: 18px; padding: 0 5vw; }
  .nav-links { gap: 13px; }
  .account span { display: none; }
  .reports-grid, .user-layout, .report-form, .report-visuals, .live-layout, .form-grid { grid-template-columns: 1fr; }
  .type-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero, .admin-action { align-items: start; flex-direction: column; }
  .generate-form { width: 100%; }
  .generate-form .primary-button { flex: 1; }
}
@media (max-width: 560px) {
  .page-wrap { width: 92vw; padding-top: 30px; }
  .overview { grid-template-columns: 1fr; }
  .overview > div { min-height: auto; }
  .report-metrics { grid-template-columns: repeat(2, 1fr); }
  .report-card-foot { align-items: start; flex-direction: column; }
  .login-card { padding: 28px 23px; }
  .hero-actions { justify-content: start; }
  .type-grid { grid-template-columns: 1fr; }
  .technician-share { align-items: stretch; flex-direction: column; }
  .share-form { min-width: 0; grid-template-columns: 1fr; }
  .live-map { height: 420px; }
}

/* Mapa ao vivo: leitura clara e alvos de toque grandes, inclusive para pessoas idosas. */
.live-hero { margin-bottom: 20px; }
.live-hero h1 { font-size: clamp(28px, 3vw, 38px); }
.live-hero p { font-size: 17px; line-height: 1.55; }
.live-hero .outline-button, .live-fit { min-height: 48px; font-size: 15px; }
.live-status { flex-wrap: wrap; margin: 0 0 16px; font-size: 16px; line-height: 1.5; }
.live-status .muted { font-size: 15px; }
.live-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.live-summary > div { display: grid; gap: 5px; padding: 17px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.live-summary strong { font-size: 30px; color: var(--navy); }
.live-summary span { font-size: 15px; color: #475968; }
.live-layout { grid-template-columns: minmax(0, 1.5fr) minmax(330px, 1fr); align-items: start; }
.live-layout .panel-heading { align-items: center; }
.live-layout .panel-heading h2 { font-size: 23px; }
.live-map { height: min(66vh, 680px); min-height: 450px; }
.live-search-label { display: block; font-size: 16px; margin-bottom: 8px; color: var(--navy); }
[data-live-search] { font-size: 17px; min-height: 52px; background: #fff; }
.live-filters { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0; }
.live-filter { border: 1px solid #b9c8ce; border-radius: 8px; background: white; color: var(--navy); padding: 11px 14px; min-height: 48px; font-size: 15px; font-weight: 700; cursor: pointer; }
.live-filter.active { background: var(--navy); color: white; border-color: var(--navy); }
.live-vehicles { max-height: 52vh; gap: 6px; }
.live-vehicle-row { width: 100%; text-align: left; cursor: pointer; border: 1px solid #dfe7ea; border-radius: 10px; background: #fff; padding: 14px 15px; min-height: 94px; }
.live-vehicle-row:hover, .live-vehicle-row.selected { background: #edf8f5; border-color: #087d5a; }
.live-vehicle-row strong { font-size: 18px; line-height: 1.4; }
.live-vehicle-row small { font-size: 14px; line-height: 1.4; }
.live-state { width: fit-content; border-radius: 5px; padding: 3px 8px; font-weight: 700; font-size: 14px !important; }
.live-state.moving { color: #075c43; background: #d6f4e8; }
.live-state.stopped { color: #79500e; background: #fff0ca; }
.live-state.stale { color: #3f505d; background: #e4ebef; }
.live-layout button:focus-visible, .live-hero button:focus-visible, .live-hero a:focus-visible, [data-live-search]:focus-visible { outline: 3px solid #157ba8; outline-offset: 3px; }
@media (max-width: 1050px) { .live-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } .live-layout { grid-template-columns: 1fr; } .live-vehicles { max-height: 400px; } }
@media (max-width: 560px) { .live-hero .hero-actions { width: 100%; } .live-hero .outline-button { width: 100%; text-align: center; } .live-summary strong { font-size: 26px; } .live-summary span { font-size: 14px; } .live-map { height: 360px; min-height: 360px; } .live-layout .panel { padding: 16px; } .live-filter { flex: 1 1 40%; } }

/* Acessibilidade do mapa: navegação previsível, sem depender só de cores. */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.live-layout { grid-template-columns: minmax(310px, 0.88fr) minmax(0, 1.62fr); }
.live-vehicles-panel { align-self: start; }
.live-vehicle-row { color: var(--ink); font-family: inherit; }
.live-vehicle-row:focus-visible, .live-filter:focus-visible, .live-fit:focus-visible { outline: 3px solid #167ba8; outline-offset: 3px; }
.live-vehicle-row.selected { box-shadow: inset 4px 0 #087d5a; }
.live-map-panel .panel-heading { flex-wrap: wrap; }
.live-legend { display: flex; gap: 15px; flex-wrap: wrap; margin-top: 13px; font-size: 14px; color: #425565; }
.live-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.live-legend i { display: inline-block; width: 13px; height: 13px; border: 2px solid #fff; border-radius: 50%; box-shadow: 0 0 0 1px #a9b8c3; }
.live-legend .moving { background: #087d5a; }
.live-legend .stopped { background: #b16b09; }
.live-legend .stale { background: #667785; }
.live-summary span { line-height: 1.35; }
@media (max-width: 1050px) {
  .live-layout { grid-template-columns: 1fr; }
  .live-vehicles { max-height: 280px; }
  .live-map { min-height: 340px; height: 380px; }
}
@media (max-width: 600px) {
  .app-body .topbar { height: auto; min-height: 72px; flex-wrap: wrap; gap: 8px; padding: 12px 4vw 6px; }
  .app-body .topbar .brand { flex: 1; }
  .app-body .topbar .nav-links { flex: 1 0 100%; height: auto; order: 3; gap: 18px; overflow-x: auto; white-space: nowrap; padding: 10px 0; }
  .app-body .topbar .nav-links a { font-size: 15px; }
  .page-wrap:has(.live-layout) { width: 94vw; padding-top: 20px; }
  .live-hero { gap: 12px; margin-bottom: 12px; }
  .live-hero h1 { font-size: 26px; line-height: 1.15; margin: 3px 0 8px; }
  .live-hero p { font-size: 15px; line-height: 1.4; }
  .live-hero .hero-actions { display: flex; width: 100%; gap: 8px; }
  .live-hero .outline-button { width: auto; flex: 1 1 130px; padding: 10px 9px; font-size: 14px; }
  .live-status { margin: 0 0 12px; gap: 7px; font-size: 15px; }
  .live-status .muted { font-size: 14px; }
  .live-summary { gap: 8px; margin-bottom: 12px; }
  .live-summary > div { padding: 11px; }
  .live-summary strong { font-size: 24px; }
  .live-summary span { font-size: 14px; }
  .live-layout .panel { padding: 14px; }
  .live-layout .panel-heading { gap: 8px; margin-bottom: 10px; }
  .live-layout .panel-heading h2 { font-size: 21px; }
  .live-filters { gap: 6px; margin: 10px 0; }
  .live-filter { padding: 9px 7px; font-size: 14px; min-height: 48px; }
  .live-vehicles { max-height: 252px; }
  .live-vehicle-row { padding: 11px 12px; min-height: 90px; }
  .live-vehicle-row strong { font-size: 17px; }
  .live-map { min-height: 305px; height: 330px; }
  .live-legend { font-size: 13px; gap: 9px; }
}
@media (prefers-reduced-motion: reduce) {
  .live-vehicle-row, .live-filter, .live-hero .outline-button { transition: none; }
}
