html, body { height: 100%; margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }

.app {
  height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.topbar {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid #e6e6e6;
  background: #fafafa;
}

.brand {
  font-weight: 700;
}

.logout {
  text-decoration: none;
  color: #1a73e8;
  font-weight: 600;
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-left: auto;
}

.topbar > .logout {
  margin-left: auto;
}

.topbar-mobile-logos {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-mobile-logos img {
  display: block;
  height: 34px;
  width: auto;
  object-fit: contain;
  flex-shrink: 0;
}

.search {
  padding: 8px 10px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-size: 14px;
}

.main {
  display: grid;
  grid-template-columns: 29fr 71fr;
  min-height: 0;
}

.list {
  border-right: 1px solid #e6e6e6;
  padding: 12px;
  overflow: auto;
}

.list-title {
  font-weight: 700;
  margin-bottom: 8px;
}

.list-logos {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.list-logos img {
  display: block;
  height: 32px;
  width: auto;
  object-fit: contain;
}

.list-search {
  width: 100%;
  margin-bottom: 8px;
}

.type-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.type-btn {
  border: 1px solid #cfd8dc;
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}

.type-btn-icon {
  border-radius: 12px;
  padding: 6px 8px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.type-btn-icon img {
  width: 18px;
  height: 18px;
  display: block;
}

.type-btn-icon span {
  font-size: 12px;
  line-height: 1;
}

.type-btn.active {
  background: #1a73e8;
  border-color: #1a73e8;
  color: #fff;
}

.type-btn.active img {
  filter: brightness(0) invert(1);
}

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

.list-item {
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  background: #fff;
}

.list-item:hover {
  border-color: #b8b8b8;
}

.item-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.item-desc {
  font-size: 13px;
  color: #444;
}

.item-label {
  font-weight: 700;
}

.item-value {
  font-weight: 400;
}

.mobile-only {
  display: none;
}

.map-wrap {
  min-width: 0;
  display: grid;
  grid-template-rows: 75% 25%;
  height: 100%;
  border-right: 1px solid #e6e6e6;
}

#map {
  width: 100%;
  height: 100%;
}

.detail {
  border-top: 1px solid #e6e6e6;
  padding: 10px 12px;
  background: #fff;
  overflow: auto;
}

.detail-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.detail-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.detail-body {
  font-size: 13px;
  color: #333;
  line-height: 1.4;
}

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

.detail-card {
  border: 1px solid #e6e6e6;
  border-radius: 10px;
  background: #fff;
  padding: 10px;
  min-width: 0;
}

.detail-current {
  background: #fafcff;
}

.detail-subtitle {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 8px;
  color: #1f2937;
}

.detail-select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  font-size: 13px;
  background: #fff;
}

.detail-subinfo {
  margin-top: 8px;
  font-size: 12px;
  color: #4b5563;
  line-height: 1.4;
}

.detail-download-btn {
  border: 1px solid #2f6fdb;
  background: #2f6fdb;
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.detail-download-btn:hover {
  background: #1f5bc1;
  border-color: #1f5bc1;
}

.mini-status-popup .leaflet-popup-content-wrapper {
  border-radius: 10px;
  padding: 0;
}

.mini-status-popup .leaflet-popup-content {
  margin: 0;
}

.mini-status-box {
  display: inline-block;
  min-width: 0;
  width: fit-content;
  padding: 8px 10px;
  white-space: nowrap;
}

.mini-status-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #333;
}

.mini-status-row {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.5;
}

.mini-status-row.running {
  color: #d32f2f;
}

.mini-status-row.stopped {
  color: #9e9e9e;
}

@media (max-width: 1200px) {
  .main {
    grid-template-columns: 1fr;
    grid-template-rows: 34vh 46vh 20vh;
  }

  .list {
    border-right: 0;
    border-bottom: 1px solid #e6e6e6;
  }

  .map-wrap {
    border-right: 0;
    border-bottom: 1px solid #e6e6e6;
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

@media (max-width: 900px) {
  .app {
    height: 100dvh;
  }

  .topbar {
    padding: 6px 10px;
    justify-content: space-between;
  }

  .logout {
    font-size: 7px;
  }

  .topbar-actions {
    gap: 8px;
    margin-left: auto;
  }

  .main {
    grid-template-columns: 55fr 45fr;
    grid-template-rows: 60% 40%;
    min-height: 0;
  }

  .list {
    grid-column: 1;
    grid-row: 1;
    border-right: 1px solid #e6e6e6;
    border-bottom: 0;
    padding: 8px;
    min-height: 0;
  }

  .list-logos {
    display: none;
  }

  .map-wrap {
    display: contents;
  }

  #detail {
    grid-column: 2;
    grid-row: 1;
    border-top: 0;
    border-left: 1px solid #e6e6e6;
    padding: 8px 8px 4px;
    min-height: 0;
  }

  #map {
    grid-column: 1 / span 2;
    grid-row: 2;
    width: 100%;
    height: 100%;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .detail-title-row {
    margin-bottom: 2px;
  }

  .detail-body {
    line-height: 1.28;
  }

  .detail-subinfo {
    margin-top: 4px;
  }

  .type-filters {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .type-btn {
    min-width: 0;
    padding: 5px 4px;
    font-size: 10px;
  }

  .type-btn-icon {
    padding: 5px 0;
    min-width: 0;
    justify-content: center;
  }

  .type-btn-icon img {
    width: 16px;
    height: 16px;
  }

  .type-btn-icon span {
    display: none;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: inline;
  }
}

.popup-title { font-weight: 700; margin-bottom: 4px; }
.popup-desc { font-size: 13px; line-height: 1.4; }

.pin-label {
  pointer-events: none;
}

.pin-label-text {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 12px;
  white-space: nowrap;
  transform: translate(14px, -28px);
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.droplet-wrap {
  background: transparent;
  border: 0;
}

.droplet-marker {
  position: relative;
  width: 20px;
  height: 20px;
  background: var(--pin-fill, #1a73e8);
  border: 3px solid var(--pin-stroke, #0f3f88);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 7px rgba(0, 0, 0, 0.32);
}

.droplet-marker::after {
  content: '';
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  top: 5px;
  left: 5px;
}

.map-fullscreen-btn {
  font-size: 18px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
}
