*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: "Inter", "Noto Sans Thai", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  background: #060e18;
  color: #d0e4f0;
}

::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.25);
}

#app {
  display: flex;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

#nav-sidebar {
  width: 60px;
  min-width: 60px;
  height: 100%;
  background: linear-gradient(180deg, #091520 0%, #050d16 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  z-index: 100;
}
#nav-sidebar .nav-logo {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
#nav-sidebar .nav-logo img {
  width: 32px;
  height: 32px;
}
#nav-sidebar .nav-logo .logo-placeholder {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, #1a91d1, #00c9e0);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: white;
}
#nav-sidebar .nav-menu {
  list-style: none;
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
#nav-sidebar .nav-menu li a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: #506070;
  text-decoration: none;
  font-size: 18px;
  transition: all 0.2s;
  position: relative;
  cursor: pointer;
}
#nav-sidebar .nav-menu li a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #8aa3bd;
}
#nav-sidebar .nav-menu li a.active {
  background: rgba(26, 145, 209, 0.2);
  color: #00c9e0;
  box-shadow: 0 0 0 1px rgba(26, 145, 209, 0.4);
}
#nav-sidebar .nav-menu li a .nav-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  background: #1a2d44;
  color: #d0e4f0;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 200;
  border: 1px solid rgba(26, 145, 209, 0.3);
}
#nav-sidebar .nav-menu li a:hover .nav-tooltip {
  opacity: 1;
}
#nav-sidebar .nav-bottom {
  margin-top: auto;
}
#nav-sidebar .nav-bottom a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  color: #506070;
  font-size: 18px;
  text-decoration: none;
  transition: all 0.2s;
}
#nav-sidebar .nav-bottom a:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #8aa3bd;
}

#app-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.screen {
  display: none;
  width: 100%;
  height: 100%;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.badge.good {
  background: rgba(39, 174, 96, 0.2);
  color: #2ecc71;
}
.badge.moderate {
  background: rgba(241, 196, 15, 0.2);
  color: #f1c40f;
}
.badge.sensitive {
  background: rgba(230, 126, 34, 0.2);
  color: #e67e22;
}
.badge.unhealthy {
  background: rgba(231, 76, 60, 0.25);
  color: #ff6b6b;
}
.badge.very-unhealthy {
  background: rgba(155, 89, 182, 0.2);
  color: #c39bd3;
}
.badge.hazardous {
  background: rgba(142, 16, 16, 0.3);
  color: #ff4444;
}
.badge.red-solid {
  background: #c0392b;
  color: white;
  font-size: 11px;
}
.badge.alert {
  background: rgba(231, 76, 60, 0.85);
  color: white;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}
.btn.btn-primary {
  background: #1a91d1;
  color: white;
}
.btn.btn-primary:hover {
  background: rgb(21.4859574468, 119.8255319149, 172.7140425532);
}
.btn.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #8aa3bd;
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.btn.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}
.btn.btn-danger {
  background: rgba(231, 76, 60, 0.15);
  color: #e74c3c;
  border: 1px solid rgba(231, 76, 60, 0.3);
}
.btn.btn-success {
  background: rgba(39, 174, 96, 0.15);
  color: #2ecc71;
  border: 1px solid rgba(39, 174, 96, 0.3);
}
.btn.btn-export {
  background: rgba(39, 174, 96, 0.1);
  color: #27ae60;
  border: 1px solid rgba(39, 174, 96, 0.3);
}

select.filter-select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  color: #8aa3bd;
  padding: 4px 24px 4px 8px;
  font-size: 12px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%238aa3bd' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
select.filter-select:hover {
  border-color: rgba(26, 145, 209, 0.3);
}
select.filter-select:focus {
  border-color: #1a91d1;
}
select.filter-select option {
  background: #0f2235;
}

.ddpm-sidebar {
  width: 52px;
  min-width: 52px;
  height: 100%;
  background: #080f18;
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0;
  z-index: 10;
}
.ddpm-sidebar .ddpm-logo {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.ddpm-sidebar .ddpm-logo img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}
.ddpm-sidebar .ddpm-logo .placeholder-logo {
  width: 34px;
  height: 34px;
  background: #1a2a3a;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #ea780e;
  border: 1px solid rgba(234, 120, 14, 0.3);
}
.ddpm-sidebar .ddpm-nav {
  list-style: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}
.ddpm-sidebar .ddpm-nav li a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #506070;
  font-size: 16px;
  text-decoration: none;
  transition: all 0.2s;
}
.ddpm-sidebar .ddpm-nav li a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #8aa3bd;
}
.ddpm-sidebar .ddpm-nav li a.active {
  background: rgba(234, 120, 14, 0.15);
  color: #ea780e;
}
.ddpm-sidebar .ddpm-bottom a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  color: #506070;
  font-size: 16px;
  text-decoration: none;
}
.ddpm-sidebar .ddpm-bottom a:hover {
  color: #8aa3bd;
}

