/* ============================================================================
   Nakhon Safe — Apple iOS System Design & Typography
   Inspired by Apple iOS Human Interface Guidelines (HIG)
   ============================================================================ */

:root {
  /* iOS System Colors */
  --ios-blue: #007AFF;
  --ios-blue-light: #5AC8FA;
  --ios-blue-gradient: linear-gradient(135deg, #0A84FF 0%, #007AFF 60%, #0056D2 100%);
  --ios-red: #FF3B30;
  --ios-red-gradient: linear-gradient(145deg, #FF453A 0%, #FF3B30 55%, #D70015 100%);
  --ios-orange: #FF9500;
  --ios-orange-gradient: linear-gradient(145deg, #FF9F0A 0%, #FF9500 55%, #C96F00 100%);
  --ios-green: #34C759;
  --ios-green-gradient: linear-gradient(145deg, #30D158 0%, #34C759 55%, #248A3D 100%);
  --ios-indigo: #5856D6;
  --ios-teal: #30B0C7;
  --ios-purple: #AF52DE;

  /* Legacy mappings to maintain backward compatibility */
  --primary: var(--ios-blue);
  --primary-dark: #0056D2;
  --primary-gradient: var(--ios-blue-gradient);
  --danger: var(--ios-red);
  --danger-gradient: var(--ios-red-gradient);
  --warning: var(--ios-orange);
  --warning-gradient: var(--ios-orange-gradient);
  --success: var(--ios-green);
  --success-gradient: var(--ios-green-gradient);

  /* iOS System Backgrounds & Grouped Layout */
  --bg-main: #F2F2F7;
  --card-bg: #FFFFFF;
  --card-bg-subtle: #F9F9FB;
  --card-border: rgba(60, 60, 67, 0.08);
  --ios-hairline: rgba(60, 60, 67, 0.12);

  /* iOS Label & Text Hierarchy */
  --text-main: #000000;
  --text-primary: #1C1C1E;
  --text-secondary: #3C3C4399; /* 60% opacity */
  --text-muted: #8E8E93;
  --text-tertiary: #C7C7CC;
  --border-color: rgba(60, 60, 67, 0.12);

  /* iOS Squircles & Radius */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-md: 20px;
  --radius-lg: 24px;
  --radius-xl: 28px;
  --radius-pill: 999px;

  /* iOS Diffuse Ambient Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.03);
  --shadow: 0 6px 18px -4px rgba(0, 0, 0, 0.05), 0 2px 6px -1px rgba(0, 0, 0, 0.02);
  --shadow-md: 0 10px 28px -6px rgba(0, 0, 0, 0.08), 0 3px 8px -2px rgba(0, 0, 0, 0.03);
  --shadow-lg: 0 18px 40px -10px rgba(0, 0, 0, 0.12), 0 4px 14px rgba(0, 0, 0, 0.04);

  /* iOS Materials / Blur */
  --ios-blur: blur(25px) saturate(190%);
}

/* ============================================================================
   Base & Typography (SF Pro Inspired Optical Tuning)
   ============================================================================ */
*, input, button, select, textarea, optgroup, table, th, td {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Noto Sans Thai", "Sukhumvit Set", "Helvetica Neue", sans-serif;
}

/* ⚠️ สำคัญ: ห้ามให้ฟอนต์กลางด้านบนทับฟอนต์ไอคอนของ Font Awesome
   (เดิมใส่ !important ที่ * และ *::before ทำให้ไอคอนกลายเป็นกล่องสี่เหลี่ยม/ตัวอักษรเพี้ยน) */
.fa, .fas, .far, .fab, .fal, .fat,
.fa-solid, .fa-regular, .fa-brands, .fa-light, .fa-thin, .fa-duotone, .fa-sharp,
.fa::before, .fas::before, .far::before, .fab::before,
.fa-solid::before, .fa-regular::before, .fa-brands::before {
  font-family: "Font Awesome 6 Free" !important;
  font-style: normal;
  -webkit-font-smoothing: antialiased;
}
.fab, .fa-brands, .fab::before, .fa-brands::before {
  font-family: "Font Awesome 6 Brands" !important;
}
.fas, .fa-solid {
  font-weight: 900 !important;
}
.far, .fa-regular {
  font-weight: 400 !important;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  background-color: var(--bg-main);
  color: var(--text-primary);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Noto Sans Thai", "Sukhumvit Set", "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* ภาษาไทยไม่ควรบีบระยะตัวอักษร (ทำให้สระ/วรรณยุกต์ซ้อนทับกันจนอ่านเพี้ยน) */
  letter-spacing: normal;
  word-break: normal;
  line-height: 1.5;
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}

/* iOS Container (Mobile App Layout 100% ทุกขนาดจอ) */
.app-container {
  max-width: 460px !important;
  width: 100% !important;
  margin: 0 auto !important;
  padding: 12px 12px 24px !important;
  flex: 1;
  box-sizing: border-box;
  background: var(--bg-main);
  min-height: 100vh;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.08);
  position: relative;
  overflow-x: hidden;
}

@media (min-width: 481px) {
  body {
    background: linear-gradient(135deg, #CBD5E1 0%, #E2E8F0 100%);
  }
  .app-container {
    border-left: 1px solid rgba(15, 23, 42, 0.1);
    border-right: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  }
  .app-header {
    border-left: 1px solid rgba(15, 23, 42, 0.1);
    border-right: 1px solid rgba(15, 23, 42, 0.1);
  }
}

@media (max-width: 480px) {
  .app-container {
    max-width: 100% !important;
    padding: 10px 10px 24px !important;
    box-shadow: none;
  }
}

html.nrt-force-mobile body {
  background: var(--bg-main) !important;
}
html.nrt-force-mobile .app-container {
  width: 100% !important;
  max-width: 460px !important;
  margin: 0 auto !important;
  padding: 10px 10px 24px !important;
  border-left: 0 !important;
  border-right: 0 !important;
  box-shadow: none !important;
}
html.nrt-force-mobile .app-header {
  max-width: 460px !important;
  margin: 0 auto !important;
  border-left: 0 !important;
  border-right: 0 !important;
}
html.nrt-force-mobile .bottom-nav {
  max-width: 460px !important;
  border-radius: 0 !important;
}
html.nrt-force-mobile .app-map-container {
  max-width: 460px !important;
  margin: 0 auto !important;
  box-shadow: none !important;
}

/* ============================================================================
   iOS Navigation Bar (Header)
   ============================================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(242, 242, 247, 0.82);
  backdrop-filter: var(--ios-blur);
  -webkit-backdrop-filter: var(--ios-blur);
  border-bottom: 0.5px solid var(--ios-hairline);
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: max(10px, env(safe-area-inset-top, 0px));
  transition: all 0.2s ease;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-primary);
  min-width: 0;
  flex: 1 1 auto;
}

.brand-avatar-wrap {
  width: auto;
  height: 50px;
  max-width: 72px;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
  border: none;
  flex-shrink: 0;
  background: transparent !important;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: translateY(-2px); /* จัดกึ่งกลางสายตาให้สมดุลพอดีระหว่างบรรทัด NAKHON SAVE และ สสจ.นครศรีธรรมราช */
  transition: transform 0.2s ease;
}

.brand-avatar {
  width: auto;
  height: 100%;
  max-height: 50px;
  object-fit: contain;
  background: transparent !important;
  padding: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.16));
}

.brand-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  line-height: 1.15;
}

.brand-title {
  font-size: 1.25rem;
  font-weight: 850;
  letter-spacing: -0.025em;
  color: #000;
  line-height: 1.15;
  margin-bottom: 2px;
}

.brand-subtitle {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: -0.01em;
  line-height: 1.15;
}

@media (max-width: 480px) {
  .app-brand {
    gap: 8px;
  }
  .brand-avatar-wrap {
    height: 44px !important;
    max-width: 64px !important;
    width: auto !important;
    transform: translateY(-2px);
  }
  .brand-avatar {
    max-height: 44px !important;
  }
  .brand-title {
    font-size: 1.12rem;
    margin-bottom: 1px;
  }
  .brand-subtitle {
    font-size: 0.70rem;
  }
}

/* iOS Header Action Pill Button */
.ios-pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--ios-blue);
  text-decoration: none;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  transition: all 0.15s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.ios-pill-btn:active {
  background: rgba(0, 122, 255, 0.2);
  transform: scale(0.96);
}

/* ============================================================================
   iOS Section Titles & Greetings
   ============================================================================ */
.ios-section-header {
  padding: 6px 4px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}

.ios-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin-bottom: 2px;
}

.ios-large-title {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #000;
  line-height: 1.2;
}

/* ============================================================================
   iOS Emergency Card (Interactive Widget Style)
   ============================================================================ */
.emergency-card {
  position: relative;
  /* iOS system blue (แบบ Widget การพยากรณ์อากาศ/สุขภาพของ iOS) */
  background: linear-gradient(160deg, #0A84FF 0%, #007AFF 48%, #0040DD 100%);
  color: #fff;
  border-radius: var(--radius-lg);
  padding: 22px 18px 18px;
  margin-bottom: 18px;
  overflow: hidden;
  border: 0.5px solid rgba(255, 255, 255, 0.22);
  box-shadow: 0 16px 36px -10px rgba(0, 122, 255, 0.35), 0 4px 12px rgba(0, 0, 0, 0.15);
}

.emergency-card.has-banner {
  padding: 0;
  background: #0040DD;
  border: 0.5px solid rgba(255, 255, 255, 0.25);
}
.emergency-card.has-banner::before {
  display: none;
}
.emergency-banner-media {
  width: 100%;
  aspect-ratio: 2 / 1;
  overflow: hidden;
  position: relative;
  background: #051A3B;
  display: block;
}
.emergency-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.35s ease;
}
.emergency-card.has-banner:hover .emergency-banner-img {
  transform: scale(1.02);
}
.emergency-card.has-banner .emergency-stats-grid {
  border-top: none;
  padding: 12px 14px 14px;
  background: linear-gradient(180deg, rgba(3, 30, 85, 0.95) 0%, rgba(1, 19, 58, 0.98) 100%);
}

/* Glass Gloss Shimmer Overlay */
.emergency-card::before {
  content: '';
  position: absolute;
  top: -40%;
  right: -20%;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(90, 200, 250, 0.25) 0%, rgba(255, 255, 255, 0) 70%);
  border-radius: 50%;
  pointer-events: none;
}

.emergency-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

/* iOS Status Pill with Live Pulse Dot */
.emergency-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  border: 0.5px solid rgba(255, 255, 255, 0.28);
  margin-bottom: 8px;
}

.live-pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34C759;
  box-shadow: 0 0 0 rgba(52, 199, 89, 0.7);
  animation: iosPulse 1.8s infinite;
}

@keyframes iosPulse {
  0%   { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7); }
  70%  { box-shadow: 0 0 0 7px rgba(52, 199, 89, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 199, 89, 0); }
}

.emergency-title {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  margin-bottom: 4px;
  line-height: 1.25;
}

.emergency-desc {
  font-size: 0.82rem;
  opacity: 0.88;
  line-height: 1.4;
  margin-bottom: 0;
  color: #E1EFFF;
}

.emergency-logo-wrap {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.15);
  border: 0.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  flex-shrink: 0;
  margin-left: 12px;
}

.emergency-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Dual Inset Glass Metrics (Apple Health / Fitness Style) */
.emergency-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.2);
  padding-top: 14px;
}

.stat-capsule {
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 0.5px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
}

.stat-capsule-label {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.82;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.stat-capsule-val {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.stat-capsule-val.success {
  color: #86EFAC;
}

/* ============================================================================
   iOS Quick Action Tiles (Control Center Style)
   ============================================================================ */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}

.action-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 14px 20px;
  border-radius: var(--radius-lg);
  color: #fff;
  text-decoration: none;
  font-weight: 800;
  text-align: center;
  border: 0.5px solid rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.4), var(--shadow-md);
  transition: transform 0.14s cubic-bezier(0.2, 0.9, 0.3, 1), box-shadow 0.14s ease;
  overflow: hidden;
  cursor: pointer;
}

.action-btn:active {
  transform: scale(0.95);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.action-btn.sos {
  background: var(--ios-red-gradient);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.4), 0 10px 24px -4px rgba(255, 59, 48, 0.42);
}

.action-btn.flood {
  background: var(--ios-orange-gradient);
  box-shadow: inset 0 1px 1.5px rgba(255, 255, 255, 0.4), 0 10px 24px -4px rgba(255, 149, 0, 0.42);
}

.action-btn-icon-wrap {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.18);
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 0.5px solid rgba(255, 255, 255, 0.35);
}

.action-btn-icon-wrap i {
  font-size: 1.7rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.action-btn span {
  font-size: 0.96rem;
  font-weight: 750;
  line-height: 1.25;
  letter-spacing: -0.015em;
}

.action-btn small {
  font-size: 0.68rem;
  font-weight: 600;
  opacity: 0.9;
  margin-top: 5px;
  letter-spacing: -0.01em;
}

/* ============================================================================
   iOS Inset Grouped TableView (Features & Services)
   ============================================================================ */
.ios-group-title {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 12px 6px 8px;
}

.ios-inset-group {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  border: 0.5px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  margin-bottom: 20px;
}

.ios-cell {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  text-decoration: none;
  color: var(--text-primary);
  background: var(--card-bg);
  transition: background 0.12s ease;
}

.ios-cell:active {
  background: rgba(0, 0, 0, 0.04);
}

.ios-cell + .ios-cell {
  border-top: 0.5px solid var(--ios-hairline);
}

/* iOS Squircle App Icon Badges */
.ios-app-icon {
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.15rem;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12);
  border: 0.5px solid rgba(255, 255, 255, 0.25);
}

.ios-app-icon.blue { background: var(--ios-blue-gradient); }
.ios-app-icon.green { background: var(--ios-green-gradient); }
.ios-app-icon.red { background: var(--ios-red-gradient); }
.ios-app-icon.orange { background: var(--ios-orange-gradient); }
.ios-app-icon.teal { background: linear-gradient(135deg, #30B0C7, #0284c7); }

.ios-cell-content {
  flex: 1;
  min-width: 0;
}

.ios-cell-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: #000;
  letter-spacing: -0.015em;
  margin-bottom: 2px;
}

.ios-cell-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ios-cell-accessory {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 0.85rem;
}

.ios-badge-tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.ios-badge-tag.danger {
  background: rgba(255, 59, 48, 0.12);
  color: var(--ios-red);
}

.ios-badge-tag.call {
  background: rgba(52, 199, 89, 0.14);
  color: var(--ios-green);
}

/* Feature Card (Legacy wrapper mapped to iOS Inset) */
.feature-card {
  background: var(--card-bg);
  border: 0.5px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.12s, transform 0.12s;
}

.feature-card:active {
  background: rgba(0, 0, 0, 0.04);
  transform: scale(0.985);
}

.feature-icon {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}

.feature-content h3 {
  font-size: 0.94rem;
  font-weight: 700;
  margin-bottom: 2px;
  color: #000;
}

.feature-content p {
  font-size: 0.76rem;
  color: var(--text-muted);
}

/* ============================================================================
   iOS Forms, Fields & Controls
   ============================================================================ */
.form-card {
  background: var(--card-bg);
  border: 0.5px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 18px 16px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: #48484A;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
}

.form-control {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid rgba(60, 60, 67, 0.18);
  border-radius: var(--radius-sm);
  font-size: 0.92rem;
  background: #FFFFFF;
  color: #000;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
  -webkit-appearance: none;
}

.form-control:focus {
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.2);
}

/* iOS Primary Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  background: var(--ios-blue-gradient);
  color: #fff;
  font-size: 0.96rem;
  font-weight: 750;
  letter-spacing: -0.015em;
  border: 0;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 122, 255, 0.35);
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(0, 122, 255, 0.25);
}

/* ============================================================================
   iOS Tab Bar (Bottom Navigation)
   ============================================================================ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: calc(60px + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: var(--ios-blur);
  -webkit-backdrop-filter: var(--ios-blur);
  border-top: 0.5px solid var(--ios-hairline);
  display: flex;
  align-items: center;
  justify-content: space-around;
  z-index: 1000;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: #8E8E93;
  padding: 4px 10px;
  min-width: 62px;
  transition: transform 0.12s ease, color 0.15s ease;
}

.nav-item:active {
  transform: scale(0.88);
}

.nav-icon-wrap {
  font-size: 1.25rem;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-item span {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.nav-item.active {
  color: var(--ios-blue);
}

.nav-item.active .nav-icon-wrap {
  filter: drop-shadow(0 2px 6px rgba(0, 122, 255, 0.3));
}

.nav-item--sos.active {
  color: var(--ios-red);
}

.nav-item--flood.active {
  color: var(--ios-orange);
}

.nav-item--knowledge.active {
  color: #DB2777;
}

/* ============================================================================
   iOS PWA Installation Banner
   ============================================================================ */
.ios-install-banner {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 432px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: var(--ios-blur);
  -webkit-backdrop-filter: var(--ios-blur);
  border: 0.5px solid rgba(0, 0, 0, 0.12);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  animation: iosSheetUp 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes iosSheetUp {
  from { transform: translate(-50%, 20px); opacity: 0; }
  to   { transform: translate(-50%, 0); opacity: 1; }
}

.ios-install-left {
  display: flex;
  align-items: center;
  gap: 11px;
}

.ios-install-icon {
  width: 44px;
  height: 44px;
  border-radius: 0;
  box-shadow: none;
  border: none;
  background: transparent !important;
  object-fit: contain;
  padding: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.ios-install-title {
  font-size: 0.88rem;
  font-weight: 750;
  color: #000;
  line-height: 1.2;
}

.ios-install-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.ios-install-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ios-install-btn {
  background: var(--ios-blue);
  color: #fff;
  border: 0;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 122, 255, 0.3);
  transition: transform 0.12s;
}

.ios-install-btn:active {
  transform: scale(0.95);
}

.ios-install-close {
  background: transparent;
  border: 0;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

/* ============================================================================
   Leaflet Map Elements & Overlays (iOS Native Feel)
   ============================================================================ */
#safeMap {
  width: 100%;
  height: calc(100vh - 160px);
  min-height: 400px;
  border-radius: var(--radius-lg);
  border: 0.5px solid var(--ios-hairline);
  box-shadow: var(--shadow-sm);
}

.safe-map-wrap {
  position: relative;
  width: 100%;
  height: calc(100vh - 138px);
  min-height: 480px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 0.5px solid var(--ios-hairline);
}

.leaflet-container, .leaflet-popup-content, .leaflet-tooltip, .leaflet-control {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Noto Sans Thai", "Sukhumvit Set", sans-serif !important;
}

.leaflet-marker-icon.fh-pin-wrap {
  background: none;
  border: 0;
  transition: transform .15s ease;
}
.leaflet-marker-icon.fh-pin-wrap:hover {
  transform: scale(1.16);
}

.fh-pin {
  position: relative;
  width: 100%;
  height: 100%;
  transform-origin: 50% 100%;
}

.fh-pin .fh-pin__ring { z-index: 1; }
.fh-pin .fh-pin__svg  { z-index: 2; }
.fh-pin .fh-pin__ico  { z-index: 3; }

.fh-pin__svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 3px 5px rgba(6, 26, 40, .28));
}

