:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f8f8;
  color: #17201f;
  --surface: #ffffff;
  --surface-2: #eef4f2;
  --line: #cfd9d6;
  --text-muted: #5c6b67;
  --teal: #008c95;
  --green: #2f9e44;
  --amber: #c17c00;
  --red: #d64545;
  --ink: #17201f;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(0, 140, 149, 0.08), rgba(246, 248, 248, 0) 320px),
    #f6f8f8;
}

.is-hidden {
  display: none !important;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
}

button {
  min-height: 42px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

button:hover,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  border-color: var(--teal);
  outline: 3px solid rgba(0, 140, 149, 0.2);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  line-height: 1.05;
}

h2 {
  font-size: 1.1rem;
  line-height: 1.2;
}

h3 {
  font-size: 1rem;
  line-height: 1.3;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-panel {
  width: min(100%, 460px);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
}

.auth-copy {
  margin-top: 8px;
  color: var(--text-muted);
}

.login-form {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}

.login-form input {
  min-height: 44px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: #ffffff;
  color: var(--ink);
}

.auth-error {
  min-height: 22px;
  color: var(--red);
  font-weight: 700;
}

.app-shell {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: 24px;
  overflow-x: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.cloud-status,
.map-mode,
.state-pill,
#selectedBadge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.cloud-status small,
.map-mode span {
  display: block;
  color: var(--text-muted);
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(47, 158, 68, 0.13);
}

.agv-stage {
  position: relative;
  min-height: 500px;
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #e7f1ef, #d7e5e2 50%, #edf2f1 100%);
}

.agv-stage-copy,
.agv-stage-meta {
  position: absolute;
  z-index: 2;
  left: 18px;
  right: 18px;
  display: flex;
  gap: 12px;
}

.agv-stage-copy {
  top: 16px;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.agv-stage-copy h2 {
  font-size: 1.35rem;
}

.agv-stage-copy p:last-child {
  color: var(--text-muted);
  max-width: 540px;
}

.agv-stage-meta {
  bottom: 16px;
  flex-wrap: wrap;
}

.agv-stage-meta span {
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid rgba(23, 32, 31, 0.15);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  font-size: 0.84rem;
  font-weight: 700;
}

.agv-stage-view {
  position: absolute;
  inset: 0;
}

.agv-stage-view.is-unavailable {
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--text-muted);
  text-align: center;
  background: linear-gradient(135deg, #e9f2f0 0%, #f7faf9 100%);
}

.agv-stage-view canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.cloud-status[data-state="offline"] .status-dot {
  background: var(--red);
  box-shadow: 0 0 0 6px rgba(214, 69, 69, 0.13);
}

.cloud-status[data-state="syncing"] .status-dot {
  background: var(--amber);
  box-shadow: 0 0 0 6px rgba(193, 124, 0, 0.13);
}

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

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
}

.metric {
  min-height: 96px;
  padding: 16px;
}

.metric span,
.readout-grid span {
  display: block;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  line-height: 1;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 300px minmax(420px, 1fr) 360px;
  grid-auto-rows: minmax(120px, auto);
  gap: 12px;
  align-items: stretch;
}

.panel {
  min-width: 0;
  padding: 16px;
}

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

.map-panel {
  grid-column: 1 / -1;
  grid-row: auto;
}

.fleet-panel {
  grid-column: 1;
  grid-row: span 3;
}

.command-panel,
.detail-panel,
.sensors-panel,
.telemetry-panel,
.power-panel,
.rpi-panel,
.camera-panel,
.alerts-panel,
.push-log-panel {
  grid-column: 3;
}

.map-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.map-search,
.map-control-row {
  min-width: 0;
}

.map-search-row,
.map-control-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.map-search-row input {
  min-width: 0;
  flex: 1;
}

.map-search-row button,
.map-control-row button {
  min-height: 40px;
}

.map-control-row button {
  min-width: 42px;
  padding-inline: 12px;
}

#mapZoomLabel {
  min-width: 54px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-align: center;
}

.map-search-status {
  min-height: 18px;
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.map-viewport {
  position: relative;
  min-height: min(78vh, 860px);
  overflow: hidden;
  border: 1px solid #aebcba;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.72) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.72) 1px, transparent 1px),
    #dce9e5;
  background-size: 42px 42px;
  isolation: isolate;
  touch-action: none;
  cursor: grab;
  user-select: none;
}

.map-viewport::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(circle at 18% 24%, rgba(0, 140, 149, 0.12), transparent 24%),
    radial-gradient(circle at 74% 68%, rgba(47, 158, 68, 0.12), transparent 26%),
    linear-gradient(135deg, rgba(255,255,255,.5), rgba(255,255,255,0));
  pointer-events: none;
}

.map-viewport.is-panning {
  cursor: grabbing;
}

.map-content {
  position: absolute;
  inset: 0;
  z-index: 1;
  transform-origin: 0 0;
  will-change: transform;
}

.tile-layer {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  opacity: 0.6;
  filter: saturate(0.72) contrast(1.05);
}

.tile-layer img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tile-layer img.tile-failed {
  opacity: 0;
}

.facility-overlay,
.route-layer,
.map-markers {
  position: absolute;
  inset: 0;
}

.facility-overlay {
  background:
    linear-gradient(90deg, transparent 0 13%, rgba(0, 140, 149, 0.15) 13% 17%, transparent 17% 36%, rgba(193, 124, 0, 0.13) 36% 40%, transparent 40% 63%, rgba(47, 158, 68, 0.14) 63% 67%, transparent 67% 100%),
    linear-gradient(180deg, transparent 0 22%, rgba(255, 255, 255, 0.56) 22% 26%, transparent 26% 62%, rgba(255, 255, 255, 0.56) 62% 66%, transparent 66% 100%);
  z-index: 1;
}

.aisle {
  position: absolute;
  border: 1px dashed rgba(23, 32, 31, 0.3);
  background: rgba(255, 255, 255, 0.16);
}

.aisle-a {
  left: 10%;
  top: 10%;
  width: 78%;
  height: 11%;
}

.aisle-b {
  left: 18%;
  top: 45%;
  width: 66%;
  height: 11%;
}

.aisle-c {
  left: 10%;
  top: 78%;
  width: 80%;
  height: 11%;
}

.zone-label {
  position: absolute;
  padding: 5px 7px;
  border: 1px solid rgba(23, 32, 31, 0.28);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.72);
  color: #17201f;
  font-size: 0.78rem;
  font-weight: 800;
}