#screen1 {
  background: #060e18;
  flex-direction: column;
}
/* บรรทัดเดียว: Component 1 (พื้นหลัง) + Component 2 (notch ทับตรงกลาง) */
#screen1 .s1-alert-banner {
  width: 100%;
  position: relative;
  flex-shrink: 0;
  min-height: 44px;
}
#screen1 .s1-alert-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 20px;
  background: #0d2742;
  border-bottom: 1px solid rgba(0, 201, 224, 0.12);
  font-size: 12px;
  color: #fff;
  min-height: 44px;
  border-radius: 6px 6px 0 0;
  box-shadow: inset 0 1px 0 rgba(0, 201, 224, 0.18);
}
/* ไอคอนเตือน = วงกลมแดงทึบ (เทียบรูปอ้างอิง) */
#screen1 .s1-alert-bar .alert-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #c0392b;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
#screen1 .s1-alert-bar .alert-icon-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
}
#screen1 .s1-alert-bar .alert-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#screen1 .s1-alert-bar .alert-datetime-wrap {
  padding: 3px 10px 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px 4px 0 0;
  border: 1px solid rgba(0, 201, 224, 0.2);
  box-shadow: 0 -1px 0 rgba(0, 201, 224, 0.1);
  flex-shrink: 0;
}
#screen1 .s1-alert-bar .alert-datetime {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  font-family: monospace;
}
#screen1 .s1-alert-bar .s1-alert-bar-divider {
  width: 1px;
  height: 24px;
  background: rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
  margin: 0 4px;
}
#screen1 .s1-alert-bar .s1-weather-strip {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.9);
  flex-shrink: 0;
}
#screen1 .s1-alert-bar .s1-weather-strip .weather-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
#screen1 .s1-alert-bar .s1-hdr-icons {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
#screen1 .s1-alert-bar .s1-hdr-icons-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  white-space: nowrap;
}
#screen1 .s1-alert-bar .dis-icon-grid {
  display: grid;
  grid-template-columns: repeat(4, 18px);
  grid-template-rows: repeat(2, 18px);
  gap: 2px;
}
#screen1 .s1-alert-bar .dis-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 10px;
}
/* Notch: แถบแบนบน + เส้นตัดเอียงเข้า + ด้านล่างตรง (เทียบรูปอ้างอิง) */
#screen1 .s1-alert-notch {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  padding: 6px 24px 8px;
  background: linear-gradient(180deg, #165a70 0%, #113660 100%);
  border: 1px solid rgba(0, 201, 224, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  /* รูปทรง: ด้านบนแถบแบนตรงกลาง (28%–72%), เส้นตัดเอียงเข้า (12%–28% และ 72%–88%), ด้านล่างตรง */
  clip-path: polygon(0% 100%, 12% 28%, 28% 0%, 72% 0%, 88% 28%, 100% 100%);
}
#screen1 .s1-alert-notch span {
  font-size: 13px;
  font-weight: 700;
  color: #00c9e0;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* แถบล่าง: สภาพอากาศ + ไอคอน (ไม่มี chevron) */
#screen1 .s1-header {
  background: linear-gradient(180deg, #113660 0%, #0e2e54 100%);
  border-bottom: 1px solid rgba(0, 201, 224, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  height: 44px;
  padding: 0 16px;
  gap: 16px;
}
#screen1 .s1-header .s1-hdr-brand {
  font-size: 12px;
  font-weight: 600;
  color: #d0e4f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}
#screen1 .s1-header .s1-weather-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: #8aa3bd;
}
#screen1 .s1-header .s1-weather-strip .weather-item {
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
#screen1 .s1-header .s1-hdr-icons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
#screen1 .s1-header .s1-hdr-icons-label {
  font-size: 10px;
  color: #64768c;
  white-space: nowrap;
}
#screen1 .s1-header .dis-icon-grid {
  display: grid;
  grid-template-columns: repeat(4, 20px);
  grid-template-rows: repeat(2, 20px);
  gap: 2px;
}
#screen1 .s1-header .dis-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 3px;
  font-size: 11px;
}
#screen1 .s1-main {
  flex: 1;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
/* แผนที่เต็มพื้นหลัง (layer หลังสุด) */
#screen1 .s1-main .s1-map-background {
  position: absolute !important;
  inset: 0;
  z-index: 0;
}
/* การ์ด overlay — แยกอิสระ พื้นหลังยังเป็นแผนที่ */
#screen1 .s1-card-overlay {
  position: absolute;
  z-index: 10;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(0, 201, 224, 0.12);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
