/* ============================================================
   style.css — เชียงราย เฝ้าระวังภัย
   Dark/Light mode + Dashboard design
   ============================================================ */

/* -- Google Fonts + Sarabun (Thai) — weight 400/500/700 สำหรับอ่านง่าย -- */
@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ============================================================
   CSS Variables — Dark (default)
   ============================================================ */
:root {
  --bg:          #0d1117;
  --bg-card:     #161b22;
  --bg-card2:    #1c2130;
  --bg-sidebar:  #0f1623;
  --border:      #30363d;
  --border-sub:  #21262d;
  --text:        #e6edf3;
  --text-muted:  #8b949e;
  --text-faint:  #484f58;
  --primary:     #58a6ff;

  /* Hazard colors */
  --fire:        #ff7b29;
  --fire-glow:   rgba(255,123,41,0.15);
  --air:         #e05c7f;
  --air-glow:    rgba(224,92,127,0.15);
  --flood:       #38bdf8;
  --flood-glow:  rgba(56,189,248,0.15);
  --weather:     #fbbf24;
  --weather-glow:rgba(251,191,36,0.15);
  --pm10:        #a78bfa;
  --pm10-glow:   rgba(167,139,250,0.15);
  --rain:        #60a5fa;
  --rain-glow:   rgba(96,165,250,0.15);
  --wind:        #34d399;
  --wind-glow:   rgba(52,211,153,0.15);
  --quake:       #c084fc;
  --quake-glow:  rgba(192,132,252,0.15);
  --chemical:    #4ade80;
  --chemical-glow:rgba(74,222,128,0.15);
  --power:       #facc15;
  --power-glow:  rgba(250,204,21,0.15);
  --water-supply:#22d3ee;
  --water-supply-glow:rgba(34,211,238,0.15);
  --oil:         #fb923c;
  --oil-glow:    rgba(251,146,60,0.15);
  --gold:        #eab308;
  --gold-glow:   rgba(234,179,8,0.15);

  /* Aliases — ใช้ใน index.php */
  --color-fire:         var(--fire);         --glow-fire:         var(--fire-glow);
  --color-air:          var(--air);          --glow-air:          var(--air-glow);
  --color-flood:        var(--flood);        --glow-flood:        var(--flood-glow);
  --color-weather:      var(--weather);      --glow-weather:      var(--weather-glow);
  --color-pm10:         var(--pm10);         --glow-pm10:         var(--pm10-glow);
  --color-rain:         var(--rain);         --glow-rain:         var(--rain-glow);
  --color-wind:         var(--wind);         --glow-wind:         var(--wind-glow);
  --color-quake:        var(--quake);        --glow-quake:        var(--quake-glow);
  --color-chemical:     var(--chemical);     --glow-chemical:     var(--chemical-glow);
  --color-power:        var(--power);        --glow-power:        var(--power-glow);
  --color-water-supply: var(--water-supply); --glow-water-supply: var(--water-supply-glow);
  --color-oil:          var(--oil);          --glow-oil:          var(--oil-glow);
  --color-gold:         var(--gold);         --glow-gold:         var(--gold-glow);

  /* Status */
  --status-danger:  #f85149;
  --status-warning: #d29922;
  --status-ok:      #3fb950;
  --status-info:    #58a6ff;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
  --transition: 180ms cubic-bezier(0.16,1,0.3,1);

  /* Font — Sarabun ไทย อ่านง่ายเหมือน Facebook, fallback ครอบคลุมทุก OS */
  --font: 'Sarabun', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;

  /* Fluid font size — เล็กบนมือถือ ใหญ่บนจอใหญ่ */
  --text-base:   clamp(15px, 1.5vw, 17px);
  --text-sm:     clamp(12px, 1.2vw, 14px);
  --text-xs:     clamp(11px, 1.1vw, 12px);
  --text-lg:     clamp(16px, 1.8vw, 18px);
  --text-xl:     clamp(18px, 2vw, 22px);
  --text-2xl:    clamp(22px, 2.5vw, 28px);
  --line-height: 1.7;
}

/* Light mode — professional neutral palette */
[data-theme="light"] {
  --bg:         #eef1f7;
  --bg-card:    #ffffff;
  --bg-card2:   #f6f8fb;
  --bg-sidebar: #1a1f2e;
  --border:     #cdd5e0;
  --border-sub: #dfe5ef;
  --text:       #0f172a;
  --text-muted: #4e6080;
  --text-faint: #8699b5;
  --primary:    #1d6fe5;
  --shadow:     0 1px 3px rgba(15,23,42,0.06), 0 4px 16px rgba(15,23,42,0.08);

  /* Softer glow — all hazard types */
  --fire-glow:          rgba(255,123,41,0.07);
  --air-glow:           rgba(224,92,127,0.07);
  --flood-glow:         rgba(56,189,248,0.07);
  --weather-glow:       rgba(251,191,36,0.07);
  --pm10-glow:          rgba(167,139,250,0.07);
  --rain-glow:          rgba(96,165,250,0.07);
  --wind-glow:          rgba(52,211,153,0.07);
  --quake-glow:         rgba(192,132,252,0.07);
  --chemical-glow:      rgba(74,222,128,0.07);
  --power-glow:         rgba(250,204,21,0.07);
  --water-supply-glow:  rgba(34,211,238,0.07);
  --oil-glow:           rgba(251,146,60,0.07);
  --gold-glow:          rgba(234,179,8,0.07);

  /* Aliases */
  --glow-fire:          var(--fire-glow);
  --glow-air:           var(--air-glow);
  --glow-flood:         var(--flood-glow);
  --glow-weather:       var(--weather-glow);
  --glow-pm10:          var(--pm10-glow);
  --glow-rain:          var(--rain-glow);
  --glow-wind:          var(--wind-glow);
  --glow-quake:         var(--quake-glow);
  --glow-chemical:      var(--chemical-glow);
  --glow-power:         var(--power-glow);
  --glow-water-supply:  var(--water-supply-glow);
  --glow-oil:           var(--oil-glow);
  --glow-gold:          var(--gold-glow);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Fluid base font — เล็กบนมือถือ ใหญ่บนจอใหญ่ */
  font-size: clamp(15px, 1.5vw, 17px);
}
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;          /* ดึงจาก html font-size */
  line-height: var(--line-height, 1.7);
  letter-spacing: 0.01em;  /* ช่วยให้ภาษาไทยอ่านง่ายขึ้น */
  min-height: 100dvh;
  /* ปรับสำหรับ mobile */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ── Responsive Typography Scale ── */
