:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #08090a;
  --surface: #121416;
  --surface-elevated: #181a1d;
  --surface-muted: #202327;
  --text: #f1f2f3;
  --muted: #a4a9ae;
  --line: #35383c;
  --header: #050506;
  --gold: #d6ad5e;
  --gold-light: #efd38d;
  --gold-dark: #9d752e;
  --silver: #c8cbd0;
  --green: #25a76a;
  --green-dark: #17804e;
  --red: #d94b4b;
  --red-dark: #b93239;
  --amber: #d6ad5e;
  --orange: #f08a24;
  --blue: #d6ad5e;
  --focus: #efd38d;
  /* r52: area aproximada no mapa (celula / ultimo fix guardado). Diferente das cores das cercas (prata, vermelho,
     dourado, verde) e da rota dourada; lida pelo app.js para o L.circle. */
  --map-area: #5aa9e6;
  --map-source-cell: #ef9955;
  /* r52: despertar por impacto (lista do sono). */
  --impact: #e8793a;
  --topbar-height: 64px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
input,
select {
  min-height: 42px;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button:disabled[aria-busy="true"] {
  cursor: progress;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 2px;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 24px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
  line-height: 1.25;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-login {
  display: grid;
  justify-items: center;
  gap: 10px;
  margin-bottom: 26px;
  color: var(--silver);
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.brand-login img {
  display: block;
  width: min(220px, 76%);
  height: auto;
}

.brand-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--silver);
}

.brand-topbar img {
  width: 40px;
  height: 40px;
  object-fit: cover;
  border-radius: 4px;
}

.login-view {
  display: grid;
  min-height: 100%;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(#ffffff08 1px, transparent 1px),
    linear-gradient(90deg, #ffffff08 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
}

.login-panel {
  width: min(100%, 390px);
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 22px 64px #00000070;
}

.form-stack {
  display: grid;
  gap: 10px;
  margin-top: 26px;
}

/* Revisao r6 paralela (portal, P2): entrada pelo codigo do e-mail (primeiro acesso, sem senha). */
.login-switch {
  width: 100%;
  margin-top: 14px;
  white-space: normal;
  text-align: center;
}

label {
  font-size: 13px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  border: 1px solid #4b4e52;
  border-radius: 6px;
  background: #0d0f10;
  color: var(--text);
  padding: 9px 11px;
}

.form-message {
  min-height: 20px;
  margin: 18px 0 0;
  color: var(--red);
  font-size: 13px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 9px 15px;
  font-weight: 750;
  text-decoration: none;
}

.button svg,
.icon-button svg,
.nav-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.button.primary {
  background: var(--gold);
  color: #14110b;
}

.button.primary:hover {
  background: var(--gold-light);
}

.button.secondary {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.button.secondary:hover {
  background: var(--surface-muted);
}

.button.lock {
  background: var(--red);
  color: #ffffff;
}

.button.lock:hover {
  background: var(--red-dark);
}

.button.unlock {
  background: var(--green);
  color: #ffffff;
}

.button.unlock:hover {
  background: var(--green-dark);
}

.button.compact {
  min-height: 36px;
  padding: 6px 10px;
}

.text-button {
  min-height: 34px;
  background: transparent;
  color: var(--gold-light);
}

.icon-button {
  display: inline-grid;
  width: 42px;
  min-width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
}

.icon-button:hover {
  background: var(--surface-muted);
}

.app-shell {
  min-height: 100%;
}

.topbar {
  position: fixed;
  z-index: 1000;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  height: var(--topbar-height);
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  border-bottom: 1px solid #292b2e;
  background: var(--header);
  color: var(--text);
  padding: 0 20px;
}

.topbar-context {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  padding: 0 16px 0 22px;
}

/* r143: navegação fora do perfil; o seletor nativo é o selo da empresa. */
.primary-navigation { grid-column: 1; display: flex; align-items: center; gap: 4px; min-width: 0; overflow-x: auto; }
.primary-navigation .nav-button { width: auto; flex: 0 0 auto; gap: 7px; white-space: nowrap; font-size: 13px; }
.primary-navigation .nav-button.active { box-shadow: inset 0 -3px var(--gold); }
.topbar > .account-menu-wrap { grid-column: 3; }
.organization-switcher { min-width: 0; max-width: 220px; margin-right: 16px; }
.organization-switcher .organization-badge { display: block; max-width: 100%; margin-right: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.organization-switcher select { max-width: 220px; min-width: 0; width: 100%; padding: 6px 24px 6px 10px; font-size: 12px; font-weight: 700; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.connection-status.connected .status-dot {
  background: var(--green);
}

.topbar .icon-button {
  border-color: #3b3d40;
  background: #17191b;
  color: var(--silver);
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
}

.nav-button:hover {
  background: var(--surface-muted);
}

.nav-button.active {
  background: #2b2519;
  color: var(--gold-light);
  box-shadow: inset 3px 0 var(--gold);
}

.content-view {
  min-height: 100vh;
  margin-left: 0;
  padding: calc(var(--topbar-height) + 26px) 28px 32px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.section-heading p {
  margin-bottom: 0;
}

.section-actions,
.device-heading-actions,
.heading-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-heading-actions {
  align-items: flex-start;
}

.fleet-layout {
  display: grid;
  min-height: calc(100vh - 150px);
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.device-list-panel {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.search-row svg {
  width: 18px;
  color: var(--muted);
}

.search-row input {
  min-height: 38px;
  border: 0;
  background: transparent;
}

.search-row input:focus {
  outline: none;
}

.device-list {
  max-height: calc(100vh - 218px);
  overflow-y: auto;
}

.device-row {
  display: grid;
  width: 100%;
  /* 181c: seleção e menu são botões irmãos; o arrasto fica num span separado. */
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 6px 10px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 15px 16px;
  text-align: left;
}

.device-row:hover {
  background: var(--surface-elevated);
}

.device-row.selected {
  box-shadow: inset 4px 0 var(--gold);
  background: #262117;
}

.device-row strong,
.device-row small {
  overflow-wrap: anywhere;
}

.device-row small {
  color: var(--muted);
}

.device-row-state {
  align-self: start;
  font-size: 12px;
  font-weight: 800;
}

.device-row-state.locked {
  color: var(--red);
}

.device-row-state.unlocked {
  color: var(--green);
}

.device-row-state.reauth,
.device-row-state.pending {
  color: var(--amber);
}

/* r125 (25/10/2026): sono substitui a ultima trava; offline nao afirma estado atual. */
.device-row-state.sleep,
.state-label.sleep {
  color: var(--amber);
}

.device-row-state.offline,
.state-label.offline {
  color: var(--muted);
}

.device-detail {
  min-width: 0;
  padding: 22px;
}

.device-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.title-row h2 {
  margin: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 5px;
  background: #292c30;
  color: var(--silver);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.badge.online {
  background: #153c2a;
  color: #78daa7;
}

.badge.sleeping {
  background: #3a2f17;
  color: var(--gold-light);
}

.state-label {
  font-size: 15px;
  font-weight: 850;
  white-space: nowrap;
}

.state-label.locked {
  color: var(--red);
}

.state-label.unlocked {
  color: var(--green);
}

.state-label.reauth,
.state-label.pending {
  color: var(--amber);
}

.command-bar {
  display: flex;
  gap: 10px;
  margin: 22px 0 14px;
}

.command-bar .button {
  min-width: 142px;
}

.assignment-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(180px, 360px) auto;
  align-items: center;
  gap: 10px;
  margin: 14px 0 18px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.assignment-row select {
  min-width: 0;
}

.assignment-row span {
  min-width: 64px;
  font-size: 12px;
}

.command-status {
  margin-bottom: 14px;
  border-left: 3px solid var(--amber);
  background: #332b1b;
  color: var(--gold-light);
  padding: 9px 11px;
  font-size: 13px;
}

.command-status.error {
  border-left-color: var(--red);
  background: #3a1d20;
  color: #ffaaaa;
}

.map-history-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(62px, auto));
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.segment {
  min-height: 36px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 750;
}

.segment:last-child {
  border-right: 0;
}

.segment:hover {
  background: var(--surface-muted);
  color: var(--text);
}

.segment.active {
  background: var(--gold);
  color: #111;
}

/* r52: "Agora" com o mapa parado (inspecao ou pan/zoom do usuario): clicar volta a seguir a moto. */
.segment.active.follow-paused {
  background: var(--surface);
  color: var(--gold);
  box-shadow: inset 0 0 0 2px var(--gold);
}

.map-history-actions {
  display: flex;
  gap: 8px;
}

.map-history-actions .icon-button {
  width: 38px;
  min-height: 38px;
}

.history-status {
  min-height: 20px;
  padding: 0 0 8px;
  font-size: 12px;
}

.map {
  width: 100%;
  height: clamp(260px, 43vh, 470px);
  border: 1px solid var(--line);
  background: #191b1d;
}

.history-timeline {
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--surface-elevated);
  padding: 10px 12px;
}

.history-timeline input {
  min-height: 24px;
  padding: 0;
  accent-color: var(--gold);
}

.history-timeline div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  font-size: 11px;
}

.history-timeline strong {
  color: var(--gold-light);
  text-align: right;
}

.leaflet-bar a,
.leaflet-bar a:hover {
  border-bottom-color: var(--line);
  background: var(--surface-elevated);
  color: var(--text);
}

.leaflet-control-attribution {
  background: #101214d9 !important;
  color: var(--muted);
}

.leaflet-control-attribution a {
  color: var(--gold-light);
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface-elevated);
  color: var(--text);
}

.device-facts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin: 0;
  border: 1px solid var(--line);
  border-top: 0;
}

.device-facts div {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 12px;
}

.device-facts div:last-child {
  border-right: 0;
}

.device-facts dt {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.device-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
}

.empty-state {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 10px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 32px;
  height: 32px;
}

.detail-empty {
  min-height: 60vh;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 15px;
  text-align: left;
  font-size: 13px;
}

th {
  background: #1c1f22;
  color: var(--silver);
  font-size: 11px;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.row-actions {
  width: 62px;
  text-align: right;
}

.compact-icon {
  width: 34px;
  min-width: 34px;
  height: 34px;
  min-height: 34px;
}

.compact-stack {
  margin-top: 8px;
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  margin-top: 8px;
}

.check-row input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--gold);
}

.plain-fieldset {
  min-width: 0;
  margin: 10px 0 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px;
}

.plain-fieldset legend {
  padding: 0 5px;
  color: var(--silver);
  font-size: 12px;
  font-weight: 800;
}

.field-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.choice-list,
.capability-grid {
  display: grid;
  gap: 7px;
}

.capability-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice-item {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 9px;
  border: 1px solid #303337;
  border-radius: 5px;
  padding: 8px 10px;
  background: #101214;
  color: var(--text);
  font-size: 12px;
  font-weight: 650;
}

.choice-item input {
  width: 17px;
  height: 17px;
  min-height: 17px;
  margin: 0;
  accent-color: var(--gold);
}

.button.danger-outline {
  border-color: #74343a;
  background: transparent;
  color: #f28d92;
}

.button.danger-outline:hover {
  background: #351b1e;
}

.dialog {
  width: min(92vw, 430px);
  max-height: calc(100dvh - 24px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  background: var(--surface-elevated);
  color: var(--text);
}

.wide-dialog {
  width: min(94vw, 780px);
}

.dialog-header,
.settings-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.dialog-header {
  position: sticky;
  z-index: 2;
  top: -24px;
  margin: -24px -24px 18px;
  border-bottom: 1px solid var(--line);
  padding: 20px 24px 16px;
  background: var(--surface-elevated);
}

.dialog-header h2,
.settings-heading h3 {
  margin: 0 0 4px;
}

.dialog-header p,
.settings-heading p {
  margin: 0;
}

.dialog-loading {
  min-height: 120px;
  display: grid;
  place-items: center;
  text-align: center;
}

.dialog::backdrop {
  background: #0c1115a8;
}

.dialog form {
  margin: 0;
}

.dialog-icon {
  display: grid;
  width: 42px;
  height: 42px;
  margin-bottom: 16px;
  place-items: center;
  border-radius: 50%;
  background: #421e22;
  color: var(--red);
}

.dialog-icon.unlock {
  background: #153c2a;
  color: var(--green);
}

.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.settings-section {
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.settings-section + .settings-section {
  margin-top: 24px;
}

.groups-layout {
  display: grid;
  grid-template-columns: minmax(180px, 250px) minmax(0, 1fr);
  gap: 18px;
}

.access-group-list {
  display: grid;
  max-height: 470px;
  overflow-y: auto;
  gap: 7px;
  margin-top: 12px;
  padding-right: 3px;
}

.access-group-button {
  display: grid;
  min-height: 56px;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  background: #101214;
  color: var(--text);
  text-align: left;
}

.access-group-button.selected {
  border-color: var(--gold-dark);
  box-shadow: inset 3px 0 var(--gold);
  background: #262117;
}

.access-group-button small {
  color: var(--muted);
  font-size: 11px;
}

.access-group-editor {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  background: #141619;
}

.biometrics-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 16px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 14px !important;
}

.inline-form label {
  display: grid;
  gap: 7px;
}

.inline-form label > span {
  color: var(--silver);
  font-size: 12px;
}

.biometric-users {
  display: grid;
  max-height: 220px;
  overflow-y: auto;
  gap: 7px;
  margin-top: 14px;
}

.biometric-user {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #101214;
}

.biometric-face-list {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.biometric-user .badge {
  min-width: 42px;
  justify-content: center;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.settings-grid.three-columns {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.settings-grid label,
.compact-field,
.sequence-setting {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.settings-grid label > span,
.compact-field > span,
.sequence-setting > span {
  color: var(--silver);
  font-size: 12px;
}

.setting-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 12px 14px;
  background: #101214;
}

.setting-line > div:first-child {
  display: grid;
  gap: 3px;
}

.setting-line .muted {
  font-size: 12px;
  font-weight: 500;
}

.switch-control {
  position: relative;
  display: inline-flex;
  width: 46px;
  min-width: 46px;
  height: 26px;
  cursor: pointer;
}

.switch-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 1px;
  opacity: 0;
}

.switch-control span {
  width: 100%;
  border: 1px solid #55595e;
  border-radius: 13px;
  background: #2b2e32;
  transition: background 140ms ease, border-color 140ms ease;
}

.switch-control span::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--silver);
  transition: transform 140ms ease, background 140ms ease;
}

.switch-control input:checked + span {
  border-color: var(--gold);
  background: var(--gold-dark);
}

.switch-control input:checked + span::after {
  transform: translateX(20px);
  background: #fff3cf;
}

.switch-control input:focus-visible + span {
  outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent);
  outline-offset: 2px;
}

.switch-control input:disabled + span {
  cursor: not-allowed;
  opacity: 0.58;
}

.switch-control input:disabled[aria-busy="true"] + span {
  cursor: progress;
}

#gestureConfiguration {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
}

#gestureConfiguration .sequence-setting:last-child {
  grid-column: 2;
}

.gesture-sequence {
  display: grid;
  grid-template-columns: repeat(5, minmax(42px, 1fr));
  gap: 7px;
}

.gesture-sequence select {
  min-width: 0;
  padding-inline: 7px;
  text-align: center;
  font-size: 18px;
}

.input-unit {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  overflow: hidden;
  border: 1px solid #4b4e52;
  border-radius: 6px;
  background: #0d0f10;
}

.input-unit input {
  border: 0;
  border-radius: 0;
}

.input-unit > span {
  padding: 0 12px 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sensor-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.sensor-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 8px;
  background: #101214;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.sensor-chip.ok {
  border-color: #286d4e;
  color: #72d7a5;
}

.sensor-chip.alert {
  border-color: #7f3438;
  color: #f28d92;
}

.geofence-list {
  display: grid;
  max-height: 250px;
  overflow-y: auto;
  gap: 8px;
  margin-bottom: 20px;
  padding-right: 4px;
}

.geofence-empty {
  border: 1px dashed var(--line);
  border-radius: 6px;
  padding: 20px;
  color: var(--muted);
  text-align: center;
}

.geofence-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: #101214;
}

.geofence-row.inactive {
  opacity: 0.62;
}

.geofence-row-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.geofence-row-copy strong,
.geofence-row-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.geofence-row-copy span {
  color: var(--muted);
  font-size: 12px;
}

.geofence-row-actions {
  display: flex;
  gap: 6px;
}

.geofence-editor {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  background: #141619;
}

.geofence-editor + #deviceGeofencesSection,
.geofence-section-heading {
  margin-top: 22px;
}

.geofence-editor form {
  margin-top: 18px;
}

.geofence-editor h4 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.geofence-enabled-row {
  align-self: end;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  background: #0d0f10;
}

.geofence-save-actions {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.dialog-spacer {
  flex: 1 1 auto;
}

.toast {
  position: fixed;
  z-index: 2000;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  transform: translateY(20px);
  border: 1px solid #4a4d51;
  border-radius: 6px;
  background: #191b1d;
  color: var(--text);
  padding: 11px 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 980px) {
  .brand-topbar span {
    display: none;
  }

  .device-facts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .device-facts div:nth-child(2) {
    border-right: 0;
  }

  .device-facts div:nth-child(-n+2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 740px) {
  :root {
    --topbar-height: 58px;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    padding: 0 14px;
  }

  .topbar-context {
    justify-content: center;
    padding-left: 0;
  }

  .connection-status {
    justify-self: center;
  }

  .content-view {
    margin-left: 0;
    padding: calc(var(--topbar-height) + 18px) 14px 32px;
  }

  .fleet-layout {
    display: block;
    min-height: 0;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .device-list-panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .device-list {
    max-height: none;
  }

  .device-detail {
    margin-top: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    padding: 16px;
  }

  .detail-empty {
    min-height: 180px;
  }

  .device-heading {
    display: block;
  }

  .state-label {
    margin-top: 10px;
  }

  .command-bar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .command-bar .button {
    min-width: 0;
  }

  .assignment-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .assignment-row span {
    min-height: 16px;
  }

  .map {
    height: 300px;
  }

  .map-history-controls {
    align-items: stretch;
  }

  .segmented-control {
    width: 100%;
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .segment {
    min-width: 0;
    padding-inline: 7px;
  }

  .device-facts {
    grid-template-columns: 1fr;
  }

  .device-facts div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .device-facts div:last-child {
    border-bottom: 0;
  }

  .section-heading {
    align-items: flex-start;
  }

  .section-actions {
    align-items: flex-end;
  }

  .section-actions .button {
    padding-inline: 11px;
  }

  .dialog-actions .dialog-spacer {
    display: none;
  }

  .wide-dialog {
    width: calc(100vw - 20px);
    padding: 18px;
  }

  .dialog-header {
    top: -18px;
    margin: -18px -18px 16px;
    padding: 16px 18px 14px;
  }

  .settings-grid,
  .settings-grid.three-columns {
    grid-template-columns: 1fr;
  }

  .groups-layout,
  .capability-grid,
  .inline-form {
    grid-template-columns: 1fr;
  }

  .access-group-list {
    max-height: 180px;
  }

  #gestureConfiguration {
    grid-template-columns: 1fr;
  }

  #gestureConfiguration .sequence-setting:last-child {
    grid-column: auto;
  }

  .gesture-sequence {
    grid-template-columns: repeat(5, minmax(38px, 1fr));
  }

  .settings-heading {
    display: grid;
  }

  .sensor-status {
    justify-content: flex-start;
  }

  .geofence-editor .settings-heading .button {
    justify-self: start;
  }
}

@media (max-width: 420px) {
  .login-panel {
    padding: 26px 22px;
  }

  .command-bar {
    grid-template-columns: 1fr;
  }

  .map-history-controls {
    display: grid;
    grid-template-columns: 1fr auto;
  }

  .segmented-control {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .segment:nth-child(2) {
    border-right: 0;
  }

  .segment:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .section-heading {
    display: grid;
  }

  .section-actions {
    justify-content: flex-end;
  }

  .dialog-actions .button {
    flex: 1 1 auto;
  }

  .setting-line {
    align-items: flex-start;
  }

  .gesture-sequence {
    gap: 5px;
  }

  .gesture-sequence select {
    min-height: 40px;
    padding: 6px 4px;
    font-size: 16px;
  }

  .geofence-row {
    grid-template-columns: 1fr;
  }

  .geofence-row-actions {
    justify-content: flex-end;
  }
}
:root .firmware-panel { margin: 16px 0; padding: 16px; border: 1px solid var(--border, #d8dee8); border-radius: 12px; }
:root .firmware-panel summary { cursor: pointer; font-weight: 600; }
:root .firmware-panel .command-bar { flex-wrap: wrap; }
:root #configurationPanel > label { display: block; margin-top: 12px; font-weight: 600; }
:root #configurationPanel > input, :root #configurationPanel > select { width: 100%; margin: 6px 0; }
:root #configurationPanel .button-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

/* mapa: tiles do OSM escurecidos para o tema (07/10/2026) */
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9) saturate(0.6); }

/* 07/10/2026: telemetria em grupos e lista de envios no deep sleep (painel da moto). */
.telemetry {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.telemetry-group {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.telemetry-group h3 {
  margin: 0;
  padding: 8px 12px;
  background: #1b1e22;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.telemetry-group .device-facts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 0;
}
.telemetry-group .device-facts div:nth-child(2n) {
  border-right: 0;
}
.telemetry-group .device-facts div:nth-child(-n+2) {
  border-bottom: 1px solid var(--line);
}
.badge.sleep {
  background: #3a2f17;
  color: var(--gold-light);
}
.badge.offline {
  background: #3a1f22;
  color: #ff9ba4;
}
.sleep-events {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}
.sleep-events-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  background: #1b1e22;
}
.sleep-events-head h3 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sleep-events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.sleep-events-table th, .sleep-events-table td {
  padding: 7px 12px;
  border-top: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.sleep-events-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  border-top: 0;
}
.sleep-events-table tr.motion td:first-child {
  border-left: 3px solid var(--amber);
}
.sleep-events-table button.link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text);
  text-decoration: underline;
  cursor: pointer;
  font: inherit;
}
.sleep-events p.muted {
  margin: 0;
  padding: 10px 12px;
}
.button.compact {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}
.button.compact[aria-pressed="true"] {
  outline: 1px solid var(--amber);
}

/* 10/10/2026 (r52): rota atual, area aproximada no mapa, posicoes do sono, tipo de movimento, dados e detectores. */
.badge.route {
  background: #22262b;
  color: var(--muted);
}
.badge.route.wifi {
  background: #3a3113;
  color: var(--gold-light);
}
.map-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--surface-elevated);
  color: var(--muted);
  font-size: 12px;
}
.map-legend-swatch {
  flex: none;
  width: 14px;
  height: 14px;
  border: 2px dashed var(--map-area);
  border-radius: 50%;
  background: color-mix(in srgb, var(--map-area) 22%, transparent);
}
/* r120 / 133b: controle Leaflet compacto; lista absoluta, sem consumir a altura do mapa da r108/r119. */
.map-sources-control { position: relative; font-family: inherit; }
.map-sources-toggle { display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 44px; min-height: 44px;
  padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-elevated);
  color: var(--text); box-shadow: 0 2px 8px #0006; font-size: 12px; font-weight: 650; }
.map-sources-toggle svg { width: 17px; height: 17px; }
.map-sources-toggle:hover, .map-sources-toggle[aria-expanded="true"] { border-color: var(--gold); }
.map-sources-toggle:focus-visible, .map-sources:focus-visible, .map-sources :is(button, input):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.map-sources-indicator { padding: 2px 5px; border-radius: 4px; color: var(--map-source-cell); background: #ef99551a; font-size: 10px; }
.map-sources-control[data-mode="complementary"] .map-sources-indicator { color: var(--gold-light); background: #d6ad5e1a; }
.map-sources { position: absolute; top: calc(100% + 6px); right: 0; width: min(300px, calc(100vw - 64px)); min-width: 0;
  max-height: 260px; overflow-y: auto; overscroll-behavior: contain; margin: 0; border: 1px solid var(--line);
  border-radius: 6px; padding: 8px 12px 10px; background: var(--surface-elevated); color: var(--text); box-shadow: 0 6px 20px #0008; }
.map-sources legend { padding: 0 5px; color: var(--silver); font-size: 12px; font-weight: 800; }
.map-sources-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.map-sources-mode { color: var(--gold-light); font-size: 11px; }
.map-sources-heading button { min-height: 44px; padding: 4px; }
.map-sources-options { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; }
.map-sources-options label { display: flex; align-items: center; gap: 7px; min-height: 44px; font-size: 12px; cursor: pointer; }
.map-sources-options input { width: 16px; height: 16px; min-height: 16px; margin: 0; accent-color: var(--gold); }
.map-sources-options [data-location-source="gsm"] { accent-color: var(--map-source-cell); }
.map-source-cell { color: var(--map-source-cell); }
.map-source-gps { color: var(--gold-light); }
.map-sources-options small { display: block; color: var(--muted); font-size: 10px; }
.map-sources-options .map-source-future { color: var(--muted); cursor: default; }
.map-sources p { margin: 3px 0 0; font-size: 11px; line-height: 1.4; }
/* r121a (24/10, Cassio: balao do circulo "tipo espagueti"): com overflow-wrap:anywhere a largura minima vira 1 caractere e o
   tooltip sticky perto da borda direita encolhia ate uma letra por linha; a largura vem do conteudo, limitada pelo teto. */
.leaflet-tooltip.map-source-tooltip { width: max-content; max-width: min(340px, calc(100vw - 60px)); white-space: normal; overflow-wrap: anywhere; }
/* Linhas opcionais no fim dos grupos (somem quando a API nao manda o campo): toda linha tem a borda de baixo e a da
   ultima fica escondida pelo overflow do grupo, assim uma linha oculta nao deixa borda sobrando. */
.telemetry-group .device-facts {
  margin-bottom: -1px;
}
.telemetry-group .device-facts > div {
  border-bottom: 1px solid var(--line);
}
.telemetry-group .device-facts > div:nth-child(odd):has(+ div[hidden]:last-child) {
  border-right: 0;
}
.fact-note {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

/* r128: o contador celular usa os mesmos grupos e tokens da telemetria. */
.data-usage-empty, .data-usage-budget { margin: 0; padding: 10px 12px; }
.data-usage-budget { display: grid; gap: 8px; border-top: 1px solid var(--line); font-size: 12px; }
.data-usage-progress { display: block; width: 100%; height: 7px; border: 0; border-radius: 4px; overflow: hidden; background: var(--surface-muted); color: var(--green); accent-color: var(--green); }
.data-usage-progress::-webkit-progress-bar { background: var(--surface-muted); border-radius: 4px; }
.data-usage-progress::-webkit-progress-value { background: var(--green); border-radius: 4px; }
.data-usage-progress::-moz-progress-bar { background: var(--green); border-radius: 4px; }
.data-usage-progress.warning { color: var(--amber); accent-color: var(--amber); }
.data-usage-progress.warning::-webkit-progress-value { background: var(--amber); }
.data-usage-progress.warning::-moz-progress-bar { background: var(--amber); }
.data-usage-progress.exceeded { color: var(--red); accent-color: var(--red); }
.data-usage-progress.exceeded::-webkit-progress-value { background: var(--red); }
.data-usage-progress.exceeded::-moz-progress-bar { background: var(--red); }
.telemetry-group .data-usage-history { display: block; border-top: 1px solid var(--line); }
.telemetry-group .data-usage-history > div { border-right: 0; }
.data-usage-note { margin: 0; padding: 8px 12px; }
.fleet-data-usage { flex: none; margin: 0 0 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); font-size: 12px; }
.fleet-data-usage summary { padding: 10px 12px; cursor: pointer; color: var(--muted); }
.fleet-data-usage summary strong { margin-left: 10px; color: var(--text); font-weight: 600; }
.fleet-data-usage-body { padding: 0 12px 10px; }
.fleet-data-usage-body p { margin: 8px 0; }
.fleet-data-usage-body .field-help { margin-top: 8px; }
.data-usage-alert { display: inline; min-height: 28px; margin: 0 12px 0 0; text-align: left; overflow-wrap: anywhere; }
body.map-window .fleet-data-usage, body.config-window .fleet-data-usage { display: none !important; }
.device-facts dd button.link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}
.sleep-events-table button.link {
  min-height: 0;
  text-align: left;
}
.sleep-events-table .fact-note + .fact-note {
  margin-top: 1px;
}
.motion-kind {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 4px;
  background: #2b2717;
  color: var(--amber);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.motion-kind.impact {
  background: #3b2416;
  color: var(--impact);
}
.sleep-events-table tr.motion.impact td:first-child {
  border-left-color: var(--impact);
}
#detectorsPanel > p {
  margin: 10px 0 0;
}
#detectorsPanel .detectors-read {
  font-size: 13px;
  font-weight: 650;
}
#detectorsPanel .detectors-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  margin-top: 12px;
}
#detectorsPanel .detectors-grid label {
  display: grid;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}