#screen1 .s1-card-left-1 {
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 200px;
}
#screen1 .s1-card-left-2 {
  left: 212px;
  top: 6px;
  bottom: 6px;
  width: 210px;
}
/* การ์ดซ้ายใช้ s1-sub-panel เหมือนขวา — ปิด padding ไว้ให้เนื้อในจัดการเอง */
#screen1 .s1-card-left-1.s1-sub-panel,
#screen1 .s1-card-left-2.s1-sub-panel {
  padding: 0;
}
#screen1 .s1-panel-charts-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
/* การ์ดขวา 1–4: แยกทีละใบ 2 คอลัมน์ (คอลัมน์ซ้าย = 1,2 กว้างขึ้น / คอลัมน์ขวา = 3,4) */
#screen1 .s1-card-right-1 {
  right: 239px;
  top: 6px;
  bottom: calc(50% + 3px);
  width: 252px;
}
#screen1 .s1-card-right-2 {
  right: 239px;
  top: calc(50% + 3px);
  bottom: 6px;
  width: 252px;
}
#screen1 .s1-card-right-3 {
  right: 6px;
  top: 6px;
  bottom: calc(50% + 3px);
  width: 227px;
}
#screen1 .s1-card-right-4 {
  right: 6px;
  top: calc(50% + 3px);
  bottom: 6px;
  width: 227px;
}
#screen1 .s1-panel {
  background: #0f2235;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
