:root {
  --page: #081425;
  --surface: #0f1e33;
  --surface-2: #132640;
  --surface-3: #172d4b;
  --ink: #f4f7fb;
  --muted: #9ba8b8;
  --soft: #6f8197;
  --line: rgba(31, 162, 255, 0.26);
  --line-2: rgba(31, 162, 255, 0.14);
  --blue: #006bff;
  --blue-dark: #1fa2ff;
  --cyan: #1fa2ff;
  --green: #1ddc7a;
  --online: #5bea3c;
  --amber: #ffc83d;
  --red: #ff4d4f;
  --violet: #8b5cf6;
  --panel-glow: rgba(0, 107, 255, 0.22);
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  --shadow-soft: 0 18px 44px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 76% 12%, rgba(0, 107, 255, 0.22), transparent 34%),
    radial-gradient(circle at 26% 4%, rgba(29, 220, 122, 0.1), transparent 28%),
    linear-gradient(180deg, #0b1a2e 0, var(--page) 320px),
    var(--page);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

body.login-locked {
  overflow: hidden;
}

body.login-locked .app-header,
body.login-locked .page,
body.login-locked .modal-backdrop:not(#loginScreen),
body.login-locked .toast {
  visibility: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.login-screen {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(8, 20, 37, 0.36), rgba(8, 20, 37, 0.78)),
    url("assets/login-command-center.png") center / cover no-repeat,
    var(--page);
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(31, 162, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 162, 255, 0.08) 1px, transparent 1px),
    radial-gradient(circle at 64% 42%, rgba(29, 220, 122, 0.16), transparent 18%),
    radial-gradient(circle at 36% 58%, rgba(0, 107, 255, 0.2), transparent 24%);
  background-size: 54px 54px, 54px 54px, auto, auto;
  opacity: 0.48;
  pointer-events: none;
}

.login-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(8, 20, 37, 0.84), rgba(8, 20, 37, 0.28), rgba(8, 20, 37, 0.74)),
    radial-gradient(circle at center, transparent 0, rgba(8, 20, 37, 0.58) 68%);
  pointer-events: none;
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid rgba(31, 162, 255, 0.32);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(15, 30, 51, 0.78), rgba(8, 20, 37, 0.72));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.48), inset 0 0 34px rgba(31, 162, 255, 0.08);
  backdrop-filter: blur(16px);
}

.login-brand-block {
  display: grid;
  justify-items: center;
  padding-bottom: 20px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(31, 162, 255, 0.18);
  text-align: center;
}

.login-logo {
  display: grid;
  width: 76px;
  height: 76px;
  place-items: center;
  overflow: hidden;
  margin: 0 auto 18px;
  border: 1px solid rgba(31, 162, 255, 0.36);
  border-radius: 16px;
  background: #07101d;
  box-shadow: 0 18px 42px rgba(0, 107, 255, 0.22);
}

.login-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.login-card h1 {
  margin: 0 0 18px;
  font-family: "Exo 2", Inter, sans-serif;
  font-size: 1.9rem;
  text-align: center;
}

.login-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.login-form input {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid rgba(31, 162, 255, 0.28);
  border-radius: 12px;
  outline: none;
  background: rgba(8, 20, 37, 0.82);
  color: var(--ink);
}

.login-form input:focus {
  border-color: rgba(31, 162, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(31, 162, 255, 0.14);
}

.login-form .primary-action {
  min-height: 46px;
  margin-top: 4px;
}

.login-error {
  min-height: 18px;
  color: var(--red);
  font-size: 0.82rem;
}

.app-header {
  position: fixed;
  z-index: 30;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 220px;
  padding: 14px 14px 12px;
  border-right: 1px solid rgba(31, 162, 255, 0.16);
  background:
    linear-gradient(180deg, rgba(15, 30, 51, 0.98), rgba(8, 20, 37, 0.98)),
    var(--page);
  box-shadow: 18px 0 54px rgba(0, 0, 0, 0.34);
}

.brand {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 9px;
  color: #ffffff;
  text-decoration: none;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Orbitron, "Exo 2", Inter, sans-serif;
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0.035em;
  line-height: 1;
  text-transform: uppercase;
}

.brand-wordmark-svg {
  display: block;
  width: 124px;
  height: auto;
  overflow: visible;
  filter:
    drop-shadow(0 0 3px rgba(255, 255, 255, 0.52))
    drop-shadow(0 0 10px rgba(255, 255, 255, 0.14));
}

.login-wordmark {
  width: min(292px, 100%);
  margin: 0 auto 12px;
}

.header-wordmark {
  width: 116px;
  max-width: 100%;
}

.logo-white {
  fill: #f8f9fb;
  stroke: rgba(255, 255, 255, 0.58);
  stroke-width: 1.45;
}

.logo-blue {
  fill: #078ee5;
  stroke: rgba(53, 180, 255, 0.52);
  stroke-width: 1.35;
  filter:
    drop-shadow(0 0 3px rgba(10, 148, 239, 0.52))
    drop-shadow(0 0 8px rgba(10, 148, 239, 0.22));
}

.brand-wordmark span {
  color: #0b94ef;
  text-shadow:
    0 0 8px rgba(11, 148, 239, 0.8),
    0 0 18px rgba(11, 148, 239, 0.46);
}

.brand-wordmark {
  display: inline-block;
  color: #f8f9fb;
  transform: scaleX(1.16);
  transform-origin: left center;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.38),
    0 0 9px rgba(255, 255, 255, 0.32),
    0 0 20px rgba(255, 255, 255, 0.16);
}

.brand-subword {
  width: min(330px, 100%);
  margin: 0 auto;
  color: rgba(247, 249, 252, 0.86);
  font-family: Orbitron, "Exo 2", Inter, sans-serif;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.86em;
  line-height: 1;
  text-indent: 0.86em;
  text-shadow:
    0 0 4px rgba(255, 255, 255, 0.18),
    0 0 9px rgba(255, 255, 255, 0.1);
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.56rem;
  font-weight: 800;
  line-height: 1.18;
}

.brand-logo {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(31, 162, 255, 0.34);
  border-radius: 12px;
  background: #07101d;
  box-shadow: 0 12px 28px rgba(0, 107, 255, 0.18), inset 0 0 18px rgba(31, 162, 255, 0.08);
}

.brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.main-nav {
  display: grid;
  flex: 1 1 auto;
  grid-auto-rows: min-content;
  gap: 0;
  width: 100%;
  min-height: 0;
  margin-top: 22px;
  padding: 0 4px 8px 0;
  overflow-y: auto;
  scrollbar-color: rgba(31, 162, 255, 0.42) transparent;
}

.main-nav a,
.registry-subnav button,
.commands-subnav button {
  display: flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #b4c3d3;
  font-size: 0.84rem;
  font-weight: 900;
  text-decoration: none;
}

.main-nav a {
  flex: 0 0 34px;
  height: 34px;
  min-height: 34px;
  max-height: 34px;
}

.main-nav > a,
.nav-group,
.nav-group > a {
  margin-bottom: 3px;
}

.main-nav a.active,
.main-nav a:hover,
.nav-group.expanded > a {
  border-color: rgba(29, 220, 122, 0.42);
  border-left-color: var(--green);
  background: linear-gradient(90deg, rgba(29, 220, 122, 0.12), rgba(0, 107, 255, 0.11));
  color: var(--ink);
  box-shadow: inset 3px 0 0 var(--green);
}

.nav-group {
  display: grid;
  gap: 0;
}

.registry-subnav,
.commands-subnav {
  display: grid;
  gap: 1px;
  padding: 0 0 3px 13px;
}

.registry-subnav[hidden],
.commands-subnav[hidden] {
  display: none;
}

.registry-subnav button,
.commands-subnav button {
  flex: 0 0 24px;
  height: 24px;
  justify-content: flex-start;
  min-height: 24px;
  max-height: 24px;
  padding: 0 8px;
  border-radius: 7px;
  color: #f4f7fb;
  font-size: 0.78rem;
  line-height: 1.1;
  text-align: left;
}

.registry-subnav button.active,
.registry-subnav button:hover,
.commands-subnav button.active,
.commands-subnav button:hover {
  color: var(--green);
  background: rgba(29, 220, 122, 0.08);
}

.header-actions {
  display: grid;
  flex: 0 0 auto;
  gap: 7px;
  width: 100%;
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(31, 162, 255, 0.12);
}

.active-user-field {
  display: grid;
  gap: 4px;
}

.active-user-field span {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 900;
  text-transform: uppercase;
}

.active-user-field select {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(31, 162, 255, 0.1);
  color: var(--ink);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 850;
}

.active-user-field select option {
  background: #eaf3fb;
  color: #081425;
  font-weight: 800;
}

.active-company-logo {
  display: block;
  width: 100%;
  max-height: 62px;
  margin-top: 6px;
  padding: 8px;
  border: 1px solid rgba(31, 162, 255, 0.28);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(19, 38, 64, 0.96), rgba(8, 20, 37, 0.92)),
    var(--surface);
  box-shadow: inset 0 0 22px rgba(31, 162, 255, 0.08);
  object-fit: contain;
}

.active-company-logo[hidden] {
  display: none;
}

.account-menu {
  position: fixed;
  z-index: 80;
  top: 14px;
  right: 18px;
}

.account-menu-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(31, 162, 255, 0.34);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(31, 162, 255, 0.22), rgba(29, 220, 122, 0.12));
  color: var(--ink);
  font: inherit;
  font-weight: 950;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26);
}

.account-menu-button:hover,
.account-menu-button[aria-expanded="true"] {
  border-color: rgba(29, 220, 122, 0.5);
  box-shadow: 0 0 0 3px rgba(29, 220, 122, 0.12), 0 14px 34px rgba(0, 0, 0, 0.26);
}

.account-menu-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  display: grid;
  gap: 10px;
  width: 244px;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(19, 38, 64, 0.98), rgba(8, 20, 37, 0.98));
  box-shadow: var(--shadow);
}

.account-menu-panel[hidden] {
  display: none;
}

.account-menu-panel .ghost-button {
  width: 100%;
  color: var(--ink);
}

.page {
  width: auto;
  max-width: 1480px;
  margin: 0 18px 0 232px;
  padding: 24px 0 44px;
}

.app-view-hidden {
  display: none !important;
}

.hero-strip,
.panel-title,
.map-toolbar,
.freshness {
  display: flex;
  align-items: center;
}

.hero-strip {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.crumb {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--ink);
  font-family: "Exo 2", Inter, sans-serif;
  line-height: 1.15;
}

h1 {
  font-size: 2rem;
}

h2 {
  font-size: 1.04rem;
}

h3 {
  font-size: 0.94rem;
}

.freshness {
  flex-direction: column;
  align-items: end;
  gap: 4px;
  color: var(--muted);
  font-size: 0.9rem;
}

.freshness strong {
  color: var(--blue-dark);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card,
.map-panel,
.detail-panel,
.table-section,
.geofence-section,
.geofence-map-card,
.geofence-form-card,
.registry-table-card,
.registry-form-card {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 58%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.stat-card {
  position: relative;
  min-height: 96px;
  overflow: hidden;
  padding: 18px;
  color: var(--ink);
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.stat-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--stat-color, var(--blue));
  content: "";
  opacity: 0;
}

.stat-card[data-filter="todos"] {
  --stat-color: var(--blue);
  --stat-bg: rgba(0, 107, 255, 0.14);
}

.stat-card[data-filter="estavel"] {
  --stat-color: var(--green);
  --stat-bg: rgba(29, 220, 122, 0.12);
}

.stat-card[data-filter="suspeita"] {
  --stat-color: var(--amber);
  --stat-bg: rgba(255, 200, 61, 0.13);
}

.stat-card[data-filter="emergencia"] {
  --stat-color: var(--red);
  --stat-bg: rgba(255, 77, 79, 0.13);
}

.stat-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-family: "Exo 2", Inter, sans-serif;
  font-size: 2.1rem;
  line-height: 1;
}

.stat-card span {
  display: block;
  color: var(--stat-color, var(--muted));
  font-weight: 900;
}

.stat-card.active,
.stat-card:hover {
  border-color: color-mix(in srgb, var(--stat-color, var(--blue)) 54%, transparent);
  background: var(--stat-bg, var(--surface));
  box-shadow: 0 20px 52px color-mix(in srgb, var(--stat-color, var(--blue)) 22%, transparent);
  transform: translateY(-1px);
}

.stat-card.active::before,
.stat-card:hover::before {
  opacity: 1;
}