.fh-pin__ico {
  position: absolute;
  left: 50%;
  top: 37%;
  transform: translate(-50%, -50%);
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .3);
}

.fh-pin__ring {
  position: absolute;
  left: 50%;
  top: 37%;
  width: 30%;
  height: 23%;
  transform: translate(-50%, -50%);
  border: 2px solid currentColor;
  border-radius: 50%;
  pointer-events: none;
  animation: fhRing 1.9s ease-out infinite;
}
@keyframes fhRing {
  0%   { width: 32%; height: 24%; opacity: .95; }
  100% { width: 165%; height: 126%; opacity: 0; }
}

.fh-pin--critical {
  transform-origin: 50% 100%;
  animation: fhHop 1.45s cubic-bezier(.36, .07, .19, .97) infinite;
}
@keyframes fhHop {
  0%   { transform: translateY(0) scale(1, 1); }
  10%  { transform: translateY(-2px) scale(.96, 1.05); }
  32%  { transform: translateY(-10px) scale(1.02, .97); }
  50%  { transform: translateY(-12px) scale(1, 1); }
  68%  { transform: translateY(-5px) scale(1.01, .99); }
  84%  { transform: translateY(2px) scale(1.09, .9); }
  93%  { transform: translateY(0) scale(.97, 1.03); }
  100% { transform: translateY(0) scale(1, 1); }
}

.fh-pin--critical::before {
  content: '';
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 58%;
  height: 26%;
  transform: translateX(-50%) scale(.35);
  border-radius: 50%;
  pointer-events: none;
  border: 2px solid rgba(255, 59, 48, .9);
  animation: fhRipple 1.45s ease-out infinite;
}
@keyframes fhRipple {
  0%   { transform: translateX(-50%) scale(.35); opacity: .9; }
  70%  { transform: translateX(-50%) scale(1); opacity: .16; }
  100% { transform: translateX(-50%) scale(1.3); opacity: 0; }
}

.fh-pin--critical .fh-pin__svg {
  animation: fhGlow 1.45s ease-in-out infinite;
}
@keyframes fhGlow {
  0%, 100% { filter: drop-shadow(0 6px 9px rgba(255, 59, 48, .55)) drop-shadow(0 0 2px rgba(255, 90, 90, .4)); }
  50%      { filter: drop-shadow(0 9px 16px rgba(255, 59, 48, .85)) drop-shadow(0 0 14px rgba(255, 96, 96, .8)); }
}
.fh-pin--critical .fh-pin__svg path { stroke-width: 3; }
.fh-pin--critical .fh-pin__ring { animation-duration: 1.45s; }

.fh-pin--urgent {
  transform-origin: 50% 100%;
  animation: fhBreath 2.6s ease-in-out infinite;
}
@keyframes fhBreath {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}
.fh-pin--urgent .fh-pin__svg {
  filter: drop-shadow(0 6px 10px rgba(255, 149, 0, .48));
}

.fh-ov-panel {
  position: absolute;
  z-index: 800;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: var(--ios-blur);
  -webkit-backdrop-filter: var(--ios-blur);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.12);
}

.fh-ov-kpi {
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 6px;
}

.fh-mini-card {
  flex: 1;
  padding: 5px 6px;
  border-radius: 9px;
  text-align: center;
  background: #F2F2F7;
  border: 0.5px solid rgba(0, 0, 0, 0.04);
  cursor: pointer;
  transition: transform 0.12s;
}
.fh-mini-card:active { transform: scale(0.96); }
.fh-mini-card__v { display: block; font-size: 1.05rem; font-weight: 800; color: #000; line-height: 1.2; }
.fh-mini-card__l { display: block; font-size: 0.62rem; font-weight: 700; color: var(--text-muted); }
.fh-mini-card--red { background: rgba(255, 59, 48, 0.1); }
.fh-mini-card--red .fh-mini-card__v { color: var(--ios-red); }
.fh-mini-card--orange { background: rgba(255, 149, 0, 0.12); }
.fh-mini-card--orange .fh-mini-card__v { color: var(--ios-orange); }
.fh-mini-card--green { background: rgba(52, 199, 89, 0.12); }
.fh-mini-card--green .fh-mini-card__v { color: var(--ios-green); }

.fh-ov-actions {
  bottom: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 800;
}

.fh-chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: var(--ios-blur);
  -webkit-backdrop-filter: var(--ios-blur);
  border-radius: var(--radius-sm);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  font-size: 0.76rem;
  font-weight: 750;
  color: var(--text-primary);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  transition: all 0.15s;
}
.fh-chip-btn.active, .fh-chip-btn:hover {
  background: var(--ios-blue);
  color: #fff;
  border-color: transparent;
}

.fh-pin-pop {
  min-width: 230px;
  max-width: 300px;
  font-size: 0.82rem;
  padding: 4px 2px;
}
.fh-pin-pop h4 {
  margin: 0 0 6px;
  font-size: 0.92rem;
  font-weight: 800;
  color: #000;
}
.fh-pin-pop__row {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin: 3px 0;
  border-bottom: 0.5px solid var(--ios-hairline);
  padding-bottom: 2px;
}
.fh-pin-pop__k {
  color: var(--text-muted);
  font-weight: 700;
  font-size: 0.74rem;
}
.fh-pin-pop__v {
  color: #000;
  font-weight: 700;
  text-align: right;
  font-size: 0.78rem;
}
.fh-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 8px 12px;
  margin-top: 8px;
  border-radius: var(--radius-sm);
  background: var(--ios-blue-gradient);
  color: #fff !important;
  font-weight: 750;
  font-size: 0.78rem;
  text-decoration: none !important;
  box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
}

/* ============================================================================
   Mobile App Map Features: Support Points, iOS Filter Pills, Drawer & Modal
   ============================================================================ */

/* Full Viewport App Map Layout (Responsive ทุกขนาดหน้าจอ) */
.app-map-container {
  position: relative;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  flex: 1 1 auto;
  height: calc(100vh - 118px - env(safe-area-inset-bottom, 0px));
  height: calc(100dvh - 118px - env(safe-area-inset-bottom, 0px));
  min-height: 380px;
  overflow: hidden;
  background: #E5E5EA;
  box-shadow: 0 0 35px rgba(0, 0, 0, 0.08);
}

@media (max-width: 480px) {
  .app-map-container {
    max-width: 100%;
    margin: 0;
    box-shadow: none;
  }
}

body:has(.app-map-container) {
  padding-bottom: calc(60px + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}

#appMapFull {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* ป้องกันปุ่มซูม (+ / -) ทับแถบหัวข้อและแถบตัวกรองด้านบน */
.app-map-container .leaflet-top.leaflet-right {
  top: 90px;
  right: 2px;
}
.app-map-container .leaflet-control-zoom {
  border: 0 !important;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12) !important;
  border-radius: 14px !important;
  overflow: hidden;
}
.app-map-container .leaflet-control-zoom a {
  width: 38px !important;
  height: 38px !important;
  line-height: 38px !important;
  background: rgba(255, 255, 255, 0.92) !important;
  color: #1C1C1E !important;
  font-weight: 700 !important;
}

/* Pro Status Header Bar (Floating Glass Card at Top) */
.map-status-header {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  z-index: 860;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.map-status-header > * {
  pointer-events: auto;
}

.map-kpi-badge-group {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.7);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.1);
  font-size: 0.72rem;
  font-weight: 700;
  color: #1C1C1E;
}
.map-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34C759;
  box-shadow: 0 0 0 0 rgba(52, 199, 89, 0.7);
  animation: beaconPulse 1.6s infinite;
}

/* Floating iOS Horizontal Filter Bar */
.map-filter-bar {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  z-index: 850;
  padding: 4px 12px 6px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  pointer-events: auto;
}
.map-filter-bar::-webkit-scrollbar { display: none; }

.map-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
  font-size: 0.72rem;
  font-weight: 700;
  color: #3C3C43;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.2, 0.9, 0.3, 1);
  user-select: none;
}

.map-filter-pill:active { transform: scale(0.94); }

