/* ========== 告警模块 ========== */
#alerts {
  display: none;
}

#alerts.active {
  display: block;
}

#alert-detail {
  display: none;
}

#alert-detail.active {
  display: block;
}

.alerts-layout {
  display: flex;
  gap: 24px;
  min-height: 500px;
}

.alerts-list {
  flex: 1;
  min-width: 0;
}

.alerts-sub {
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
}

.alerts-news-scroll {
  max-height: 720px;
  overflow-y: auto;
  padding-right: 6px;
}

.alerts-all-scroll {
  max-height: 760px;
  overflow-y: auto;
  padding-right: 6px;
}

.pinned-incidents {
  margin-bottom: 24px;
}

.all-reports {
  margin-top: 24px;
}

.alert-card {
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.alert-icon {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
}

.alert-icon.red {
  background: #fef2f2;
}

.alert-icon.orange {
  background: #fff7ed;
}

.alert-icon.green {
  background: #f0fdf4;
}

.alert-body {
  flex: 1;
  min-width: 200px;
}

.alert-body strong {
  display: inline;
  margin-right: 8px;
}

.badge.nearby {
  font-size: 10px;
  font-weight: 700;
  background: #e0e7ff;
  color: #3730a3;
  padding: 2px 6px;
  border-radius: 4px;
}

.alert-body p {
  font-size: 13px;
  margin: 8px 0;
  color: #444;
}

.alert-meta {
  font-size: 12px;
  color: #666;
  margin-right: 8px;
}

.impact-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: 4px;
}

.impact-tag.high {
  background: #fef2f2;
  color: #991b1b;
}

.impact-tag.medium {
  background: #fff7ed;
  color: #c2410c;
}

.impact-tag.low {
  background: #f0fdf4;
  color: #166534;
}

.alert-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.alert-actions a,
.alert-actions button {
  font-size: 13px;
  color: #2563eb;
  text-decoration: none;
  border: 1px solid #dbeafe;
  background: #eff6ff;
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.alerts-detail-placeholder {
  width: 320px;
  flex-shrink: 0;
  border: 1px dashed #ccc;
  border-radius: 8px;
  padding: 40px 24px;
  background: #fafafa;
  text-align: center;
  position: relative;
  color: #888;
  font-size: 13px;
}

.live-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 11px;
  font-weight: 600;
  color: #dc2626;
}

.placeholder-box p {
  margin-top: 8px;
  max-width: 240px;
  margin-left: auto;
  margin-right: auto;
}

.alerts-detail-placeholder .help-icon {
  position: absolute;
  bottom: 12px;
  right: 12px;
}

.alert-detail-layout {
  max-width: 980px;
}

.alert-back-btn {
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 16px;
  cursor: pointer;
  font-size: 13px;
}

.alert-detail-content {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

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

.alert-detail-item {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 10px;
  background: #f8fafc;
}

.alert-detail-item .k {
  font-size: 11px;
  color: #64748b;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
  display: block;
}

.alert-detail-item .v {
  font-size: 13px;
  color: #0f172a;
}

.alert-detail-camera {
  margin-top: 14px;
}

.alert-detail-camera img {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

@media (max-width: 900px) {
  .twoday-cards {
    grid-template-columns: 1fr;
  }

  .sun-row {
    flex-direction: column;
  }

  .sun-divider {
    width: 60px;
    height: 1px;
  }

  .live-cards {
    grid-template-columns: 1fr;
  }

  .route-cards {
    grid-template-columns: repeat(2, 1fr);
  }

  .route-layout {
    flex-direction: column;
  }

  .route-details-panel {
    width: 100%;
  }

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

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

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

  .weather-cards {
    grid-template-columns: 1fr;
  }

  .weather-search input {
    width: 100%;
  }

  .forecast-cards {
    grid-template-columns: 1fr;
  }

  .impact-main-row {
    flex-direction: column;
    align-items: stretch;
  }

  .impact-ring-container {
    width: 100%;
  }

  .factor-label {
    width: 120px;
  }

  .alerts-layout {
    flex-direction: column;
  }

  .alerts-detail-placeholder {
    width: 100%;
  }

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

  #map-view.active {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }
}


.habit-routes-page {
  padding: 20px 24px 24px;
}

.habit-routes-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}

.habit-routes-layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 18px;
  min-height: 620px;
  align-items: stretch;
}