.status-chart-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.025), transparent 62%),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.status-chart-card h2 {
  margin-top: 4px;
}

.status-chart-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-pie {
  position: relative;
  display: grid;
  width: 118px;
  height: 118px;
  place-items: center;
  border-radius: 50%;
  background: rgba(155, 168, 184, 0.16);
}

.status-pie::after {
  position: absolute;
  inset: 24px;
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.status-pie span {
  position: relative;
  z-index: 1;
  color: var(--ink);
  font-size: 1.65rem;
  font-weight: 900;
}

.status-legend {
  display: grid;
  gap: 8px;
  min-width: 170px;
}

.status-legend span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-weight: 900;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-legend span .legend-dot {
  flex: 0 0 auto;
}

.status-legend span strong {
  margin-left: auto;
  color: var(--ink);
}

.legend-dot.estavel {
  background: var(--green);
}

.legend-dot.suspeita {
  background: var(--amber);
}

.legend-dot.emergencia {
  background: var(--red);
}

.filters {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(300px, 1.55fr) minmax(170px, 0.75fr) 132px;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: rgba(15, 30, 51, 0.78);
  box-shadow: var(--shadow-soft);
}

.operations {
  display: flex;
  height: calc(100vh - var(--map-view-top, 24px) - 12px);
  min-height: 0;
  flex-direction: column;
}

.filters label,
.registry-tools label,
.registry-form label,
.geofence-form label {
  display: grid;
  gap: 6px;
}

.filters span,
.registry-tools span,
.registry-form span,
.geofence-form span,
.command-form label > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.filters input,
.filters select,
.registry-tools input,
.registry-tools select,
.registry-form input,
.registry-form select,
.geofence-form input,
.geofence-form select,
.command-form input,
.command-form select {
  width: 100%;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 20, 37, 0.72);
  color: var(--ink);
  outline: none;
}

.filters input:focus,
.filters select:focus,
.registry-tools input:focus,
.registry-tools select:focus,
.registry-form input:focus,
.registry-form select:focus,
.geofence-form input:focus,
.geofence-form select:focus,
.command-form input:focus,
.command-form select:focus {
  border-color: rgba(31, 162, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(31, 162, 255, 0.13);
}

.filters button,
.ghost-button,
.user-button,
.icon-button,
.danger-action,
.primary-action,
.segmented button,
.actions-grid button,
.command-button,
.pagination-bar button,
.registry-subnav button {
  border: 0;
  border-radius: 12px;
  font-weight: 900;
}

.filters button,
.primary-action,
.actions-grid button {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #ffffff;
  box-shadow: 0 12px 26px rgba(0, 107, 255, 0.22);
}

.filters button {
  align-self: end;
  min-height: 42px;
}

.ghost-button,
.user-button {
  min-height: 40px;
  padding: 0 13px;
  border: 1px solid var(--line-2);
  background: rgba(31, 162, 255, 0.1);
  color: var(--ink);
}

.user-button {
  color: var(--ink);
}

.header-actions .ghost-button,
.header-actions .user-button {
  width: 100%;
  background: rgba(31, 162, 255, 0.1);
  color: #ffffff;
}

.header-actions .ghost-button:hover,
.header-actions .user-button:hover {
  border-color: rgba(29, 220, 122, 0.38);
  background: rgba(29, 220, 122, 0.12);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  flex: 1;
  min-height: 0;
}

.operations .workspace {
  align-items: stretch;
}

.workspace.details-open {
  grid-template-columns: minmax(680px, 1fr) 350px;
}

.map-panel,
.detail-panel,
.table-section,
.geofence-section,
.geofence-map-card,
.geofence-form-card,
.registry-table-card,
.registry-form-card {
  min-width: 0;
  padding: 14px;
}

.map-panel {
  display: flex;
  height: 100%;
  min-height: 0;
  flex-direction: column;
}

.detail-panel {
  max-height: 100%;
  overflow: auto;
}

.panel-title,
.map-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.map-toolbar {
  flex-wrap: wrap;
}

.map-detail-toggle {
  min-height: 34px;
  padding: 0 14px;
}

.map-detail-toggle.active {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #ffffff;
}

.detail-panel[hidden] {
  display: none !important;
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-2);
  background: rgba(31, 162, 255, 0.12);
  color: var(--ink);
  font-size: 1.1rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(29, 220, 122, 0.12);
  color: var(--online);
  font-size: 0.78rem;
  font-weight: 900;
}

.status-pill.suspeita {
  background: rgba(255, 200, 61, 0.14);
  color: var(--amber);
}

.status-pill.emergencia {
  background: rgba(255, 77, 79, 0.14);
  color: var(--red);
}

.segmented {
  display: flex;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-3);
}

.segmented button {
  min-height: 32px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
}

.nav-group.permission-hidden {
  display: none;
}

.segmented button.active {
  background: rgba(244, 247, 251, 0.08);
  color: var(--blue-dark);
  box-shadow: var(--shadow-soft);
}

.map-canvas {
  position: relative;
  flex: 1;
  overflow: hidden;
  min-height: 0;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #07101d;
}

#trackingMap {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.map-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  padding: 24px;
  background: #0f1e33;
  color: var(--ink);
  font-weight: 900;
  text-align: center;
}

.map-fallback.visible {
  display: grid;
}

.geofence-section {
  margin-top: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.geofence-layout {
  display: grid;
  grid-template-columns: minmax(560px, 1fr) 390px;
  gap: 14px;
  align-items: start;
}

.geofence-map-card,
.geofence-form-card {
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-2);
}

.geofence-map {
  width: 100%;
  height: 520px;
  min-height: 520px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #07101d;
}

.geofence-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.geofence-tools .ghost-button {
  min-height: 34px;
}

.geofence-form {
  display: grid;
  gap: 12px;
}

.geofence-command-group {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
}

.geofence-command-group legend {
  padding: 0 5px;
  color: var(--ink);
  font-weight: 900;
}

.geofence-command-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.geofence-status-field small {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.geofence-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.geofence-item {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-2);
  text-align: left;
}

.geofence-item.active {
  border-color: rgba(29, 220, 122, 0.45);
  box-shadow: 0 0 0 3px rgba(29, 220, 122, 0.1);
}

.geofence-item button {
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  text-align: left;
  font-weight: 900;
}

.geofence-item small {
  color: var(--muted);
  font-weight: 800;
}