/* Panel 1: สภาพอากาศ — ใช้พื้นที่เต็ม + scroll เมื่อเนื้อหายาว */
#screen1 .s1-panel-weather {
  min-height: 0;
}
#screen1 .s1-panel-weather-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 10px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
#screen1 .s1-panel-weather .s1-section-header {
  flex-shrink: 0;
}
#screen1 .s1-panel-weather .current-display {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}
#screen1 .s1-panel-weather .current-display .current-icon {
  font-size: 36px;
  flex-shrink: 0;
}
#screen1 .s1-panel-weather .current-display .current-temp-wrap {
  font-size: 24px;
  font-weight: 700;
  color: #fff;
}
#screen1 .s1-panel-weather .current-display .current-temp-wrap .temp-unit {
  font-size: 14px;
  color: #8aa3bd;
}
#screen1 .s1-panel-weather .current-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px 0 10px;
}
#screen1 .s1-panel-weather .current-item {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
#screen1 .s1-panel-weather .current-item .item-icon {
  font-size: 16px;
  flex-shrink: 0;
}
#screen1 .s1-panel-weather .current-item .item-text {
  min-width: 0;
}
#screen1 .s1-panel-weather .current-item .item-val {
  font-size: 12px;
  color: #d0e4f0;
  line-height: 1.3;
}
#screen1 .s1-panel-weather .current-item .item-label {
  font-size: 10px;
  color: #506070;
}
#screen1 .s1-panel-weather .rank-list {
  max-height: 220px;
  overflow-y: auto;
  padding: 4px 0;
  margin-bottom: 4px;
}
#screen1 .s1-panel-weather .rank-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  font-size: 11px;
}
#screen1 .s1-panel-weather .rank-item .rank-num {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}
#screen1 .s1-panel-weather .rank-item .rank-num.rank-1 {
  background: #e74c3c;
  color: #fff;
}
#screen1 .s1-panel-weather .rank-item .rank-num.rank-2 {
  background: #e67e22;
  color: #fff;
}
#screen1 .s1-panel-weather .rank-item .rank-num.rank-3 {
  background: #f1c40f;
  color: #000;
}
#screen1 .s1-panel-weather .rank-item .rank-num.rank-other {
  background: rgba(255, 255, 255, 0.1);
  color: #8aa3bd;
}
#screen1 .s1-panel-weather .rank-item .rank-area {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: #d0e4f0;
}
#screen1 .s1-panel-weather .rank-item .rank-val {
  font-size: 12px;
  color: #00c9e0;
  font-weight: 600;
}
#screen1 .s1-panel-weather .rank-item .rank-unit {
  font-size: 10px;
  color: #506070;
}
#screen1 .s1-panel-weather .forecast-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px 0 0;
}
#screen1 .s1-panel-weather .forecast-row .forecast-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 38px;
  gap: 2px;
  padding: 4px 2px;
}
#screen1 .s1-panel-weather .forecast-row .forecast-item .fc-date {
  font-size: 10px;
  color: #506070;
}
#screen1 .s1-panel-weather .forecast-row .forecast-item .fc-icon {
  font-size: 16px;
}
#screen1 .s1-panel-weather .forecast-row .forecast-item .fc-hi {
  font-size: 11px;
  color: #ea780e;
  font-weight: 600;
}
#screen1 .s1-panel-weather .forecast-row .forecast-item .fc-lo {
  font-size: 10px;
  color: #8aa3bd;
}
#screen1 .s1-section-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #00c9e0;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  letter-spacing: 0.5px;
}
#screen1 .s1-section-header::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  background: #00c9e0;
  border-radius: 2px;
}
#screen1 .s1-section-header {
  font-size: 12px;
}
#screen1 .s1-current .current-icon {
  font-size: 36px;
  text-align: center;
  padding: 8px 0;
}
#screen1 .s1-current .current-temp {
  font-size: 32px;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
}
#screen1 .s1-current .current-unit {
  font-size: 16px;
  color: #8aa3bd;
}
#screen1 .s1-current .current-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 10px;
}
#screen1 .s1-current .current-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
#screen1 .s1-current .current-item .item-icon {
  font-size: 14px;
  color: #00c9e0;
}
#screen1 .s1-current .current-item .item-val {
  font-size: 12px;
  color: #d0e4f0;
}
#screen1 .s1-current .current-item .item-label {
  font-size: 10px;
  color: #506070;
}
#screen1 .s1-rankings .rank-list {
  padding: 4px 0;
  overflow-y: auto;
  max-height: 120px;
}
#screen1 .s1-rankings .rank-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
}
#screen1 .s1-rankings .rank-item .rank-num {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}
#screen1 .s1-rankings .rank-item .rank-num.rank-1 {
  background: #e74c3c;
  color: white;
}
#screen1 .s1-rankings .rank-item .rank-num.rank-2 {
  background: #e67e22;
  color: white;
}
#screen1 .s1-rankings .rank-item .rank-num.rank-3 {
  background: #f1c40f;
  color: black;
}
#screen1 .s1-rankings .rank-item .rank-num:not(.rank-1):not(.rank-2):not(.rank-3) {
  background: rgba(255, 255, 255, 0.1);
  color: #8aa3bd;
}
#screen1 .s1-rankings .rank-item .rank-area {
  flex: 1;
  font-size: 12px;
  color: #d0e4f0;
}
#screen1 .s1-rankings .rank-item .rank-val {
  font-size: 12px;
  color: #00c9e0;
  font-weight: 600;
  font-family: monospace;
}
#screen1 .s1-rankings .rank-item .rank-unit {
  font-size: 10px;
  color: #506070;
}
#screen1 .s1-forecast .forecast-row {
  display: flex;
  overflow-x: auto;
  padding: 6px 8px;
  gap: 6px;
}
#screen1 .s1-forecast .forecast-row .forecast-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 36px;
  gap: 2px;
}
#screen1 .s1-forecast .forecast-row .forecast-item .fc-date {
  font-size: 10px;
  color: #506070;
}
#screen1 .s1-forecast .forecast-row .forecast-item .fc-icon {
  font-size: 16px;
}
#screen1 .s1-forecast .forecast-row .forecast-item .fc-hi {
  font-size: 11px;
  color: #ea780e;
  font-weight: 600;
}
#screen1 .s1-forecast .forecast-row .forecast-item .fc-lo {
  font-size: 10px;
  color: #8aa3bd;
}
#screen1 .s1-hist-tabs {
  display: flex;
  gap: 4px;
  padding: 4px 8px;
}
#screen1 .s1-hist-tabs .tab {
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11px;
  cursor: pointer;
  color: #506070;
  background: transparent;
  border: 1px solid transparent;
}
#screen1 .s1-hist-tabs .tab.active {
  background: rgba(26, 145, 209, 0.2);
  color: #00c9e0;
  border-color: rgba(26, 145, 209, 0.3);
}
#screen1 .s1-hist-tabs .tab:hover:not(.active) {
  color: #8aa3bd;
}
#screen1 .chart-wrap {
  padding: 6px 8px;
  flex: 1;
  min-height: 0;
  position: relative;
}
/* Panel 2: กราฟความสูงเท่ากัน สมมาตร */
#screen1 .s1-panel-charts .chart-wrap {
  flex: 0 0 130px;
  height: 130px;
  min-height: 130px;
}
#screen1 .chart-label {
  font-size: 10px;
  color: #506070;
  padding: 0 10px 2px;
}
#screen1 .s1-map-panel {
  position: relative !important;
  overflow: hidden;
  padding: 0 !important;
  display: block !important;
}
#screen1 .s1-map-panel .map-mode-wrap {
  position: absolute !important;
  inset: 0;
  display: flex;
  flex-direction: column;
}
#screen1 #s1-map {
  flex: 1;
  min-height: 0;
}
#screen1 #s1-map .leaflet-container {
  background: #060e18 !important;
}
/* แถบเมนูแผนที่ — overlay ลอยด้านหน้าแผนที่ (ลดขนาดลง) */
#screen1 .s1-map-tabs {
  position: absolute;
  top: 10%;
  left: calc(50% - 50px);
  transform: translateX(-50%);
  width: 480px;
  max-width: calc(100% - 24px);
  height: 30px;
  z-index: 500;
  display: flex;
  align-items: stretch;
  background: rgba(6, 14, 24, 0.82);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(0, 201, 224, 0.18);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
#screen1 .s1-map-tabs .map-tab {
  flex: 1;
  text-align: center;
  padding: 5px 4px;
  font-size: 11px;
  color: #506070;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
#screen1 .s1-map-tabs .map-tab.active {
  color: #00c9e0;
  border-bottom-color: #00c9e0;
  background: rgba(0, 201, 224, 0.08);
  text-shadow: 0 0 8px rgba(0, 201, 224, 0.95), 0 0 20px rgba(0, 201, 224, 0.55), 0 0 40px rgba(0, 201, 224, 0.25);
  box-shadow: inset 0 -3px 10px rgba(0, 201, 224, 0.18);
}
#screen1 .s1-map-tabs .map-tab:hover:not(.active) {
  color: #8aa3bd;
}
/* ปุ่ม 2D/3D — ล่างสุดของแผนที่ เข้า theme โทนเข้ม */
#screen1 .s1-map-panel .map-mode-toggle {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 500;
  display: flex;
  gap: 0;
  background: rgba(6, 14, 24, 0.9);
  border: 1px solid rgba(0, 201, 224, 0.25);
  border-radius: 8px;
  padding: 2px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}