.map-filter-pill.active {
  background: var(--ios-blue);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.38);
}
.map-filter-pill.active i { color: #fff !important; }

.map-filter-pill.active.shelter   { background: #30B0C7; border-color: #30B0C7; box-shadow: 0 4px 14px rgba(48, 176, 199, 0.4); }
.map-filter-pill.active.food      { background: #AF52DE; border-color: #AF52DE; box-shadow: 0 4px 14px rgba(175, 82, 222, 0.4); }
.map-filter-pill.active.volunteer { background: #5856D6; border-color: #5856D6; box-shadow: 0 4px 14px rgba(88, 86, 214, 0.4); }
.map-filter-pill.active.icp       { background: #FF2D55; border-color: #FF2D55; box-shadow: 0 4px 14px rgba(255, 45, 85, 0.4); }
.map-filter-pill.active.sos       { background: #FF3B30; border-color: #FF3B30; box-shadow: 0 4px 14px rgba(255, 59, 48, 0.4); }
.map-filter-pill.active.roads     { background: #FF9500; border-color: #FF9500; box-shadow: 0 4px 14px rgba(255, 149, 0, 0.4); }
.map-filter-pill.active.water     { background: #007AFF; border-color: #007AFF; box-shadow: 0 4px 14px rgba(0, 122, 255, 0.4); }
.map-filter-pill.active.cctv      { background: #32ADE6; border-color: #32ADE6; box-shadow: 0 4px 14px rgba(50, 173, 230, 0.4); }

.map-filter-pill .pill-count {
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 6px;
  border-radius: 99px;
  font-size: 0.66rem;
  font-weight: 700;
}
.map-filter-pill.active .pill-count {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

/* Floating Action Button (FAB) "+ แจ้งจุดสนับสนุน" */
.map-fab-add {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: linear-gradient(135deg, #0A84FF 0%, #007AFF 100%);
  color: #fff;
  border: 0.5px solid rgba(255, 255, 255, 0.4);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 750;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.map-fab-add:active {
  transform: scale(0.94);
  box-shadow: 0 2px 6px rgba(0, 122, 255, 0.25);
}

/* Floating Map Tools (Locate, Satellite, List View) */
.map-quick-tools {
  position: absolute;
  right: 12px;
  bottom: 120px;
  z-index: 850;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.map-tool-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border: 0.5px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
  display: grid;
  place-items: center;
  color: #1C1C1E;
  font-size: 1.05rem;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.map-tool-btn:active { transform: scale(0.9); }
.map-tool-btn.active {
  background: var(--ios-blue);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 122, 255, 0.35);
}
.map-tool-btn.active i { color: #fff !important; }

/* Interactive Map Search & Summary Bar inside Bottom Sheet */
.map-search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F2F2F7;
  border-radius: 12px;
  padding: 6px 12px;
  margin: 6px 14px 2px;
}
.map-search-box i {
  color: #8E8E93;
  font-size: 0.82rem;
}
.map-search-input {
  border: 0;
  background: transparent;
  width: 100%;
  font-size: 0.78rem;
  outline: none;
  font-family: inherit;
  color: #000;
}
.map-search-input::placeholder {
  color: #8E8E93;
}

/* Bottom Sheet Drawer (Mobile App Style) */
.map-bottom-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(25px) saturate(190%);
  -webkit-backdrop-filter: blur(25px) saturate(190%);
  border-top-left-radius: 28px;
  border-top-right-radius: 28px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.12);
  transition: transform 0.28s cubic-bezier(0.2, 0.9, 0.3, 1);
  transform: translateY(calc(100% - 88px));
  max-height: 75vh;
  display: flex;
  flex-direction: column;
}

.map-bottom-sheet.expanded {
  transform: translateY(0);
}

.map-sheet-handle-wrap {
  width: 100%;
  padding: 8px 0 2px;
  display: flex;
  justify-content: center;
  cursor: pointer;
}

.map-sheet-handle {
  width: 36px;
  height: 4.5px;
  background: #C7C7CC;
  border-radius: 99px;
  transition: background 0.15s ease;
}
.map-bottom-sheet.expanded .map-sheet-handle {
  background: #8E8E93;
}

.map-sheet-header {
  padding: 4px 16px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.map-sheet-title {
  font-size: 0.92rem;
  font-weight: 800;
  color: #000;
  display: flex;
  align-items: center;
  gap: 6px;
}

.map-sheet-subtitle {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.map-sheet-toggle-btn {
  background: #E5E5EA;
  border: 0;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #3C3C43;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.map-sheet-list {
  padding: 8px 14px 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Card item inside bottom sheet */
.support-item-card {
  background: rgba(255, 255, 255, 0.95);
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 10px 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: transform 0.12s, box-shadow 0.12s;
  cursor: pointer;
}

.support-item-card:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.support-item-card:active {
  transform: scale(0.985);
  background: #F9F9FB;
}

/* Leaflet Cluster Overrides for iOS Style */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(0, 122, 255, 0.2) !important;
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: #007AFF !important;
  color: #fff !important;
  font-weight: 800 !important;
  font-size: 13px !important;
  font-family: inherit !important;
  box-shadow: 0 3px 8px rgba(0, 122, 255, 0.4) !important;
}

/* Custom Pro Leaflet Popup Styling */
.leaflet-popup-content-wrapper {
  border-radius: 20px !important;
  padding: 4px !important;
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18) !important;
  border: 0.5px solid rgba(0, 0, 0, 0.08) !important;
}
.leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}
.leaflet-popup-close-button {
  top: 10px !important;
  right: 10px !important;
  font-size: 18px !important;
  color: #8E8E93 !important;
}

.support-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.support-item-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 750;
  color: #fff;
  flex-shrink: 0;
}

.support-item-badge.shelter   { background: #0891B2; }
.support-item-badge.food      { background: #7C3AED; }
.support-item-badge.volunteer { background: #1D4ED8; }
.support-item-badge.icp       { background: #C2255C; }
.support-item-badge.help      { background: #FF3B30; }
.support-item-badge.flood     { background: #FF9500; }

.support-item-title {
  font-size: 0.88rem;
  font-weight: 750;
  color: #000;
  line-height: 1.25;
}

.support-item-location {
  font-size: 0.74rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.support-item-desc {
  font-size: 0.74rem;
  color: #48484A;
  background: #F2F2F7;
  padding: 5px 8px;
  border-radius: 8px;
  line-height: 1.35;
}

.support-item-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.support-act-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.74rem;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  border: 0;
}

.support-act-btn.call {
  background: rgba(52, 199, 89, 0.12);
  color: #248A3D;
}
.support-act-btn.call:active { background: rgba(52, 199, 89, 0.22); }

.support-act-btn.nav {
  background: rgba(0, 122, 255, 0.1);
  color: var(--ios-blue);
}
.support-act-btn.nav:active { background: rgba(0, 122, 255, 0.2); }

/* iOS Modal Sheet for "+ แจ้งจุดสนับสนุน" */
.ios-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 1200;
  display: none;
  align-items: flex-end;
  justify-content: center;
  animation: iosFadeIn 0.2s ease;
}

.ios-modal-overlay.active {
  display: flex;
}

.ios-modal-card {
  width: 100%;
  max-width: 460px;
  background: #FFFFFF;
  border-top-left-radius: 26px;
  border-top-right-radius: 26px;
  padding: 16px 18px calc(24px + env(safe-area-inset-bottom, 0px));
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.25);
  max-height: 85vh;
  overflow-y: auto;
  animation: iosModalUp 0.25s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes iosModalUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@keyframes iosFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.ios-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 0.5px solid var(--ios-hairline);
}

.ios-modal-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: #000;
}

.ios-modal-close {
  background: #E5E5EA;
  border: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #8E8E93;
  display: grid;
  place-items: center;
  font-size: 1rem;
  cursor: pointer;
}

/* Segmented Control for Kind Picker */
.ios-segmented-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}

.ios-segmented-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #F2F2F7;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.78rem;
  font-weight: 700;
  color: #3C3C43;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ios-segmented-btn.active {
  background: #000;
  color: #fff;
  border-color: #000;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}
.ios-segmented-btn.active.shelter { background: #0891B2; border-color: #0891B2; }
.ios-segmented-btn.active.food    { background: #7C3AED; border-color: #7C3AED; }
.ios-segmented-btn.active.volunteer { background: #1D4ED8; border-color: #1D4ED8; }
.ios-segmented-btn.active.icp    { background: #C2255C; border-color: #C2255C; }

/* Custom Native Map Pins (Shelter, Food, Volunteer, ICP) */
.support-pin {
  position: relative;
  width: 36px;
  height: 44px;
  filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.28));
  cursor: pointer;
  transition: transform 0.15s;
}
.support-pin:hover { transform: scale(1.15); }

.support-pin-body {
  width: 36px;
  height: 36px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #FFFFFF;
}

.support-pin-icon {
  transform: rotate(45deg);
  color: #FFFFFF;
  font-size: 15px;
}

.support-pin.shelter .support-pin-body   { background: #0891B2; }
.support-pin.food .support-pin-body      { background: #7C3AED; }
.support-pin.volunteer .support-pin-body { background: #1D4ED8; }
.support-pin.icp .support-pin-body       { background: #C2255C; }

/* ============================================================================
   iOS System Color Corrections — ปรับสีเดิมทั้งหมดให้เป็นสีระบบ iOS
   (systemTeal / systemPurple / systemIndigo / systemPink / systemGray)
   ============================================================================ */
.support-item-badge.shelter,
.ios-segmented-btn.active.shelter,
.support-pin.shelter .support-pin-body { background: #30B0C7; border-color: #30B0C7; }

.support-item-badge.food,
.ios-segmented-btn.active.food,
.support-pin.food .support-pin-body { background: #AF52DE; border-color: #AF52DE; }

.support-item-badge.volunteer,
.ios-segmented-btn.active.volunteer,
.support-pin.volunteer .support-pin-body { background: #5856D6; border-color: #5856D6; }

.support-item-badge.icp,
.ios-segmented-btn.active.icp,
.support-pin.icp .support-pin-body { background: #FF2D55; border-color: #FF2D55; }

/* ปุ่มตัวกรองบนแผนที่: ใช้สีน้ำเงินระบบ iOS แทนดำ */
.map-filter-pill.active {
  background: var(--ios-blue);
  color: #fff;
  border-color: var(--ios-blue);
  box-shadow: 0 4px 12px rgba(0, 122, 255, 0.32);
}

/* ============================================================================
   Thai Typography — ไม่บีบระยะตัวอักษรในข้อความภาษาไทย
   (SF Thai / Noto Sans Thai วางสระ-วรรณยุกต์ด้วยระยะปกติของฟอนต์)
   ============================================================================ */
body,
.brand-title,
.brand-subtitle,
.emergency-title,
.emergency-desc,
.stat-capsule-label,
.stat-capsule-val,
.action-btn span,
.action-btn small,
.ios-cell-title,
.ios-cell-sub,
.ios-group-title,
.nav-item span,
.fh-mini-card__l {
  letter-spacing: normal;
}

/* หัวข้อภาษาอังกฤษให้คงการบีบระยะแบบ iOS */
.ios-large-title {
  letter-spacing: -0.022em;
  font-weight: 700;
}

/* iOS ใช้ตัวหนาระดับ 600–700 (ไม่หนาเกินไป) */
.brand-title,
.emergency-title,
.ios-cell-title,
.action-btn span {
  font-weight: 700;
}

/* ข้อความภาษาไทยอื่น ๆ ไม่ต้องเพิ่ม/ลดระยะตัวอักษร */
.ios-eyebrow,
.emergency-status-pill,
.ios-group-title,
.ios-install-title,
.ios-install-sub,
.ios-badge-tag,
.stat-capsule-label,
.nav-item span,
.fh-mini-card__l {
  letter-spacing: normal;
}

/* หัวข้อทุกระดับให้ความหนาแบบ iOS (Semibold) */
h1, h2, h3, h4 {
  font-weight: 700;
  letter-spacing: normal;
}

/* ============================================================================
   Header & Bottom Nav Centering for Mobile App Layout
   ============================================================================ */
.app-header {
  width: 100% !important;
  max-width: 460px !important;
  margin: 0 auto !important;
  box-sizing: border-box !important;
}

.bottom-nav {
  width: 100% !important;
  max-width: 460px !important;
  left: 50% !important;
  right: auto !important;
  transform: translateX(-50%) !important;
  border-radius: 20px 20px 0 0;
  border-left: 1px solid var(--ios-hairline);
  border-right: 1px solid var(--ios-hairline);
  box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.08);
}

/* ============================================================================
   Admin (หลังบ้านเจ้าหน้าที่) — iOS style
   ============================================================================ */
.admin-login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: radial-gradient(circle at 50% 0%, #E8F2FF 0%, #F2F2F7 55%);
}
.admin-login-wrap { width: 100%; max-width: 380px; }
.admin-login-card {
  background: #fff;
  border-radius: 22px;
  padding: 26px 20px 20px;
  box-shadow: 0 18px 40px -12px rgba(0, 0, 0, 0.16);
  text-align: center;
}
.admin-login-icon {
  width: 58px; height: 58px; margin: 0 auto 12px;
  border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #0A84FF, #007AFF 55%, #0040DD);
  color: #fff; font-size: 1.5rem;
  box-shadow: 0 8px 18px rgba(0, 122, 255, 0.35);
}
.admin-login-card h1 { font-size: 1.15rem; margin-bottom: 4px; }
.admin-login-card > p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 18px; }
.admin-login-card form { text-align: left; }
.admin-login-back {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 16px; font-size: 0.82rem; font-weight: 600;
  color: var(--ios-blue); text-decoration: none;
}

.admin-alert {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; border-radius: 12px;
  font-size: 0.82rem; font-weight: 600;
  margin-bottom: 12px;
}
.admin-alert.ok  { background: rgba(52, 199, 89, 0.14); color: #248A3D; }
.admin-alert.err { background: rgba(255, 59, 48, 0.12); color: #D70015; }

.admin-container { padding-top: 8px; }
.admin-head-actions { display: flex; gap: 8px; }
.admin-icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: #fff; color: var(--ios-red);
  border: 0.5px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  text-decoration: none; font-size: 0.95rem;
}
.admin-user {
  font-size: 0.76rem; color: var(--text-muted);
  margin: -4px 0 12px 4px;
}

.admin-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-bottom: 14px;
}
.admin-stat {
  background: #fff; border-radius: 14px;
  padding: 10px 6px; text-align: center;
  text-decoration: none; color: var(--text-primary);
  border: 0.5px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease;
}
.admin-stat:active { transform: scale(0.96); }
.admin-stat .v { display: block; font-size: 1.15rem; font-weight: 700; line-height: 1.2; }
.admin-stat .l { display: block; font-size: 0.64rem; font-weight: 600; color: var(--text-muted); }
.admin-stat.orange .v { color: #FF9500; }
.admin-stat.blue   .v { color: #007AFF; }
.admin-stat.green  .v { color: #34C759; }
.admin-stat.active { background: rgba(0, 122, 255, 0.08); border-color: rgba(0, 122, 255, 0.4); }

.admin-filter {
  background: #fff; border-radius: 16px; padding: 12px;
  border: 0.5px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}
.admin-search {
  display: flex; align-items: center; gap: 8px;
  background: #F2F2F7; border-radius: 10px;
  padding: 9px 12px; margin-bottom: 10px;
  color: var(--text-muted);
}
.admin-search input {
  border: 0; background: transparent; outline: none;
  font-size: 0.85rem; width: 100%; color: var(--text-primary);
}
.admin-filter-row {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 10px;
}
.admin-filter-row .form-control { font-size: 0.78rem; padding: 9px 10px; }
.admin-filter-actions { display: flex; gap: 10px; align-items: center; }
.admin-filter-actions .btn-primary { flex: 1; padding: 11px 14px; font-size: 0.85rem; }
.admin-reset {
  font-size: 0.75rem; font-weight: 600; color: var(--text-muted);
  text-decoration: none; white-space: nowrap;
}

.admin-count {
  font-size: 0.78rem; color: var(--text-muted);
  margin: 0 4px 10px; display: flex; justify-content: space-between; gap: 8px;
}
.admin-critical { color: #FF3B30; font-weight: 700; }

.admin-empty {
  text-align: center; padding: 36px 16px;
  background: #fff; border-radius: 18px;
  border: 0.5px solid var(--card-border);
}
.admin-empty i { font-size: 1.8rem; color: #C7C7CC; margin-bottom: 8px; }
.admin-empty h3 { font-size: 0.92rem; color: var(--text-muted); }
.admin-empty p { font-size: 0.75rem; color: #AEAEB2; margin-top: 4px; }

.admin-card {
  background: #fff; border-radius: 18px;
  padding: 13px 14px; margin-bottom: 12px;
  border: 0.5px solid var(--card-border);
  box-shadow: var(--shadow-sm);
}
.admin-card-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 8px;
}
.admin-card-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.admin-urg {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--uc); flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}
.admin-type {
  font-size: 0.68rem; font-weight: 700; padding: 3px 8px;
  border-radius: 999px; white-space: nowrap;
}
.admin-type.sos   { background: rgba(255, 59, 48, 0.12); color: #D70015; }
.admin-type.flood { background: rgba(255, 149, 0, 0.14); color: #C96F00; }
.admin-id { font-size: 0.68rem; color: var(--text-muted); font-weight: 600; }
.admin-status {
  font-size: 0.68rem; font-weight: 700; padding: 4px 9px;
  border-radius: 999px; white-space: nowrap;
  color: var(--sc);
  background: rgba(142, 142, 147, 0.12);
}
.admin-card-meta {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 0.74rem; color: var(--text-secondary);
  margin-bottom: 6px;
}
.admin-card-meta a { color: var(--ios-blue); text-decoration: none; font-weight: 600; }
.admin-urg-label { font-weight: 700; }
.admin-card-row {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 0.78rem; color: var(--text-primary); margin-bottom: 5px;
}
.admin-maplink {
  margin-left: auto; font-size: 0.7rem; font-weight: 700;
  color: var(--ios-blue); text-decoration: none;
  background: rgba(0, 122, 255, 0.1); padding: 3px 8px; border-radius: 999px;
}
.admin-card-detail {
  font-size: 0.8rem; color: #3C3C43; background: #F7F7FA;
  border-radius: 12px; padding: 8px 10px; margin: 6px 0;
}
.admin-card-note {
  font-size: 0.76rem; color: #248A3D;
  background: rgba(52, 199, 89, 0.12);
  border-radius: 12px; padding: 7px 10px; margin: 6px 0;
}
.admin-card-foot {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 0.7rem; color: var(--text-muted); margin-top: 6px;
}

.admin-manage { margin-top: 10px; border-top: 0.5px solid var(--ios-hairline); padding-top: 8px; }
.admin-manage > summary {
  list-style: none; cursor: pointer;
  font-size: 0.8rem; font-weight: 700; color: var(--ios-blue);
  display: flex; align-items: center; gap: 6px;
}
.admin-manage > summary::-webkit-details-marker { display: none; }
.admin-manage-form { margin-top: 10px; }
.admin-manage-form .form-group { margin-bottom: 10px; }
.admin-manage-form .form-control { font-size: 0.82rem; }
.admin-btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.admin-btn {
  display: inline-flex; align-items: center; gap: 6px;
  border: 0; border-radius: 12px; padding: 9px 13px;
  font-size: 0.78rem; font-weight: 700; cursor: pointer;
  background: #EFEFF4; color: var(--text-primary);
  transition: transform 0.12s ease, opacity 0.12s ease;
}
.admin-btn:active { transform: scale(0.96); opacity: 0.9; }
.admin-btn.blue  { background: #007AFF; color: #fff; }
.admin-btn.green { background: #34C759; color: #fff; }
.admin-btn.red   { background: rgba(255, 59, 48, 0.12); color: #D70015; }
.admin-btn.gray  { background: #E5E5EA; color: #3C3C43; }
.admin-btn.ghost { background: #fff; color: #007AFF; border: 0.5px solid rgba(0, 122, 255, 0.35); }

/* ซ่อนป้ายชื่ออำเภอของชั้นระบายสี (ซ้ำกับหมุด/ชื่อบนแผนที่) */
.fh-area-lb-wrap { display: none !important; }

/* ลิงก์เข้าใช้งานสำหรับเจ้าหน้าที่ (ท้ายหน้าแรก) */
.home-staff-link {
  text-align: center;
  margin: 18px 0 6px;
}
.home-staff-link a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(142, 142, 147, 0.1);
}
.home-staff-link a:active { opacity: 0.7; }

/* ============================================================================
   แจ้งเส้นทางน้ำท่วม (roads.php) — iOS style
   ============================================================================ */
.roads-container { padding-bottom: 96px; }

.road-intro {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin: -2px 4px 12px;
}

.road-map-link {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 0.74rem; font-weight: 700;
  color: var(--ios-blue); text-decoration: none;
  background: rgba(0, 122, 255, 0.1);
  padding: 6px 11px; border-radius: 999px;
}

.road-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 14px;
}
.road-stat {
  position: relative;
  border: 0.5px solid var(--card-border);
  background: #fff;
  border-radius: 14px;
  padding: 9px 6px;
  text-align: center;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, background 0.12s ease;
}
.road-stat:active { transform: scale(0.96); }
.road-stat .v { display: block; font-size: 1.05rem; font-weight: 700; line-height: 1.2; color: var(--text-primary); }
.road-stat .l { display: block; font-size: 0.6rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.road-stat .dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  margin-bottom: 2px;
}
.road-stat.active {
  background: rgba(0, 122, 255, 0.08);
  border-color: rgba(0, 122, 255, 0.45);
}

.road-list-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 0.76rem; color: var(--text-muted);
  margin: 0 4px 8px;
}
.road-updated { font-size: 0.68rem; }

.road-card {
  background: #fff;
  border-radius: 18px;
  padding: 13px 14px;
  margin-bottom: 11px;
  border: 0.5px solid var(--card-border);
  box-shadow: var(--shadow-sm);
}
.road-card-top {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 7px;
}
.road-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.68rem; font-weight: 700;
  color: var(--rt);
  background: rgba(142, 142, 147, 0.12);
  border-left: 3px solid var(--rc);
  padding: 4px 9px 4px 7px;
  border-radius: 8px;
}
.road-verified {
  font-size: 0.64rem; font-weight: 700; color: #248A3D;
  display: inline-flex; align-items: center; gap: 4px;
}
.road-verified.pending { color: #C96F00; }

.road-name {
  font-size: 0.95rem; font-weight: 700; color: #000;
  line-height: 1.35; margin-bottom: 3px;
}
.road-span {
  font-size: 0.76rem; color: var(--text-secondary);
  display: flex; align-items: flex-start; gap: 6px; margin-bottom: 5px;
}
.road-meta {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 0.72rem; color: var(--text-muted);
  margin-top: 4px;
}
.road-detour {
  font-size: 0.76rem; color: #0056D2;
  background: rgba(0, 122, 255, 0.09);
  border-radius: 10px; padding: 6px 9px; margin-top: 7px;
}
.road-note {
  font-size: 0.76rem; color: #3C3C43;
  background: #F7F7FA; border-radius: 10px;
  padding: 6px 9px; margin-top: 6px;
}
.road-photo {
  width: 100%; border-radius: 12px; margin-top: 8px;
  max-height: 220px; object-fit: cover;
}
.road-actions { display: flex; gap: 8px; margin-top: 9px; }
.road-btn {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 11px;
  padding: 9px 10px;
  font-size: 0.76rem; font-weight: 700; font-family: inherit;
  background: rgba(0, 122, 255, 0.1); color: var(--ios-blue);
  cursor: pointer; text-decoration: none;
}
.road-btn.ghost { background: #EFEFF4; color: #3C3C43; }
.road-btn:active { opacity: 0.75; }

.road-empty {
  text-align: center; padding: 34px 18px;
  background: #fff; border-radius: 18px;
  border: 0.5px solid var(--card-border);
}
.road-empty i { font-size: 1.7rem; color: #C7C7CC; margin-bottom: 8px; }
.road-empty h3 { font-size: 0.9rem; color: var(--text-muted); }
.road-empty p { font-size: 0.74rem; color: #AEAEB2; margin-top: 4px; }

.road-skeleton {
  height: 118px; border-radius: 18px; margin-bottom: 11px;
  background: linear-gradient(90deg, #EFEFF4 25%, #F7F7FA 50%, #EFEFF4 75%);
  background-size: 200% 100%;
  animation: roadShimmer 1.2s infinite linear;
}
@keyframes roadShimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

.road-fab {
  position: fixed;
  right: max(16px, calc(50% - 214px));
  bottom: calc(78px + env(safe-area-inset-bottom, 0px));
  z-index: 900;
  display: inline-flex; align-items: center; gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  background: var(--ios-blue-gradient);
  color: #fff; font-size: 0.86rem; font-weight: 700; font-family: inherit;
  box-shadow: 0 10px 24px -6px rgba(0, 122, 255, 0.55);
  cursor: pointer;
  transition: transform 0.12s ease;
}
@media (max-width: 480px) {
  .road-fab { right: 16px; }
}
.road-fab:active { transform: scale(0.95); }

/* ฟอร์มแจ้งเส้นทาง */
.road-modal-card { max-height: 90vh; }
.road-status-grid { display: grid; gap: 6px; }
.form-group .road-status-opt,
.road-status-opt {
  display: flex; flex-direction: row; align-items: center; gap: 10px;
  border: 1.5px solid #E5E5EA;
  border-radius: 12px;
  padding: 7px 10px;
  cursor: pointer;
  background: #fff;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.road-status-opt input { position: absolute; opacity: 0; pointer-events: none; }
.road-status-opt .ic {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center;
  background: rgba(142, 142, 147, 0.12);
  color: var(--rc); font-size: 0.85rem; flex-shrink: 0;
}
.road-status-opt .tx { display: flex; flex-direction: column; min-width: 0; }
.road-status-opt .tx b { font-size: 0.82rem; font-weight: 700; color: var(--text-primary); }
.road-status-opt .tx small { font-size: 0.68rem; color: var(--text-muted); line-height: 1.3; }
.road-status-opt:has(input:checked) {
  border-color: var(--rc);
  background: rgba(142, 142, 147, 0.06);
}
.road-status-opt:has(input:checked) .ic {
  background: var(--rc);
  color: #fff;
}

.road-hint { font-weight: 500; color: var(--text-muted); font-size: 0.7rem; }
.road-pick-map {
  width: 100%; height: 220px;
  border-radius: 14px;
  border: 0.5px solid var(--card-border);
  overflow: hidden;
  background: #E5E5EA;
}
.road-pick-tools { display: flex; gap: 8px; margin-top: 8px; }
.road-chip-btn {
  flex: 1;
  border: 0; border-radius: 10px;
  padding: 9px 10px;
  background: #EFEFF4; color: #3C3C43;
  font-size: 0.74rem; font-weight: 700; font-family: inherit;
  cursor: pointer;
}
.road-chip-btn:active { opacity: 0.7; }
.road-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.road-file {
  width: 100%; font-size: 0.76rem; color: var(--text-muted);
  padding: 10px; border: 1px dashed #C7C7CC; border-radius: 12px;
  background: #FAFAFD;
}
.road-form-msg { font-size: 0.78rem; font-weight: 600; margin: 4px 0 8px; min-height: 0; }
.road-form-msg.err { color: #D70015; }
.road-form-note {
  font-size: 0.68rem; color: var(--text-muted);
  text-align: center; margin-top: 8px;
}

.road-view-map {
  width: 100%; height: 46vh; min-height: 240px;
  border-radius: 14px; overflow: hidden;
  background: #E5E5EA; margin-bottom: 10px;
}
.road-view-body { font-size: 0.82rem; }

.road-toast {
  position: fixed;
  left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 16px);
  opacity: 0;
  z-index: 1400;
  background: rgba(28, 28, 30, 0.94);
  color: #fff;
  font-size: 0.8rem; font-weight: 600;
  padding: 11px 16px;
  border-radius: 999px;
  display: inline-flex; align-items: center; gap: 7px;
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  transition: opacity 0.25s ease, transform 0.25s ease;
  max-width: 88vw;
}
.road-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* แถบแท็บ 6 ช่อง */
.bottom-nav.six .nav-item {
  min-width: 0; flex: 1;
  padding: 4px 1px;
}
.bottom-nav.six .nav-item span {
  font-size: clamp(0.48rem, 1.85vw, 0.58rem);
  white-space: nowrap;
  letter-spacing: -0.02em;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}
.bottom-nav.six .nav-icon-wrap { font-size: 1.15rem; }

/* ป้ายชื่อเส้นทางบนแผนที่ (แสดงตลอดเวลา) */
.road-map-label {
  background: rgba(255, 255, 255, 0.95);
  border: 0.5px solid rgba(60, 60, 67, 0.18);
  border-radius: 999px;
  padding: 2px 7px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #1C1C1E;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.16);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.road-map-label::before,
.leaflet-tooltip.road-map-label::before { display: none; }
.road-map-label-dot {
  width: 6px; height: 6px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}

/* แท็บหลังบ้าน */
.admin-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
}
.admin-tab {
  flex: 1;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 10px;
  border-radius: 12px;
  background: #fff;
  border: 0.5px solid var(--card-border);
  font-size: 0.78rem; font-weight: 700;
  color: var(--text-muted); text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.admin-tab.active {
  background: rgba(0, 122, 255, 0.1);
  border-color: rgba(0, 122, 255, 0.4);
  color: var(--ios-blue);
}

/* ============================================================================
   1. Emergency Alert Flash Banner (iOS Style)
   ============================================================================ */
.ios-flash-banner {
  position: relative;
  border-radius: 18px;
  padding: 13px 15px;
  margin-bottom: 16px;
  overflow: hidden;
  box-shadow: 0 8px 24px -4px rgba(255, 59, 48, 0.28), 0 2px 6px rgba(0, 0, 0, 0.04);
  border: 0.5px solid rgba(255, 255, 255, 0.35);
  animation: bannerSlideDown 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes bannerSlideDown {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.ios-flash-banner.danger {
  background: linear-gradient(135deg, #FF3B30 0%, #D70015 65%, #990000 100%);
  color: #FFFFFF;
}

.ios-flash-banner.warning {
  background: linear-gradient(135deg, #FF9500 0%, #D97706 70%, #92400E 100%);
  color: #FFFFFF;
}

.flash-banner-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.flash-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  border: 0.5px solid rgba(255, 255, 255, 0.3);
}

.flash-beacon-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 0 0 rgba(255, 255, 255, 0.8);
  animation: beaconPulse 1.4s infinite;
}

@keyframes beaconPulse {
  0%   { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.8); }
  70%  { box-shadow: 0 0 0 7px rgba(255, 255, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.flash-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: 0;
  color: #fff;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
  transition: opacity 0.15s;
}
.flash-close-btn:active { opacity: 0.7; }

.flash-title {
  font-size: 0.94rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 4px;
  line-height: 1.25;
}

.flash-desc {
  font-size: 0.76rem;
  opacity: 0.95;
  line-height: 1.4;
  margin-bottom: 8px;
}

.flash-action-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #FFFFFF;
  color: #D70015;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.12s;
}
.flash-action-link:active { transform: scale(0.96); }

/* ============================================================================
   2. Medical Vulnerability Triage (คัดกรองกลุ่มเสี่ยงวิกฤต)
   ============================================================================ */
.triage-section {
  background: #FFF5F5;
  border: 1px solid #FECACA;
  border-radius: 18px;
  padding: 14px 13px;
  margin-bottom: 16px;
}

.triage-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.triage-section-title {
  font-size: 0.86rem;
  font-weight: 800;
  color: #B91C1C;
  display: flex;
  align-items: center;
  gap: 6px;
}

.triage-badge-pill {
  background: #DC2626;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
}

.triage-card {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #FFFFFF;
  border: 1px solid rgba(220, 38, 38, 0.18);
  border-radius: 13px;
  padding: 10px 12px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.triage-card:active {
  background: #FEF2F2;
}

.triage-card.selected {
  background: #FEF2F2;
  border-color: #DC2626;
  box-shadow: 0 2px 8px rgba(220, 38, 38, 0.15);
}

.triage-checkbox {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  accent-color: #DC2626;
  margin-top: 2px;
  cursor: pointer;
}

.triage-icon-box {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 0.95rem;
  color: #fff;
  flex-shrink: 0;
}
.triage-icon-box.electric  { background: linear-gradient(135deg, #EF4444, #B91C1C); }
.triage-icon-box.dialysis  { background: linear-gradient(135deg, #F59E0B, #D97706); }
.triage-icon-box.pregnant  { background: linear-gradient(135deg, #EC4899, #BE185D); }
.triage-icon-box.bedridden { background: linear-gradient(135deg, #8B5CF6, #6D28D9); }

.triage-info-title {
  font-size: 0.82rem;
  font-weight: 750;
  color: #1E293B;
  line-height: 1.25;
}

.triage-info-desc {
  font-size: 0.69rem;
  color: #64748B;
  margin-top: 1px;
  line-height: 1.3;
}

/* ============================================================================
   3. First Aid & Disease Guide Modal (iOS Sheet)
   ============================================================================ */
.guide-card-tile {
  background: #FFFFFF;
  border: 0.5px solid rgba(60, 60, 67, 0.12);
  border-radius: 16px;
  padding: 13px 15px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: all 0.15s ease;
}
.guide-card-tile:active {
  background: #F2F2F7;
  transform: scale(0.985);
}

.guide-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 11px;
  background: linear-gradient(135deg, #007AFF 0%, #0051D5 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.2rem;
  box-shadow: 0 4px 10px rgba(0, 122, 255, 0.3);
  flex-shrink: 0;
}

.guide-item-card {
  background: #FFFFFF;
  border: 0.5px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  padding: 14px 15px;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.03);
}

.guide-item-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.guide-item-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.guide-item-badge.foot       { background: #FF9500; }
.guide-item-badge.lepto      { background: #FF3B30; }
.guide-item-badge.snake      { background: #5856D6; }
.guide-item-badge.electric   { background: #FFCC00; color: #000; }

.guide-item-name {
  font-size: 0.94rem;
  font-weight: 800;
  color: #000;
}

.guide-item-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.guide-rule-box {
  background: #F2F2F7;
  border-radius: 10px;
  padding: 8px 11px;
  font-size: 0.76rem;
  line-height: 1.45;
  color: #3C3C43;
}

.guide-rule-box b {
  color: #000;
}

.guide-warning-callout {
  background: #FFF1F0;
  border-left: 3px solid #FF3B30;
  padding: 7px 10px;
  border-radius: 0 8px 8px 0;
  margin-top: 6px;
  font-size: 0.72rem;
  color: #B91C1C;
  line-height: 1.35;
}

/* ============================================================================
   ศูนย์พักพิง (shelters.php) — iOS style
   ============================================================================ */
.shelter-container { padding-bottom: 96px; }

.shelter-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin-bottom: 14px;
}
.shelter-sum-item {
  background: #fff;
  border: 0.5px solid var(--card-border);
  border-radius: 14px;
  padding: 9px 4px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.shelter-sum-item .v { display: block; font-size: 1rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.shelter-sum-item .l { display: block; font-size: 0.58rem; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.shelter-sum-item.ok .v { color: #248A3D; }

.shelter-card {
  background: #fff;
  border-radius: 18px;
  padding: 13px 14px;
  margin-bottom: 11px;
  border: 0.5px solid var(--card-border);
  box-shadow: var(--shadow-sm);
}
.shelter-card-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 6px;
}
.shelter-name {
  font-size: 0.92rem; font-weight: 700; color: #000;
  display: flex; align-items: flex-start; gap: 7px; line-height: 1.35;
}
.shelter-name i { color: #30B0C7; margin-top: 2px; }
.shelter-badge {
  font-size: 0.66rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.shelter-badge.green { background: rgba(52, 199, 89, 0.14); color: #248A3D; }
.shelter-badge.red   { background: rgba(255, 59, 48, 0.12); color: #D70015; }
.shelter-badge.gray  { background: rgba(142, 142, 147, 0.14); color: #6C6C70; }

.shelter-loc {
  font-size: 0.74rem; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
}
.shelter-bar {
  height: 8px; border-radius: 999px; background: #EFEFF4; overflow: hidden;
  margin-bottom: 5px;
}
.shelter-bar span { display: block; height: 100%; border-radius: 999px; transition: width 0.3s ease; }
.shelter-nums {
  display: flex; justify-content: space-between;
  font-size: 0.7rem; color: var(--text-muted); margin-bottom: 9px;
}
.shelter-actions { display: flex; gap: 8px; }

.shelter-foot-note {
  text-align: center; font-size: 0.7rem; color: var(--text-muted);
  margin: 14px 8px 6px;
}

/* Modal */
.shelter-cap-box { margin-bottom: 12px; }
.shelter-cap-line {
  font-size: 1.25rem; font-weight: 700; color: var(--text-primary);
  background: #F2F2F7; border-radius: 14px; padding: 10px 14px;
}
.shelter-cap-sub { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); margin-top: 2px; }

.shelter-stays-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.8rem; font-weight: 700; color: var(--text-primary);
  margin-bottom: 8px;
}
.shelter-stays-count {
  background: rgba(0, 122, 255, 0.12); color: #007AFF;
  font-size: 0.7rem; padding: 2px 9px; border-radius: 999px;
}
.shelter-stay-list { max-height: 210px; overflow-y: auto; margin-bottom: 12px; }
.shelter-stay-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border-radius: 12px; background: #F7F7FA;
  margin-bottom: 6px;
}
.shelter-stay-main { font-size: 0.82rem; color: var(--text-primary); min-width: 0; }
.shelter-stay-main b { font-weight: 700; }
.shelter-stay-main small { color: var(--text-muted); font-size: 0.72rem; }
.shelter-stay-sub { font-size: 0.7rem; color: var(--text-muted); margin-top: 2px; }
.shelter-out-btn {
  border: 0; border-radius: 9px; padding: 6px 12px;
  background: rgba(255, 59, 48, 0.12); color: #D70015;
  font-size: 0.72rem; font-weight: 700; font-family: inherit; cursor: pointer;
}
.shelter-stay-empty {
  text-align: center; font-size: 0.76rem; color: var(--text-muted);
  padding: 14px; background: #F7F7FA; border-radius: 12px; margin-bottom: 12px;
}

.shelter-checkin {
  border-top: 0.5px solid var(--ios-hairline);
  padding-top: 12px;
}
.shelter-checkin-title {
  font-size: 0.86rem; font-weight: 700; color: var(--text-primary);
  margin-bottom: 10px;
}
.shelter-capacity-form {
  margin-top: 14px; padding-top: 12px;
  border-top: 0.5px solid var(--ios-hairline);
}
.shelter-capacity-form label { font-size: 0.74rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 6px; }
.shelter-capacity-row { display: flex; gap: 8px; align-items: center; }
.shelter-capacity-row .form-control { flex: 1; }

.road-form-msg.ok { color: #248A3D; }

/* ============================================================================
   App Library / Home quick grid (iOS style)
   ============================================================================ */
.home-apps-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 2px 4px 10px;
}
.home-apps-all {
  font-size: 0.74rem; font-weight: 700;
  color: var(--ios-blue); text-decoration: none;
  display: inline-flex; align-items: center; gap: 4px;
}
.home-app-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px 6px;
  background: #fff;
  border-radius: 18px;
  padding: 14px 8px;
  border: 0.5px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  margin-bottom: 6px;
}
.home-app {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-decoration: none; color: var(--text-primary);
  padding: 2px 0;
  transition: transform 0.12s ease;
}
.home-app:active { transform: scale(0.93); }
.home-app-ic, .app-tile-ic {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: grid; place-items: center;
  color: #fff; font-size: 1.25rem;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
  border: 0.5px solid rgba(255, 255, 255, 0.25);
}
.home-app-ic.blue,   .app-tile-ic.blue   { background: linear-gradient(160deg, #0A84FF, #007AFF 55%, #0040DD); }
.home-app-ic.green,  .app-tile-ic.green  { background: linear-gradient(160deg, #30D158, #34C759 55%, #248A3D); }
.home-app-ic.red,    .app-tile-ic.red    { background: linear-gradient(160deg, #FF453A, #FF3B30 55%, #D70015); }
.home-app-ic.orange, .app-tile-ic.orange { background: linear-gradient(160deg, #FF9F0A, #FF9500 55%, #C96F00); }
.home-app-ic.amber,  .app-tile-ic.amber  { background: linear-gradient(160deg, #FFD60A, #FFC300 55%, #B58900); }
.home-app-ic.teal,   .app-tile-ic.teal   { background: linear-gradient(160deg, #40C8E0, #30B0C7 55%, #1E7F92); }
.home-app-ic.cyan,   .app-tile-ic.cyan   { background: linear-gradient(160deg, #64D2FF, #32ADE6 55%, #0A84C7); }
.home-app-ic.gray,   .app-tile-ic.gray   { background: linear-gradient(160deg, #AEAEB2, #8E8E93 55%, #636366); }
.home-app-ic.purple, .app-tile-ic.purple { background: linear-gradient(160deg, #BF5AF2, #AF52DE 55%, #7A3AA8); }
.home-app-lbl {
  font-size: 0.62rem; font-weight: 600; line-height: 1.15;
  text-align: center; color: var(--text-primary);
  max-width: 74px; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}

/* หน้า apps.php */
.apps-container { padding-bottom: 92px; }
.app-section-title {
  font-size: 0.78rem; font-weight: 700; color: var(--text-muted);
  margin: 16px 6px 8px;
}
.app-library {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px 6px;
  background: #fff;
  border-radius: 20px;
  padding: 16px 8px;
  border: 0.5px solid var(--card-border);
  box-shadow: var(--shadow-sm);
}
.app-tile {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  text-decoration: none; color: var(--text-primary);
  transition: transform 0.12s ease;
}
.app-tile:active { transform: scale(0.93); }
.app-tile-ic { width: 58px; height: 58px; border-radius: 16px; font-size: 1.4rem; }
.app-tile-lbl {
  font-size: 0.64rem; font-weight: 600; line-height: 1.2;
  text-align: center; max-width: 78px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.apps-foot {
  text-align: center; font-size: 0.68rem; color: #AEAEB2;
  margin: 20px 8px 6px;
}

/* ============================================================================
   Loading states — "กำลังโหลด / กำลัง…" แบบ iOS
   ============================================================================ */

/* หน้าจอขาว + วงกลมหมุน ระหว่างรอหน้าใหม่ (ทาก่อน paint ด้วย html.ns-booting) */
html.ns-booting::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1490;
  background: #F2F2F7;
}
html.ns-booting::after {
  content: '';
  position: fixed;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  z-index: 1491;
  border-radius: 50%;
  background: conic-gradient(from 0deg,
      rgba(0, 122, 255, 0) 0deg,
      rgba(0, 122, 255, 0.18) 120deg,
      rgba(0, 122, 255, 0.8) 300deg,
      #007AFF 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 3px));
  animation: nsSpin 0.85s linear infinite;
}

.ns-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(242, 242, 247, 0.72);
  -webkit-backdrop-filter: blur(6px) saturate(140%);
  backdrop-filter: blur(6px) saturate(140%);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
  pointer-events: none;
}
.ns-loading-overlay.show {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.ns-loading-card {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  padding: 13px 20px 13px 16px;
  background: rgba(255, 255, 255, 0.96);
  border: 0.5px solid rgba(60, 60, 67, 0.12);
  border-radius: 999px;
  box-shadow: 0 12px 32px -8px rgba(0, 0, 0, 0.22), 0 2px 8px rgba(0, 0, 0, 0.06);
  transform: scale(0.96);
  transition: transform 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.ns-loading-overlay.show .ns-loading-card { transform: scale(1); }

.ns-loading-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: #1C1C1E;
  white-space: nowrap;
}

/* วงกลมหมุนแบบ iOS (ใช้ conic-gradient + mask) */
.ns-spinner,
.ns-btn-spin {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
  background: conic-gradient(from 0deg,
      rgba(0, 122, 255, 0) 0deg,
      rgba(0, 122, 255, 0.18) 120deg,
      rgba(0, 122, 255, 0.75) 300deg,
      #007AFF 360deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 2.6px), #000 calc(100% - 2.6px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 2.6px), #000 calc(100% - 2.6px));
  animation: nsSpin 0.85s linear infinite;
}
.ns-btn-spin {
  width: 15px;
  height: 15px;
  margin-right: 7px;
  vertical-align: -2px;
  background: conic-gradient(from 0deg, rgba(255, 255, 255, 0) 0deg, rgba(255, 255, 255, 0.35) 150deg, #fff 360deg);
}
@keyframes nsSpin { to { transform: rotate(360deg); } }

/* แถบความคืบหน้าด้านบน (ตอนเปลี่ยนหน้า) */
.ns-topbar {
  position: fixed;
  top: 0;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  width: 100%;
  max-width: 460px;
  height: 3px;
  z-index: 1600;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: linear-gradient(90deg, #0A84FF, #5AC8FA, #34C759, #0A84FF);
  background-size: 220% 100%;
  animation: nsBar 1.1s linear infinite;
  box-shadow: 0 1px 6px rgba(0, 122, 255, 0.35);
  pointer-events: none;
}
.ns-topbar.show { opacity: 1; }
@keyframes nsBar {
  from { background-position: 0% 0; }
  to   { background-position: 220% 0; }
}

/* ปุ่มที่กำลังทำงาน */
.ns-btn-busy {
  opacity: 0.85;
  cursor: progress !important;
}

/* Skeleton shimmer (ใช้ร่วมกับ .road-skeleton เดิม) */
.shelter-skeleton,
.list-skeleton {
  height: 118px;
  border-radius: 18px;
  margin-bottom: 11px;
  background: linear-gradient(90deg, #EFEFF4 25%, #F7F7FA 50%, #EFEFF4 75%);
  background-size: 200% 100%;
  animation: roadShimmer 1.2s infinite linear;
}

@media (prefers-reduced-motion: reduce) {
  .ns-spinner, .ns-btn-spin, .ns-topbar { animation-duration: 2s; }
}

/* ============================================================================
   Popup รายละเอียดเหตุการณ์บนแผนที่ — iOS card
   ============================================================================ */
.leaflet-popup-content-wrapper {
  border-radius: 18px;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, 0.28), 0 2px 8px rgba(0, 0, 0, 0.08);
  padding: 0;
}
.leaflet-popup-content { margin: 12px 13px; width: auto !important; }
.leaflet-popup-tip { box-shadow: none; }
.leaflet-container a.leaflet-popup-close-button {
  top: 6px; right: 6px;
  width: 26px; height: 26px;
  font-size: 18px; line-height: 24px;
  color: #8E8E93;
  border-radius: 50%;
}
.leaflet-container a.leaflet-popup-close-button:hover {
  background: rgba(142, 142, 147, 0.14);
  color: #1C1C1E;
}

.pop-card {
  width: 258px;
  max-width: 76vw;
  font-size: 0.8rem;
}
.pop-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; margin-bottom: 8px; padding-right: 14px;
}
.pop-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.68rem; font-weight: 700;
  padding: 4px 9px; border-radius: 999px; white-space: nowrap;
}
.pop-badge.sos   { background: rgba(255, 59, 48, 0.12); color: #D70015; }
.pop-badge.flood { background: rgba(255, 149, 0, 0.14); color: #C96F00; }
.pop-urg {
  font-size: 0.64rem; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; white-space: nowrap;
}
.pop-urg.critical { background: #FF3B30; color: #fff; }
.pop-urg.urgent   { background: #FF9500; color: #fff; }
.pop-urg.normal   { background: rgba(52, 199, 89, 0.16); color: #248A3D; }

.pop-title {
  font-size: 0.9rem; font-weight: 700; color: #000;
  line-height: 1.35; margin-bottom: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pop-loc {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 0.73rem; color: var(--text-muted);
  line-height: 1.35; margin-bottom: 10px;
}
.pop-loc i { color: #FF3B30; margin-top: 2px; }

.pop-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
  gap: 5px;
  margin-bottom: 10px;
}
.pop-metric {
  background: #F2F2F7;
  border-radius: 12px;
  padding: 7px 3px;
  text-align: center;
}
.pop-metric b {
  display: block; font-size: 1.02rem; font-weight: 700;
  color: #1C1C1E; line-height: 1.15;
}
.pop-metric span {
  display: block; font-size: 0.56rem; font-weight: 600;
  color: #8E8E93; line-height: 1.2; margin-top: 1px;
}
.pop-metric.warn b   { color: #C96F00; }
.pop-metric.danger b { color: #D70015; }

.pop-empty {
  font-size: 0.7rem; color: #AEAEB2;
  background: #F7F7FA; border-radius: 10px;
  padding: 7px 9px; margin-bottom: 10px;
}

.pop-label {
  font-size: 0.64rem; font-weight: 700; color: #8E8E93;
  margin-bottom: 5px;
}
.pop-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 9px; }
.pop-chip {
  font-size: 0.64rem; font-weight: 600;
  color: #0056D2; background: rgba(0, 122, 255, 0.1);
  padding: 3px 8px; border-radius: 999px;
}

.pop-row {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.73rem; color: #3C3C43; margin-bottom: 8px;
}
.pop-row i { color: #007AFF; }

.pop-meta {
  display: flex; justify-content: space-between; align-items: center;
  gap: 8px; font-size: 0.64rem; color: #8E8E93;
  margin-bottom: 9px;
}
.pop-status {
  font-weight: 700; padding: 2px 8px; border-radius: 999px;
  background: rgba(142, 142, 147, 0.14); white-space: nowrap;
}
.pop-status.pending     { color: #C96F00; }
.pop-status.in_progress { color: #007AFF; }
.pop-status.done        { color: #248A3D; }
.pop-status.cancel      { color: #6C6C70; }

.pop-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 9px 10px;
  border-radius: 12px;
  background: linear-gradient(160deg, #0A84FF, #007AFF 55%, #0040DD);
  color: #fff !important;
  font-size: 0.75rem; font-weight: 700;
  text-decoration: none !important;
  box-shadow: 0 6px 16px -4px rgba(0, 122, 255, 0.45);
}
.pop-btn:active { opacity: 0.85; }

/* --- ป๊อปอัปแบบ "รายละเอียด" (ข้อความตามแบบฟอร์มราชการ) --- */
.pop-detail {
  width: 272px;
  max-width: 78vw;
  max-height: 62vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}
.pop-detail::-webkit-scrollbar { width: 4px; }
.pop-detail::-webkit-scrollbar-thumb { background: rgba(142, 142, 147, 0.4); border-radius: 4px; }

.pop-code {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.66rem; color: #8E8E93;
  margin: -2px 0 9px;
}

.pop-sec { margin-bottom: 9px; }
.pop-sec-tight { margin-bottom: 4px; }
.pop-sec-label {
  font-size: 0.73rem; font-weight: 700; color: #1C1C1E;
  margin-bottom: 4px;
}
.pop-list {
  margin: 0; padding-left: 17px;
  font-size: 0.74rem; color: #3C3C43; line-height: 1.5;
}
.pop-list li { margin-bottom: 1px; }
.pop-text {
  font-size: 0.74rem; color: #3C3C43; line-height: 1.5;
}
.pop-sub { color: #8E8E93; }
.pop-muted { font-size: 0.72rem; color: #AEAEB2; }

.pop-kv {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 10px;
  font-size: 0.73rem;
  padding: 4px 0;
  border-bottom: 0.5px solid rgba(60, 60, 67, 0.08);
}
.pop-kv:last-of-type { border-bottom: 0; }
.pop-kv > span { color: #6C6C70; flex-shrink: 0; }
.pop-kv > b {
  font-weight: 700; color: #1C1C1E;
  text-align: right; word-break: break-word;
}
.pop-kv > b.red { color: #D70015; }
.pop-kv > b.status-pending     { color: #C96F00; }
.pop-kv > b.status-in_progress { color: #007AFF; }
.pop-kv > b.status-done        { color: #248A3D; }
.pop-kv > b.status-cancel      { color: #6C6C70; }

/* แถวตัวเลขสรุปในบัตรรายการ (bottom sheet) */
.support-item-metrics {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 0.72rem; font-weight: 700; color: #3C3C43;
  background: #F7F7FA; border-radius: 9px;
  padding: 4px 9px; margin: 2px 0 7px;
}
.support-item-metrics i { color: #8E8E93; font-size: 0.7rem; margin-right: 2px; }
.support-item-metrics .dot { color: #C7C7CC; }

/* ============================================================================
   CCTV Online (cctv.php) — iOS style
   ============================================================================ */
.cctv-container { padding-bottom: 96px; }

.cctv-stats {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 12px;
}
.cctv-stat {
  background: #fff;
  border: 0.5px solid var(--card-border);
  border-radius: 14px;
  padding: 10px 8px;
  text-align: center;
  box-shadow: var(--shadow-sm);
}
.cctv-stat .v { display: block; font-size: 1.15rem; font-weight: 700; color: #1C1C1E; line-height: 1.2; }
.cctv-stat .l { display: block; font-size: 0.62rem; font-weight: 600; color: var(--text-muted); }
.cctv-stat.ok .v { color: #248A3D; }
.cctv-refresh {
  width: 52px;
  border: 0; border-radius: 14px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--ios-blue);
  font-size: 1rem; cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.cctv-refresh:active { transform: scale(0.95); }

.cctv-search {
  display: flex; align-items: center; gap: 8px;
  background: #fff;
  border: 0.5px solid var(--card-border);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 10px;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}
.cctv-search input {
  border: 0; background: transparent; outline: none;
  font-size: 0.85rem; width: 100%; color: var(--text-primary);
}

.cctv-chips {
  display: flex; gap: 7px; overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
}
.cctv-chips::-webkit-scrollbar { display: none; }
.cctv-chip {
  flex: 0 0 auto;
  border: 0.5px solid var(--card-border);
  background: #fff;
  color: var(--text-primary);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.74rem; font-weight: 600; font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}
.cctv-chip span { color: var(--text-muted); font-size: 0.68rem; }
.cctv-chip.active {
  background: var(--ios-blue);
  border-color: var(--ios-blue);
  color: #fff;
}
.cctv-chip.active span { color: rgba(255, 255, 255, 0.85); }

.cctv-list-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 0.75rem; color: var(--text-muted);
  margin: 0 4px 8px;
}
.cctv-only-online {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.72rem; font-weight: 600;
  color: var(--text-primary);
  background: #fff;
  border: 0.5px solid var(--card-border);
  border-radius: 999px;
  padding: 5px 10px;
}
.cctv-only-online input { width: 14px; height: 14px; accent-color: #007AFF; }

.cctv-card {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  background: #fff;
  border: 0.5px solid var(--card-border);
  border-radius: 16px;
  padding: 11px 12px;
  margin-bottom: 9px;
  box-shadow: var(--shadow-sm);
}
.cctv-card.off { opacity: 0.72; }
.cctv-card-main { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cctv-cam-icon {
  width: 40px; height: 40px; border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(160deg, #AEAEB2, #8E8E93 60%, #636366);
  color: #fff; font-size: 1rem; flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.14);
}
.cctv-cam-icon.on {
  background: linear-gradient(160deg, #30D158, #34C759 55%, #248A3D);
}
.cctv-card-text { min-width: 0; }
.cctv-name {
  font-size: 0.84rem; font-weight: 700; color: #000;
  line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 190px;
}
.cctv-meta {
  display: flex; align-items: center; gap: 5px;
  font-size: 0.68rem; color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cctv-dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block; flex-shrink: 0;
}
.cctv-dot.on { background: #34C759; box-shadow: 0 0 0 3px rgba(52, 199, 89, 0.16); }
.cctv-dot.off { background: #C7C7CC; }
.cctv-state { font-weight: 600; }
.cctv-watch {
  flex-shrink: 0;
  border: 0; border-radius: 11px;
  background: rgba(0, 122, 255, 0.1);
  color: var(--ios-blue);
  font-size: 0.74rem; font-weight: 700; font-family: inherit;
  padding: 9px 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.cctv-watch:disabled { background: #EFEFF4; color: #AEAEB2; cursor: not-allowed; }
.cctv-watch:active:not(:disabled) { opacity: 0.75; }

.cctv-foot {
  text-align: center; font-size: 0.68rem; color: #AEAEB2;
  margin: 12px 8px 4px;
}

/* Modal + player */
.cctv-modal-card { padding-bottom: 14px; }
.cctv-player-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 10px;
}
.cctv-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.cctv-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  background: #000;
  display: block;
}
.cctv-player-error {
  position: absolute; inset: 0; z-index: 3;
  display: none;
  flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px;
  text-align: center;
  background: rgba(0, 0, 0, 0.88);
  color: #fff;
}
.cctv-player-error > i { font-size: 1.4rem; color: #FF453A; }
.cctv-err-msg { font-size: 0.78rem; font-weight: 700; line-height: 1.45; }
.cctv-err-actions { display: flex; gap: 8px; margin-top: 2px; flex-wrap: wrap; justify-content: center; }
.cctv-err-btn {
  border: 0; border-radius: 10px;
  background: #fff; color: #000;
  font-family: inherit; font-size: 0.72rem; font-weight: 700;
  padding: 8px 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  text-decoration: none;
}
.cctv-err-btn.ghost { background: rgba(255, 255, 255, 0.18); color: #fff; }
.cctv-err-hint {
  font-size: 0.64rem; color: rgba(255, 255, 255, 0.6);
  line-height: 1.5; max-width: 280px;
}
.cctv-player-loading {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  background: #111;
  color: #fff; font-size: 0.78rem; font-weight: 600;
}
.cctv-modal-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.cctv-badge {
  font-size: 0.7rem; font-weight: 700;
  background: rgba(0, 122, 255, 0.1); color: #0056D2;
  padding: 4px 10px; border-radius: 999px;
}
.cctv-status { font-size: 0.7rem; font-weight: 700; }
.cctv-status.on { color: #248A3D; }
.cctv-status.off { color: #8E8E93; }
.cctv-modal-actions { display: flex; gap: 8px; }

/* pin บนแผนที่ */
.cctv-pin {
  width: 26px; height: 26px; border-radius: 9px;
  background: linear-gradient(160deg, #5AC8FA, #0A84C1);
  display: grid; place-items: center;
  color: #fff; font-size: 11px;
  border: 2px solid #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
}

/* ============================================================================
   คู่มือติดตั้งลงหน้าจอโฮม (iOS / Android)
   ============================================================================ */
.ios-install-sheet-card { padding-bottom: 16px; }
.ios-install-lead {
  font-size: 0.78rem; color: var(--text-muted);
  margin: 0 0 10px; line-height: 1.5;
}
.ios-step-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.ios-step {
  display: flex; gap: 10px;
  background: #F7F7FA;
  border-radius: 12px;
  padding: 10px 11px;
}
.ios-step > .ios-step-num {
  width: 22px; height: 22px; min-width: 22px;
  line-height: 22px; text-align: center;
  border-radius: 50%;
  background: var(--ios-blue); color: #fff;
  font-size: 0.72rem; font-weight: 700;
  display: block; flex-shrink: 0;
}
.ios-step b { display: block; font-size: 0.8rem; color: #000; margin-bottom: 2px; line-height: 1.4; }
.ios-step > div > span { display: block; font-size: 0.72rem; color: var(--text-muted); line-height: 1.45; }
.ios-install-tip {
  font-size: 0.72rem; color: #5B5B60;
  background: rgba(0, 122, 255, 0.07);
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 10px;
  line-height: 1.45;
}


/* ============================================================================
   NAKHON SAVE — Smart Health Theme Integration (Medical Neo-Glass)
   ============================================================================ */

/* 1. Standalone Top Scenic Header Banner (แบบ NakhonSi Smart Health) */
.moph-scenic-card {
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(160deg, #E0F2FE 0%, #BAE6FD 100%);
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 16px 36px -8px rgba(14, 116, 144, 0.2), 0 4px 14px rgba(0, 0, 0, 0.04);
  margin-bottom: 16px;
  display: block;
}
.moph-scenic-card .moph-scenic-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.moph-scenic-card:hover .moph-scenic-img {
  transform: scale(1.025);
}

/* 2. Clean Hero Status Card (Medical Neo-Glass Style) */
.hero-card-clean {
  background: linear-gradient(145deg, #FFFFFF 0%, #F0F9FF 45%, #E0F2FE 100%);
  border-radius: 26px;
  padding: 22px 20px 20px;
  position: relative;
  overflow: hidden;
  border: 1.5px solid rgba(186, 230, 253, 0.7);
  box-shadow: 0 16px 36px -8px rgba(14, 116, 144, 0.12), 0 2px 8px rgba(0, 0, 0, 0.03);
  margin-bottom: 18px;
}
.hero-card-clean::before {
  content: '';
  position: absolute;
  top: -45px;
  right: -35px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.18) 0%, transparent 70%);
  pointer-events: none;
}
.hero-card-clean::after {
  content: '';
  position: absolute;
  bottom: -35px;
  left: -25px;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(16, 185, 129, 0.14) 0%, transparent 70%);
  pointer-events: none;
}
.hero-clean-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ECFDF5;
  border: 1px solid #A7F3D0;
  padding: 5px 13px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
  color: #065F46;
  margin-bottom: 10px;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.08);
}
.hero-clean-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 8px #10B981;
  animation: heroDotPulse 1.8s infinite ease-in-out;
}
@keyframes heroDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.65; }
}
.hero-clean-heading {
  font-size: 1.35rem;
  font-weight: 900;
  line-height: 1.3;
  color: #0F172A;
  margin-bottom: 5px;
}
.hero-clean-desc {
  font-size: 0.84rem;
  color: #475569;
  line-height: 1.45;
  margin-bottom: 16px;
}

/* 3. Hero Clean Stats Grid */
.hero-clean-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.stat-pill-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(186, 230, 253, 0.7);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.stat-pill-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(14, 116, 144, 0.1);
}
.stat-pill-top {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #64748B;
}
.stat-pill-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  font-size: 0.72rem;
  color: #fff;
}
.stat-pill-icon.blue { background: linear-gradient(135deg, #0284C7, #0369A1); }
.stat-pill-icon.green { background: linear-gradient(135deg, #10B981, #059669); }
.stat-pill-value {
  font-size: 1.38rem;
  font-weight: 900;
  color: #0F172A;
  line-height: 1.2;
}
.stat-pill-value small {
  font-size: 0.76rem;
  font-weight: 600;
  color: #64748B;
  margin-left: 2px;
}

/* 4. Action SOS Buttons (Smart Health High-Gloss Styling) */
.action-grid-modern {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
.action-card-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 14px 18px;
  border-radius: 24px;
  color: #fff;
  text-decoration: none;
  text-align: center;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 30px -6px rgba(0, 0, 0, 0.18), inset 0 1.5px 2px rgba(255, 255, 255, 0.45);
  transition: transform 0.16s cubic-bezier(0.2, 0.9, 0.3, 1), box-shadow 0.16s ease;
  overflow: hidden;
  cursor: pointer;
}
.action-card-btn:active {
  transform: scale(0.96);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.15);
}
.action-card-btn.sos {
  background: linear-gradient(145deg, #FF453A 0%, #EF4444 55%, #DC2626 100%);
  box-shadow: 0 14px 32px -6px rgba(239, 68, 68, 0.45), inset 0 1.5px 2px rgba(255, 255, 255, 0.5);
}
.action-card-btn.flood {
  background: linear-gradient(145deg, #F59E0B 0%, #EA580C 55%, #C2410C 100%);
  box-shadow: 0 14px 32px -6px rgba(234, 88, 12, 0.45), inset 0 1.5px 2px rgba(255, 255, 255, 0.5);
}
.action-card-btn .action-tag {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.action-card-btn .action-icon-circle {
  width: 54px;
  height: 54px;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}
.action-card-btn .action-icon-circle i {
  font-size: 1.8rem;
  color: #fff;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}
.action-card-btn .action-title {
  font-size: 0.98rem;
  font-weight: 850;
  line-height: 1.25;
  color: #fff;
  margin-bottom: 4px;
}
.action-card-btn .action-sub {
  font-size: 0.7rem;
  font-weight: 600;
  opacity: 0.92;
  line-height: 1.35;
}

/* 5. Modern Services Grid (สไตล์ Smart Health / Apple App Library) */
.home-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 18px 4px 10px;
}
.home-section-title {
  font-size: 0.96rem;
  font-weight: 850;
  color: #1E293B;
  display: flex;
  align-items: center;
  gap: 8px;
}
.home-section-more {
  font-size: 0.8rem;
  font-weight: 700;
  color: #0284C7;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: opacity 0.15s ease;
}
.home-section-more:hover { opacity: 0.8; }

.services-grid-smart {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px 8px;
  background: #FFFFFF;
  border-radius: 24px;
  padding: 16px 10px 18px;
  border: 1.5px solid rgba(186, 230, 253, 0.6);
  box-shadow: 0 10px 28px -6px rgba(14, 116, 144, 0.08), 0 2px 8px rgba(0, 0, 0, 0.02);
  margin-bottom: 20px;
}
.service-tile-smart {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  gap: 7px;
  padding: 4px 2px;
  transition: transform 0.14s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.service-tile-smart:active {
  transform: scale(0.92);
}
.service-tile-smart:hover {
  transform: translateY(-2px);
}
.service-icon-box {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 1.35rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: box-shadow 0.2s ease;
}
.service-tile-smart:hover .service-icon-box {
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}
.service-icon-box.blue   { background: linear-gradient(160deg, #0A84FF, #007AFF 55%, #0040DD); }
.service-icon-box.amber  { background: linear-gradient(160deg, #F59E0B, #D97706 60%, #B45309); }
.service-icon-box.teal   { background: linear-gradient(160deg, #14B8A6, #0D9488 60%, #0F766E); }
.service-icon-box.cyan   { background: linear-gradient(160deg, #06B6D4, #0284C7 60%, #0369A1); }
.service-icon-box.green  { background: linear-gradient(160deg, #10B981, #059669 60%, #047857); }
.service-icon-box.red    { background: linear-gradient(160deg, #EF4444, #DC2626 60%, #B91C1C); }
.service-icon-box.purple { background: linear-gradient(160deg, #8B5CF6, #7C3AED 60%, #6D28D9); }
.service-icon-box.gray   { background: linear-gradient(160deg, #64748B, #475569 60%, #334155); }

.service-tile-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #1E293B;
  text-align: center;
  line-height: 1.25;
}

/* 6. Emergency Hotline Quick Bar */
.emergency-hotline-strip {
  background: linear-gradient(145deg, #FEF2F2 0%, #FEE2E2 100%);
  border: 1.5px solid #FECACA;
  border-radius: 20px;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
  box-shadow: 0 4px 14px rgba(239, 68, 68, 0.08);
}
.hotline-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.hotline-icon {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: #EF4444;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  box-shadow: 0 3px 8px rgba(239, 68, 68, 0.3);
}
.hotline-meta-title {
  font-size: 0.88rem;
  font-weight: 850;
  color: #991B1B;
}
.hotline-meta-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: #B91C1C;
}
.hotline-btn-call {
  background: #DC2626;
  color: #fff;
  padding: 8px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  transition: transform 0.14s ease;
}
.hotline-btn-call:active {
  transform: scale(0.94);
}

/* ============================================================================
   NAKHON SAVE — Interactive Hero Slider Carousel (สไตล์ Smart Health)
   ============================================================================ */
.hero-slider-section {
  margin-bottom: 22px;
  position: relative;
}

.slider-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}

.slider-section-title {
  font-size: 0.92rem;
  font-weight: 850;
  color: #1E293B;
  display: flex;
  align-items: center;
  gap: 7px;
}

.slider-count-badge {
  font-size: 0.72rem;
  font-weight: 800;
  color: #0284C7;
  background: #E0F2FE;
  border: 1px solid #BAE6FD;
  padding: 2px 9px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.hero-slider-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 2 / 1;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 16px 36px -8px rgba(14, 116, 144, 0.22), 0 3px 10px rgba(0, 0, 0, 0.05);
  border: 1.5px solid rgba(186, 230, 253, 0.75);
  background: linear-gradient(145deg, #0284C7, #0369A1);
  touch-action: pan-y;
}

.hero-slider-track {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  width: 100%;
  height: 100%;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.hero-slide-item {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.hero-slide-card {
  position: relative;
  width: 100%;
  height: 100%;
  display: block;
  overflow: hidden;
  text-decoration: none;
}

.hero-slide-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: transform 0.4s ease;
}

.hero-slide-card:hover .hero-slide-img {
  transform: scale(1.025);
}

/* Floating Navigation Arrows */
.slider-nav-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  color: #0369A1;
  display: grid;
  place-items: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.16s ease;
  font-size: 0.92rem;
}

.slider-nav-btn:hover {
  background: #FFFFFF;
  color: #0284C7;
  transform: translateY(-50%) scale(1.08);
}

.slider-nav-btn:active {
  transform: translateY(-50%) scale(0.92);
}

.slider-nav-btn.prev {
  left: 10px;
}

.slider-nav-btn.next {
  right: 10px;
}

/* Slide Link Floating Badge */
.hero-slide-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 750;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  display: inline-flex;
  align-items: center;
  gap: 5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  transition: all 0.2s ease;
}

.hero-slide-card:hover .hero-slide-badge {
  background: rgba(2, 132, 199, 0.92);
  transform: translateX(-2px);
}

/* Dots Indicators */
.hero-slider-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
}

.hero-slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #CBD5E1;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.hero-slider-dot.active {
  width: 24px;
  border-radius: 999px;
  background: linear-gradient(135deg, #0284C7, #0EA5E9);
  box-shadow: 0 0 10px rgba(14, 165, 233, 0.55);
}

/* ============================================================================
   NAKHON SAVE — ThaiWater App Design Theme (ต้นแบบ app ThaiWater)
   ============================================================================ */

/* 1. ThaiWater Top Segment Tabs */
.tw-tabs-bar {
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 16px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid rgba(186, 230, 253, 0.8);
  box-shadow: 0 4px 16px -2px rgba(2, 132, 199, 0.08);
}
.tw-tab-item {
  flex: 1;
  text-align: center;
  padding: 9px 12px;
  font-size: 0.88rem;
  font-weight: 750;
  color: #64748B;
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
  border-radius: 12px;
}
.tw-tab-item:hover {
  color: #0284C7;
}
.tw-tab-item.active {
  color: #0284C7;
  font-weight: 850;
  background: #FFFFFF;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.12);
}
.tw-tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: #0284C7;
}

/* 2. ThaiWater Sky & Weather Hero Section */
.tw-sky-hero {
  position: relative;
  background: linear-gradient(180deg, #BAE0FE 0%, #D8EEFE 40%, #EFF7FE 85%, #FFFFFF 100%);
  border-radius: 26px;
  padding: 20px 18px 18px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 14px 32px -6px rgba(2, 132, 199, 0.15), 0 2px 8px rgba(0, 0, 0, 0.03);
  margin-bottom: 16px;
}
.tw-sky-backdrop {
  position: absolute;
  top: 0;
  right: 0;
  width: 160px;
  height: 120px;
  pointer-events: none;
  opacity: 0.9;
}
.tw-sky-sun {
  position: absolute;
  top: 14px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: radial-gradient(circle, #FDE047 30%, #F59E0B 100%);
  box-shadow: 0 0 24px rgba(245, 158, 11, 0.55);
}
.tw-sky-cloud {
  position: absolute;
  top: 32px;
  right: 12px;
  width: 70px;
  height: 26px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 999px;
  backdrop-filter: blur(4px);
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.5);
}
.tw-sky-cloud::before {
  content: '';
  position: absolute;
  top: -12px;
  left: 14px;
  width: 28px;
  height: 28px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 50%;
}
.tw-sky-date {
  font-size: 0.84rem;
  font-weight: 700;
  color: #475569;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.tw-sky-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: #0F172A;
  margin-bottom: 14px;
  line-height: 1.25;
}

/* 3. ThaiWater Dual Frosted Glass Cards */
.tw-glass-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.tw-glass-card {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  border-radius: 18px;
  padding: 12px 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 6px 18px -4px rgba(2, 132, 199, 0.1);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tw-glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -4px rgba(2, 132, 199, 0.18);
}
.tw-glass-card-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #1E293B;
  margin-bottom: 2px;
}
.tw-glass-card-sub {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748B;
}
.tw-glass-card-arrow {
  color: #0284C7;
  font-size: 0.82rem;
}

/* 4. ThaiWater Warning Banner (Yellow Pill) */
.tw-warning-card {
  background: linear-gradient(135deg, #FEF9C3 0%, #FEF08A 100%);
  border: 1.5px solid #FDE047;
  border-radius: 18px;
  padding: 11px 15px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-decoration: none;
  margin-bottom: 16px;
  box-shadow: 0 6px 16px -2px rgba(234, 179, 8, 0.16);
  transition: transform 0.15s ease;
}
.tw-warning-card:hover {
  transform: translateY(-1px);
}
.tw-warning-left {
  display: flex;
  align-items: center;
  gap: 9px;
}
.tw-warning-badge {
  background: #EAB308;
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 900;
  padding: 3px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.tw-warning-text {
  font-size: 0.82rem;
  font-weight: 800;
  color: #854D0E;
}
.tw-warning-arrow {
  color: #A16207;
  font-size: 0.82rem;
}

/* 5. ThaiWater Ranked Metric Lists (ฝนสะสม & สถานการณ์น้ำรายอำเภอ) */
.tw-section-wrap {
  margin-bottom: 20px;
}
.tw-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 4px;
}
.tw-section-title-box {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tw-section-icon-round {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  background: #E0F2FE;
  color: #0284C7;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
}
.tw-section-title-text {
  font-size: 0.92rem;
  font-weight: 850;
  color: #0F172A;
  line-height: 1.25;
}
.tw-section-unit {
  font-size: 0.72rem;
  font-weight: 600;
  color: #64748B;
}

.tw-rank-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tw-rank-card {
  background: #FFFFFF;
  border: 1px solid rgba(186, 230, 253, 0.7);
  border-radius: 16px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.05);
  transition: transform 0.14s ease;
}
.tw-rank-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(2, 132, 199, 0.1);
}
.tw-rank-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.tw-rank-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #F1F5F9;
  color: #475569;
  font-size: 0.72rem;
  font-weight: 800;
  display: grid;
  place-items: center;
}
.tw-rank-name {
  font-size: 0.84rem;
  font-weight: 800;
  color: #1E293B;
}
.tw-rank-tag {
  font-size: 0.72rem;
  font-weight: 850;
  padding: 3px 9px;
  border-radius: 8px;
  color: #FFFFFF;
}
.tw-rank-tag.red    { background: #DC2626; }
.tw-rank-tag.orange { background: #EA580C; }
.tw-rank-tag.amber  { background: #D97706; }
.tw-rank-tag.green  { background: #16A34A; }
.tw-rank-tag.blue   { background: #0284C7; }

/* 6. ThaiWater "พื้นที่ของฉัน" (My Area View - Image 3) */
.tw-my-area-card {
  background: linear-gradient(160deg, #FEF3C7 0%, #FFFBEB 45%, #FFFFFF 100%);
  border: 1.5px solid #FDE68A;
  border-radius: 26px;
  padding: 24px 20px 22px;
  box-shadow: 0 14px 32px -6px rgba(245, 158, 11, 0.18), 0 2px 8px rgba(0, 0, 0, 0.03);
  margin-bottom: 18px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.tw-my-area-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.tw-my-area-loc {
  font-size: 1.25rem;
  font-weight: 900;
  color: #78350F;
  margin-bottom: 2px;
}
.tw-my-area-sub {
  font-size: 0.78rem;
  font-weight: 700;
  color: #92400E;
}
.tw-my-area-temp {
  font-size: 2.8rem;
  font-weight: 950;
  color: #1E293B;
  line-height: 1.1;
  margin: 6px 0 12px;
}
.tw-my-area-sun-box {
  width: 90px;
  height: 90px;
  margin: 0 auto 16px;
  position: relative;
  display: grid;
  place-items: center;
}
.tw-sun-rays {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: radial-gradient(circle, #FDE047 30%, #F59E0B 100%);
  box-shadow: 0 0 32px rgba(245, 158, 11, 0.65);
  animation: sunGlowPulse 2.5s infinite alternate ease-in-out;
}
@keyframes sunGlowPulse {
  0% { transform: scale(0.96); filter: drop-shadow(0 0 10px rgba(245, 158, 11, 0.5)); }
  100% { transform: scale(1.04); filter: drop-shadow(0 0 22px rgba(245, 158, 11, 0.8)); }
}
.tw-my-area-alert {
  background: #FEF9C3;
  border: 1px solid #FDE047;
  border-radius: 999px;
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 800;
  color: #854D0E;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
}
.tw-my-area-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  text-align: left;
}
.tw-my-metric-card {
  background: #FFFFFF;
  border: 1px solid #FDE68A;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
}
.tw-my-metric-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 750;
  color: #64748B;
  margin-bottom: 4px;
}
.tw-my-metric-val {
  font-size: 1.4rem;
  font-weight: 900;
  color: #0F172A;
}

/* ThaiWater Bell Button */
.tw-bell-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(186, 230, 253, 0.8);
  color: #0284C7;
  display: grid;
  place-items: center;
  position: relative;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.1);
  transition: transform 0.15s ease;
  text-decoration: none;
}
.tw-bell-btn:active {
  transform: scale(0.92);
}
.tw-bell-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #EF4444;
  border: 1.5px solid #fff;
}

/* ThaiWater Active Nav Pill Accent */
.bottom-nav .nav-item.active .nav-icon-wrap {
  background: linear-gradient(135deg, #0284C7, #0EA5E9) !important;
  color: #ffffff !important;
  border-radius: 14px !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35) !important;
  padding: 3px 12px !important;
  transition: all 0.2s ease !important;
}
.bottom-nav .nav-item.active span {
  color: #0284C7 !important;
  font-weight: 850 !important;
}

/* ============================================================================
   ThaiWater Scenic Background & Ultra-Frosted Transparent Glass Menu
   ============================================================================ */
.tw-sky-hero.has-bg {
  position: relative;
  min-height: 255px;
  background-size: cover;
  background-position: center 32%;
  border-radius: 26px;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 16px 36px -6px rgba(2, 132, 199, 0.25), 0 3px 10px rgba(0, 0, 0, 0.06);
  margin-bottom: 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.tw-hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg, 
    rgba(10, 25, 47, 0.52) 0%, 
    rgba(15, 23, 42, 0.15) 35%, 
    rgba(15, 23, 42, 0.58) 100%
  );
  pointer-events: none;
  z-index: 1;
}

.tw-hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px 16px 16px;
  box-sizing: border-box;
}

.tw-date-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.45);
  padding: 4px 13px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 750;
  color: #FFFFFF;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  margin-bottom: 6px;
}

.tw-sky-hero.has-bg .tw-sky-title {
  font-size: 1.48rem;
  font-weight: 900;
  color: #FFFFFF;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7);
  margin-bottom: 32px;
  line-height: 1.25;
}

/* เมนูการ์ดกระจกโปร่งใส (Ultra Frosted Glass สไตล์ ThaiWater ในภาพตัวอย่าง) */
.tw-glass-card.transparent {
  background: linear-gradient(
    135deg, 
    rgba(255, 255, 255, 0.58) 0%, 
    rgba(255, 255, 255, 0.26) 100%
  ) !important;
  backdrop-filter: blur(24px) saturate(200%) !important;
  -webkit-backdrop-filter: blur(24px) saturate(200%) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.68) !important;
  box-shadow: 
    0 10px 30px rgba(0, 0, 0, 0.2), 
    inset 0 1px 2px rgba(255, 255, 255, 0.8) !important;
  border-radius: 20px !important;
  padding: 13px 15px !important;
  transition: all 0.2s cubic-bezier(0.2, 0.8, 0.2, 1) !important;
}

.tw-glass-card.transparent:hover {
  background: linear-gradient(
    135deg, 
    rgba(255, 255, 255, 0.72) 0%, 
    rgba(255, 255, 255, 0.4) 100%
  ) !important;
  transform: translateY(-3px) scale(1.02) !important;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.25) !important;
}

.tw-glass-card.transparent .tw-glass-card-title {
  color: #FFFFFF !important;
  font-weight: 900 !important;
  font-size: 0.94rem !important;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) !important;
}

.tw-glass-card.transparent .tw-glass-card-sub {
  color: #F8FAFC !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4) !important;
  opacity: 0.95 !important;
}

.tw-glass-card.transparent .tw-glass-card-arrow {
  color: #FFFFFF !important;
  opacity: 0.95 !important;
  font-size: 0.9rem !important;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

/* ============================================================================
   ThaiWater Exact App Replication & Nakhon Si Thammarat Dashboard Theme
   ============================================================================ */

/* 1. Exact ThaiWater Sky Hero (Image 1) */
.tw-sky-hero-exact {
  position: relative;
  background: linear-gradient(180deg, #BAE0FE 0%, #D2EBFE 45%, #EAF5FE 100%);
  border-radius: 24px;
  padding: 18px 16px 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 28px -6px rgba(2, 132, 199, 0.12), 0 2px 6px rgba(0, 0, 0, 0.02);
  margin-bottom: 14px;
  min-height: 225px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.tw-sky-header-top {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.tw-sky-header-text {
  max-width: 60%;
}

.tw-sky-date-exact {
  font-size: 0.92rem;
  font-weight: 600;
  color: #1E293B;
  margin-bottom: 2px;
}

.tw-sky-title-exact {
  font-size: 1.48rem;
  font-weight: 900;
  color: #0F172A;
  line-height: 1.25;
}

.tw-sky-island-art {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 190px;
  height: 140px;
  pointer-events: none;
  z-index: 1;
}

.tw-sky-island-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: top right;
  display: block;
}

/* Dual Frosted Cards in Hero (Exact Image 1) */
.tw-glass-grid-exact {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 24px;
}

.tw-glass-card-exact {
  background: rgba(255, 255, 255, 0.76) !important;
  backdrop-filter: blur(20px) saturate(180%) !important;
  -webkit-backdrop-filter: blur(20px) saturate(180%) !important;
  border: 1.5px solid rgba(255, 255, 255, 0.95) !important;
  border-radius: 18px !important;
  padding: 12px 14px !important;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 8px 24px rgba(2, 132, 199, 0.08) !important;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.tw-glass-card-exact:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(2, 132, 199, 0.16) !important;
}

.tw-glass-exact-title {
  font-size: 0.95rem;
  font-weight: 850;
  color: #0F172A;
  line-height: 1.3;
}

.tw-glass-exact-sub {
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
  line-height: 1.3;
}

.tw-glass-exact-arrow {
  color: #0F172A;
  font-size: 0.85rem;
}

/* 2. PM2.5 Section (Exact Image 1) */
.tw-pm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.tw-pm-card {
  background: linear-gradient(145deg, #FFF1F2 0%, #FFE4E6 100%);
  border: 1px solid #FECDD3;
  border-radius: 18px;
  padding: 13px 14px;
  box-shadow: 0 2px 8px rgba(244, 63, 94, 0.05);
}

.tw-pm-province {
  font-size: 0.95rem;
  font-weight: 850;
  color: #0F172A;
  margin-bottom: 6px;
}

.tw-pm-middle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.tw-pm-emoji {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #F43F5E;
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.tw-pm-val-box {
  display: flex;
  flex-direction: column;
}

.tw-pm-label {
  font-size: 0.68rem;
  font-weight: 700;
  color: #64748B;
}

.tw-pm-value {
  font-size: 1.3rem;
  font-weight: 900;
  color: #0F172A;
  line-height: 1.1;
}

.tw-pm-desc {
  font-size: 0.72rem;
  font-weight: 750;
  color: #BE123C;
}

/* 3. ThaiWater Dashboard Mobile Cards (Image 2) */
.tw-dash-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 14px;
}

.tw-dash-pill {
  white-space: nowrap;
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  color: #475569;
  font-size: 0.78rem;
  font-weight: 750;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.tw-dash-pill.active {
  background: #0284C7;
  border-color: #0284C7;
  color: #FFFFFF;
  box-shadow: 0 3px 10px rgba(2, 132, 199, 0.3);
}

.tw-dash-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.tw-dash-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
  position: relative;
  overflow: hidden;
}

.tw-dash-storm-icon {
  font-size: 2.2rem;
  color: #475569;
  margin-bottom: 8px;
}

.tw-dash-storm-title {
  font-size: 1rem;
  font-weight: 900;
  color: #0F172A;
}

.tw-dash-storm-sub {
  font-size: 0.74rem;
  color: #64748B;
  font-weight: 600;
}

.tw-dash-dam-num {
  font-size: 1.7rem;
  font-weight: 900;
  color: #0284C7;
  line-height: 1.1;
  margin-bottom: 4px;
}

.tw-dash-dam-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: #1E293B;
  margin-bottom: 4px;
}

.tw-dash-dam-val {
  font-size: 0.74rem;
  color: #475569;
  font-weight: 600;
}

/* 4. Ranked Rain Stations (Image 2) */
.tw-dash-rank-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
  margin-bottom: 12px;
}

.tw-dash-rank-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 850;
  color: #0F172A;
  margin-bottom: 10px;
}

.tw-dash-rank-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #F1F5F9;
  font-size: 0.8rem;
  font-weight: 750;
  color: #334155;
}

.tw-dash-rank-row:last-child {
  border-bottom: none;
}

.tw-dash-rain-pill {
  background: #EA580C;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 850;
  padding: 2px 9px;
  border-radius: 6px;
}

/* 5. Rain Forecast 3-Day Card (Image 2) */
.tw-dash-forecast-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 18px;
  padding: 14px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.04);
  margin-bottom: 14px;
}

.tw-forecast-day-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 750;
}

.tw-forecast-day-row:last-child {
  margin-bottom: 0;
}

.tw-forecast-badge {
  flex: 1;
  max-width: 170px;
  text-align: center;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 0.74rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.tw-forecast-badge.mod {
  background: #16A34A;
  color: #FFFFFF;
}

.tw-forecast-badge.light {
  background: #BAE6FD;
  color: #0369A1;
}

/* 6. Donut Stations Charts (Image 2) */
.tw-dash-donut-card {
  background: #FFFFFF;
  border: 1px solid #E2E8F0;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  margin-bottom: 14px;
}

.tw-donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tw-donut-chart-box {
  width: 110px;
  height: 110px;
  flex-shrink: 0;
  position: relative;
  display: grid;
  place-items: center;
}

.tw-donut-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.tw-donut-center-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 10px;
}

.tw-donut-center-num {
  font-size: 1.15rem;
  font-weight: 900;
  color: #0F172A;
  line-height: 1;
}

.tw-donut-center-lbl {
  font-size: 0.62rem;
  font-weight: 700;
  color: #64748B;
  line-height: 1.2;
}

.tw-donut-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tw-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.74rem;
  font-weight: 750;
  color: #334155;
}

.tw-legend-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tw-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.tw-legend-count-pill {
  width: 22px;
  height: 20px;
  border-radius: 5px;
  display: grid;
  place-items: center;
  color: #FFFFFF;
  font-size: 0.7rem;
  font-weight: 850;
}

/* 7. Official ThaiWater Credit Footer Card */
.tw-credit-card {
  background: linear-gradient(145deg, #F0F9FF 0%, #E0F2FE 100%);
  border: 1.5px solid #BAE6FD;
  border-radius: 20px;
  padding: 16px 18px;
  text-align: center;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.08);
  margin-top: 14px;
  margin-bottom: 24px;
}

.tw-credit-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #FFFFFF;
  border: 1px solid #BAE6FD;
  color: #0284C7;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 3px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}

.tw-credit-title {
  font-size: 0.95rem;
  font-weight: 900;
  color: #0F172A;
  margin-bottom: 2px;
}

.tw-credit-sub {
  font-size: 0.76rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 12px;
}

.tw-credit-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0284C7;
  color: #FFFFFF;
  font-size: 0.84rem;
  font-weight: 800;
  padding: 9px 18px;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.35);
  transition: transform 0.15s ease, background 0.15s ease;
}

.tw-credit-link:hover {
  background: #0369A1;
  transform: translateY(-2px);
}

/* ============================================================================
   ThaiWater Live Dashboard App Theme (พื้นที่ของฉัน: ถอดแบบภาพที่ 2 สู่หน้าจอมือถือ)
   ============================================================================ */
.tw-app-dash-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

/* Header bar inside My Area */
.tw-dash-mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
  color: #FFFFFF;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.2);
  margin-bottom: 4px;
}
.tw-dash-m-title {
  font-size: 0.95rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tw-dash-m-time {
  font-size: 0.68rem;
  opacity: 0.9;
  font-weight: 600;
}
.tw-dash-m-btn-refresh {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #FFFFFF;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: transform 0.14s ease;
}
.tw-dash-m-btn-refresh:active {
  transform: scale(0.92);
}

/* 4 Top Cards (สไตล์ภาพที่ 2) */
.tw-app-grid-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.tw-app-card {
  background: #FFFFFF;
  border: 1px solid rgba(186, 230, 253, 0.7);
  border-radius: 20px;
  padding: 14px 12px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  position: relative;
  overflow: hidden;
  box-sizing: border-box;
}

/* Card 1: Storm */
.tw-app-card.storm {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.tw-app-card.storm img {
  height: 48px;
  width: auto;
  margin-bottom: 6px;
  object-fit: contain;
}
.tw-app-storm-title {
  font-size: 0.98rem;
  font-weight: 900;
  color: #0F172A;
  margin-bottom: 2px;
}
.tw-app-storm-sub {
  font-size: 0.72rem;
  color: #64748B;
  font-weight: 600;
}

/* Card 2: Dam */
.tw-app-card.dam {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.tw-app-dam-top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 2px;
}
.tw-app-dam-top img {
  height: 38px;
  width: auto;
  object-fit: contain;
}
.tw-app-dam-pct {
  font-size: 1.85rem;
  font-weight: 950;
  color: #0284C7;
  line-height: 1;
}
.tw-app-dam-pct small {
  font-size: 0.85rem;
  font-weight: 700;
  margin-left: 2px;
}
.tw-app-dam-lbl {
  font-size: 0.72rem;
  color: #64748B;
  font-weight: 600;
}
.tw-app-dam-title {
  font-size: 0.84rem;
  font-weight: 850;
  color: #0F172A;
  margin-bottom: 2px;
}
.tw-app-dam-vol {
  font-size: 0.78rem;
  font-weight: 800;
  color: #334155;
}
.tw-app-dam-date {
  font-size: 0.65rem;
  color: #94A3B8;
  margin-top: 2px;
}

/* Card 3: 24h Rain Top 3 */
.tw-rain24-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
}
.tw-rain24-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-top: 1px solid #F1F5F9;
  font-size: 0.8rem;
}
.tw-rain24-list li:first-child {
  border-top: 1px solid #F1F5F9;
}
.tw-rain24-st {
  color: #1E293B;
  font-weight: 750;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}
.tw-rain24-badge {
  display: inline-block;
  min-width: 38px;
  padding: 3px 8px;
  font-size: 0.72rem;
  font-weight: 850;
  line-height: 1;
  color: #FFFFFF;
  text-align: center;
  border-radius: 6px;
  flex-shrink: 0;
}

/* Card 4: Forecast */
.tw-fc-inner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tw-fc-map {
  width: 78px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tw-fc-map img {
  width: 100%;
  max-height: 120px;
  object-fit: contain;
}
.tw-fc-table-wrap {
  flex: 1;
  min-width: 0;
}
.tw-fc-table {
  width: 100%;
  border-collapse: collapse;
}
.tw-fc-table th {
  text-align: left;
  font-size: 0.82rem;
  font-weight: 850;
  padding: 0 4px 6px;
  color: #0F172A;
}
.tw-fc-table td {
  padding: 3px 2px;
  vertical-align: middle;
}
.tw-fc-day {
  text-align: right;
  padding-right: 6px !important;
  white-space: nowrap;
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  width: 52px;
}
.tw-fc-today-box {
  border-radius: 8px;
  min-height: 48px;
  padding: 4px 8px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 750;
}
.tw-fc-today-box .tw-fc-ic img {
  max-height: 24px;
  width: auto;
}
.tw-fc-today-box .tw-fc-tx {
  font-size: 0.78rem;
  font-weight: 800;
}
.tw-fc-bar {
  display: block;
  width: 100%;
  padding: 4px 8px;
  border-radius: 6px;
  text-align: center;
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.2;
}

/* Cards 5 & 6: Donut Station Breakdown (ภาพที่ 2) */
.tw-donut-panel-card {
  background: #FFFFFF;
  border: 1px solid rgba(186, 230, 253, 0.7);
  border-radius: 20px;
  padding: 16px 14px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}
.tw-donut-panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 900;
  color: #0F172A;
  margin-bottom: 12px;
}
.tw-donut-panel-grid {
  display: grid;
  grid-template-columns: minmax(130px, 0.85fr) minmax(180px, 1.15fr);
  gap: 12px;
  align-items: center;
}
@media (max-width: 380px) {
  .tw-donut-panel-grid {
    grid-template-columns: 1fr;
    justify-items: center;
  }
}
.tw-chart-box {
  position: relative;
  width: 100%;
  max-width: 140px;
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.tw-chart-svg {
  width: 100%;
  height: 100%;
  display: block;
  transform: rotate(-90deg);
}
.tw-chart-info {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  width: 75%;
  pointer-events: none;
}
.tw-chart-info img {
  max-width: 28px;
  height: auto;
  margin-bottom: 2px;
}
.tw-chart-info .tw-ci-lbl {
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748B;
  line-height: 1.1;
}
.tw-chart-info h3 {
  font-size: 1.15rem;
  font-weight: 900;
  margin: 2px 0 0;
  color: #0F172A;
  line-height: 1;
}
.tw-chart-info h3 small {
  font-size: 70%;
  color: #64748B;
  font-weight: 600;
}
.tw-stat-table {
  width: 100%;
  border-collapse: collapse;
}
.tw-stat-table tr {
  border-top: 1px solid #F1F5F9;
}
.tw-stat-table tr:first-child {
  border-top: 0;
}
.tw-stat-table td {
  padding: 4px 2px;
  vertical-align: middle;
  font-size: 0.78rem;
  font-weight: 750;
  color: #1E293B;
}
.tw-stat-table td:first-child {
  text-align: center;
  width: 28px;
}
.tw-stat-table td:first-child img {
  max-height: 18px;
  width: auto;
}
.tw-stat-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  font-size: 0.72rem;
  font-weight: 850;
  color: #FFFFFF;
  line-height: 1;
}
.tw-stat-circle.is-muted {
  background: #CBD5E1;
}

/* ============================================================================
   NSS Modern Session Dividers (เส้นแบ่ง Session ดีไซน์พรีเมียม สไตล์ Modern Public Health)
   ============================================================================ */
.nss-session-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 26px 0 16px;
  position: relative;
  width: 100%;
}
.nss-session-divider::before,
.nss-session-divider::after {
  content: '';
  flex: 1 1 0;
  height: 1.5px;
  border-radius: 999px;
  pointer-events: none;
}
.nss-session-divider::before {
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.02) 0%, rgba(2, 132, 199, 0.42) 100%);
}
.nss-session-divider::after {
  background: linear-gradient(90deg, rgba(2, 132, 199, 0.42) 0%, rgba(2, 132, 199, 0.02) 100%);
}

.nss-divider-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1.5px solid rgba(186, 230, 253, 0.95);
  box-shadow:
    0 4px 16px -4px rgba(2, 132, 199, 0.16),
    0 1px 3px rgba(15, 23, 42, 0.04);
  white-space: nowrap;
  user-select: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.nss-divider-badge:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -4px rgba(2, 132, 199, 0.22);
}

.nss-divider-icon {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 0.78rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.nss-divider-icon.is-sky {
  background: linear-gradient(135deg, #E0F2FE 0%, #BAE6FD 100%);
  color: #0284C7;
}
.nss-divider-icon.is-blue {
  background: linear-gradient(135deg, #DBEAFE 0%, #93C5FD 100%);
  color: #2563EB;
}
.nss-divider-icon.is-emerald {
  background: linear-gradient(135deg, #DCFCE7 0%, #86EFAC 100%);
  color: #15803D;
}
.nss-divider-icon.is-indigo {
  background: linear-gradient(135deg, #EDE9FE 0%, #C4B5FD 100%);
  color: #6D28D9;
}
.nss-divider-icon.is-sos {
  background: linear-gradient(135deg, #FFE4E6 0%, #FDA4AF 100%);
  color: #E11D48;
}

.nss-divider-title {
  font-size: 0.84rem;
  font-weight: 800;
  color: #0F172A;
  letter-spacing: 0.1px;
}

.nss-divider-chip {
  font-size: 0.66rem;
  font-weight: 700;
  padding: 1.5px 7px;
  border-radius: 999px;
  background: #F0F9FF;
  color: #0284C7;
  border: 1px solid rgba(186, 230, 253, 0.85);
  margin-left: 2px;
}

/* Variant: Emerald (ผลการช่วยเหลือ) */
.nss-session-divider.is-emerald::before {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.02) 0%, rgba(16, 185, 129, 0.45) 100%);
}
.nss-session-divider.is-emerald::after {
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.45) 0%, rgba(16, 185, 129, 0.02) 100%);
}
.nss-session-divider.is-emerald .nss-divider-badge {
  border-color: rgba(187, 247, 208, 0.95);
  box-shadow: 0 4px 16px -4px rgba(16, 185, 129, 0.16), 0 1px 3px rgba(15, 23, 42, 0.04);
}
.nss-session-divider.is-emerald .nss-divider-chip {
  background: #F0FDF4;
  color: #15803D;
  border-color: rgba(187, 247, 208, 0.85);
}

/* Variant: SOS / Hotline (สายด่วน) */
.nss-session-divider.is-sos::before {
  background: linear-gradient(90deg, rgba(225, 29, 72, 0.02) 0%, rgba(225, 29, 72, 0.45) 100%);
}
.nss-session-divider.is-sos::after {
  background: linear-gradient(90deg, rgba(225, 29, 72, 0.45) 0%, rgba(225, 29, 72, 0.02) 100%);
}
.nss-session-divider.is-sos .nss-divider-badge {
  border-color: rgba(254, 205, 211, 0.95);
  box-shadow: 0 4px 16px -4px rgba(225, 29, 72, 0.16), 0 1px 3px rgba(15, 23, 42, 0.04);
}
.nss-session-divider.is-sos .nss-divider-chip {
  background: #FFF1F2;
  color: #BE123C;
  border-color: rgba(254, 205, 211, 0.85);
}

@media (max-width: 480px) {
  .nss-session-divider {
    margin: 22px 0 14px;
    gap: 8px;
  }
  .nss-divider-badge {
    padding: 4.5px 11px 4.5px 6.5px;
    gap: 6px;
  }
  .nss-divider-icon {
    width: 22px;
    height: 22px;
    min-width: 22px;
    font-size: 0.72rem;
  }
  .nss-divider-title {
    font-size: 0.77rem;
  }
  .nss-divider-chip {
    font-size: 0.62rem;
    padding: 1px 5px;
  }
}

/* ============================================================================
   ANIMATION KEYFRAMES (เอฟเฟกต์เคลื่อนไหวสุดล้ำ: คลื่นน้ำ, แสงเลื่อน, เรดาร์)
   ============================================================================ */
@keyframes nssGlossSweep {
  0% { transform: translateX(-120%) rotate(25deg); opacity: 0; }
  12% { opacity: 0.75; }
  32% { transform: translateX(260%) rotate(25deg); opacity: 0; }
  100% { transform: translateX(260%) rotate(25deg); opacity: 0; }
}

@keyframes nssBeaconPing {
  0% { transform: scale(0.8); opacity: 1; }
  70% { transform: scale(2.4); opacity: 0; }
  100% { transform: scale(2.4); opacity: 0; }
}

@keyframes nssWaveDrift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3.5px); }
}

@keyframes nssHouseBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-2.5px) rotate(-1.5deg); }
}

/* ============================================================================
   3 แถบสถานการณ์น้ำดีไซน์ใหม่ (Replica จากภาพที่ 1: คลื่นน้ำ + 3D Icon + ระลอกน้ำ)
   ============================================================================ */
.tw-tabs-sky-stage {
  position: relative;
  padding: 8px;
  margin-bottom: 20px;
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(240, 249, 255, 0.85) 0%, rgba(224, 242, 254, 0.65) 50%, rgba(186, 230, 253, 0.45) 100%);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1.5px solid rgba(186, 230, 253, 0.9);
  box-shadow: 0 12px 30px -12px rgba(2, 132, 199, 0.22);
}
.tw-tabs-bar-exact {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 0;
  margin: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.tw-tab-btn-exact {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 96px;
  padding: 12px 13px 10px 13px;
  border-radius: 20px;
  border: 1.5px solid rgba(186, 230, 253, 0.95);
  background: linear-gradient(160deg, #FFFFFF 0%, #F8FAFC 55%, #F0F9FF 100%);
  box-shadow: 0 6px 18px -4px rgba(2, 132, 199, 0.12), inset 0 1px 0 #ffffff;
  color: #0C4A6E;
  font-family: 'Kanit', 'Prompt', sans-serif;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease, border-color 0.22s ease;
}

.tw-tab-btn-exact:hover {
  transform: translateY(-3px) scale(1.015);
  border-color: #7DD3FC;
  box-shadow: 0 12px 26px -6px rgba(2, 132, 199, 0.22);
  text-decoration: none;
}
.tw-tab-btn-exact:active {
  transform: scale(0.98);
}

.tw-tab-btn-exact.is-active {
  background: linear-gradient(145deg, #38BDF8 0%, #0284C7 52%, #0369A1 100%);
  border-color: #ffffff;
  box-shadow:
    0 12px 28px -6px rgba(2, 132, 199, 0.45),
    0 0 0 2px rgba(125, 211, 252, 0.7),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.85);
  color: #ffffff;
}

.tw-tab-btn-exact.is-active::after {
  content: '';
  position: absolute;
  top: -60%;
  left: -70%;
  width: 45%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: rotate(25deg);
  animation: nssGlossSweep 4.5s ease-in-out infinite;
  pointer-events: none;
  z-index: 3;
}

.tw-tab-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  position: relative;
  z-index: 2;
  margin-bottom: 6px;
}

.tw-tab-icon-circle-3d {
  width: 34px;
  height: 34px;
  min-width: 34px;
  border-radius: 50%;
  background: #ffffff;
  display: grid;
  place-items: center;
  color: #0284C7;
  font-size: 0.98rem;
  box-shadow: 0 4px 10px rgba(3, 105, 161, 0.25), inset 0 1px 1px #ffffff;
  transition: transform 0.2s ease;
}
.tw-tab-btn-exact:hover .tw-tab-icon-circle-3d {
  transform: scale(1.08) rotate(-4deg);
}

.tw-tab-icon-box {
  width: 34px;
  height: 34px;
  min-width: 34px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  transition: transform 0.2s ease;
}
.tw-tab-btn-exact:hover .tw-tab-icon-box {
  transform: scale(1.08);
}
.tw-tab-icon-box svg {
  width: 32px;
  height: 32px;
}

.tw-tab-arrow-circle {
  width: 24px;
  height: 24px;
  min-width: 24px;
  border-radius: 50%;
  background: #ffffff;
  border: 1.5px solid #BAE6FD;
  color: #0284C7;
  display: grid;
  place-items: center;
  font-size: 0.65rem;
  box-shadow: 0 2px 6px rgba(2, 132, 199, 0.12);
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}
.tw-tab-btn-exact.is-active .tw-tab-arrow-circle {
  border-color: #ffffff;
  box-shadow: 0 3px 8px rgba(3, 105, 161, 0.25);
}
.tw-tab-btn-exact:hover .tw-tab-arrow-circle {
  transform: translateX(2px) scale(1.08);
}

.tw-tab-text-wrap {
  position: relative;
  z-index: 2;
  margin-top: auto;
}
.tw-tab-title-main {
  font-size: clamp(0.82rem, 1.14vw, 0.98rem);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.tw-tab-sub-main {
  font-size: clamp(0.70rem, 0.94vw, 0.84rem);
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
}

.tw-tab-btn-exact:not(.is-active) .tw-tab-title-main {
  color: #0F172A;
}
.tw-tab-btn-exact:not(.is-active) .tw-tab-sub-main {
  color: #0284C7;
}

.tw-tab-btn-exact.is-active .tw-tab-title-main {
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}
.tw-tab-btn-exact.is-active .tw-tab-sub-main {
  color: #ffffff;
  font-weight: 800;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
}

.tw-tab-flood-house {
  position: absolute;
  right: 22px;
  bottom: 2px;
  width: 44px;
  height: 36px;
  z-index: 2;
  pointer-events: none;
  animation: nssHouseBob 3.6s ease-in-out infinite;
}
.tw-tab-flood-house svg {
  width: 100%;
  height: 100%;
  display: block;
  filter: drop-shadow(0 2px 5px rgba(2, 44, 90, 0.3));
}

.tw-tab-wave-svg {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 38px;
  pointer-events: none;
  z-index: 1;
  animation: nssWaveDrift 3.8s ease-in-out infinite;
}
.tw-tab-btn-exact.is-active .tw-wave-back {
  fill: rgba(56, 189, 248, 0.45);
}
.tw-tab-btn-exact.is-active .tw-wave-front {
  fill: rgba(255, 255, 255, 0.28);
}
.tw-tab-btn-exact:not(.is-active) .tw-wave-back {
  fill: rgba(186, 230, 253, 0.32);
}
.tw-tab-btn-exact:not(.is-active) .tw-wave-front {
  fill: rgba(224, 242, 254, 0.65);
}

/* ============================================================================
   ปุ่มกดฉุกเฉิน 2 ช่องดีไซน์ใหม่ (รูปทรงแปลกตา + คลื่นน้ำ + Shimmer + Radar Beacon)
   ============================================================================ */
.action-grid-modern.is-compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px !important;
}

.action-card-btn {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  min-height: 82px;
  padding: 14px 14px 12px 14px;
  text-align: left;
  overflow: hidden;
  border: 1.5px solid rgba(255, 255, 255, 0.65);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease;
  user-select: none;
  text-decoration: none;
}

.action-card-btn.sos {
  border-radius: 26px 14px 24px 16px;
  background: linear-gradient(135deg, #FF6B81 0%, #EF4444 48%, #DC2626 100%);
  box-shadow:
    0 12px 28px -6px rgba(239, 68, 68, 0.45),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.65);
}

.action-card-btn.flood {
  border-radius: 14px 26px 16px 24px;
  background:
    radial-gradient(circle at 92% 16%, rgba(186, 230, 253, 0.35) 0%, transparent 55%),
    linear-gradient(135deg, #38BDF8 0%, #0284C7 52%, #0369A1 100%);
  border-color: rgba(186, 230, 253, 0.9);
  box-shadow:
    0 12px 28px -6px rgba(2, 132, 199, 0.45),
    inset 0 1.5px 1px rgba(255, 255, 255, 0.7);
}

.action-card-btn:hover {
  transform: translateY(-3px) scale(1.015);
  text-decoration: none;
}
.action-card-btn.sos:hover {
  box-shadow: 0 16px 34px -6px rgba(239, 68, 68, 0.6);
}
.action-card-btn.flood:hover {
  box-shadow: 0 16px 34px -6px rgba(2, 132, 199, 0.6);
}
.action-card-btn:active {
  transform: scale(0.98);
}

.action-shimmer-beam {
  position: absolute;
  top: -60%;
  left: -70%;
  width: 45%;
  height: 220%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.42), transparent);
  transform: rotate(25deg);
  animation: nssGlossSweep 4.8s ease-in-out infinite;
  pointer-events: none;
  z-index: 3;
}

.action-card-btn .action-icon-circle {
  position: relative;
  z-index: 2;
  width: 44px;
  height: 44px;
  min-width: 44px;
  border-radius: 14px;
  margin-bottom: 0;
  display: grid;
  place-items: center;
  transition: transform 0.22s ease;
}
.action-card-btn:hover .action-icon-circle {
  transform: scale(1.08) rotate(-4deg);
}

.action-card-btn.sos .action-icon-circle {
  background: #ffffff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  color: #E11D48 !important;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.3), inset 0 1px 1px #ffffff;
}
.action-card-btn.sos .action-icon-circle i {
  color: #E11D48 !important;
  font-size: 1.25rem;
}

.action-card-btn.flood .action-icon-circle {
  background: #ffffff !important;
  border: 1.5px solid rgba(255, 255, 255, 0.95);
  color: #0284C7 !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.3), inset 0 1px 1px #ffffff;
}
.action-card-btn.flood .action-icon-circle i {
  color: #0284C7 !important;
  font-size: 1.25rem;
}

.action-card-btn .action-card-body {
  position: relative;
  z-index: 2;
  flex: 1;
  min-width: 0;
}

.action-card-btn .action-title {
  font-size: clamp(0.86rem, 1.22vw, 1.02rem);
  font-weight: 850;
  line-height: 1.22;
  margin-bottom: 3px;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.16);
}
.action-card-btn.sos .action-title {
  padding-right: 36px;
}

.action-card-btn .action-sub {
  display: block;
  font-size: clamp(0.68rem, 0.9vw, 0.76rem);
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.action-sub-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(4px);
  color: #ffffff;
  font-size: clamp(0.66rem, 0.86vw, 0.74rem);
  font-weight: 700;
  margin-top: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  white-space: nowrap;
}
.action-sub-pill i { font-size: 0.68rem; }

.action-card-btn .action-tag {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2.5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(6px);
  color: #ffffff;
  letter-spacing: 0.3px;
}

.action-arrow-circle-btn {
  position: absolute;
  right: 11px;
  bottom: 11px;
  z-index: 2;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 0.68rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, background 0.2s ease;
}
.action-card-btn:hover .action-arrow-circle-btn {
  transform: translateX(2px) scale(1.1);
  background: rgba(255, 255, 255, 0.38);
}

.action-wave-svg {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 100%;
  height: 36px;
  pointer-events: none;
  z-index: 1;
  animation: nssWaveDrift 4s ease-in-out infinite;
}

@media (max-width: 520px) {
  .action-grid-modern.is-compact {
    gap: 8px;
    margin-bottom: 16px !important;
  }
  .action-grid-modern.is-compact .action-card-btn {
    padding: 11px 10px 10px 10px;
    gap: 8px;
    min-height: 72px;
  }
  .action-grid-modern.is-compact .action-card-btn .action-icon-circle {
    width: 36px;
    height: 36px;
    min-width: 36px;
    border-radius: 12px;
  }
  .action-grid-modern.is-compact .action-card-btn .action-icon-circle i {
    font-size: 1.05rem;
  }
  .action-grid-modern.is-compact .action-card-btn.sos {
    border-radius: 20px 12px 18px 14px;
  }
  .action-grid-modern.is-compact .action-card-btn.flood {
    border-radius: 12px 20px 14px 18px;
  }
  .action-grid-modern.is-compact .action-card-btn .action-title {
    font-size: 0.80rem;
  }
  .action-grid-modern.is-compact .action-card-btn .action-sub {
    font-size: 0.66rem;
  }
  .action-sub-pill {
    padding: 2px 7px;
    font-size: 0.62rem;
  }
  .action-arrow-circle-btn {
    width: 20px;
    height: 20px;
    font-size: 0.58rem;
    right: 8px;
    bottom: 8px;
  }
  .tw-tab-btn-exact {
    min-height: 84px;
    padding: 9px 8px 8px 8px;
    border-radius: 16px;
  }
  .tw-tab-icon-circle-3d, .tw-tab-icon-box {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.82rem;
  }
  .tw-tab-icon-box svg {
    width: 26px;
    height: 26px;
  }
  .tw-tab-arrow-circle {
    width: 20px;
    height: 20px;
    min-width: 20px;
    font-size: 0.55rem;
  }
  .tw-tab-title-main {
    font-size: 0.74rem;
  }
  .tw-tab-sub-main {
    font-size: 0.65rem;
  }
  .tw-tab-flood-house {
    width: 34px;
    height: 28px;
    right: 16px;
    bottom: 2px;
  }
}

/* ============================================================================
   NSS Live Emergency Flash Alert Banner
   ============================================================================ */
.nss-flash-alert {
  position: relative;
  margin-bottom: 14px;
  border-radius: 18px;
  padding: 13px 15px;
  color: #ffffff;
  overflow: hidden;
  box-shadow: 0 10px 25px -5px rgba(220, 38, 38, 0.38), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
}
.nss-flash-alert.is-danger {
  background: linear-gradient(135deg, #EF4444 0%, #DC2626 50%, #991B1B 100%);
  border-color: rgba(254, 202, 202, 0.65);
}
.nss-flash-alert.is-warning {
  background: linear-gradient(135deg, #F97316 0%, #EA580C 50%, #C2410C 100%);
  border-color: rgba(254, 215, 170, 0.65);
  box-shadow: 0 10px 25px -5px rgba(234, 88, 12, 0.38), inset 0 1px 1px rgba(255, 255, 255, 0.4);
}

/* My Location Radar */
.nss-my-location-widget {
  background:
    radial-gradient(circle at 92% 12%, rgba(56, 189, 248, 0.15) 0%, transparent 45%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.98) 0%, rgba(240, 249, 255, 0.96) 100%);
  border: 1.5px solid rgba(186, 230, 253, 0.95);
  border-radius: 22px;
  padding: 15px;
  margin-bottom: 20px;
  box-shadow: 0 10px 30px -8px rgba(2, 132, 199, 0.15);
}

/* Health Tips Section */
.health-tips-section { margin-bottom: 22px; }
.health-tips-scroll-wrap {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 4px 2px 14px 2px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

/* ============================================================================
   Faonam Style Animated Water Level Gauge Popup (มาตรวัดระดับน้ำเคลื่อนไหว)
   ============================================================================ */
.water-popup-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 0;
  font-family: -apple-system, BlinkMacSystemFont, "Kanit", "Noto Sans Thai", "Segoe UI", Roboto, sans-serif;
  min-width: 250px;
  max-width: 330px;
}
.water-gauge-wrap {
  flex: 0 0 32px;
  height: 132px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  user-select: none;
}
.water-gauge-tube {
  width: 26px;
  height: 126px;
  border-radius: 4px;
  border: 1.5px solid #CBD5E1;
  background: #F8FAFC;
  position: relative;
  overflow: visible;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.06);
}
.water-bank-line {
  position: absolute;
  left: -5px;
  right: -5px;
  height: 3px;
  background: #DC2626;
  border-radius: 2px;
  z-index: 6;
  box-shadow: 0 0 4px rgba(220, 38, 38, 0.5);
  pointer-events: none;
}
.water-ruler-ticks {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.water-ruler-ticks .wtick {
  position: absolute;
  left: 0;
  height: 1px;
  background: rgba(220, 38, 38, 0.45);
}
.water-ruler-ticks .wtick.short {
  width: 45%;
}
.water-ruler-ticks .wtick.long {
  width: 80%;
  background: rgba(220, 38, 38, 0.65);
}
.water-liquid-wrap {
  position: absolute;
  inset: 0;
  border-radius: 2.5px;
  overflow: hidden;
  z-index: 2;
  background: transparent;
}
.water-liquid-body {
  position: absolute;
  bottom: -10px;
  left: 0;
  right: 0;
  will-change: height, transform;
}
.water-liquid-body.is-settled {
  animation: waterLiquidBob 3.5s ease-in-out infinite;
}
@keyframes waterLiquidBob {
  0%   { transform: translateY(2.5px); }
  50%  { transform: translateY(-4.5px); }
  100% { transform: translateY(2.5px); }
}
.water-wave-box {
  position: absolute;
  top: -7px;
  left: 0;
  right: 0;
  height: 8px;
  overflow: hidden;
  pointer-events: none;
}
.water-wave-svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 200%;
  height: 100%;
}
.water-wave-svg.wave1 {
  animation: waterWaveScroll 2.2s linear infinite;
  opacity: 0.95;
}
.water-wave-svg.wave2 {
  animation: waterWaveScrollBack 3.4s linear infinite;
  opacity: 0.55;
  top: -1px;
}
@keyframes waterWaveScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}
@keyframes waterWaveScrollBack {
  0% { transform: translateX(-50%); }
  100% { transform: translateX(0); }
}

/* Faonam Map Popup Text Details */
.map-popup-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: #0F172A;
  padding-right: 14px;
}
.map-popup-text strong {
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.34;
  color: #0F172A;
  margin-bottom: 2px;
  word-break: break-word;
}
.map-popup-text span {
  font-size: 0.80rem;
  line-height: 1.4;
  color: #334155;
}
.map-popup-text .map-popup-val.is-overflow {
  font-weight: 800;
  color: #DC2626;
}
.map-popup-text .map-popup-val.is-normal {
  font-weight: 700;
  color: #16A34A;
}
.map-popup-text .map-popup-meta {
  font-size: 0.70rem;
  color: #64748B;
  margin-top: 2px;
}
.map-popup-text a {
  margin-top: 5px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #007AFF;
  text-decoration: underline;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.map-popup-text a:hover {
  color: #0056D2;
}

/* Custom Leaflet popup styling for Faonam style */
.leaflet-popup.faonam-popup .leaflet-popup-content-wrapper {
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.16);
  padding: 2px;
}
.leaflet-popup.faonam-popup .leaflet-popup-content {
  margin: 10px 12px;
  line-height: 1.35;
}
.leaflet-popup.faonam-popup a.leaflet-popup-close-button {
  top: 8px;
  right: 8px;
  padding: 0;
  width: 20px;
  height: 20px;
  color: #64748B;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* =========================================================
   GEMINI AI HEALTH & DISASTER CHATBOT (น้องนคร AI - NAKHON SAVE)
   ========================================================= */

/* Floating Chat Trigger Button */
.ai-chat-fab {
  position: fixed;
  bottom: calc(85px + env(safe-area-inset-bottom, 0px));
  right: max(16px, calc(50% - 214px));
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0369A1 0%, #0284C7 50%, #38BDF8 100%);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(2, 132, 199, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.9);
  cursor: pointer;
  z-index: 995;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  text-decoration: none;
  animation: fabFloat 3s ease-in-out infinite alternate;
}

@media (max-width: 480px) {
  .ai-chat-fab {
    right: 16px;
  }
}

.ai-chat-fab:active {
  transform: scale(0.92);
}

.ai-chat-fab-sparkle {
  position: absolute;
  top: 4px;
  left: 6px;
  font-size: 0.7rem;
  color: #FDE047;
  animation: pulseRotate 2s linear infinite;
}

@keyframes fabFloat {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-6px); }
}

@keyframes pulseRotate {
  0%   { transform: scale(0.8) rotate(0deg); opacity: 0.7; }
  50%  { transform: scale(1.1) rotate(180deg); opacity: 1; }
  100% { transform: scale(0.8) rotate(360deg); opacity: 0.7; }
}

/* AI Chat Modal Overlay */
.ai-chat-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10050;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.ai-chat-modal.active {
  opacity: 1;
  pointer-events: auto;
}

.ai-chat-window {
  width: 100%;
  max-width: 460px;
  height: 86vh;
  max-height: 740px;
  background: #FFFFFF;
  border-radius: 28px 28px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 -12px 48px rgba(0, 0, 0, 0.35);
  transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.3, 1);
  position: relative;
  z-index: 10051;
}

.ai-chat-modal.active .ai-chat-window {
  transform: translateY(0);
}

/* Chat Header */
.ai-chat-header {
  background: linear-gradient(135deg, #075985 0%, #0369A1 60%, #0284C7 100%);
  color: #FFFFFF;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  flex-shrink: 0;
}

.ai-chat-header-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ai-avatar {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.3);
  display: grid;
  place-items: center;
  font-size: 1.3rem;
  color: #FDE047;
  position: relative;
  backdrop-filter: blur(10px);
}

.ai-online-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #10B981;
  border: 2px solid #075985;
}

.ai-chat-close-btn {
  background: rgba(255, 255, 255, 0.18);
  border: none;
  color: #FFFFFF;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.2s;
}

.ai-chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Chat Body (Message Stream) */
.ai-chat-body {
  flex: 1;
  padding: 18px 16px;
  overflow-y: auto;
  background: #F8FAFC;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

.ai-msg {
  display: flex;
  gap: 10px;
  max-width: 88%;
  animation: msgFadeIn 0.25s ease-out;
}

@keyframes msgFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ai-msg.user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.ai-msg.bot {
  align-self: flex-start;
}

.ai-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 0.86rem;
  line-height: 1.55;
  word-break: break-word;
}

.ai-msg.user .ai-bubble {
  background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
  color: #FFFFFF;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.25);
}

.ai-msg.bot .ai-bubble {
  background: #FFFFFF;
  color: #1E293B;
  border-bottom-left-radius: 4px;
  border: 1px solid #E2E8F0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.ai-bubble b, .ai-bubble strong {
  color: #0369A1;
  font-weight: 800;
}

.ai-msg.user .ai-bubble b, .ai-msg.user .ai-bubble strong {
  color: #FDE047;
}

/* Quick Suggestion Pills */
.ai-quick-topics {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 16px;
  background: #F1F5F9;
  border-top: 1px solid #E2E8F0;
  scrollbar-width: none;
  flex-shrink: 0;
}

.ai-quick-btn {
  background: #FFFFFF;
  border: 1px solid #CBD5E1;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s;
}

.ai-quick-btn:hover, .ai-quick-btn:active {
  background: #0284C7;
  color: #FFFFFF;
  border-color: #0284C7;
}

/* Chat Input Bar */
.ai-chat-input-bar {
  padding: 12px 16px calc(14px + env(safe-area-inset-bottom, 8px));
  background: #FFFFFF;
  border-top: 1px solid #E2E8F0;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-shrink: 0;
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.04);
}

.ai-chat-input {
  flex: 1;
  background: #F8FAFC;
  border: 1.5px solid #CBD5E1;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 0.88rem;
  color: #0F172A;
  outline: none;
  font-family: inherit;
  transition: border-color 0.2s;
}

.ai-chat-input:focus {
  border-color: #0284C7;
  background: #FFFFFF;
}

.ai-chat-send-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
  color: #FFFFFF;
  border: none;
  display: grid;
  place-items: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3);
  transition: transform 0.15s;
}

.ai-chat-send-btn:active {
  transform: scale(0.92);
}

/* Typing Indicator Animation */
.ai-typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
}

.ai-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94A3B8;
  animation: aiBounce 1.4s infinite ease-in-out both;
}

.ai-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes aiBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Mascot Image Styles */
.ai-fab-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.ai-header-avatar-img {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  object-fit: cover;
}

.ai-chat-msg-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 1.5px solid #0284C7;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
  align-self: flex-end;
}

/* AI Chat Action Links & Interactive Button Pills */
.ai-chat-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #EFF6FF;
  color: #0284C7 !important;
  border: 1.2px solid #BAE6FD;
  border-radius: 10px;
  padding: 5px 12px;
  margin: 5px 2px;
  font-size: 0.8rem;
  font-weight: 700;
  text-decoration: none !important;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.08);
  vertical-align: middle;
}

.ai-chat-link:hover, .ai-chat-link:active {
  background: linear-gradient(135deg, #0284C7 0%, #0369A1 100%);
  color: #FFFFFF !important;
  border-color: #0284C7;
  transform: translateY(-1.5px);
  box-shadow: 0 4px 10px rgba(2, 132, 199, 0.28);
}