.leaflet-container {
  font: inherit;
  background: #07101d;
}

body[data-map-theme="dark"] .leaflet-tile {
  filter: brightness(0.62) saturate(0.82) hue-rotate(178deg) contrast(1.08);
}

body[data-map-theme="light"] .leaflet-tile {
  filter: none;
}

.leaflet-control-zoom a,
.leaflet-bar a {
  border-color: var(--line-2) !important;
  background: rgba(15, 30, 51, 0.92) !important;
  color: var(--ink) !important;
}

.leaflet-control-attribution {
  background: rgba(8, 20, 37, 0.82) !important;
  color: var(--muted) !important;
}

.tracking-marker {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 3px solid #ffffff;
  border-radius: 50% 50% 50% 8px;
  box-shadow: 0 8px 20px rgba(22, 34, 51, 0.28);
  transform: rotate(-45deg);
}

.tracking-marker::after {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ffffff;
  content: "";
}

.tracking-marker.estavel,
.tracking-marker.gps {
  background: var(--green);
}

.tracking-marker.lbs {
  background: var(--cyan);
}

.tracking-marker.wifi {
  background: var(--red);
}

.tracking-marker.tag {
  background: #8b5cf6;
}

.tracking-marker.suspeita {
  background: var(--violet);
}

.tracking-marker.emergencia {
  background: var(--red);
}

.tracking-marker.active {
  border-color: var(--ink);
  transform: rotate(-45deg) scale(1.18);
}

.leaflet-popup-content {
  margin: 10px 12px;
  color: var(--ink);
  font-size: 0.9rem;
}

.leaflet-popup-content strong {
  display: block;
  margin-bottom: 4px;
}

.device-card {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-2);
}

.device-card strong {
  font-size: 1.28rem;
  overflow-wrap: anywhere;
}

.device-card span {
  color: var(--muted);
  font-weight: 800;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 12px;
}

.detail-grid div,
.command-card,
.history-summary div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-2);
}

.detail-grid dt {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.detail-grid dd {
  margin: 5px 0 0;
  font-weight: 900;
  overflow-wrap: anywhere;
}

.actions-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.actions-grid button {
  min-height: 38px;
  padding: 0 8px;
  font-size: 0.84rem;
}

.timeline ol {
  display: grid;
  gap: 10px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  position: relative;
  padding-left: 22px;
}

.timeline li::before {
  position: absolute;
  top: 3px;
  left: 0;
  width: 9px;
  height: 9px;
  border: 3px solid var(--green);
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.timeline strong,
.timeline span {
  display: block;
}

.timeline span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.87rem;
}

.table-section,
.commands-section,
.registry-section {
  margin-top: 14px;
}

.commands-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr);
  gap: 14px;
  align-items: start;
}

.commands-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(19, 38, 64, 0.94), rgba(15, 30, 51, 0.92));
  box-shadow: var(--shadow-soft);
}

.commands-card[hidden] {
  display: none;
}

#bulkCommandPanel {
  max-width: 920px;
}

.panel-title.compact {
  margin-bottom: 12px;
}

.panel-title.compact h3 {
  margin: 0;
  font-size: 1rem;
}

.commands-form {
  display: grid;
  gap: 12px;
}

.bulk-command-form {
  grid-template-columns: minmax(230px, 0.9fr) minmax(230px, 0.9fr) minmax(300px, 1.2fr);
  align-items: start;
}

.bulk-command-form .primary-action {
  grid-column: 1 / -1;
}

.bulk-command-panel,
.bulk-equipment-card,
.bulk-imeis-card {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.form-grid {
  display: grid;
  gap: 10px;
}

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

.commands-form label,
.bulk-company-field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.commands-form input,
.commands-form select,
.commands-form textarea {
  width: 100%;
  border: 1px solid rgba(31, 162, 255, 0.28);
  border-radius: 12px;
  outline: none;
  background: rgba(8, 20, 37, 0.82);
  color: var(--ink);
  font: inherit;
  font-weight: 800;
}

.bulk-company-field select {
  min-height: 42px;
  padding: 0 12px;
}

.command-settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.bulk-equipment-list {
  display: grid;
  gap: 6px;
  max-height: 162px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-color: rgba(31, 162, 255, 0.42) rgba(8, 20, 37, 0.6);
}

.bulk-equipment-item {
  display: flex !important;
  align-items: center;
  gap: 10px;
  min-height: 28px;
  min-width: 0;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
}

.bulk-equipment-item input {
  flex: 0 0 auto;
  width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  padding: 0;
  accent-color: var(--blue);
}

.bulk-equipment-item span {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dbe8f7;
}

.bulk-check-all {
  justify-content: flex-start;
  margin-bottom: 2px;
}

.empty-state.compact {
  padding: 10px;
  border-radius: 8px;
  font-size: 0.78rem;
}

.sent-commands-card {
  width: 100%;
  min-width: 1120px;
}

.sent-command-search {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.sent-command-search label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.sent-command-search input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(31, 162, 255, 0.28);
  border-radius: 12px;
  outline: none;
  background: rgba(8, 20, 37, 0.82);
  color: var(--ink);
  font: inherit;
  font-weight: 850;
}

.sent-command-search input:focus {
  border-color: rgba(31, 162, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(31, 162, 255, 0.14);
}

.sent-command-table {
  display: grid;
  gap: 7px;
  min-width: 0;
  width: 100%;
}

.sent-command-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.9fr) minmax(92px, 0.48fr) minmax(138px, 0.72fr) minmax(154px, 0.78fr) minmax(390px, 2.35fr);
  column-gap: 14px;
  row-gap: 8px;
  align-items: center;
  min-width: 0;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 162, 255, 0.13);
  border-radius: 8px;
  background: var(--surface-2);
  color: #eef6ff;
  font-weight: 850;
}

.sent-command-row.head {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.sent-command-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: clip;
  white-space: nowrap;
}

.sent-command-row span[data-label="Comando"] {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.analytics-user-row {
  grid-template-columns: minmax(160px, 1.1fr) minmax(140px, 0.9fr) minmax(140px, 0.9fr) minmax(210px, 1.25fr) minmax(210px, 1.25fr);
}

.analytics-section {
  margin-top: 14px;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.analytics-card,
.analytics-machine-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(19, 38, 64, 0.94), rgba(15, 30, 51, 0.92));
  box-shadow: var(--shadow-soft);
}