h1 { font-size: clamp(1.4rem, 3.5vw, 2rem);   font-weight: 700; line-height: 1.3; }
h2 { font-size: clamp(1.2rem, 2.5vw, 1.6rem);  font-weight: 700; line-height: 1.35; }
h3 { font-size: clamp(1.05rem, 2vw, 1.3rem);   font-weight: 600; line-height: 1.4; }
h4 { font-size: clamp(0.95rem, 1.5vw, 1.1rem); font-weight: 600; line-height: 1.45; }
p  { font-size: 1rem; line-height: 1.75; margin-bottom: 0.75em; }

/* ── Mobile-first text helpers ── */
.text-sm   { font-size: clamp(0.8rem, 1.2vw, 0.875rem); }
.text-xs   { font-size: clamp(0.7rem, 1vw, 0.75rem); }
.text-lg   { font-size: clamp(1rem, 1.8vw, 1.125rem); }

/* ── Touch targets ≥ 44px สำหรับมือถือ ── */
button, a, [role="button"] { touch-action: manipulation; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
img { display: block; max-width: 100%; }

/* ============================================================
   Navbar
   ============================================================ */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
}
.nav-logo .logo-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, #ff7b29, #e05c7f);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}
.nav-logo .logo-text { line-height: 1.2; }
.nav-logo .logo-th { font-size: 15px; font-weight: 700; }
.nav-logo .logo-en { font-size: 10px; color: var(--text-muted); }

.nav-links {
  display: flex;
  list-style: none;
  gap: 4px;
  flex: 1;
  justify-content: center;
}
.nav-links a {
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
}
.nav-links a:hover { color: var(--text); background: var(--border-sub); }
.nav-links a.active {
  background: var(--text);
  color: var(--bg-card);
  font-weight: 600;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 220px;
  justify-content: flex-end;
}
.live-badge {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: rgba(63,185,80,0.1);
  border: 1px solid rgba(63,185,80,0.25);
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  color: var(--status-ok);
}
.live-dot {
  width: 7px; height: 7px;
  background: var(--status-ok);
  border-radius: 50%;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}
.nav-clock {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: 1px;
}
.btn-login {
  padding: 6px 16px;
  background: #1d6fe5;
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: background var(--transition);
}
.btn-login:hover { background: #1558c0; }
.btn-theme {
  width: 34px; height: 34px;
  background: var(--border-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-size: 16px;
  transition: all var(--transition);
}
.btn-theme:hover { color: var(--text); background: var(--border); }

/* ============================================================
   Ticker Bar
   ============================================================ */
.ticker-bar {
  position: fixed;
  top: 56px; left: 0; right: 0;
  z-index: 99;
  background: rgba(30,22,10,0.95);
  border-bottom: 1px solid rgba(255,123,41,0.2);
  height: 36px;
  display: flex;
  align-items: center;
  overflow: hidden;
}
[data-theme="light"] .ticker-bar {
  background: rgba(255,243,230,0.97);
  border-bottom-color: rgba(255,123,41,0.3);
}
.ticker-label {
  flex-shrink: 0;
  padding: 0 14px;
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #ff7b29;
  background: rgba(255,123,41,0.12);
  height: 100%;
  border-right: 1px solid rgba(255,123,41,0.2);
}
.ticker-content {
  flex: 1;
  overflow: hidden;
  position: relative;
}
.ticker-inner {
  display: flex;
  white-space: nowrap;
  animation: ticker 45s linear infinite;
}
.ticker-inner:hover { animation-play-state: paused; }
@keyframes ticker {
  0% { transform: translateX(100%); }
  100% { transform: translateX(-100%); }
}
.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 28px;
  font-size: 13px;
  color: var(--text);
}
.ticker-item .ticker-time {
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
}
.ticker-sep { color: var(--text-faint); padding: 0 8px; }

/* ============================================================
   Main Layout
   ============================================================ */
.page-wrap {
  padding-top: calc(56px + 36px + 20px);
  padding-bottom: 48px;
  max-width: 1400px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

/* ============================================================
   Section Header
   ============================================================ */
.section-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 16px;
}
.section-title {
  font-size: 16px;
  font-weight: 700;
}
.badge-pill {
  display: inline-flex; align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
}
.badge-green  { background: rgba(63,185,80,0.15);  color: var(--status-ok); }
.badge-red    { background: rgba(248,81,73,0.15);   color: var(--status-danger); }
.badge-orange { background: rgba(255,123,41,0.15);  color: var(--fire); }
.badge-blue   { background: rgba(56,189,248,0.15);  color: var(--flood); }

/* ============================================================
   KPI Cards Grid
   ============================================================ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid color-mix(in srgb, var(--card-color, var(--fire)) 22%, var(--border));
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
  cursor: default;
  box-shadow:
    0 2px 8px rgba(0,0,0,0.35),
    inset 0 1px 0 rgba(255,255,255,0.04);
}
.kpi-card:hover {
  transform: translateY(-4px) scale(1.01);
  border-color: color-mix(in srgb, var(--card-color, var(--fire)) 55%, transparent);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--card-color, var(--fire)) 30%, transparent),
    0 8px 32px rgba(0,0,0,0.45),
    0 0 40px color-mix(in srgb, var(--card-color, var(--fire)) 25%, transparent);
}

/* Top accent bar with glow */
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--card-color, var(--fire)) 60%, transparent),
    var(--card-color, var(--fire)),
    color-mix(in srgb, var(--card-color, var(--fire)) 60%, transparent)
  );
  box-shadow:
    0 0 8px var(--card-color, var(--fire)),
    0 0 20px color-mix(in srgb, var(--card-color, var(--fire)) 50%, transparent);
}