#detectorsPanel .detectors-grid input {
  width: 100%;
}
#detectorsPanel .detectors-hint {
  margin: 12px 0 0;
  font-size: 12px;
}
#detectorsPanel .button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0;
}
@media (max-width: 740px) {
  #detectorsPanel .detectors-grid {
    grid-template-columns: 1fr;
  }
  /* A tabela do sono (5 colunas) rola dentro do cartao em vez de cortar a coluna de baterias. */
  .sleep-events-table {
    display: block;
    overflow-x: auto;
  }
  .sleep-events-table th, .sleep-events-table td {
    padding: 6px 8px;
  }
}

/* 15/10/2026: balao da ultima posicao (tooltip do Leaflet no hover; no celular abre no toque) e os tooltips do historico,
   no tema escuro do portal. */
.leaflet-tooltip {
  background: var(--surface-elevated);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
}
.leaflet-tooltip-top:before { border-top-color: var(--line); }
.leaflet-tooltip-bottom:before { border-bottom-color: var(--line); }
.leaflet-tooltip-left:before { border-left-color: var(--line); }
.leaflet-tooltip-right:before { border-right-color: var(--line); }
/* 15/10 (Cassio): largo e baixo, nao uma coluna comprida; grade de duas colunas a partir de 520 px de mapa. */
.leaflet-tooltip.last-position {
  max-width: min(680px, 92vw);
  white-space: normal;
  line-height: 1.3;
  font-size: 12px;
  padding: 8px 12px;
}
.leaflet-tooltip.last-position .lp-head { margin-bottom: 4px; }
.leaflet-tooltip.last-position .lp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(200px, 1fr));
  gap: 2px 16px;
}
.leaflet-tooltip.last-position .lp-item { min-width: 0; }
@media (max-width: 740px) {
  .leaflet-tooltip.last-position .lp-grid { grid-template-columns: 1fr; }
}