.analytics-card {
  display: grid;
  gap: 8px;
  text-align: left;
}

button.analytics-card {
  color: inherit;
}

.analytics-clickable:hover {
  border-color: rgba(29, 220, 122, 0.42);
  box-shadow: inset 0 0 0 1px rgba(29, 220, 122, 0.16), var(--shadow-soft);
}

.analytics-card span,
.analytics-machine-summary span {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.analytics-card strong {
  font-size: 1.45rem;
  line-height: 1;
}

.analytics-machine-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.analytics-machine-summary div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: rgba(8, 20, 37, 0.5);
}

.analytics-machine-summary strong {
  font-size: 1.1rem;
}

#analyticsMachineChart {
  display: block;
  width: 100%;
  height: 260px;
  border: 1px solid var(--line-2);
  border-radius: 8px;
  background: rgba(8, 20, 37, 0.62);
}

.analytics-users-dialog {
  width: min(840px, 100%);
}

.simulator-section {
  margin-top: 14px;
}

.simulator-layout {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.simulator-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(19, 38, 64, 0.94), rgba(15, 30, 51, 0.92));
  box-shadow: var(--shadow-soft);
}

.simulator-form {
  display: grid;
  gap: 12px;
}

.simulator-coordinate-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.simulator-map-button {
  width: 100%;
}

.simulator-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.simulator-form input {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(31, 162, 255, 0.28);
  border-radius: 12px;
  outline: none;
  background: rgba(8, 20, 37, 0.82);
  color: var(--ink);
  font: inherit;
  font-weight: 850;
}

.simulator-form input:focus {
  border-color: rgba(31, 162, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(31, 162, 255, 0.14);
}

.simulator-form small {
  color: var(--muted);
  line-height: 1.35;
}

.compact-button {
  min-height: 34px;
  padding: 0 10px;
  white-space: nowrap;
}

.simulator-table {
  display: grid;
  gap: 7px;
  min-width: 0;
  overflow-x: auto;
}

.simulator-row {
  display: grid;
  grid-template-columns: 190px 130px 100px 250px 300px 130px 110px 230px 400px;
  column-gap: 18px;
  row-gap: 8px;
  align-items: center;
  width: 2030px;
  min-width: 2030px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 162, 255, 0.13);
  border-radius: 8px;
  background: var(--surface-2);
  color: #eef6ff;
  font-weight: 850;
}

.simulator-row.head {
  min-height: 34px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.simulator-row span {
  min-width: 0;
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.simulator-row span[data-label="Bateria"],
.simulator-row span[data-label="Pacotes"] {
  text-align: center;
}

.simulator-row span[data-label="Status"] {
  display: flex;
  align-items: center;
  gap: 8px;
}

.simulator-actions {
  display: grid;
  grid-template-columns: 118px 118px 92px;
  gap: 10px;
  justify-self: start;
  align-items: center;
  width: 348px;
  overflow: visible !important;
}

.simulator-actions .compact-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 34px;
  padding: 0 8px;
  box-sizing: border-box;
  border: 1px solid rgba(31, 162, 255, 0.28);
  border-radius: 10px;
  background: rgba(31, 162, 255, 0.1);
  line-height: 1;
  font-size: 0.8rem;
}

.simulator-actions .danger-action {
  border-color: rgba(255, 77, 79, 0.28);
  background: rgba(255, 77, 79, 0.16);
}

.simulator-actions .compact-button:first-child {
  border-radius: 10px;
}

.simulator-actions .compact-button:last-child {
  border-radius: 10px;
}

.simulator-actions .compact-button:hover {
  background: rgba(31, 162, 255, 0.16);
}

.simulator-actions .danger-action:hover {
  background: rgba(255, 77, 79, 0.24);
}

.commands-form input,
.commands-form select {
  min-height: 42px;
  padding: 0 12px;
}

.commands-form textarea {
  min-height: 156px;
  padding: 12px;
  resize: vertical;
}

.bulk-command-form .command-card {
  margin: 0;
  padding: 12px;
  min-height: 96px;
}

.bulk-imeis-card textarea {
  min-height: 232px;
}

.bulk-command-form .compact-suffix {
  grid-template-columns: 54px minmax(0, auto);
}

.bulk-command-form .command-check-card .check-row {
  gap: 8px;
}

.commands-form input:focus,
.commands-form select:focus,
.commands-form textarea:focus {
  border-color: rgba(31, 162, 255, 0.72);
  box-shadow: 0 0 0 3px rgba(31, 162, 255, 0.14);
}

.registry-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  align-items: start;
}

.primary-action {
  min-height: 40px;
  padding: 0 14px;
}

.danger-action {
  background: rgba(255, 77, 79, 0.14);
  color: var(--red);
}

.registry-tools {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px;
  gap: 10px;
  margin-bottom: 12px;
}

.registry-tools[hidden],
.registry-form-card[hidden],
#newRegistryButton[hidden] {
  display: none !important;
}

.registry-layout:has(.registry-form-card[hidden]) .registry-table-card {
  grid-column: 1 / -1;
}

.registry-table,
.data-table,
.history-table {
  display: grid;
  gap: 7px;
}

.registry-table-card {
  background:
    linear-gradient(180deg, rgba(31, 162, 255, 0.08), rgba(255, 255, 255, 0.03) 44%, rgba(8, 20, 37, 0.08)),
    #142942;
}

.registry-table-card .crumb,
.registry-table-card .registry-tools label > span {
  color: #c7d9ef;
}

.registry-table-card .panel-title h2,
.registry-table-card .pagination-bar {
  color: #f8fbff;
}

.history-table {
  width: 1368px;
  min-width: 1368px;
}

.table-section {
  overflow-x: auto;
  scrollbar-color: rgba(31, 162, 255, 0.42) rgba(15, 30, 51, 0.9);
}

.data-table {
  width: 1164px;
  min-width: 1164px;
}

.registry-row,
.table-row,
.history-row {
  display: grid;
  align-items: center;
  justify-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-2);
}

.registry-row {
  grid-template-columns: 1fr 0.8fr 1fr 1.2fr 0.65fr;
  border-color: rgba(82, 170, 255, 0.28);
  border-radius: 8px;
  background: #1b3858;
  color: #f2f7ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.registry-row:nth-child(even):not(.head) {
  background: #183250;
}