/* Ambient glow blob */
.kpi-card .card-glow-bg {
  position: absolute;
  top: -10px; right: -10px;
  width: 100px; height: 100px;
  background: radial-gradient(circle, var(--card-glow, var(--fire-glow)) 0%, transparent 70%);
  filter: blur(20px);
  pointer-events: none;
  transition: opacity var(--transition);
  opacity: 0.7;
}
.kpi-card:hover .card-glow-bg {
  opacity: 1;
  transform: scale(1.3);
}

/* Bottom ambient glow on hover */
.kpi-card::after {
  content: '';
  position: absolute;
  bottom: -20px; left: 10%; right: 10%;
  height: 40px;
  background: radial-gradient(ellipse, var(--card-glow, var(--fire-glow)) 0%, transparent 70%);
  filter: blur(12px);
  opacity: 0;
  transition: opacity var(--transition);
  pointer-events: none;
}
.kpi-card:hover::after {
  opacity: 1;
}

/* Danger pulse animation */
.kpi-card.status-danger {
  animation: card-danger-pulse 2.5s ease-in-out infinite;
}
@keyframes card-danger-pulse {
  0%, 100% {
    box-shadow:
      0 2px 8px rgba(0,0,0,0.35),
      0 0 0 0 color-mix(in srgb, var(--card-color, var(--fire)) 40%, transparent);
  }
  50% {
    box-shadow:
      0 2px 8px rgba(0,0,0,0.35),
      0 0 0 6px color-mix(in srgb, var(--card-color, var(--fire)) 12%, transparent);
  }
}
.kpi-icon { font-size: 24px; margin-bottom: 10px; display: block; }
.kpi-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
  line-height: 1.3;
}
.kpi-value {
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  color: var(--card-color, var(--fire));
  margin-bottom: 6px;
  font-variant-numeric: tabular-nums lining-nums;
}
.kpi-unit {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 2px;
}
.kpi-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 600;
  margin-bottom: 8px;
}
.status-danger  { background: rgba(248,81,73,0.15);  color: var(--status-danger); }
.status-warning { background: rgba(210,153,34,0.15); color: var(--status-warning); }
.status-ok,
.status-normal  { background: rgba(63,185,80,0.15);  color: var(--status-ok); }
.status-info    { background: rgba(88,166,255,0.15); color: var(--status-info); }

.kpi-meta {
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 6px;
  line-height: 1.4;
}

/* skeleton loader */
.kpi-card.loading .kpi-value,
.kpi-card.loading .kpi-label,
.kpi-card.loading .kpi-status {
  background: var(--border);
  color: transparent;
  border-radius: 4px;
  animation: shimmer 1.5s infinite;
}
@keyframes shimmer {
  0%,100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* ============================================================
   Two-column: Alerts + Map
   ============================================================ */
.two-col {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .two-col { grid-template-columns: 1fr; }
}

/* Alert Panel */
.alert-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 520px;
}
.alert-panel-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-list {
  overflow-y: auto;
  flex: 1;
  overscroll-behavior: contain;
}
.alert-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-sub);
  transition: background var(--transition);
}
.alert-item:hover { background: var(--border-sub); }
.alert-item:last-child { border-bottom: none; }
.alert-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.dot-flood   { background: var(--flood); }
.dot-fire    { background: var(--fire); }
.dot-air     { background: var(--air); }
.dot-rain    { background: var(--rain); }
.dot-quake   { background: var(--quake); }
.dot-storm   { background: var(--wind); }
.dot-general { background: var(--text-muted); }
.dot-landslide { background: #a16207; }

.alert-info { flex: 1; }
.alert-type {
  font-size: 13px;
  font-weight: 700;
  line-height: 1.3;
}
.alert-type.flood   { color: var(--flood); }
.alert-type.fire    { color: var(--fire); }
.alert-type.air     { color: var(--air); }
.alert-type.quake   { color: var(--quake); }
.alert-type.general { color: var(--text); }
.alert-body {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
}
.alert-meta {
  display: flex; align-items: center; gap: 4px;
  font-size: 10px;
  color: var(--text-faint);
  margin-top: 4px;
}
.alert-time {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-faint);
  margin-top: 2px;
  flex-shrink: 0;
}