/* 15/10 (Cassio): o mapa fica fixo no desktop enquanto a telemetria rola por baixo. "overflow: clip" no quadro da frota
   mantem o recorte das bordas sem criar area de rolagem (overflow: hidden impedia o sticky). r108: o mapa nao e mais
   sticky; a coluna de informacoes rola sozinha (ver o bloco r108 abaixo). */
.map-tools {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin: 6px 0;
}
@media (min-width: 981px) {
  .fleet-layout { overflow: clip; }
}

/* 15/10 (Cassio): janela so do mapa (?mapa=1), para outro monitor. Mesma pagina, resto escondido. */
body.map-window .topbar,
body.map-window .section-heading,
body.map-window .device-list-panel,
body.map-window .device-heading,
body.map-window .command-bar,
body.map-window #commandStatus,
body.map-window .assignment-row,
body.map-window #selectedDevice > details,
body.map-window .telemetry,
body.map-window .sleep-events,
body.map-window #mapWindowButton { display: none !important; }
body.map-window .content-view { min-height: auto; margin-left: 0; padding: 10px 12px; }
body.map-window .fleet-layout { min-height: auto; grid-template-columns: 1fr; border: 0; }
body.map-window .device-detail { padding: 0; }
body.map-window .detail-empty { padding: 24px; }