.table-row {
  gap: 7px;
  font-size: 0.92rem;
  grid-template-columns:
    148px
    158px
    82px
    84px
    58px
    76px
    70px
    72px
    116px
    80px
    98px;
}

.history-row {
  gap: 7px;
  font-size: 0.9rem;
  grid-template-columns:
    150px
    110px
    114px
    100px
    100px
    92px
    72px
    88px
    84px
    84px
    280px;
}

.registry-row.head,
.table-row.head,
.history-row.head {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: none;
}

.registry-row.head {
  color: #c3d8f2;
}

.registry-row:not(.head):hover,
.registry-row.active,
.table-row:not(.head):hover,
.history-row:not(.head):hover {
  border-color: rgba(31, 162, 255, 0.28);
  background: rgba(31, 162, 255, 0.08);
}

.registry-row:not(.head):hover,
.registry-row.active {
  border-color: rgba(31, 162, 255, 0.58);
  background: #214a73;
}

.registry-row span,
.table-row span,
.history-row span {
  min-width: 0;
  width: 100%;
  overflow-wrap: normal;
  word-break: normal;
  text-align: center;
}

.registry-row .cell-inline,
.table-row .cell-inline,
.history-row .cell-inline {
  justify-content: center;
}

.registry-row .cell-inline {
  color: #eef6ff;
}

.table-row span[data-label="Local"],
.table-row span[data-label="Recebido em"],
.history-row span[data-label="Local"] {
  white-space: normal;
  overflow-wrap: normal;
}

.table-row span[data-label="Local"],
.history-row span[data-label="Local"] {
  text-align: left;
}

.table-row > :not([data-label="Local"]):not([data-label="Recebido em"]),
.history-row > :not([data-label="Local"]) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.imei-link {
  justify-self: center;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  font-size: 0.92rem;
  font-weight: 900;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.table-row.head span:last-child,
.table-row .command-button {
  position: sticky;
  right: 0;
  z-index: 2;
}

.table-row.head span:last-child {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  background: var(--surface);
  box-shadow: -14px 0 18px rgba(8, 20, 37, 0.92);
}

.imei-link:hover {
  color: var(--green);
}

.command-button {
  justify-self: stretch;
  text-align: center;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid rgba(31, 162, 255, 0.18);
  background: #14375c;
  color: var(--ink);
  white-space: nowrap;
  box-shadow: -14px 0 18px rgba(8, 20, 37, 0.9), inset 0 0 0 1px rgba(31, 162, 255, 0.1);
}

.command-button:hover {
  border-color: rgba(29, 220, 122, 0.35);
  background: #15594a;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
}

.dot.estavel {
  background: var(--green);
}

.dot.suspeita {
  background: var(--amber);
}

.dot.emergencia {
  background: var(--red);
}

.dot.lbs {
  background: var(--cyan);
}

.dot.tag {
  background: #8b5cf6;
}

.cell-inline {
  display: inline-flex;
  align-items: center;
  gap: 0;
  justify-content: center;
}

.empty-state {
  padding: 22px;
  border-radius: 12px;
  background: var(--surface-2);
  color: var(--muted);
  text-align: center;
}

.transfer-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(260px, 30%, 330px);
  gap: 14px;
  align-items: start;
}

.transfer-selection-panel,
.bulk-transfer-panel {
  display: grid;
  gap: 14px;
}

.bulk-transfer-panel {
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-2);
}

.bulk-transfer-title {
  display: grid;
  gap: 2px;
}

.bulk-transfer-title h3 {
  font-size: 1rem;
}

.parameters-panel {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface-2);
}

.parameters-panel label {
  display: grid;
  gap: 6px;
}

.parameters-panel label > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.parameters-panel input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
}

.parameters-panel .input-suffix strong {
  min-width: 42px;
  color: var(--muted);
  font-weight: 900;
}

.transfer-controls {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) minmax(210px, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.transfer-controls label {
  display: grid;
  gap: 6px;
}

.transfer-controls span,
.bulk-transfer-panel label > span,
.transfer-equipment small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.transfer-controls select,
.bulk-transfer-panel select {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
}

.bulk-transfer-panel label {
  display: grid;
  gap: 6px;
}

.bulk-transfer-panel textarea {
  width: 100%;
  min-height: 150px;
  resize: vertical;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}

.bulk-transfer-panel textarea::placeholder {
  color: var(--muted);
}

.transfer-list {
  display: grid;
  gap: 7px;
}

.transfer-equipment {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface-2);
}

.transfer-equipment:hover {
  border-color: rgba(31, 162, 255, 0.28);
  background: rgba(31, 162, 255, 0.08);
}