/* Map Panel */
.map-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.map-panel-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.map-panel-header-left { display: flex; align-items: center; gap: 8px; flex: 1; }
.map-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.map-filter-btn {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  transition: all var(--transition);
}
.map-filter-btn:hover { border-color: var(--text-muted); color: var(--text); }
.map-filter-btn.active {
  background: var(--text);
  color: var(--bg-card);
  border-color: var(--text);
}
#disaster-map {
  height: 420px;
  flex: 1;
}

/* ============================================================
   News / Cards Grid
   ============================================================ */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
}
.news-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.news-card-thumb {
  height: 140px;
  background: var(--bg-card2);
  display: flex; align-items: center; justify-content: center;
  font-size: 52px;
  position: relative;
  overflow: hidden;
}
.news-card-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  position: absolute; top: 0; left: 0;
}
.news-card-badge {
  position: absolute; top: 10px; right: 10px;
  padding: 2px 8px;
  background: rgba(0,0,0,0.6);
  border-radius: var(--radius-pill);
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  backdrop-filter: blur(4px);
}
.news-card-cat {
  position: absolute; top: 10px; left: 10px;
  padding: 2px 8px;
  background: rgba(0,0,0,0.55);
  border-radius: var(--radius-pill);
  font-size: 10px;
  color: #fff;
  backdrop-filter: blur(4px);
}
.news-card-body { padding: 14px; flex: 1; display: flex; flex-direction: column; }
.news-card-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card-excerpt {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.news-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border-sub);
}
.news-card-date { font-size: 11px; color: var(--text-faint); }
.btn-download {
  padding: 5px 12px;
  background: rgba(88,166,255,0.1);
  color: var(--primary);
  border: 1px solid rgba(88,166,255,0.25);
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 600;
  transition: all var(--transition);
}
.btn-download:hover { background: rgba(88,166,255,0.2); }
.news-views { font-size: 11px; color: var(--text-muted); }

/* ============================================================
   API Sources Bar
   ============================================================ */
.api-bar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}
.api-bar-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.api-sources { display: flex; gap: 8px; flex-wrap: wrap; }
.api-source {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
  padding: 3px 10px;
  border: 1px solid var(--border-sub);
  border-radius: var(--radius-pill);
}
.api-source .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.dot-ok { background: var(--status-ok); }
.dot-err { background: var(--status-danger); }

/* ============================================================
   Footer
   ============================================================ */
.footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 48px 24px 0;
}
.footer-grid {
  max-width: 1400px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr;
  gap: 24px;
  padding-bottom: 32px;
}
@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}
.footer-brand-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 10px;
  display: flex; align-items: center; gap: 8px;
}
.footer-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 16px; }
.social-links { display: flex; gap: 8px; }
.social-btn {
  width: 36px; height: 36px;
  background: var(--border-sub);
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  transition: all var(--transition);
}
.social-btn:hover { background: var(--border); transform: translateY(-2px); }

.footer-col-title { font-size: 13px; font-weight: 700; margin-bottom: 14px; color: var(--text); }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links li a {
  font-size: 13px;
  color: var(--text-muted);
  transition: color var(--transition);
  display: flex; align-items: center; gap: 6px;
}
.footer-links li a:hover { color: var(--text); }

.footer-team { display: flex; flex-direction: column; gap: 10px; }
.team-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  background: var(--border-sub);
  border-radius: var(--radius-sm);
}
.team-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
}
.team-name { font-size: 12px; font-weight: 600; }
.team-role { font-size: 10px; color: var(--text-muted); }