.zone-charger {
  left: 5%;
  top: 12%;
}

.zone-pack {
  left: 23%;
  top: 29%;
}

.zone-qa {
  right: 21%;
  top: 26%;
}

.zone-ship {
  right: 7%;
  bottom: 19%;
}

.route-layer {
  z-index: 2;
}

.route-layer polyline {
  fill: none;
  stroke: #008c95;
  opacity: 0.28;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.route-layer .route-line.is-selected {
  opacity: 1;
  stroke-width: 1.9;
}

.route-layer circle {
  fill: #ffffff;
  stroke: #008c95;
  stroke-width: 0.9;
  vector-effect: non-scaling-stroke;
}

.route-layer .waypoint-label {
  fill: #18302f;
  font-size: 2.6px;
  font-weight: 800;
  letter-spacing: 0;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 0.85px;
}

.map-markers {
  z-index: 3;
}

.map-empty-state {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(320px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  border: 1px solid rgba(0, 140, 149, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 16px 40px rgba(23, 32, 31, 0.14);
  padding: 16px;
  color: var(--ink);
  text-align: center;
}

.map-empty-state strong,
.map-empty-state span {
  display: block;
}

.map-empty-state span {
  margin-top: 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.robot-marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 76px;
  min-height: 64px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.agv-car {
  position: absolute;
  left: 14px;
  top: 4px;
  width: 48px;
  height: 38px;
  transform: rotate(var(--heading));
  transform-origin: center;
}

.agv-car::before {
  content: "";
  position: absolute;
  left: 20px;
  top: -9px;
  border-right: 5px solid transparent;
  border-bottom: 10px solid #17201f;
  border-left: 5px solid transparent;
}

.agv-car-cab,
.agv-car-load {
  position: absolute;
  left: 10px;
  width: 28px;
  border: 2px solid #ffffff;
  border-radius: 7px;
  background: var(--teal);
  box-shadow: 0 10px 22px rgba(23, 32, 31, 0.24);
}

.agv-car-cab {
  top: 0;
  height: 17px;
}

.agv-car-load {
  top: 17px;
  height: 21px;
  background: #17201f;
}

.agv-wheel {
  position: absolute;
  width: 9px;
  height: 14px;
  border-radius: 4px;
  background: #17201f;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.38);
}

.agv-wheel-fl,
.agv-wheel-rl {
  left: 2px;
}

.agv-wheel-fr,
.agv-wheel-rr {
  right: 2px;
}

.agv-wheel-fl,
.agv-wheel-fr {
  top: 6px;
}

.agv-wheel-rl,
.agv-wheel-rr {
  bottom: 3px;
}

.agv-marker-label {
  position: absolute;
  top: 46px;
  left: 50%;
  min-width: 40px;
  transform: translateX(-50%);
  border: 1px solid rgba(23, 32, 31, 0.16);
  border-radius: 8px;
  padding: 2px 5px;
  background: rgba(255, 255, 255, 0.9);
  font-size: 0.72rem;
  font-weight: 800;
  text-align: center;
}

.robot-marker[data-state="paused"] {
  color: #6e4a00;
}

.robot-marker[data-state="paused"] .agv-car-cab {
  background: var(--amber);
}

.robot-marker[data-state="charging"] {
  color: #195b28;
}

.robot-marker[data-state="charging"] .agv-car-cab {
  background: var(--green);
}

.robot-marker[data-state="stopped"],
.robot-marker[data-state="fault"] {
  color: #842424;
}

.robot-marker[data-state="stopped"] .agv-car-cab,
.robot-marker[data-state="fault"] .agv-car-cab {
  background: var(--red);
}

.robot-marker.is-selected {
  outline: 3px solid rgba(0, 140, 149, 0.34);
  outline-offset: 2px;
}

.robot-marker.is-highlighted {
  outline: 3px solid rgba(193, 124, 0, 0.72);
  outline-offset: 4px;
}

.map-attribution {
  position: absolute;
  right: 10px;
  bottom: 10px;
  z-index: 4;
  padding: 4px 6px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-muted);
  font-size: 0.74rem;
}

.fleet-list,
.sensor-grid,
.alerts-list,
.push-log-list,
.command-log {
  display: grid;
  gap: 10px;
}

.fleet-card {
  width: 100%;
  min-height: 104px;
  padding: 12px;
  text-align: left;
}

.fleet-card.is-selected {
  border-color: var(--teal);
  background: #ecf8f7;
}

.fleet-card header,
.fleet-meta,
.sensor-row,
.alert-row,
.battery-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.fleet-card strong,
.fleet-card span,
.fleet-card small {
  display: block;
}

.fleet-card small {
  margin-top: 4px;
  color: var(--text-muted);
}

.fleet-meta {
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.state-pill {
  min-height: 34px;
  color: #ffffff;
  background: var(--teal);
  font-weight: 800;
}

.state-pill[data-state="paused"] {
  background: var(--amber);
}

.state-pill[data-state="charging"] {
  background: var(--green);
}

.state-pill[data-state="stopped"],
.state-pill[data-state="fault"] {
  background: var(--red);
}

.field-label {
  display: block;
  margin: 12px 0 7px;
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 800;
}

select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
}

.speed-control {
  display: grid;
  grid-template-columns: 1fr 76px;
  gap: 10px;
  align-items: center;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

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

.command-grid button[data-command="stop"] {
  border-color: rgba(214, 69, 69, 0.55);
  color: var(--red);
}

.joystick-panel {
  display: grid;
  gap: 12px;
  margin: 16px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.joystick-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.joystick-heading .eyebrow {
  margin-bottom: 4px;
}

#joystickMode {
  min-width: 92px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  background: var(--surface);
  color: var(--teal);
  text-align: center;
  font-size: 0.82rem;
}

.joystick-pad {
  position: relative;
  width: min(220px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 2px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(0, 140, 149, 0.18) 50%, transparent calc(50% + 1px)),
    linear-gradient(0deg, transparent calc(50% - 1px), rgba(0, 140, 149, 0.18) 50%, transparent calc(50% + 1px)),
    #ffffff;
  touch-action: none;
}

.joystick-ring {
  position: absolute;
  inset: 28%;
  border: 1px dashed rgba(0, 140, 149, 0.45);
  border-radius: 8px;
}

.joystick-thumb {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 62px;
  height: 62px;
  transform: translate(-50%, -50%);
  border: 3px solid #ffffff;
  border-radius: 8px;
  background: var(--teal);
  box-shadow: 0 12px 24px rgba(23, 32, 31, 0.2);
}

.joystick-readout {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.joystick-hint {
  color: var(--text-muted);
  font-size: 0.84rem;
}

.multi-joystick-panel {
  margin: 16px 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.compact-heading {
  margin-bottom: 10px;
}

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

.multi-joystick-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.multi-joystick-card.is-selected {
  border-color: var(--teal);
  background: #ecf8f7;
}

.multi-joystick-card header,
.camera-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.multi-joystick-card button {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 0.76rem;
}

.mini-joystick-pad {
  position: relative;
  width: min(116px, 100%);
  aspect-ratio: 1;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(0, 140, 149, 0.16) 50%, transparent calc(50% + 1px)),
    linear-gradient(0deg, transparent calc(50% - 1px), rgba(0, 140, 149, 0.16) 50%, transparent calc(50% + 1px)),
    #ffffff;
  touch-action: none;
}

.mini-thumb {
  width: 38px;
  height: 38px;
}

.mini-joystick-readout {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-align: center;
}

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

.camera-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.camera-card-heading span {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.camera-frame {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #17201f;
}

.camera-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-card.is-offline .camera-frame::after {
  content: "Stream unavailable";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(23, 32, 31, 0.86);
  color: #ffffff;
  font-weight: 800;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
  justify-items: start;
  color: var(--text-muted);
  font-weight: 800;
}

.power-summary,
.cell-grid,
.rail-grid,
.rpi-health-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

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

.mini-metric,
.error-row,
.service-row {
  display: grid;
  gap: 5px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
}

.mini-metric span,
.error-row span,
.service-row span {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.mini-metric strong,
.error-row strong,
.service-row strong {
  overflow-wrap: anywhere;
}

.mini-metric[data-level="warn"],
.error-row[data-level="warn"],
.error-row[data-level="error"],
.service-row[data-level="warn"],
.service-row[data-level="error"] {
  border-color: rgba(193, 124, 0, 0.55);
  background: #fff8ea;
}

.mini-metric[data-level="critical"],
.error-row[data-level="critical"],
.service-row[data-level="critical"] {
  border-color: rgba(214, 69, 69, 0.55);
  background: #fff0f0;
}

.error-list {
  display: grid;
  gap: 8px;
}

.command-log {
  min-height: 92px;
  align-content: start;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--text-muted);
  font-size: 0.86rem;
}

.battery-readout {
  justify-content: flex-start;
  margin-bottom: 16px;
}

.battery-ring {
  display: grid;
  place-items: center;
  width: 86px;
  height: 86px;
  border: 10px solid #d8e7e4;
  border-top-color: var(--teal);
  border-right-color: var(--green);
  border-radius: 8px;
  background: #ffffff;
  flex: 0 0 auto;
}

.battery-ring span {
  font-size: 1.35rem;
  font-weight: 900;
}

#robotMission {
  margin-top: 5px;
  color: var(--text-muted);
}

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

.readout-grid div,
.sensor-row,
.alert-row {
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.readout-grid strong {
  display: block;
  margin-top: 6px;
  overflow-wrap: anywhere;
}

.sensor-row {
  min-height: 58px;
}

.sensor-row span,
.alert-row span {
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.sensor-row strong,
.alert-row strong {
  overflow-wrap: anywhere;
}

.sensor-row[data-level="warn"] {
  border-color: rgba(193, 124, 0, 0.48);
  background: #fff8ea;
}

.sensor-row[data-level="critical"],
.alert-row[data-level="critical"] {
  border-color: rgba(214, 69, 69, 0.48);
  background: #fff0f0;
}

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

.alerts-list:empty::before {
  content: "No active alerts";
  color: var(--text-muted);
}

.push-log-list:empty::before {
  content: "No authenticated AGV telemetry pushes yet";
  color: var(--text-muted);
}

.alert-row {
  display: block;
}

.alert-row strong {
  display: block;
  margin-bottom: 5px;
}

.push-log-row {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.push-log-row header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.push-log-row strong {
  color: var(--text);
}

.push-log-row small,
.push-log-row span {
  color: var(--text-muted);
}

.push-log-fields {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .dashboard-grid {
    grid-template-columns: 300px minmax(0, 1fr);
  }

  .map-panel {
    grid-column: 1 / -1;
    grid-row: auto;
  }

  .fleet-panel {
    grid-column: 1;
  }

  .command-panel,
  .detail-panel,
  .sensors-panel,
  .telemetry-panel,
  .power-panel,
  .rpi-panel,
  .camera-panel,
  .alerts-panel,
  .push-log-panel {
    grid-column: span 1;
  }

  .map-viewport {
    min-height: 560px;
  }

  .map-tools {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-strip,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .agv-stage {
    min-height: 420px;
  }

  .map-panel,
  .fleet-panel,
  .command-panel,
  .detail-panel,
  .sensors-panel,
  .telemetry-panel,
  .power-panel,
  .rpi-panel,
  .camera-panel,
  .alerts-panel,
  .push-log-panel {
    grid-column: 1;
    grid-row: auto;
  }

  .map-viewport {
    min-height: 56vh;
    height: 560px;
    max-height: 720px;
  }

  .map-control-row {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}

@media (max-width: 520px) {
  .metric-strip,
  .readout-grid,
  .command-grid,
  .multi-joystick-grid,
  .camera-grid,
  .power-summary,
  .cell-grid,
  .rail-grid,
  .rpi-health-grid,
  .telemetry-grid {
    grid-template-columns: 1fr;
  }

  .agv-stage-copy,
  .agv-stage-meta {
    left: 12px;
    right: 12px;
  }

  .map-viewport {
    min-height: 420px;
    height: 62vh;
  }

  .map-tools {
    grid-template-columns: 1fr;
  }

  .map-search-row {
    flex-wrap: wrap;
  }

  .map-search-row input,
  .map-search-row button,
  .map-control-row button {
    flex: 1 1 120px;
  }

  .panel-heading,
  .fleet-card header,
  .battery-readout {
    align-items: flex-start;
    flex-direction: column;
  }

  .robot-marker {
    width: 50px;
    min-height: 32px;
    padding: 6px;
    font-size: 0.78rem;
  }

  .map-search-row {
    flex-direction: column;
    align-items: stretch;
  }

  .map-control-row button {
    flex: 1;
  }
}