.habit-routes-sidebar {
  min-width: 0;
}

.habit-routes-list-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 16px;
  height: 100%;
  box-sizing: border-box;
}

#habit-routes-list {
  margin-top: 10px;
  max-height: 540px;
  overflow-y: auto;
}

.habit-route-card {
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  margin-bottom: 12px;
}

.habit-route-title {
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 6px;
}

.habit-route-distance {
  color: #64748b;
  font-size: 13px;
  margin-bottom: 10px;
}

.habit-route-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.habit-route-settings {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #f8fafc;
}

.habit-route-settings.hidden {
  display: none;
}

.habit-window-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0;
}

.habit-window-row input[type="time"] {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
}

.habit-routes-map-wrap {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  box-sizing: border-box;
}

.habit-routes-map-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

#habitRoutesMap {
  width: 100%;
  height: 560px;
  border-radius: 14px;
  overflow: hidden;
}

/* Chatbot */
.ai-chat-launcher {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 5000;

  height: 54px;
  min-width: 136px;
  padding: 0 20px;
  border: none;
  border-radius: 999px;

  background: linear-gradient(135deg, #2563eb, #14b8a6);
  color: #ffffff;
  font-weight: 800;
  font-size: 15px;

  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;

  box-shadow: 0 16px 34px rgba(37, 99, 235, 0.34);
  cursor: pointer;
  transition: all 0.18s ease;
}

.ai-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(37, 99, 235, 0.42);
}

.ai-chat-launcher.is-open {
  display: none;
}

.ai-chat-launcher.is-open::before {
  content: "×";
  font-size: 30px;
  line-height: 1;
  font-weight: 700;
}

.ai-chat-launcher-icon {
  font-size: 18px;
  line-height: 1;
}

.ai-chat-launcher-text {
  letter-spacing: 0.01em;
}

.ai-chat-container {
  position: fixed;
  right: 20px;
  bottom: 92px;
  width: 340px;
  background: #fff;
  border: 1px solid #dbeafe;
  border-radius: 18px;
  box-shadow: 0 16px 35px rgba(15, 23, 42, 0.16);
  z-index: 4200;
  overflow: hidden;

  opacity: 0;
  transform: translateY(18px) scale(0.96);
  transform-origin: bottom right;
  pointer-events: none;
  visibility: hidden;

  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    visibility 0.22s ease;
}

.ai-chat-container.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: #2563eb;
  color: #fff;
  font-weight: 800;
}

.ai-chat-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
}

.ai-chat-messages {
  height: 260px;
  overflow-y: auto;
  padding: 14px;
  background: #f8fafc;
  font-size: 13px;
  color: #334155;
}

.ai-chat-system,
.ai-chat-msg {
  margin-bottom: 10px;
  line-height: 1.5;
}

.ai-chat-msg strong {
  color: #0f172a;
}

.ai-chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}

.ai-chat-input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 14px;
}

.ai-chat-mic,
.ai-chat-send {
  border: none;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
}

.ai-chat-mic {
  width: 40px;
  height: 40px;
  background: #eff6ff;
}

.ai-chat-send {
  padding: 10px 12px;
  background: #2563eb;
  color: #fff;
}


.ai-chat-container {
  position: fixed;
}

.ai-listening-overlay {
  position: absolute;
  inset: 0;
  background: rgba(241, 245, 249, 0.76);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 60;
}

.ai-listening-overlay.hidden {
  display: none !important;
}

.ai-listening-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 11px;
}

.ai-listening-pulse {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: micPulse 1.15s ease-in-out infinite;
}

.ai-listening-mic {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #14b8a6);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.28);
}

.ai-listening-text {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
}