/* 15/10 (Cassio, 10:15): coluna da moto = informacao + bloquear/desbloquear; configuracoes so na janela ?config=1 */
body:not(.config-window) #configurationPanel,
body:not(.config-window) #detectorsPanel,
body:not(.config-window) #firmwarePanel,
body:not(.config-window) #bridgeToolsPanel,
body:not(.config-window) #heartbeatMaintenancePanel,
body:not(.config-window) #deleteDeviceButton { display: none !important; }

.heartbeat-maintenance-list { display: grid; gap: 10px; }
.heartbeat-maintenance-operation { min-width: 0; padding: 12px; }
.heartbeat-maintenance-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; }
.heartbeat-maintenance-state { font-size: .86rem; font-weight: 600; }
.heartbeat-maintenance-state.completed { color: var(--success, #197148); }
.heartbeat-maintenance-state.failed, .heartbeat-maintenance-state.expired { color: var(--danger, #b32332); }
.heartbeat-maintenance-result pre { max-height: 280px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; }
body.config-window .account-menu-wrap,
body.config-window .section-heading,
body.config-window .device-list-panel,
body.config-window .map-resizer,
body.config-window .map-panel,
body.config-window .command-bar,
body.config-window #commandStatus,
body.config-window .telemetry,
body.config-window .sleep-events,
body.config-window #configWindowButton { display: none !important; }
/* r109: a barra do topo fica visivel nesta janela (fixa); o padding de cima desconta a altura dela. Desde a r104 era 10 px e a
   barra cobria o cabecalho da moto (nome, Seguranca, Editar nome, Excluir). */
body.config-window .content-view { margin-left: 0; padding: calc(var(--topbar-height) + 10px) 16px 10px; min-height: auto; }
body.config-window .fleet-layout { display: block; min-height: auto; border: 0; }
body.config-window .device-detail { padding: 8px 4px; }
body.config-window .device-heading { padding: 8px 0; }

/* r115: aprovação na coluna de status e ferramentas remotas da iFace. */
.bridge-pending-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.bridge-pending-heading strong { font-size: 13px; }
.bridge-pending-heading .button { min-height: 32px; padding: 5px 8px; }
.bridge-pending-note { padding: 12px 16px; font-size: 12px; }
.device-row.bridge-pending-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); }
.bridge-pending-row .device-row-state { display: grid; gap: 8px; }
.bridge-pending-row .button { white-space: normal; font-size: 12px; min-height: 36px; padding: 6px 8px; }
.bridge-tools-panel[open] > summary { margin-bottom: 12px; }
.bridge-tools-panel .button-row { flex-wrap: wrap; margin: 10px 0; }
.bridge-tools-panel select, .bridge-tools-panel input { max-width: 100%; width: 100%; }
.bridge-tools-panel .check-row input { width: auto; }
.bridge-tool-output { max-height: 420px; min-height: 80px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--surface-muted); padding: 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.bridge-tool-fields { margin: 8px 0; }
.bridge-unavailable { padding-left: 20px; font-size: 12px; }

/* 15/10 (Cassio, 09:50): menu de contexto (botao direito) na lista de motos */
/* r119 (Cassio, 23/10/2026: "botao direito no menu vai por baixo do mapa"): acima das camadas do Leaflet (400..1000) e da
   barra do topo (1000); abaixo do toast (2000). O menu da conta mantem os 1200 dele. */
.context-menu { position: fixed; z-index: 1100; min-width: 210px; padding: 4px; display: grid; background: var(--surface-elevated, #1b1d20);
  border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
.context-menu[hidden] { display: none; }
.context-menu-title { padding: 6px 10px 4px; font-size: 12px; color: var(--muted, #9aa0a6); }
.context-menu-item { text-align: left; background: none; border: 0; color: inherit; padding: 8px 10px; border-radius: 6px; cursor: pointer; font: inherit; }
.context-menu-item:hover, .context-menu-item:focus-visible { background: var(--surface-muted, #2a2d31); outline: none; }
.context-menu-item.danger { color: #f88; }
.context-menu-item:disabled { opacity: .45; cursor: default; }

/* 15/10 (Cassio, 03:40): o mapa e o coracao do sistema: coluna propria, global, fixa, fora dos parametros e acoes de cada moto,
   redimensionavel pelo divisor (largura guardada no navegador). Clicar numa moto so recentra; o mapa nunca e recriado. */
.device-heading { flex-wrap: wrap; }            /* detalhe mais estreito: nome, badges e acoes quebram linha */
.device-heading > div { min-width: 0; }
.device-heading-actions { flex-wrap: wrap; }
.map-panel { min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px 12px; background: var(--surface); }
.map-panel-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; min-height: 34px; }
.map-panel-bar .map-history-controls { margin: 0; padding: 0; border-top: 0; }  /* r108: sem o traco herdado da coluna antiga */
.map-panel-bar .map-tools { margin: 0 0 0 auto; }
.map-panel .map { flex: 1 1 auto; min-height: 240px; }
.map-resizer { display: none; }
@media (min-width: 981px) {
  /* r108 (20/10/2026, Cassio): lista | MAPA (todo o resto da largura) | divisor | informacoes. O divisor dimensiona a coluna
     de informacoes (--detail-width, guardada no navegador); sem escolha, 26vw entre 300 e 420 px (as minimas somam
     888 px e cabem a partir de 981 px). Antes (r101) o mapa era a coluna da direita (--map-width, 40vw) e as
     informacoes ficavam com o centro. */
  .fleet-layout { grid-template-columns: minmax(240px, 300px) minmax(340px, 1fr) 8px var(--detail-width, clamp(300px, 26vw, 420px)); }
  .map-panel .map { height: auto; }
  .map-resizer { display: block; cursor: col-resize; background: var(--line); position: relative; z-index: 6; touch-action: none; }
  .map-resizer:hover, .map-resizer.dragging, .map-resizer:focus-visible { background: #5aa9e6; outline: none; }
}
/* r108 (20/10/2026, Cassio): na janela principal do desktop a frota ocupa a altura da janela: o mapa abre grande e a coluna
   de informacoes (estreita, condensada) e a lista rolam sozinhas, sem rolar a pagina. Nao vale para as janelas do mapa
   (?mapa=1) e de configuracoes (?config=1), que tem o proprio arranjo. */
@media (min-width: 981px) {
  body:not(.map-window):not(.config-window) .devices-view {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 620px;
    padding-bottom: 16px;
  }
  body:not(.map-window):not(.config-window) .devices-view > .section-heading { flex: none; margin-bottom: 14px; }
  body:not(.map-window):not(.config-window) .fleet-layout { flex: 1 1 auto; min-height: 0; grid-template-rows: minmax(0, 1fr); }
  body:not(.map-window):not(.config-window) .device-list-panel { display: flex; flex-direction: column; min-height: 0; }
  body:not(.map-window):not(.config-window) .device-list { flex: 1 1 auto; min-height: 0; max-height: none; }
  /* Janela baixa (ex.: 1024x620) com rota de celula: legenda e rotulos da linha do tempo em varias linhas nao cabem com o
     mapa no minimo (240 px); a coluna do mapa rola sozinha em vez de cortar o fim (o quadro da frota recorta com clip). */
  body:not(.map-window):not(.config-window) .map-panel { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
  body:not(.map-window):not(.config-window) .device-detail {
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 14px 14px 18px;
  }
  body:not(.map-window):not(.config-window) .device-detail .detail-empty { min-height: 100%; }
  /* Condensada: telemetria numa coluna, linhas mais baixas, botoes lado a lado; a tabela do sono rola dentro do cartao. */
  #selectedDevice > .command-bar { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0 10px; }
  #selectedDevice > .command-bar .button { min-width: 0; }
  .telemetry { grid-template-columns: minmax(0, 1fr); gap: 8px; margin-top: 10px; }
  .telemetry-group h3 { padding: 6px 10px; }
  .telemetry-group .device-facts > div { padding: 7px 10px; }
  .telemetry-group .device-facts dt { margin-bottom: 2px; font-size: 10px; }
  .telemetry-group .device-facts dd { font-size: 12px; }
  .sleep-events { margin-top: 10px; }
  .sleep-events-head { flex-wrap: wrap; padding: 6px 10px; }
  .sleep-events-table { display: block; overflow-x: auto; font-size: 12px; }
  .sleep-events-table th, .sleep-events-table td { padding: 5px 8px; }
}
@media (max-width: 980px) {
  .fleet-layout { display: flex; flex-direction: column; }
  .device-list-panel { order: 1; border-right: 0; border-bottom: 1px solid var(--line); }
  .map-panel { order: 2; border-bottom: 1px solid var(--line); }
  .device-detail { order: 3; }
  .map-panel .map { height: 320px; }
}
body.map-window .device-list-panel,
body.map-window .device-detail,
body.map-window .map-resizer { display: none !important; }
body.map-window .fleet-layout { display: block; min-height: auto; border: 0; }
body.map-window .map-panel { position: static; height: calc(100vh - 70px); border: 0; padding: 0; }
body.map-window .map-panel .map { height: auto; }

/* r143: menu do perfil; a navegação principal fica no cabeçalho. */
.account-menu-wrap { position: relative; }
.account-menu { position: absolute; z-index: 1200; top: calc(100% + 8px); right: 0; left: auto; min-width: 240px; max-width: min(320px, calc(100vw - 24px)); }
.account-menu-header { display: grid; gap: 2px; padding: 8px 10px 6px; font-size: 13px; }
.account-menu-header #userName { font-weight: 700; color: var(--text); overflow-wrap: anywhere; }
.account-menu-header .muted { font-size: 12px; }
/* Revisao r2 da regra simplificada (P1): aviso do administrador da iFace com senha temporaria pendente. */
.account-menu-header .account-menu-note { margin-top: 6px; line-height: 1.35; overflow-wrap: anywhere; }
.account-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.account-menu .nav-button { padding: 9px 10px; }
.account-menu .nav-button.danger { color: #f88; }
.account-menu .nav-button.danger:hover { background: rgba(255, 136, 136, 0.12); }

/* Empresa atual no cabeçalho; itens fora do teto no editor de grupos. */
.organization-badge {
  min-width: 0;
  max-width: 40vw;
  margin-right: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
  color: var(--gold-light);
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.choice-item.outside-ceiling { opacity: 0.55; }
.choice-item.outside-ceiling small { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 500; }
/* r110, regra simplificada de 20/10: o que so o super admin faz na iFace (grupo de gestor, par de permissoes de gestao,
   senha de administrador), para quem nao e super admin. O item travado usa .outside-ceiling (mesmo visual). */
.super-admin-only-note { color: var(--gold-light); }
/* Revisao 01a159c6 (P2 2): grupo da pessoa que o catalogo carregado nao tinha (continua marcado ate desmarcar). */
.choice-item.missing-group small { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 500; }
@media (max-width: 420px) {
  .organization-badge { max-width: 30vw; margin-right: 8px; }
}

/* Pedido 91 (22/10/2026, Cassio): apenas o nome-base e o estado da conexao da IHM. */
.field-hint {
  margin: -4px 0 0;
  font-size: 12px;
  line-height: 1.45;
}
.device-row-name { min-width: 0; }
.device-row-name > strong, .device-row-name > .ihm-connection { display: block; }
.ihm-connection { color: var(--muted); font-size: 11px; font-weight: 400; line-height: 1.5; }
.ihm-connection.ihm-disconnected { color: #ffb9ac; background: #54271f; border-radius: 4px; padding: 1px 5px; font-weight: 700; }
.device-row-name > .ihm-connection { margin-top: 3px; width: fit-content; }

/* r110 (Empresas da plataforma, 20/10/2026): tela Empresas (lista + empresa escolhida com usuarios e grupos), dialogos de
   empresa, arquivamento, vinculo e grupo, e a matriz empresa x grupo na edicao de usuario. Sem rolagem horizontal no
   celular: tudo em grade que vira uma coluna. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.dialog textarea {
  width: 100%;
  min-height: 84px;
  resize: vertical;
  border: 1px solid #4b4e52;
  border-radius: 6px;
  background: #0d0f10;
  color: var(--text);
  padding: 9px 11px;
  font: inherit;
}
.dialog textarea:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent); outline-offset: 2px; }
.form-message.collapsible:empty { min-height: 0; margin-top: 0; }
.form-message.is-info { color: var(--gold-light); }
.notice {
  margin: 12px 0 0;
  border: 1px solid #4a3f28;
  border-radius: 6px;
  background: #1d1a12;
  color: var(--gold-light);
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.45;
}
.notice.danger { border-color: #74343a; background: #2a1517; color: #f6a5a9; }
.badge.platform { background: #2b2519; color: var(--gold-light); }
.badge.archived { background: #2a1517; color: #f6a5a9; }
.badge.manager { background: #153c2a; color: #78daa7; }
.badge-row { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.icon-button.danger { color: #f28d92; }
.icon-button.danger:hover { background: #351b1e; }
.list-status { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; padding: 12px 14px; font-size: 13px; }
.list-status[hidden] { display: none; }
.list-status:empty { padding: 0; }
.list-status.is-error { color: #f6a5a9; }

.organizations-layout {
  display: grid;
  min-height: calc(100vh - 170px);
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.organizations-list-panel { min-width: 0; border-right: 1px solid var(--line); }
.organizations-filters { display: grid; gap: 0; border-bottom: 1px solid var(--line); }
.organizations-filters .search-row { border-bottom: 1px solid var(--line); }
.organizations-status-filter { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 10px; padding: 10px 12px; }
.organizations-status-filter span { color: var(--muted); font-size: 12px; }
.organizations-status-filter select { min-height: 36px; padding: 6px 9px; }
.organizations-list { max-height: calc(100vh - 290px); overflow-y: auto; }
.organization-row {
  display: grid;
  width: 100%;
  gap: 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  padding: 13px 16px;
  text-align: left;
}
.organization-row:hover { background: var(--surface-elevated); }
.organization-row.selected { box-shadow: inset 4px 0 var(--gold); background: #262117; }
.organization-row.archived strong { color: var(--muted); }
.organization-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.organization-row strong, .organization-row small { overflow-wrap: anywhere; }
.organization-row small { color: var(--muted); font-size: 12px; }

.organization-detail { min-width: 0; padding: 22px; }
.organization-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.organization-heading-text { min-width: 0; }
.organization-heading h2 { margin: 0; overflow-wrap: anywhere; }
.organization-heading h2:focus { outline: none; }
.organization-heading h2:focus-visible { outline: 3px solid color-mix(in srgb, var(--focus) 55%, transparent); outline-offset: 2px; }
#organizationDetailMeta { margin: 6px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.organization-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin: 18px 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
}
.organization-counts div { min-width: 0; border-right: 1px solid var(--line); padding: 10px 12px; }
.organization-counts div:last-child { border-right: 0; }
.organization-counts dt { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.organization-counts dd { margin: 4px 0 0; font-size: 18px; font-weight: 800; }
.tab-row { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab-button {
  min-height: 40px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  padding: 8px 14px;
  font-weight: 750;
}
.tab-button:hover { color: var(--text); }
.tab-button.active { border-bottom-color: var(--gold); color: var(--gold-light); }
.panel-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 14px 0 10px; }
.panel-toolbar p { margin: 0; font-size: 13px; }
.platform-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.platform-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101214;
  padding: 10px 12px;
}
.platform-row.inactive { opacity: 0.72; }
.platform-row-info { display: grid; gap: 3px; min-width: 0; }
.platform-row-title { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.platform-row-title strong { overflow-wrap: anywhere; }
.platform-row-info small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.platform-row-actions { display: flex; gap: 6px; }
.platform-row-capabilities { line-height: 1.4; }

.archive-effects { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.confirm-token { color: var(--gold-light); font-weight: 800; overflow-wrap: anywhere; }
.new-account-fields { border-top: 1px solid var(--line); padding-top: 10px; }

/* Matriz empresa x grupo (dialogo de usuario, empresa da plataforma). */
.dialog.member-dialog-wide { width: min(94vw, 640px); }
.member-platform-section { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 14px; }
.member-platform-section h3 { margin: 0 0 4px; font-size: 15px; }
.member-platform-section .list-status { padding: 6px 0 0; }
.super-admin-row { margin-top: 4px; }
.membership-matrix { display: grid; gap: 8px; margin-top: 10px; }
.matrix-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 230px);
  align-items: center;
  gap: 6px 12px;
  border: 1px solid #303337;
  border-radius: 6px;
  background: #101214;
  padding: 8px 10px;
}
.matrix-row.is-current { background: #141619; }
.matrix-member { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 650; }
.matrix-member input { width: 18px; min-width: 18px; height: 18px; min-height: 18px; margin: 0; accent-color: var(--gold); }
.matrix-organization { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; min-width: 0; }
.matrix-organization strong { overflow-wrap: anywhere; }
.matrix-organization small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.matrix-row select { min-height: 38px; padding: 6px 9px; font-size: 13px; }
.matrix-note { grid-column: 1 / -1; margin: 0; color: var(--muted); font-size: 12px; }
.matrix-note:empty { display: none; }
.matrix-row.is-current .matrix-note { grid-column: auto; }

@media (max-width: 980px) {
  .organization-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .organization-counts div:nth-child(2) { border-right: 0; }
  .organization-counts div:nth-child(-n + 2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 740px) {
  .organizations-layout { display: block; min-height: 0; overflow: visible; border: 0; background: transparent; }
  .organizations-list-panel { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
  .organizations-list { max-height: 320px; }
  .organization-detail { margin-top: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 16px; }
  .organization-heading { display: grid; }
  .organization-heading .button { justify-self: start; }
  .matrix-row { grid-template-columns: minmax(0, 1fr); }
  .matrix-row.is-current .matrix-note { grid-column: 1 / -1; }
}
@media (max-width: 420px) {
  .organization-counts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .organization-counts dd { font-size: 16px; }
  .platform-row { grid-template-columns: minmax(0, 1fr); }
  .platform-row-actions { justify-content: flex-end; }
  .organizations-view .heading-actions { justify-content: flex-end; }
}

/* Revisao r3 da regra simplificada (thread 01a15ac1, P2): Conta e senha com os dois caminhos (alterar com a senha atual; definir
   pelo codigo do e-mail). */
.account-dialog .account-section-title { margin: 18px 0 8px; font-size: 15px; }
.account-dialog .account-code-form { margin-top: 18px; border-top: 1px solid var(--line); }
.account-dialog .account-code-form > .button { margin: 4px 0 4px; }
.account-dialog .account-code-form > p.muted { margin: 0 0 10px; font-size: 13px; line-height: 1.45; }
.account-dialog .notice[hidden] { display: none; }

/* r121: cartões por moto; um único seletor de fontes no controle Camadas. */
.findmy-network-panel { border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin: 16px 0; }
.findmy-network-panel h3, .findmy-network-card h4 { margin: 0 0 10px; }
.findmy-network-panel p { font-size: 12px; line-height: 1.55; overflow-wrap: anywhere; }
.findmy-network-grid { display: grid; gap: 12px; margin: 14px 0; }
.findmy-network-card { border: 1px solid var(--line); border-radius: 10px; padding: 12px; min-width: 0; }
.findmy-network-card .button-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.findmy-network-card .button, .findmy-network-panel > .button { min-height: 44px; padding: 8px 10px; font-size: 11px; }
.findmy-network-card button:disabled { cursor: not-allowed; }
.findmy-network-notice { color: #efc87b; }
.findmy-apple-pairing { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.findmy-apple-pairing > strong { display: block; margin: 8px 0; font-size: 20px; letter-spacing: .12em; }
.findmy-apple-pairing > label { display: block; margin: 10px 0; font-size: 12px; line-height: 1.5; }
.findmy-apple-pairing input[type="text"] { display: block; width: 11em; margin-top: 6px; text-transform: uppercase; letter-spacing: .12em; }
.findmy-apple-pairing input[type="checkbox"] { width: auto; margin-right: 8px; }
.findmy-apple-pairing > .button { margin: 4px 6px 4px 0; }
.map-source-android { color: #81c995; }
.map-source-apple { color: #c9d2df; }

/* Pedido 181 (r131): presença junto do nome; a segunda linha é escolha da pessoa. */
.device-presence { width: 10px; height: 10px; margin-top: 4px; border: 2px solid var(--red); border-radius: 50%; background: var(--red); }
.device-presence.online { border-color: var(--green); background: var(--green); }
.device-presence.sleep { border-color: var(--green); background: transparent; }
/* 26/10 (Cassio): modo roubo = bolinha laranja; coacao fica no status (amarelo piscando), nao na bolinha. */
.device-presence.theft { border-color: var(--orange); background: var(--orange); }
.device-row-state.duress, .state-label.duress { color: var(--amber); font-weight: 700; animation: status-duress 1s steps(2, start) infinite; }
@keyframes status-duress { 50% { opacity: 0.2; } }
@media (prefers-reduced-motion: reduce) { .device-row-state.duress, .state-label.duress { animation: none; text-decoration: underline; } }
.device-row-secondary { grid-column: 2 / -1; }
.device-row.pinned { grid-template-columns: 16px minmax(0, 1fr) 32px; }
.device-row-open { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-content: start; gap: 6px 10px; min-width: 0; min-height: 32px; border: 0; padding: 0; color: inherit; background: transparent; text-align: left; }
.device-row-menu { width: 32px; min-height: 32px; align-self: start; border: 1px solid var(--line); border-radius: 5px; padding: 0; color: var(--muted); background: transparent; font-size: 22px; line-height: 1; }
.device-row-menu:hover { color: var(--text); background: var(--surface-elevated); }
.device-row-drag { align-self: start; cursor: grab; color: var(--muted); line-height: 32px; }
.device-row-drag:active { cursor: grabbing; }
.device-row-open:focus-visible, .device-row-menu:focus-visible, .device-row-drag:focus-visible { outline: 2px solid var(--gold-light); outline-offset: 2px; }

.device-row.pinned .device-row-name > strong::after { content: " ⌖"; color: var(--gold-light); }

@media (max-width: 980px) {
  .device-row { grid-template-columns: minmax(0, 1fr) 44px; }
  .device-row.pinned { grid-template-columns: 16px minmax(0, 1fr) 44px; }
  .device-row-menu { width: 44px; min-height: 44px; }
}

.device-row[role="group"] { cursor: pointer; }

/* 181m: a pending dump is an independent diagnostic, preserving lock/duress/presence. */
.panic-pending { color: var(--amber); overflow-wrap: anywhere; }
.device-row-name > .panic-pending { display: block; margin-top: 3px; font-size: 11px; line-height: 1.4; }
#devicePanicPending { margin: 8px 0 14px; font-size: 13px; line-height: 1.5; }
#devicePanicPending[hidden] { display: none; }

/* r142 — apresentação básica; autorização e valores permanecem na API e nos formulários. */
body:not(.platform-operator) [data-platform-only],
body:not(.platform-operator) .device-row-drag,
body:not(.platform-operator) #heartbeatMaintenancePanel,
body:not(.platform-operator) #ihmPairingPanel,
body:not(.platform-operator) .findmy-network-panel { display: none !important; }
.portal-version { display: block; padding: 4px 16px; text-align: right; color: var(--muted); font-size: 11px; }
.development-badge { display: inline-block; margin-left: 8px; padding: 2px 6px; border: 1px solid #9b7839; border-radius: 4px; background: #fff4d6; color: #604400; font-size: 11px; line-height: 1.4; }

[hidden] { display: none !important; }

body.platform-operator [data-basic-only] { display: none !important; }

body:not(.platform-operator) .biometric-user { grid-template-columns: minmax(0, 1fr) auto auto; }
body:not(.platform-operator) .biometric-user > input { min-width: 0; }
body:not(.platform-operator) .device-row.pinned { grid-template-columns: minmax(0, 1fr) 32px; }
body:not(.platform-operator) .device-row.pinned .device-row-name > strong::after { content: none; }
@media (max-width: 980px) {
  body:not(.platform-operator) .device-row.pinned { grid-template-columns: minmax(0, 1fr) 44px; }
}

/* r142 complemento: ausência de posição e falha da frota têm estado explícito. */
.map { position: relative; }
.map-empty-message { position: absolute; z-index: 800; top: 50%; left: 50%; transform: translate(-50%, -50%); width: max-content; max-width: calc(100% - 32px); margin: 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--text); text-align: center; pointer-events: none; }
.fleet-load-error { margin: 8px 0 12px; }

/* r143: a empresa ocupa uma tela; Usuários compartilha a área de Pessoas. */
#organizationsListPage .organizations-list-panel { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
#organizationDetail { padding: 0; }
#backToOrganizationsButton { margin-bottom: 20px; }
#organizationDetail .organization-heading h1 { overflow-wrap: anywhere; }
#organizationDetailName:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
#organizationPeopleHost .section-heading { margin: 18px 0; }
#organizationPeopleHost .table-wrap { overflow-x: auto; }
#organizationPeopleHost td { overflow-wrap: anywhere; }
#organizationPeopleHost .organization-groups { margin-top: 24px; }
.company-settings-list { display: grid; gap: 12px; margin-top: 16px; }
.company-setting { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.company-setting-info { min-width: 0; max-width: 680px; }
.company-setting h3 { margin: 0 0 8px; font-size: 15px; }
.company-setting-value { margin: 0 0 8px; font-weight: 700; }
.company-setting .field-help { margin: 0; line-height: 1.45; }
.company-setting-form { display: grid; gap: 10px; min-width: 210px; }
.company-setting-form input, .company-setting-form select { width: 100%; }
body.config-window #primaryNavigation { display: none !important; }

@media (max-width: 740px) {
  body.has-primary-navigation { --topbar-height: 108px; }
  .topbar { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-rows: 58px; }
  body.has-primary-navigation .topbar { grid-template-rows: 58px 50px; }
  .primary-navigation { grid-column: 1 / -1; grid-row: 2; align-self: stretch; margin: 0 -14px; padding: 0 10px; border-top: 1px solid var(--line); }
  .primary-navigation .nav-button { min-height: 48px; border-radius: 0; }
  .topbar-context { grid-column: 1 / 3; grid-row: 1; justify-content: flex-end; padding: 0 10px 0 0; }
  .topbar > .account-menu-wrap { grid-row: 1; }
  .organization-switcher { max-width: min(44vw, 200px); margin-right: 10px; }
  .organization-switcher select { max-width: min(44vw, 200px); }
  .connection-status { flex: 0 0 auto; font-size: 10px; gap: 5px; }
  .company-setting { flex-direction: column; gap: 14px; padding: 14px; }
  .company-setting-form { min-width: 0; width: 100%; }
  #organizationDetail .organization-heading { flex-wrap: wrap; }
  #organizationPeopleHost .section-heading { display: flex; flex-wrap: wrap; gap: 12px; }
  #organizationPeopleHost .heading-actions { flex-wrap: wrap; }
}