#screen1 .s1-map-panel .map-mode-toggle button {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #64768c;
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
#screen1 .s1-map-panel .map-mode-toggle button.active {
  color: #00c9e0;
  background: rgba(0, 201, 224, 0.15);
  box-shadow: inset 0 0 0 1px rgba(0, 201, 224, 0.3);
}
#screen1 .s1-map-panel .map-mode-toggle button:hover:not(.active) {
  color: #8aa3bd;
  background: rgba(255, 255, 255, 0.05);
}
#screen1 .s1-main .s1-col-header {
  font-size: 11px;
  font-weight: 600;
  color: #00c9e0;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(26, 145, 209, 0.08);
  flex-shrink: 0;
}
#screen1 .s1-sub-panel {
  background: #0f2235;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  overflow: hidden;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 6px 8px;
  gap: 4px;
}
#screen1 .s1-sub-panel .s1-section-header {
  flex-shrink: 0;
}
/* ส่วนสรุปตัวเลข (ต้นน้ำ/พื้นที่) ไม่ให้ถูกบีบ */
#screen1 .s1-sub-panel > div:not(.s1-section-header):not(.flood-table-wrap):not(.s1-col-header) {
  flex-shrink: 0;
}
/* ตารางอุทกภัย — ใช้พื้นที่เหลือเต็มกรอบ + scroll เมื่อแถวมาก */
#screen1 .s1-sub-panel .flood-table-wrap {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  max-height: none;
}
/* รายการข่าว/รายงาน — ใช้พื้นที่เหลือเต็มกรอบ + scroll เมื่อยาวเกิน */
#screen1 .s1-sub-panel .news-list {
  flex: 1;
  min-height: 0;
  max-height: none;
  overflow-y: auto;
  padding: 6px 8px;
}
#screen1 .s1-sub-panel table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
#screen1 .s1-sub-panel table.data-table th {
  background: rgba(26, 145, 209, 0.15);
  color: #00c9e0;
  padding: 4px 6px;
  text-align: left;
  position: sticky;
  top: 0;
  font-weight: 500;
}
#screen1 .s1-sub-panel table.data-table td {
  padding: 3px 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  color: #8aa3bd;
}
#screen1 .s1-sub-panel table.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}
#screen1 .s1-sub-panel table.data-table td.danger {
  color: #e74c3c;
}
#screen1 .s1-sub-panel .decision-list {
  padding: 4px;
  overflow-y: auto;
  max-height: 120px;
}
#screen1 .s1-sub-panel .decision-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
#screen1 .s1-sub-panel .decision-item:last-child {
  border-bottom: none;
}
#screen1 .s1-sub-panel .decision-item .d-icon {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}
#screen1 .s1-sub-panel .decision-item .d-content .d-title {
  font-size: 12px;
  color: #d0e4f0;
  font-weight: 500;
}
#screen1 .s1-sub-panel .decision-item .d-content .d-sub {
  font-size: 11px;
  color: #8aa3bd;
  margin-top: 2px;
}
#screen1 .s1-sub-panel .news-list {
  padding: 4px;
  overflow-y: auto;
  max-height: 100px;
}
#screen1 .s1-sub-panel .news-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 4px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  cursor: pointer;
}
#screen1 .s1-sub-panel .news-item:hover {
  background: rgba(255, 255, 255, 0.03);
}
#screen1 .s1-sub-panel .news-item .news-date {
  font-size: 11px;
  color: #506070;
  white-space: nowrap;
}
#screen1 .s1-sub-panel .news-item .news-title {
  font-size: 12px;
  color: #8aa3bd;
  line-height: 1.4;
}

/* ══ Bottom Bar: Timeline + System Status ══════════════════════ */
#screen1 .s1-bottom-bar {
  display: flex;
  align-items: center;
  height: 54px;
  min-height: 54px;
  background: linear-gradient(90deg, #0a1a2a 0%, #0d1f30 50%, #0a1a2a 100%);
  border-top: 1px solid rgba(234, 120, 14, 0.25);
  padding: 0 14px;
  gap: 0;
  z-index: 20;
  position: relative;
}

/* Timeline Section (ซ้าย) */
#screen1 .s1-timeline-section {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}
#screen1 .s1-timeline-section::-webkit-scrollbar {
  height: 3px;
}

#screen1 .s1-timeline-label {
  font-size: 10px;
  font-weight: 700;
  color: #ea780e;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  white-space: nowrap;
  padding: 3px 8px;
  border: 1px solid rgba(234, 120, 14, 0.35);
  border-radius: 4px;
  background: rgba(234, 120, 14, 0.08);
  flex-shrink: 0;
}