.ai-listening-subtext {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

@keyframes micPulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.28);
  }

  70% {
    transform: scale(1.06);
    box-shadow: 0 0 0 22px rgba(37, 99, 235, 0);
  }

  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
  }
}

/* For save button on route planner suggested routes cards */
.save-habit-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  color: #475569;
  border: 1px solid #e2e8f0;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  z-index: 20;
  transition: all 0.2s ease;
}

.save-habit-btn:hover {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.route-card {
  position: relative !important;
}

/* Alerts CSS */
/* Alert Badge */
.alerts-dropdown-wrap {
  position: relative;
  cursor: pointer;
  padding: 5px;
}

.nav-badge {
  position: absolute;
  top: 0;
  right: 0;
  background: #ef4444;
  color: white;
  font-size: 9px;
  font-weight: bold;
  min-width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
}

/* Dropdown Menu */
.alerts-nav-dropdown {
  position: absolute;
  top: 40px;
  right: 0;
  width: 280px;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  padding: 10px 0;
}

.alerts-nav-dropdown.hidden {
  display: none;
}

.dropdown-header {
  padding: 5px 15px;
  font-size: 11px;
  font-weight: 800;
  color: #64748b;
  border-bottom: 1px solid #f1f5f9;
}

#nav-alerts-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 300px;
  overflow-y: auto;
}

.nav-alert-item {
  padding: 12px 15px;
  border-bottom: 1px solid #f8fafc;
  font-size: 13px;
  transition: background 0.2s;
}

.nav-alert-item:hover {
  background: #f0f7ff;
}

.dropdown-footer {
  padding: 10px;
  text-align: center;
  border-top: 1px solid #f1f5f9;
}

.dropdown-footer a {
  font-size: 12px;
  color: #2563eb;
  text-decoration: none;
  font-weight: 600;
}

.alerts-dropdown-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin-right: 12px;
  cursor: pointer;
  position: relative;
}

.nav-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: bold;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #fff;
  z-index: 5;
}

.nav-badge.hidden {
  display: none;
}

.nav-alert-item-wrap {
  padding: 10px 14px;
  background: #f8fafc;
  /* Subtle off-white background for the list */
  border-bottom: 1px solid #f1f5f9;
}

/* The actual white card in your screenshot */
.nav-alert-card {
  background: white;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid #e2e8f0;
}

.nav-alert-title {
  font-size: 15px;
  font-weight: 800;
  color: #111827;
  margin-bottom: 4px;
}

.nav-alert-text {
  font-size: 13px;
  color: #4b5563;
  margin-bottom: 12px;
  line-height: 1.4;
}

.vms-label-pin {
  background: none !important;
  border: none !important;
}

.vms-label-pin span {
  color: #1e293b;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow:
    1px 1px 0 #fff, -1px -1px 0 #fff,
    1px -1px 0 #fff, -1px 1px 0 #fff,
    0 1px 0 #fff, 0 -1px 0 #fff;
  transform: translate(-50%, -50%);
  display: block;
}

/* The outlined button from your screenshot */
.btn-dismiss-alert {
  width: 100%;
  background: white;
  border: 1px solid #d1d5db;
  color: #374151;
  padding: 6px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-dismiss-alert:hover {
  background: #f9fafb;
  border-color: #9ca3af;
}

@media (max-width: 1080px) {
  .about-team-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .about-mission-panel {
    grid-template-columns: 1fr;
  }

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

  .about-member-modal {
    width: min(92vw, 760px);
  }

  .about-member-modal-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .about-member-modal-photo {
    height: 300px;
  }

  .about-member-modal-content {
    padding: 38px 28px 34px;
  }

  .about-member-modal-name {
    font-size: 34px;
  }

  .about-member-modal-divider {
    margin: 36px 0 26px;
  }

  .about-member-modal-bio {
    font-size: 16px;
    line-height: 1.85;
  }
}

@media (max-width: 520px) {
  .about-team-grid {
    grid-template-columns: 1fr;
  }
}