.footer-bottom {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-faint);
  gap: 12px;
  flex-wrap: wrap;
}
.footer-bottom a { color: var(--text-muted); }
.footer-bottom a:hover { color: var(--text); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
  .container { padding: 0 16px; }
}
@media (max-width: 768px) {
  .navbar { padding: 0 14px; }
  .nav-links { display: none; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .page-wrap { padding-left: 12px; padding-right: 12px; }
  .news-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card { padding: 12px; }
  .card-value { font-size: clamp(22px, 5vw, 28px); }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .news-grid { grid-template-columns: 1fr; }
  .kpi-card { padding: 10px; }
  .card-label { font-size: 10px; }
  .card-value { font-size: clamp(20px, 6vw, 26px); }
  .card-icon  { font-size: 20px; }
  .section-header { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ============================================================
   Detail Modal
   ============================================================ */
/* cursor pointer บนการ์ดที่คลิกได้ */
.kpi-card { cursor: pointer; }
.kpi-card:focus-visible {
  outline: 2px solid var(--card-color, var(--fire));
  outline-offset: 2px;
}

/* detail table */
.detail-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.detail-table th {
  text-align: left; padding: 7px 10px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em;
  border-bottom: 1px solid var(--border);
}
.detail-table td {
  padding: 8px 10px; border-bottom: 1px solid var(--border-sub);
  color: var(--text); vertical-align: middle;
}
.detail-table tr:last-child td { border-bottom: none; }
.detail-table tr:hover td { background: var(--border-sub); }

/* stat row (ราคา/สรุป) */
.detail-stats { display: grid; grid-template-columns: repeat(auto-fit,minmax(130px,1fr)); gap: 10px; margin-bottom: 14px; }
.detail-stat {
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: center;
}
.detail-stat-label { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.detail-stat-value { font-size: 22px; font-weight: 800; color: var(--card-color, var(--primary)); font-variant-numeric: tabular-nums; }
.detail-stat-unit  { font-size: 12px; color: var(--text-muted); margin-left: 2px; }

/* badge row */
.detail-badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.detail-badge {
  padding: 4px 12px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
}

/* empty state */
.detail-empty { text-align: center; padding: 32px 16px; color: var(--text-muted); font-size: 14px; }

/* ============================================================
   AdSense Banner
   ============================================================ */
.adsense-banner {
  max-width: 1400px;
  margin: 0 auto 20px;
  padding: 0 20px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.adsense-banner ins { display: block; width: 100%; }
@media (max-width: 768px) {
  .adsense-banner { min-height: 60px; padding: 0 12px; }
}

/* News grid */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.news-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform var(--transition), box-shadow var(--transition);
}
.news-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}
.news-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Leaflet dark override */
[data-theme="dark"] .leaflet-tile { filter: brightness(0.6) invert(1) contrast(3) hue-rotate(200deg) saturate(0.3) brightness(0.7); }
.leaflet-control-zoom a { background: var(--bg-card) !important; color: var(--text) !important; border-color: var(--border) !important; }

/* ============================================================
   PATCH — classes used in server HTML (index.php v1)
   เพิ่ม CSS ให้ตรงกับ HTML ที่ deploy บน server
   ============================================================ */

/* Layout wrappers */
.main-content { padding-top: calc(56px + 36px + 20px); padding-bottom: 48px; }
.container { max-width: 1400px; margin: 0 auto; padding: 0 20px; }
.kpi-section { margin-bottom: 24px; }

/* Navbar patch */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: var(--bg-card); border-bottom: 1px solid var(--border);
  height: 56px; display: flex; align-items: center; padding: 0 20px; gap: 16px; }
.navbar-inner { display: flex; align-items: center; width: 100%; gap: 16px; }
.navbar-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; }
.brand-logo { flex-shrink: 0; color: var(--fire); }
.brand-text { line-height: 1.2; }
.brand-name { font-size: 15px; font-weight: 700; display: block; }
.brand-sub  { font-size: 10px; color: var(--text-muted); display: block; }
.navbar-clock { margin-left: auto; text-align: right; }
.clock-date { font-size: 10px; color: var(--text-muted); }
.clock-time { font-family: var(--font-mono); font-size: 14px; font-weight: 600; letter-spacing: 1px; }
.navbar-nav { display: flex; gap: 4px; align-items: center; }
.nav-link { padding: 6px 12px; border-radius: var(--radius-pill); font-size: 13px;
  font-weight: 500; color: var(--text-muted); transition: all var(--transition); text-decoration: none; }
.nav-link:hover { color: var(--text); background: var(--border-sub); }
.nav-link.active { background: var(--text); color: var(--bg-card); font-weight: 600; }
.navbar-controls { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.btn-icon { width: 34px; height: 34px; background: var(--border-sub); border: 1px solid var(--border);
  border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 16px; transition: all var(--transition); }
.btn-icon:hover { color: var(--text); background: var(--border); }
.nav-badge { display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; background: var(--status-danger); color: #fff;
  border-radius: 50%; font-size: 10px; font-weight: 700; margin-left: 4px; }
.mobile-only { display: none; }
@media (max-width: 768px) { .mobile-only { display: flex; } .navbar-nav { display: none; } .navbar-nav.open { display: flex; flex-direction: column; position: absolute; top: 56px; left: 0; right: 0; background: var(--bg-card); border-bottom: 1px solid var(--border); padding: 8px; z-index: 99; } }

/* Ticker patch */
.ticker-bar { position: fixed; top: 56px; left: 0; right: 0; z-index: 99;
  background: rgba(30,22,10,0.95); border-bottom: 1px solid rgba(255,123,41,0.2);
  height: 36px; display: flex; align-items: center; overflow: hidden; }
[data-theme="light"] .ticker-bar { background: rgba(255,243,230,0.97); }
.ticker-label { flex-shrink: 0; padding: 0 14px; display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700; color: #ff7b29; background: rgba(255,123,41,0.12);
  height: 100%; border-right: 1px solid rgba(255,123,41,0.2); }
.ticker-track { flex: 1; overflow: hidden; position: relative; }
.ticker-content { display: flex; white-space: nowrap; animation: ticker 50s linear infinite; }
.ticker-content:hover { animation-play-state: paused; }
@keyframes ticker { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.ticker-item { display: inline-flex; align-items: center; gap: 6px;
  padding: 0 24px; font-size: 13px; color: var(--text); }
.ticker-sep { color: var(--text-faint); padding: 0 8px; }

/* Section header */
.section-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; padding: 0; }
.section-header .section-title { font-size: 16px; font-weight: 700; }
.title-icon { font-size: 18px; }
.section-subtitle { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

/* KPI card inner elements */
.card-inner { position: relative; z-index: 1; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.card-icon  { font-size: clamp(22px, 2.5vw, 28px); }
.card-label { font-size: clamp(11px, 1.1vw, 13px); color: var(--text-muted); margin-bottom: 4px; line-height: 1.4; font-weight: 500; }
.card-value-row { display: flex; align-items: baseline; gap: 4px; margin-bottom: 6px; }
.card-value {
  font-size: clamp(28px, 3.5vw, 36px);
  font-weight: 800; line-height: 1;
  color: var(--card-color, var(--fire));
  font-variant-numeric: tabular-nums lining-nums;
  text-shadow: 0 0 20px color-mix(in srgb, var(--card-color, var(--fire)) 40%, transparent);
}
.card-unit  { font-size: clamp(12px, 1.2vw, 14px); color: var(--text-muted); font-weight: 500; }
.card-status {
  display: inline-block; padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: clamp(10px, 1vw, 12px); font-weight: 700; letter-spacing: 0.03em;
}
.card-meta  { font-size: clamp(10px, 1vw, 12px); color: var(--text-faint); margin-top: 6px; line-height: 1.5; }
.kpi-card.loading .card-value,
.kpi-card.loading .card-label,
.kpi-card.loading .card-status { background: var(--border); color: transparent; border-radius: 4px; animation: shimmer 1.5s infinite; }

/* Two-column: Map + Alerts */
.two-col-section { margin-bottom: 24px; }
.two-col-grid { display: grid; grid-template-columns: 1fr 300px; gap: 16px; }
@media (max-width: 900px) { .two-col-grid { grid-template-columns: 1fr; } }
.col-map, .col-alerts { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.panel-header { padding: 12px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-title { font-size: 14px; font-weight: 700; margin: 0; }
.panel-link { font-size: 12px; color: var(--primary); text-decoration: none; white-space: nowrap; }
.map-container { height: 420px; flex: 1; }
.map-loading { height: 420px; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 14px; }
.map-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.legend-item { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted); }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* Alert timeline (col-alerts) */
.col-alerts .alert-list { overflow-y: auto; flex: 1; max-height: 420px; }
.alert-item { padding: 12px 16px; border-bottom: 1px solid var(--border-sub); display: flex; align-items: flex-start; gap: 10px; }
.alert-item:last-child { border-bottom: none; }
.alert-icon { font-size: 20px; flex-shrink: 0; }
.alert-body { flex: 1; }
.alert-title { font-size: 13px; font-weight: 700; line-height: 1.3; margin-bottom: 2px; }
.alert-meta  { font-size: 10px; color: var(--text-faint); }
.alert-badge { flex-shrink: 0; padding: 2px 8px; border-radius: var(--radius-pill); font-size: 10px; font-weight: 600; }
.level-danger  { background: rgba(248,81,73,0.15);  color: var(--status-danger); }
.level-warning { background: rgba(210,153,34,0.15); color: var(--status-warning); }
.level-info    { background: rgba(88,166,255,0.15); color: var(--status-info); }
.level-ok      { background: rgba(63,185,80,0.15);  color: var(--status-ok); }
.alert-empty   { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }
.alert-loading { padding: 24px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* News section */
.news-section { margin-bottom: 24px; }
.section-header-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-heading { font-size: 16px; font-weight: 700; }
.news-card-img-wrap { height: 140px; background: var(--bg-card2); display: flex; align-items: center;
  justify-content: center; font-size: 48px; overflow: hidden; position: relative; }
.news-card-img-placeholder { font-size: 48px; color: var(--text-faint); }
.news-card-img { width: 100%; height: 100%; object-fit: cover; position: absolute; top: 0; left: 0; }
.news-cat { display: inline-block; padding: 2px 8px; background: rgba(0,0,0,0.55);
  border-radius: var(--radius-pill); font-size: 10px; color: #fff; margin-bottom: 6px; }
.news-title { font-size: 14px; font-weight: 700; line-height: 1.4; margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-title a { color: var(--text); text-decoration: none; }
.news-title a:hover { color: var(--primary); }
.news-excerpt { font-size: 12px; color: var(--text-muted); line-height: 1.5; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.news-meta { font-size: 11px; color: var(--text-faint); margin-top: 10px;
  padding-top: 10px; border-top: 1px solid var(--border-sub); }

/* Sources bar */
.sources-bar { margin-bottom: 32px; }
.sources-inner { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 20px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sources-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.sources-list { display: flex; gap: 8px; flex-wrap: wrap; }
.source-chip { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--text-muted);
  padding: 3px 10px; border: 1px solid var(--border-sub); border-radius: var(--radius-pill);
  text-decoration: none; transition: all var(--transition); }
.source-chip:hover { color: var(--text); border-color: var(--border); }

/* Footer patch */
.site-footer { background: var(--bg-card); border-top: 1px solid var(--border); padding: 48px 24px 0; }
.footer-grid { max-width: 1400px; margin: 0 auto; display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 24px; padding-bottom: 32px; }
@media (max-width: 768px) { .footer-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .footer-grid { grid-template-columns: 1fr; } }
.footer-logo { font-size: 17px; font-weight: 700; margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.footer-col.footer-brand .footer-desc { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin-bottom: 8px; }
.footer-disclaimer { font-size: 11px; color: var(--text-faint); line-height: 1.5; }
.footer-heading { font-size: 13px; font-weight: 700; margin-bottom: 14px; }
.footer-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-links li a { font-size: 13px; color: var(--text-muted); text-decoration: none;
  display: flex; align-items: center; gap: 6px; transition: color var(--transition); }
.footer-links li a:hover { color: var(--text); }
.footer-bottom { max-width: 1400px; margin: 0 auto; padding: 16px 0;
  border-top: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; font-size: 12px; color: var(--text-faint); gap: 12px; flex-wrap: wrap; }
.footer-copy { color: var(--text-faint); }
.footer-attr a, .pplx-attr { color: var(--text-muted); text-decoration: none; }
.footer-attr a:hover, .pplx-attr:hover { color: var(--text); }

/* Buttons */
.btn-outline { display: inline-flex; align-items: center; padding: 6px 14px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px;
  color: var(--text-muted); text-decoration: none; transition: all var(--transition); }
.btn-outline:hover { border-color: var(--text-muted); color: var(--text); }
.btn-primary-sm { display: inline-block; padding: 6px 14px; background: var(--primary);
  color: #fff; border-radius: var(--radius-sm); font-size: 12px; font-weight: 600; text-decoration: none; }

/* Light mode overrides for patch classes */
[data-theme="light"] .navbar { background: #fff; border-bottom-color: #e2e8f0; }
[data-theme="light"] .ticker-bar { background: rgba(255,243,230,0.97); border-bottom-color: rgba(255,123,41,0.3); }
[data-theme="light"] .col-map,
[data-theme="light"] .col-alerts { background: #fff; border-color: #e2e8f0; }
[data-theme="light"] .news-cat { background: rgba(0,0,0,0.35); }
[data-theme="light"] .site-footer { background: #fff; border-top-color: #e2e8f0; }

/* Leaflet map in .map-container */
.map-container { height: 420px; }
#disaster-map { height: 420px; }

/* ============================================================
   MAP HEIGHT FIX — บังคับ height สำหรับ col-map flex container
   ============================================================ */
.col-map {
  min-height: 480px;
  display: flex;
  flex-direction: column;
}
.col-map .panel-header {
  flex-shrink: 0;
}
.map-container,
#disaster-map {
  height: 420px !important;
  min-height: 420px !important;
  width: 100% !important;
  flex: 1;
  display: block !important;
  position: relative;
  z-index: 1;
}
/* ซ่อน loading text เมื่อแผนที่ขึ้นแล้ว */
.leaflet-container ~ .map-loading,
.leaflet-container + .map-loading {
  display: none !important;
}
/* two-col-grid height */
.two-col-grid {
  align-items: stretch;
}

/* ============================================================
   COMMENTS SECTION — article.php
   ============================================================ */
.comments-section {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border, #30363d);
}
.comments-heading {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.comments-count {
  background: var(--color-fire, #ff7b29);
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  padding: .15rem .5rem;
  border-radius: 1rem;
  line-height: 1.4;
}
.comments-list { list-style: none; padding: 0; margin: 0 0 2rem; }
.comment-item {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border, #30363d);
}
.comment-item:last-child { border-bottom: none; margin-bottom: 0; }
.comment-avatar {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-fire, #ff7b29), #e84393);
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.comment-body { flex: 1; }
.comment-meta { display: flex; gap: .75rem; align-items: baseline; flex-wrap: wrap; margin-bottom: .4rem; }
.comment-author { font-weight: 600; font-size: .9rem; }
.comment-date { font-size: .75rem; color: var(--text-muted); }
.comment-text { font-size: .9rem; line-height: 1.7; color: var(--text-muted); }
.comments-empty { color: var(--text-muted); font-size: .9rem; margin-bottom: 1.5rem; }
.comments-closed { color: var(--text-muted); font-size: .875rem; margin-top: 1rem; }
.comment-notice {
  padding: .75rem 1rem;
  border-radius: .5rem;
  margin-bottom: 1.25rem;
  font-size: .875rem;
}
.comment-notice-ok  { background: rgba(63,185,80,.12); border: 1px solid #3fb950; color: #3fb950; }
.comment-notice-err { background: rgba(248,81,73,.12); border: 1px solid #f85149; color: #f85149; }
.comment-form-wrap { margin-top: 1.5rem; }
.comment-form-title { font-size: 1rem; font-weight: 700; margin-bottom: 1rem; }
.comment-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 600px) { .comment-form-row { grid-template-columns: 1fr; } }
.form-group-inline label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-bottom: .35rem;
}
.form-group-inline input,
.form-group-inline textarea {
  width: 100%;
  padding: .65rem 1rem;
  background: var(--bg-deep, #0d1117);
  border: 1px solid var(--border, #30363d);
  border-radius: .5rem;
  color: var(--text);
  font-size: .9rem;
  font-family: inherit;
  box-sizing: border-box;
}
.form-group-inline textarea { resize: vertical; }
.btn-comment-submit {
  padding: .75rem 1.5rem;
  background: linear-gradient(135deg, var(--color-fire, #ff7b29), #e84393);
  color: #fff;
  border: none;
  border-radius: .5rem;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

/* ============================================================
   ACTIVE INCIDENTS BAR — หน้า index.php
   ============================================================ */
.active-incidents-bar {
  background: rgba(255,123,41,0.08);
  border: 1px solid rgba(255,123,41,0.2);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.incidents-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--fire);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 6px;
}
.incidents-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  flex: 1;
}
.incident-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--bg-card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  transition: all var(--transition);
}
.incident-chip:hover { border-color: var(--fire); color: var(--fire); }
.incident-chip-type {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  background: rgba(255,123,41,0.15);
  color: var(--fire);
}
.incident-chip-type.type-power  { background: rgba(250,204,21,0.15); color: var(--power); }
.incident-chip-type.type-water  { background: rgba(34,211,238,0.15); color: var(--water-supply); }
.incident-chip-type.type-flood  { background: rgba(56,189,248,0.15); color: var(--flood); }
.incident-chip-type.type-quake  { background: rgba(192,132,252,0.15); color: var(--quake); }
.incident-chip-type.type-fire   { background: rgba(255,123,41,0.15); color: var(--fire); }
.incident-chip-type.type-scam   { background: rgba(248,81,73,0.15);  color: var(--status-danger); }
.incident-chip-type.type-accident { background: rgba(248,81,73,0.15); color: var(--status-danger); }
.incidents-empty { font-size: 12px; color: var(--status-ok); }

/* ============================================================
   LIGHT MODE — Professional overrides
   ============================================================ */

/* Navbar: clean white + shadow instead of flat border */
[data-theme="light"] .navbar,
[data-theme="light"] .navbar-inner {
  background: #ffffff;
  border-bottom: 1px solid #e0e6ef;
  box-shadow: 0 1px 8px rgba(15,23,42,0.07);
}
[data-theme="light"] .nav-link:hover { background: #eef1f7; }
[data-theme="light"] .nav-link.active { background: #0f172a; color: #fff; }

/* Ticker: warm amber, readable */
[data-theme="light"] .ticker-bar {
  background: rgba(254,243,220,0.98);
  border-bottom-color: rgba(180,110,30,0.2);
}
[data-theme="light"] .ticker-item { color: #2d3748; }

/* KPI cards: depth with shadow, softer glow */
[data-theme="light"] .kpi-card {
  box-shadow: 0 1px 4px rgba(15,23,42,0.06), 0 4px 14px rgba(15,23,42,0.08);
  border-color: rgba(15,23,42,0.07);
}
[data-theme="light"] .kpi-card:hover {
  box-shadow: 0 4px 24px rgba(15,23,42,0.14);
  border-color: color-mix(in srgb, var(--card-color, var(--fire)) 35%, transparent);
}
[data-theme="light"] .kpi-card .card-glow-bg { opacity: 0.35; }
[data-theme="light"] .kpi-card::before { opacity: 0.75; }

/* Cards: kpi-value text shadow off (too garish on white) */
[data-theme="light"] .card-value { text-shadow: none; }

/* Alert + Map panels */
[data-theme="light"] .col-map,
[data-theme="light"] .col-alerts,
[data-theme="light"] .alert-panel,
[data-theme="light"] .map-panel {
  box-shadow: 0 1px 4px rgba(15,23,42,0.06), 0 4px 14px rgba(15,23,42,0.08);
  border-color: #d4dce8;
  background: #ffffff;
}
[data-theme="light"] .panel-header { border-bottom-color: #e0e6ef; }

/* News cards */
[data-theme="light"] .news-card {
  box-shadow: 0 1px 4px rgba(15,23,42,0.05), 0 4px 12px rgba(15,23,42,0.07);
  border-color: #d8e0ec;
}
[data-theme="light"] .news-card:hover { box-shadow: 0 6px 24px rgba(15,23,42,0.12); }

/* Alert items */
[data-theme="light"] .alert-item:hover { background: #f0f4fa; }
[data-theme="light"] .alert-item { border-bottom-color: #e5ecf5; }

/* Sources/API bar */
[data-theme="light"] .sources-inner { background: #ffffff; border-color: #d4dce8; box-shadow: 0 1px 4px rgba(15,23,42,0.05); }
[data-theme="light"] .source-chip { border-color: #d4dce8; }
[data-theme="light"] .source-chip:hover { border-color: #4e6080; }

/* Footer */
[data-theme="light"] .site-footer { background: #edf1f7; border-top-color: #cdd5e0; }
[data-theme="light"] .footer-bottom { border-top-color: #cdd5e0; }

/* Map filter buttons */
[data-theme="light"] .map-filter-btn.active { background: #0f172a; color: #fff; border-color: #0f172a; }
[data-theme="light"] .map-filter-btn:hover { border-color: #4e6080; color: #0f172a; }

/* Section heading bar */
[data-theme="light"] .section-header-row { border-bottom: none; }

/* Comment form inputs */
[data-theme="light"] .form-group-inline input,
[data-theme="light"] .form-group-inline textarea {
  background: #f6f8fb;
  border-color: #cdd5e0;
  color: #0f172a;
}

/* Leaflet map tiles — keep dark in light mode for readability */
[data-theme="light"] .leaflet-tile {
  filter: brightness(0.9) saturate(0.85);
}

/* Active incidents banner — light mode */
[data-theme="light"] .active-incidents-bar {
  background: #fff7ed;
  border-color: #fed7aa;
}
[data-theme="light"] .incident-chip {
  background: #ffffff;
  border-color: #e2cdb4;
  color: #7c4a1a;
}
[data-theme="light"] .incident-chip:hover { background: #fff7ed; }