#screen1 .s1-timeline-track {
  display: flex;
  align-items: center;
  gap: 6px;
  position: relative;
  flex: 1;
  min-width: 0;
}

#screen1 .s1-timeline-line {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    rgba(234, 120, 14, 0.5) 0%,
    rgba(0, 201, 224, 0.3) 50%,
    rgba(234, 120, 14, 0.15) 100%
  );
  transform: translateY(-50%);
  z-index: 0;
  border-radius: 1px;
}

#screen1 .s1-tl-event {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(13, 30, 48, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 4px 10px;
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  transition: border-color 0.2s, background 0.2s;
}
#screen1 .s1-tl-event:hover {
  border-color: rgba(234, 120, 14, 0.4);
  background: rgba(13, 30, 48, 0.95);
}

#screen1 .s1-tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

#screen1 .s1-tl-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

#screen1 .s1-tl-time {
  font-size: 10px;
  font-weight: 700;
  color: #00c9e0;
  font-family: 'Bahnschrift', 'Inter', sans-serif;
}

#screen1 .s1-tl-desc {
  font-size: 10px;
  color: #8aa3bd;
  white-space: nowrap;
}

/* เส้นคั่นแนวตั้ง */
#screen1 .s1-bottom-divider {
  width: 1px;
  height: 34px;
  background: rgba(234, 120, 14, 0.3);
  margin: 0 14px;
  flex-shrink: 0;
}

/* Status Section (ขวา) */
#screen1 .s1-status-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#screen1 .s1-status-label {
  font-size: 10px;
  font-weight: 600;
  color: #8aa3bd;
  white-space: nowrap;
}

#screen1 .s1-status-grid {
  display: flex;
  align-items: center;
  gap: 10px;
}

#screen1 .s1-status-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

#screen1 .s1-status-name {
  font-size: 9px;
  color: #64768c;
  white-space: nowrap;
}

#screen1 .s1-status-val {
  font-size: 12px;
  font-weight: 700;
  font-family: 'Bahnschrift', 'Inter', sans-serif;
  padding: 1px 8px;
  border-radius: 3px;
}

#screen1 .s1-status-val.ok {
  color: #1d8f5f;
  background: rgba(29, 143, 95, 0.12);
}

#screen1 .s1-status-val.warn {
  color: #f1c40f;
  background: rgba(241, 196, 15, 0.12);
}

#screen1 .s1-status-val.error {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.12);
}

#screen2 {
  flex-direction: row;
}
#screen2 .s2-content {
  flex: 1;
  overflow: hidden;
  background: #070f1a;
  display: flex;
  flex-direction: column;
}
#screen2 .s2-header {
  background: #091929;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: 44px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
#screen2 .s2-header .search-box {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  padding: 4px 10px;
  width: 200px;
}
#screen2 .s2-header .search-box input {
  background: transparent;
  border: none;
  outline: none;
  color: #d0e4f0;
  font-size: 12px;
  width: 150px;
}
#screen2 .s2-header .search-box .search-icon {
  color: #506070;
  font-size: 13px;
}
#screen2 .s2-header .header-buttons {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
#screen2 .s2-header .header-btn {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  border: none;
  background: rgba(26, 145, 209, 0.15);
  color: #1a91d1;
  border: 1px solid rgba(26, 145, 209, 0.3);
}
#screen2 .s2-header .header-btn:hover {
  background: rgba(26, 145, 209, 0.25);
}
#screen2 .s2-header .header-btn.active {
  background: #ea780e;
  color: white;
  border-color: #ea780e;
}
#screen2 .s2-main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 16px;
  gap: 12px;
}
#screen2 .s2-modal-card {
  background: #0d1b2a;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
}
#screen2 .s2-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #0a1828;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
#screen2 .s2-modal-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #d0e4f0;
}
#screen2 .s2-modal-header .close-btn {
  color: #506070;
  cursor: pointer;
  font-size: 16px;
}
#screen2 .s2-modal-header .close-btn:hover {
  color: #d0e4f0;
}
#screen2 .s2-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.02);
}
#screen2 .s2-filter-row .filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}
#screen2 .s2-filter-row .filter-group label {
  font-size: 11px;
  color: #506070;
  white-space: nowrap;
}
#screen2 .s2-filter-row .filter-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
#screen2 .s2-table-wrap {
  flex: 1;
  overflow-y: auto;
}
#screen2 .s2-table-wrap table.s2-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
#screen2 .s2-table-wrap table.s2-table thead {
  position: sticky;
  top: 0;
  z-index: 5;
}
#screen2 .s2-table-wrap table.s2-table thead th {
  background: #0a1828;
  color: #8aa3bd;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
}
#screen2 .s2-table-wrap table.s2-table thead th .sort-icon {
  color: #506070;
  margin-left: 4px;
}
#screen2 .s2-table-wrap table.s2-table thead th:hover {
  color: #d0e4f0;
}
#screen2 .s2-table-wrap table.s2-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background 0.1s;
}
#screen2 .s2-table-wrap table.s2-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}
#screen2 .s2-table-wrap table.s2-table tbody tr td {
  padding: 7px 10px;
  color: #8aa3bd;
  vertical-align: middle;
}
#screen2 .s2-table-wrap table.s2-table tbody tr td:first-child {
  color: #d0e4f0;
}
#screen2 .s2-table-wrap table.s2-table tbody tr td.time-col {
  font-family: monospace;
  font-size: 11px;
}
#screen2 .s2-table-wrap table.s2-table tbody tr td.pm25-col {
  color: #ea780e;
  font-weight: 600;
}
#screen2 .s2-table-wrap table.s2-table tbody tr td.aqi-col {
  color: #e74c3c;
  font-weight: 600;
}
#screen2 .s2-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  background: #0a1828;
  flex-shrink: 0;
}
#screen2 .s2-footer .aqi-legend {
  display: flex;
  align-items: center;
  gap: 10px;
}
#screen2 .s2-footer .aqi-legend .legend-title {
  font-size: 11px;
  color: #506070;
}
#screen2 .s2-footer .aqi-legend .legend-items {
  display: flex;
  gap: 8px;
}
#screen2 .s2-footer .aqi-legend .legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #8aa3bd;
}
#screen2 .s2-footer .aqi-legend .legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
#screen2 .s2-footer .pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}
#screen2 .s2-footer .pagination .page-info {
  font-size: 11px;
  color: #506070;
  margin-right: 8px;
}
#screen2 .s2-footer .pagination .page-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #8aa3bd;
}
#screen2 .s2-footer .pagination .page-btn:hover {
  background: rgba(255, 255, 255, 0.07);
  color: #d0e4f0;
}
#screen2 .s2-footer .pagination .page-btn.active {
  background: #1a91d1;
  color: white;
  border-color: #1a91d1;
}