.transfer-equipment input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.transfer-equipment span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.transfer-equipment strong,
.transfer-equipment small {
  overflow-wrap: anywhere;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.pagination-bar div {
  display: flex;
  gap: 6px;
}

.pagination-bar button {
  min-width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  background: rgba(31, 162, 255, 0.1);
  color: var(--ink);
}

.pagination-bar button.active {
  background: linear-gradient(135deg, var(--blue), var(--blue-dark));
  color: #ffffff;
}

.registry-form,
.command-form {
  display: grid;
  gap: 12px;
}

.registry-form [hidden] {
  display: none !important;
}

.command-form {
  gap: 14px;
}

.check-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.company-status {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0;
  border: 0;
}

.company-status legend,
.logo-upload > span {
  width: 100%;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.company-status label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.company-status input {
  width: 20px;
  height: 20px;
  accent-color: var(--blue);
}

.profile-tabs-field {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: rgba(8, 20, 37, 0.42);
}

.profile-tabs-field legend {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.profile-tabs-field label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 850;
}

.profile-tabs-field .profile-full-option {
  grid-column: 1 / -1;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(29, 220, 122, 0.35);
  border-radius: 10px;
  background: rgba(29, 220, 122, 0.1);
  color: #eafff4;
}

.profile-tabs-field input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.logo-upload input {
  display: none;
}

.logo-upload strong {
  color: var(--blue-dark);
  cursor: pointer;
  font-size: 0.95rem;
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 2px;
}

.toast {
  position: fixed;
  z-index: 40;
  right: 18px;
  bottom: 18px;
  max-width: min(380px, calc(100vw - 36px));
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #0b182a;
  color: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

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

.page {
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  backface-visibility: hidden;
}

body.page-cube-transitioning {
  pointer-events: auto;
}

body.page-cube-transitioning .page {
  will-change: transform, opacity, filter;
  pointer-events: none;
}

body.page-cube-exit .page {
  animation: page-cube-exit 260ms cubic-bezier(0.55, 0.08, 0.2, 1) both;
}

body.page-cube-enter .page {
  animation: page-cube-enter 320ms cubic-bezier(0.16, 0.84, 0.26, 1) both;
}

body.page-slide-exit .page {
  animation: page-slide-exit 250ms cubic-bezier(0.55, 0.08, 0.2, 1) both;
}

body.page-slide-enter .page {
  animation: page-slide-enter 300ms cubic-bezier(0.16, 0.84, 0.26, 1) both;
}

@keyframes page-cube-exit {
  0% {
    opacity: 1;
    filter: brightness(1);
    transform: perspective(1200px) translateZ(0) rotateY(0deg);
  }
  100% {
    opacity: 0.28;
    filter: brightness(0.78);
    transform: perspective(1200px) translateX(-8%) translateZ(-190px) rotateY(-88deg);
  }
}

@keyframes page-cube-enter {
  0% {
    opacity: 0.28;
    filter: brightness(0.78);
    transform: perspective(1200px) translateX(8%) translateZ(-190px) rotateY(88deg);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
    transform: perspective(1200px) translateZ(0) rotateY(0deg);
  }
}

@keyframes page-slide-exit {
  0% {
    opacity: 1;
    transform: translateX(0);
  }
  100% {
    opacity: 0.18;
    transform: translateX(42%);
  }
}

@keyframes page-slide-enter {
  0% {
    opacity: 0.18;
    transform: translateX(-42%);
  }
  100% {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  body.page-cube-exit .page,
  body.page-cube-enter .page,
  body.page-slide-exit .page,
  body.page-slide-enter .page {
    animation: none !important;
  }
}

.modal-backdrop {
  position: fixed;
  z-index: 10000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(3, 8, 16, 0.72);
  backdrop-filter: blur(8px);
}

.modal-backdrop[hidden] {
  display: none;
}

.history-dialog,
.trace-dialog,
.command-dialog,
.simulator-map-dialog {
  position: relative;
  z-index: 10001;
  padding: 18px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.history-dialog {
  width: min(1040px, 100%);
  max-height: min(780px, calc(100vh - 48px));
  overflow: auto;
  scrollbar-color: rgba(31, 162, 255, 0.42) rgba(15, 30, 51, 0.9);
}

.status-equipments-dialog {
  width: min(1180px, 100%);
}

.status-equipments-table {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.status-equipment-row {
  display: grid;
  grid-template-columns: 180px 160px minmax(220px, 1fr) 110px 170px 130px;
  gap: 14px;
  align-items: center;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid rgba(31, 162, 255, 0.14);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-weight: 850;
  text-align: left;
}

.status-equipment-row.head {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.status-equipment-row:not(.head) {
  cursor: pointer;
}

.status-equipment-row:not(.head):hover {
  border-color: rgba(31, 162, 255, 0.55);
  background: rgba(18, 58, 94, 0.9);
}

.status-equipment-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-equipment-row span[data-label="Status"] {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trace-dialog {
  width: min(1100px, 100%);
  max-height: min(820px, calc(100vh - 48px));
  overflow: auto;
}

.command-dialog {
  width: min(520px, 100%);
}

.simulator-map-dialog {
  width: min(920px, 100%);
}

.simulator-picker-map {
  height: min(520px, calc(100vh - 220px));
  min-height: 360px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(8, 20, 37, 0.7);
}

.simulator-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.simulator-picker-footer strong {
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  background: rgba(8, 20, 37, 0.62);
  color: var(--ink);
  font-size: 0.9rem;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.trace-button {
  min-height: 34px;
  padding: 0 14px;
}

.command-current,
.history-summary,
.trace-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.command-current {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.command-card {
  display: grid;
  align-content: center;
  gap: 12px;
  min-height: 76px;
}

.command-card > span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.command-check-card .check-row {
  gap: 9px;
}

.command-check-card .check-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.compact-suffix {
  grid-template-columns: 58px auto;
  justify-content: start;
}

.compact-suffix input {
  height: 42px;
  padding: 0 10px;
  text-align: center;
}

.history-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.trace-summary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.command-current span,
.command-current strong,
.history-summary span,
.history-summary strong,
.trace-summary span,
.trace-summary strong {
  display: block;
}

.command-current span,
.history-summary span,
.trace-summary span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.command-current strong,
.history-summary strong,
.trace-summary strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.trace-date-field {
  display: block;
}

.trace-date-field input {
  width: 100%;
  min-width: 0;
  height: 36px;
  margin-top: 5px;
  padding: 0 10px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 900;
}

.trace-date-field input[type="text"] {
  text-align: center;
}

.trace-map {
  width: 100%;
  height: min(620px, calc(100vh - 230px));
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: #07101d;
}

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

.input-suffix input {
  min-width: 0;
}

@media (max-width: 1180px) {
  .stats-grid,
  .status-chart-card,
  .filters,
  .registry-tools,
  .workspace,
  .registry-layout,
  .geofence-layout,
  .simulator-layout {
    grid-template-columns: 1fr;
  }

  .transfer-panel {
    grid-template-columns: 1fr;
  }

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

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

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

  .analytics-machine-summary {
    grid-template-columns: 1fr;
  }

  .bulk-command-form .primary-action {
    grid-column: 1 / -1;
  }

  .status-chart-wrap {
    justify-content: space-between;
  }

  .filters button {
    width: 100%;
  }

  .table-section {
    overflow-x: visible;
  }

  .data-table {
    width: 100%;
    min-width: 0;
  }

  .table-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .table-row.head {
    display: none;
  }

  .table-row > [data-label],
  .table-row .command-button[data-label] {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
  }

  .table-row > [data-label]::before,
  .table-row .command-button[data-label]::before {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .table-row .command-button {
    position: static;
    justify-content: stretch;
    width: 100%;
    box-shadow: none;
  }

  .sent-command-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .sent-command-row.head {
    display: none;
  }

  .sent-command-row span {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    white-space: normal;
  }

  .sent-command-row span::before {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .simulator-table {
    overflow-x: visible;
  }

  .simulator-row {
    grid-template-columns: 1fr;
    gap: 8px;
    min-width: 0;
    padding: 12px;
  }

  .simulator-row.head {
    display: none;
  }

  .simulator-row span {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    gap: 10px;
    white-space: normal;
  }

  .simulator-row span::before {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .simulator-row span[data-label="Status"] {
    display: grid;
  }

  .simulator-actions {
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .simulator-actions button {
    width: 100%;
  }

  .status-equipment-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .status-equipment-row.head {
    display: none;
  }

  .status-equipment-row span {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
    gap: 10px;
    white-space: normal;
  }

  .status-equipment-row span::before {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .status-equipment-row span[data-label="Status"] {
    display: grid;
    grid-template-columns: 104px minmax(0, 1fr);
  }
}

@media (min-width: 721px) and (max-width: 1180px) {
  .filters {
    grid-template-columns: minmax(132px, 0.75fr) minmax(180px, 1fr) minmax(124px, 0.7fr) 104px;
  }
}

@media (min-width: 1181px) and (max-width: 1320px) {
  .transfer-controls {
    grid-template-columns: minmax(210px, 1fr) minmax(210px, 1fr);
  }

  .transfer-controls .primary-action {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 720px) {
  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    position: sticky;
    inset: auto;
    display: grid;
    grid-template-columns: 1fr;
    width: auto;
    padding: 14px 18px;
    border-right: 0;
    border-bottom: 1px solid rgba(31, 162, 255, 0.18);
    background: rgba(8, 20, 37, 0.94);
    box-shadow: 0 16px 38px rgba(0, 0, 0, 0.24);
    backdrop-filter: blur(18px);
  }

  .brand {
    color: var(--ink);
  }

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

  .brand-logo {
    border-color: rgba(31, 162, 255, 0.34);
    background: linear-gradient(145deg, rgba(0, 107, 255, 0.16), rgba(29, 220, 122, 0.08));
  }

  .main-nav {
    display: flex;
    flex: none;
    flex-direction: row;
    gap: 0;
    margin-top: 0;
    padding: 0;
    overflow-x: auto;
    overflow-y: visible;
  }

  .main-nav a {
    flex: 0 0 auto;
    height: 38px;
    min-height: 38px;
    max-height: 38px;
    margin-right: 6px;
    margin-bottom: 0;
    color: var(--muted);
  }

  .nav-group {
    flex: 0 0 auto;
    min-width: 180px;
  }

  .registry-subnav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding-left: 6px;
  }

  .registry-subnav button {
    height: 30px;
    min-height: 30px;
    max-height: 30px;
    padding: 0 8px;
    font-size: 0.76rem;
  }

  .main-nav a.active,
  .main-nav a:hover {
    background: rgba(29, 220, 122, 0.12);
    color: var(--ink);
  }

  .main-nav,
  .header-actions {
    grid-column: auto;
  }

  .header-actions {
    display: flex;
    flex: none;
    width: auto;
    margin-top: 0;
  }

  .header-actions .ghost-button,
  .header-actions .user-button {
    width: auto;
    background: rgba(31, 162, 255, 0.1);
    color: var(--ink);
  }

  .header-actions .user-button {
    color: var(--ink);
  }

  .page {
    width: min(100% - 28px, 1480px);
    max-width: none;
    margin: 0 auto;
  }

  .hero-strip,
  .panel-title,
  .map-toolbar {
    align-items: start;
    flex-direction: column;
  }

  .freshness {
    align-items: start;
  }

  .operations .filters {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 8px;
    padding: 8px;
  }

  .operations .filters label {
    gap: 3px;
  }

  .operations .filters span {
    font-size: 0.66rem;
  }

  .operations .filters input,
  .operations .filters select {
    height: 36px;
    border-radius: 10px;
  }

  .operations .filters label:has(#companyFilter) {
    order: 1;
  }

  .operations .filters label:has(#statusFilter) {
    order: 2;
  }

  .operations .filters .search-field {
    order: 3;
  }

  .operations .filters button {
    order: 4;
    align-self: end;
    min-height: 36px;
    border-radius: 10px;
  }

  .operations .map-panel {
    padding: 8px;
  }

  .operations .map-toolbar {
    align-items: center;
    flex-direction: row;
    gap: 8px;
    margin-bottom: 8px;
  }

  .operations .map-toolbar .crumb {
    display: none;
  }

  .operations .map-toolbar h2 {
    font-size: 0.9rem;
  }

  .operations .segmented,
  .operations .map-detail-toggle {
    flex: 0 0 auto;
  }

  .operations .segmented button,
  .operations .map-detail-toggle {
    min-height: 32px;
    padding: 0 10px;
    font-size: 0.78rem;
  }

  .map-canvas {
    min-height: 0;
    height: auto;
  }

  #trackingMap {
    min-height: 0;
    height: 100%;
  }

  h1 {
    font-size: 1.6rem;
  }

  .stat-card strong {
    font-size: 1.75rem;
  }

}

@media (max-width: 620px) {
  .stats-grid,
  .detail-grid,
  .actions-grid,
  .history-summary,
  .trace-summary,
  .command-current,
  .form-actions {
    grid-template-columns: 1fr;
  }

  .transfer-controls {
    grid-template-columns: 1fr;
  }

  .parameters-panel {
    grid-template-columns: 1fr;
  }

  .status-chart-wrap {
    align-items: flex-start;
    flex-direction: column;
  }

  .registry-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
  }

  .registry-row.head {
    display: none;
  }

  .registry-row > [data-label] {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .registry-row > [data-label]::before {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 900;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .modal-backdrop {
    padding: 10px;
  }

  .history-dialog {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 20px);
    padding: 12px;
  }

  .history-dialog .panel-title {
    gap: 10px;
  }

  .history-dialog .modal-actions {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .history-table {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .history-row {
    grid-template-columns: 1fr;
    gap: 8px;
    width: 100%;
    max-width: 100%;
    min-height: 0;
    padding: 12px;
  }

  .history-row.head {
    display: none;
  }

  .history-row > [data-label] {
    display: grid;
    grid-template-columns: 116px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    white-space: normal;
  }

  .history-row > [data-label]::before {
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 900;
    text-transform: uppercase;
    content: attr(data-label);
  }

  .history-row > :not([data-label="Local"]) {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
  }

  .history-row .cell-inline {
    justify-content: flex-start;
  }
}
