.mesh-map {
  width: 100%;
  height: min(62vh, 520px);
  min-height: 280px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0, 184, 184, 0.28);
  background: rgba(8, 12, 24, 0.85);
  z-index: 1;
}
.mesh-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.1rem;
}
.mesh-stat {
  font-size: 0.92rem;
  color: rgba(241, 241, 241, 0.78);
}
.mesh-stat strong {
  color: #00e0e0;
  font-weight: 700;
}
html[data-theme="light"] .mesh-stat {
  color: rgba(20, 28, 40, 0.72);
}
html[data-theme="light"] .mesh-stat strong {
  color: #007a7a;
}
.leaflet-container {
  font: inherit;
  background: #0b1020;
}

.mesh-story {
  max-width: 36rem;
  color: rgba(241, 241, 241, 0.82);
  font-size: 0.95rem;
  line-height: 1.35;
}
.mesh-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
}
.mesh-kpi {
  background: rgba(0, 184, 184, 0.08);
  border: 1px solid rgba(0, 184, 184, 0.22);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-height: 4.2rem;
}
.mesh-kpi__label {
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: rgba(241, 241, 241, 0.55);
}
.mesh-kpi strong {
  font-size: 1.35rem;
  line-height: 1.1;
  color: #5eead4;
}
.mesh-kpi__unit {
  font-size: 0.75rem;
  color: rgba(241, 241, 241, 0.45);
  margin-top: -0.1rem;
}
.mesh-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem 1rem;
  font-size: 0.8rem;
  color: rgba(241, 241, 241, 0.65);
}
.mesh-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-right: 0.35rem;
  vertical-align: middle;
  border: 2px solid transparent;
}
.mesh-dot--gw { background: #00e0e0; border-color: #00b8b8; }
.mesh-dot--hot { background: #5eead4; border-color: #2dd4bf; }
.mesh-dot--warm { background: #a8c0ff; border-color: #7aa2ff; }
.mesh-dot--cold { background: #94a3b8; border-color: #64748b; }
.mesh-dot--far { background: #ffd166; border-color: #f0a202; }

.mesh-top-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.mesh-top-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.03);
  color: inherit;
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.mesh-top-item:hover {
  background: rgba(0, 184, 184, 0.12);
  border-color: rgba(0, 184, 184, 0.35);
}
.mesh-top-item__rank {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(240, 162, 2, 0.2);
  color: #ffd166;
  font-weight: 700;
  font-size: 0.8rem;
  flex: 0 0 auto;
}
.mesh-top-item__main {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
  flex: 1 1 auto;
}
.mesh-top-item__main strong {
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mesh-top-item__main small {
  color: rgba(241, 241, 241, 0.5);
  font-size: 0.75rem;
}
.mesh-top-item__km {
  font-weight: 700;
  color: #5eead4;
  white-space: nowrap;
}
.mesh-gateway__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
}
.mesh-gateway__meta {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  color: rgba(241, 241, 241, 0.78);
}
.mesh-popup__tag {
  display: inline-block;
  margin: 0.15rem 0 0.25rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  font-size: 0.72rem;
  background: rgba(0, 184, 184, 0.18);
  color: #5eead4;
}
.leaflet-popup-content-wrapper {
  background: #141824;
  color: #f1f1f1;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.leaflet-popup-tip {
  background: #141824;
}
html[data-theme="light"] .mesh-kpi {
  background: rgba(0, 122, 122, 0.06);
  border-color: rgba(0, 122, 122, 0.18);
}
html[data-theme="light"] .mesh-kpi__label,
html[data-theme="light"] .mesh-legend,
html[data-theme="light"] .mesh-top-item__main small,
html[data-theme="light"] .mesh-story {
  color: rgba(20, 28, 40, 0.55);
}
html[data-theme="light"] .mesh-kpi strong,
html[data-theme="light"] .mesh-top-item__km {
  color: #007a7a;
}
html[data-theme="light"] .mesh-top-item {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .leaflet-popup-content-wrapper,
html[data-theme="light"] .leaflet-popup-tip {
  background: #fff;
  color: #1a1a1a;
}

.mesh-sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.7rem;
}
.mesh-sensor-card {
  border: 1px solid rgba(0, 184, 184, 0.22);
  background: rgba(0, 184, 184, 0.07);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.mesh-sensor-card strong { font-size: 0.95rem; }
.mesh-sensor-card small { color: rgba(241,241,241,0.45); font-size: 0.72rem; }
.mesh-sensor-card__vals {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.7rem;
  font-size: 0.86rem;
  color: rgba(241,241,241,0.85);
}
.mesh-chat-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  max-height: 360px;
  overflow: auto;
}
.mesh-chat-item {
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
}
.mesh-chat-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  font-size: 0.75rem;
  color: rgba(241,241,241,0.5);
  margin-bottom: 0.25rem;
}
.mesh-chat-item__meta strong { color: #5eead4; font-size: 0.82rem; }
.mesh-chat-item__text { font-size: 0.92rem; line-height: 1.35; word-break: break-word; }

.mesh-stale-banner {
  border: 1px solid rgba(240, 162, 2, 0.45);
  background: rgba(240, 162, 2, 0.12);
  color: #ffd166;
  border-radius: 10px;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
}
.mesh-map--home {
  height: min(42vh, 360px);
  min-height: 220px;
}
.mesh-history-canvas {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  background: rgba(0,0,0,0.2);
  border-radius: 10px;
}
.mesh-new-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 320px;
  overflow: auto;
}
.mesh-new-item,
.mesh-new-item--static {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(255, 209, 102, 0.28);
  background: rgba(255, 209, 102, 0.08);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  color: inherit;
}
.mesh-new-item__main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.mesh-new-item__main strong { font-size: 0.95rem; }
.mesh-new-item__main small { color: rgba(241,241,241,0.5); font-size: 0.75rem; }
button.mesh-new-item:hover {
  border-color: rgba(255, 209, 102, 0.55);
  background: rgba(255, 209, 102, 0.14);
}
.mesh-highlight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}
.mesh-event-banner {
  border: 1px solid rgba(255, 209, 102, 0.45);
  background: linear-gradient(90deg, rgba(240, 162, 2, 0.18), rgba(0, 184, 184, 0.12));
  color: #ffd166;
  border-radius: 12px;
  padding: 0.7rem 1rem;
}
.mesh-event-banner__inner {
  display: flex;
  align-items: flex-start;
  gap: 0.35rem;
}
.mesh-event-banner__inner strong {
  display: block;
  color: #ffe08a;
  margin-bottom: 0.15rem;
}
.mesh-event-banner__inner span {
  display: block;
  color: rgba(241, 241, 241, 0.85);
  font-size: 0.92rem;
}
.mesh-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}
@media (max-width: 767px) {
  .mesh-compare-grid { grid-template-columns: 1fr; }
}
.mesh-compare-card .mesh-kpi-grid {
  margin-top: 0.75rem;
}
.home-mesh-compare-section {
  padding: 2.5rem 0 1rem;
}
.mesh-highlight-card {
  border: 1px solid rgba(0,184,184,0.25);
  background: rgba(0,184,184,0.08);
  border-radius: 10px;
  padding: 0.65rem 0.75rem;
}
.mesh-highlight-card span {
  display: block;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: rgba(241,241,241,0.5);
}
.mesh-highlight-card strong { font-size: 1.05rem; color: #5eead4; }
.mesh-highlight-card small { color: rgba(241,241,241,0.55); }
.mesh-badge-new {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  background: rgba(45, 212, 191, 0.25);
  color: #5eead4;
}
.home-mesh-map-section { padding: 1.5rem 0 0.5rem; }