#screen3 {
  flex-direction: column;
}
#screen3 .s3-header {
  background: #091929;
  height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  flex-shrink: 0;
}
#screen3 .s3-header .hamburger {
  color: #8aa3bd;
  font-size: 18px;
  cursor: pointer;
}
#screen3 .s3-header .s3-search {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 4px;
  padding: 4px 10px;
  width: 180px;
}
#screen3 .s3-header .s3-search input {
  background: transparent;
  border: none;
  outline: none;
  color: #d0e4f0;
  font-size: 12px;
  flex: 1;
}
#screen3 .s3-header .s3-search .search-icon {
  color: #506070;
}
#screen3 .s3-header .s3-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-left: 8px;
}
#screen3 .s3-header .s3-logo .logo-badge {
  background: #ea780e;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}
#screen3 .s3-header .s3-nav-buttons {
  display: flex;
  gap: 6px;
  margin-left: auto;
}
#screen3 .s3-header .s3-nav-buttons .nav-btn {
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: rgba(255, 255, 255, 0.06);
  color: #8aa3bd;
}
#screen3 .s3-header .s3-nav-buttons .nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #d0e4f0;
}
#screen3 .s3-header .s3-nav-buttons .nav-btn.active {
  background: #ea780e;
  color: white;
  border-color: #ea780e;
}
#screen3 .s3-header .logout-btn {
  color: #506070;
  font-size: 18px;
  cursor: pointer;
}
#screen3 .s3-header .logout-btn:hover {
  color: #e74c3c;
}
#screen3 .s3-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}
#screen3 .s3-left {
  width: 240px;
  min-width: 240px;
  background: rgba(6, 14, 24, 0.9);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#screen3 .s3-left .s3-panel-header {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#screen3 .s3-left .s3-panel-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: #d0e4f0;
}
#screen3 .s3-left .s3-panel-header .panel-date {
  font-size: 11px;
  color: #506070;
  font-family: monospace;
}
#screen3 .s3-left .tab-row {
  display: flex;
  gap: 4px;
  padding: 6px 10px;
}
#screen3 .s3-left .tab-row .stab {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  color: #506070;
  background: transparent;
}
#screen3 .s3-left .tab-row .stab.active {
  background: #00c9e0;
  color: #0a1520;
  font-weight: 600;
}
#screen3 .s3-left .tab-row .stab:hover:not(.active) {
  color: #8aa3bd;
}
#screen3 .s3-left .chart-legend-row {
  display: flex;
  gap: 10px;
  padding: 0 10px 4px;
}
#screen3 .s3-left .chart-legend-row .cleg {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  color: #506070;
}
#screen3 .s3-left .chart-legend-row .cleg .cleg-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}
#screen3 .s3-left #s3-bar-chart-wrap {
  flex: 1;
  padding: 6px;
  min-height: 0;
}
#screen3 .s3-left .s3-legend-panel {
  padding: 8px 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
#screen3 .s3-left .s3-legend-panel h5 {
  font-size: 11px;
  color: #8aa3bd;
  margin-bottom: 6px;
  font-weight: 600;
}
#screen3 .s3-left .s3-legend-panel .legend-rows {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#screen3 .s3-left .s3-legend-panel .legend-rows .leg-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
#screen3 .s3-left .s3-legend-panel .legend-rows .leg-row .leg-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 8px;
}
#screen3 .s3-left .s3-legend-panel .legend-rows .leg-row .leg-label {
  font-size: 11px;
  color: #8aa3bd;
}
#screen3 .s3-left .s3-legend-panel .legend-rows .leg-row .leg-range {
  font-size: 11px;
  color: #506070;
  margin-left: auto;
}
#screen3 .s3-map-wrap {
  flex: 1;
  position: relative;
}
#screen3 .s3-map-wrap #s3-map {
  width: 100%;
  height: 100%;
}
#screen3 .s3-right {
  width: 280px;
  min-width: 280px;
  background: rgba(6, 14, 24, 0.9);
  border-left: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
#screen3 .s3-right .s3-right-header {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
#screen3 .s3-right .s3-right-header h4 {
  font-size: 13px;
  font-weight: 600;
  color: #d0e4f0;
}
#screen3 .s3-right .s3-right-header .right-tabs {
  display: flex;
  gap: 4px;
}
#screen3 .s3-right .s3-right-header .right-tabs .rtab {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  cursor: pointer;
  color: #506070;
  background: transparent;
}
#screen3 .s3-right .s3-right-header .right-tabs .rtab.active {
  background: #ea780e;
  color: white;
  font-weight: 600;
}
#screen3 .s3-right .s3-alert-list {
  flex: 1;
  overflow-y: auto;
  padding: 6px;
}
#screen3 .s3-right .s3-alert-card {
  background: rgba(15, 34, 53, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 6px;
  margin-bottom: 6px;
  overflow: hidden;
}
#screen3 .s3-right .s3-alert-card .alert-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
#screen3 .s3-right .s3-alert-card .alert-card-header .timing {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #8aa3bd;
}
#screen3 .s3-right .s3-alert-card .alert-card-header .timing span.time-box {
  font-family: monospace;
  font-size: 12px;
  color: #00c9e0;
}
#screen3 .s3-right .s3-alert-card .alert-card-header .timing span.time-box .colon {
  color: #ea780e;
  animation: blink 1s infinite;
}
#screen3 .s3-right .s3-alert-card .alert-card-header .starred {
  color: #ea780e;
}
#screen3 .s3-right .s3-alert-card .alert-card-header .aqi-badge-sm {
  margin-left: auto;
}
#screen3 .s3-right .s3-alert-card .alert-card-body {
  padding: 6px 10px;
}
#screen3 .s3-right .s3-alert-card .alert-card-body .aqi-status {
  font-size: 12px;
  color: #27ae60;
  font-weight: 500;
  margin-bottom: 4px;
}
#screen3 .s3-right .s3-alert-card .alert-card-body .aqi-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
#screen3 .s3-right .s3-alert-card .alert-card-body .aqi-row .aqi-tag {
  background: rgba(39, 174, 96, 0.2);
  color: #27ae60;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}
#screen3 .s3-right .s3-alert-card .alert-card-body .field-row {
  display: grid;
  grid-template-columns: 50px 1fr;
  gap: 2px 6px;
  margin-top: 4px;
}
#screen3 .s3-right .s3-alert-card .alert-card-body .field-row .f-label {
  font-size: 11px;
  color: #506070;
}
#screen3 .s3-right .s3-alert-card .alert-card-body .field-row .f-val {
  font-size: 11px;
  color: #8aa3bd;
}
#screen3 .s3-right .s3-alert-card .alert-card-body .coord-row {
  font-size: 10px;
  color: #506070;
  margin-top: 4px;
  font-family: monospace;
}
#screen3 .s3-right .s3-alert-card .alert-card-body .date-row {
  font-size: 11px;
  color: #506070;
  margin-top: 4px;
}
#screen3 .s3-right .s3-alert-card.warning .alert-card-header {
  background: rgba(231, 76, 60, 0.08);
}
#screen3 .s3-right .s3-alert-card.warning .aqi-status {
  color: #e74c3c;
}
#screen3 .s3-right .s3-alert-card.warning .aqi-tag {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
}

.leaflet-popup-content-wrapper {
  background: #0f2235 !important;
  border: 1px solid rgba(26, 145, 209, 0.4) !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5) !important;
  color: #d0e4f0 !important;
}

.leaflet-popup-tip {
  background: #0f2235 !important;
}

.leaflet-popup-close-button {
  color: #8aa3bd !important;
}

.leaflet-container {
  background: #060f1a;
}

.leaflet-control-attribution {
  display: none;
}

.custom-aqi-marker {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: white;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: transform 0.2s;
}
.custom-aqi-marker:hover {
  transform: scale(1.2);
}

@keyframes blink {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}
@keyframes blink-bg {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.9;
  }
}
@keyframes pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
}
@media (max-width: 1200px) {
  #screen3 .s3-left {
    width: 200px;
  }
  #screen3 .s3-right {
    width: 240px;
  }
}
