    .chart-container {
        width: 100%;
        height: 450px; /* คุณสามารถใช้ height: 600px ได้เหมือนเดิม */
        background-color: #000000;
        padding: 40px;
        border-radius: 10px;
        border: 2px solid #1a1a40; 
        box-shadow: 0 0 20px rgba(65, 105, 225, 0.3); 
        color: rgb(0, 0, 0); 
        display: flex;
        flex-direction: column;
        align-items: center;
    }

   
    h2 {
        text-align: left;
        color: #f7f5f5;
    }

    /* button {
        margin-top: 30px;
        padding: 10px 20px;
        background-color: #007bff;
        color: #fff;
        border: none;
        align-items: center;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
        border-radius: 5px;
        cursor: pointer;
    } */

    .btn-shw-search {
        /* กำหนดให้ปุ่มลอยค้างที่หน้าจอ */
        position: fixed;
        
        /* การกำหนดตำแหน่ง (ปรับตัวเลขตามต้องการ) */
        top: 150px;  /* ห่างจากขอบล่าง */
        right: 8px;   /* ห่างจากขอบขวา */
        
        /* ขนาดและรูปร่าง */
        width: 40px;
        height: 40px;
        border-radius: 50%; /* ทำให้เป็นวงกลม */
        
        /* สีตามรูปภาพของคุณ */
        background-color: #3874f5; /* สีฟ้า */
        color: white;
        border: none;
        
        /* จัดวางไอคอนให้อยู่กลางปุ่ม */
        display: flex;
        justify-content: center;
        align-items: center;
        
        /* เงาและเลเยอร์ */
        box-shadow: 0 4px 8px rgba(249, 0, 0, 0.3);
        z-index: 9999; /* ให้ลอยทับทุกองค์ประกอบ */
        
        cursor: pointer;
        transition: all 0.3s ease;
    }

    /* เอฟเฟกต์เมื่อเอาเมาส์ไปชี้ */
    .btn-shw-search:hover {
        background-color: #3874f5;
        transform: scale(1.2); /* ขยายใหญ่ขึ้นเล็กน้อย */
    }

    .btn-shw-chart {
        /* กำหนดให้ปุ่มลอยค้างที่หน้าจอ */
        position: fixed;
        
        /* การกำหนดตำแหน่ง (ปรับตัวเลขตามต้องการ) */
        top: 200px;  /* ห่างจากขอบล่าง */
        right: 8px;   /* ห่างจากขอบขวา */
        
        /* ขนาดและรูปร่าง */
        width: 40px;
        height: 40px;
        border-radius: 50%; /* ทำให้เป็นวงกลม */
        
        /* สีตามรูปภาพของคุณ */
        background-color: #3874f5; /* สีฟ้า */
        color: white;
        border: none;
        
        /* จัดวางไอคอนให้อยู่กลางปุ่ม */
        display: flex;
        justify-content: center;
        align-items: center;
        
        /* เงาและเลเยอร์ */
        box-shadow: 0 4px 8px rgba(249, 0, 0, 0.3);
        z-index: 9999; /* ให้ลอยทับทุกองค์ประกอบ */
        
        cursor: pointer;
        transition: all 0.3s ease;
    }

    /* เอฟเฟกต์เมื่อเอาเมาส์ไปชี้ */
    .btn-shw-chart:hover {
        background-color: #3874f5;
        transform: scale(1.2); /* ขยายใหญ่ขึ้นเล็กน้อย */
    }

    .btn-shw-table {
        /* กำหนดให้ปุ่มลอยค้างที่หน้าจอ */
        position: fixed;
        
        /* การกำหนดตำแหน่ง (ปรับตัวเลขตามต้องการ) */
        top: 250px;  /* ห่างจากขอบล่าง */
        right: 8px;   /* ห่างจากขอบขวา */
        
        /* ขนาดและรูปร่าง */
        width: 40px;
        height: 40px;
        border-radius: 50%; /* ทำให้เป็นวงกลม */
        
        /* สีตามรูปภาพของคุณ */
        background-color: #3874f5; /* สีฟ้า */
        color: white;
        border: none;
        
        /* จัดวางไอคอนให้อยู่กลางปุ่ม */
        display: flex;
        justify-content: center;
        align-items: center;
        
        /* เงาและเลเยอร์ */
        box-shadow: 0 4px 8px rgba(249, 0, 0, 0.3);
        z-index: 9999; /* ให้ลอยทับทุกองค์ประกอบ */
        
        cursor: pointer;
        transition: all 0.3s ease;
    }

    /* เอฟเฟกต์เมื่อเอาเมาส์ไปชี้ */
    .btn-shw-table:hover {
        background-color: #3874f5;
        transform: scale(1.2); /* ขยายใหญ่ขึ้นเล็กน้อย */
    }

    .theme-toggle-btn {
        /* กำหนดให้ปุ่มลอยค้างที่หน้าจอ */
        position: fixed;
        /* การกำหนดตำแหน่ง (ปรับตัวเลขตามต้องการ) */
        top: 100px;  /* ห่างจากขอบบน */
        left: 8px;   /* ห่างจากขอบซ้าย */

        /* ขนาดและรูปร่าง */
        width: 40px;
        height: 40px;
        border-radius: 50%; /* ทำให้เป็นวงกลม */

        /* สีตามรูปภาพของคุณ */
        background-color: #3874f5; /* สีฟ้า */
        color: white;
        border: none;

        /* จัดวางไอคอนให้อยู่กลางปุ่ม */
        display: flex;
        justify-content: center;
        align-items: center;

        /* เงาและเลเยอร์ */
        box-shadow: 0 4px 8px rgba(249, 0, 0, 0.3);
        z-index: 9999; /* ให้ลอยทับทุกองค์ประกอบ */

        cursor: pointer;
        transition: all 0.3s ease;
    }

    /* เอฟเฟกต์เมื่อเอาเมาส์ไปชี้ */
    .theme-toggle-btn:hover {
        background-color: #3874f5;
        transform: scale(1.2); /* ขยายใหญ่ขึ้นเล็กน้อย */
    }

    /* ── DETAIL PANEL (สไลด์จากด้านขวา) ── */
    #detailPanel {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        width: 400px;
        max-width: 100vw;
        z-index: 1100;
        background: rgba(255, 255, 255, 0.97);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-left: 1px solid rgba(0, 0, 0, 0.08);
        box-shadow: -8px 0 32px rgba(0, 0, 0, 0.18);
        display: flex;
        flex-direction: column;
        transform: translateX(100%);
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
        color: #1e293b;
    }
    #detailPanel.open { transform: translateX(0); }

    /* overlay หลัง panel */
    #detailOverlay {
        position: fixed;
        inset: 0;
        z-index: 1099;
        background: rgba(0, 0, 0, 0.25);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.35s;
    }
    #detailOverlay.open {
        opacity: 1;
        pointer-events: auto;
    }

    /* หัวของ panel — สีพื้นหลังถูกควบคุมโดย .dp-risk-* */
    .dp-head {
        padding: 18px 18px 14px;
        background: linear-gradient(135deg, #475569, #64748b); /* default (unknown) */
        color: #fff;
        flex-shrink: 0;
        transition: background 0.3s;
    }
    /* สี header ตามระดับความเสี่ยง */
    .dp-head.dp-risk-critical { background: linear-gradient(135deg, #991b1b, #dc2626); }
    .dp-head.dp-risk-high     { background: linear-gradient(135deg, #c2410c, #ea580c); }
    .dp-head.dp-risk-medium   { background: linear-gradient(135deg, #b45309, #f59e0b); }
    .dp-head.dp-risk-low      { background: linear-gradient(135deg, #15803d, #16a34a); }
    .dp-head.dp-risk-unknown  { background: linear-gradient(135deg, #475569, #64748b); }
    .dp-head-top {
        display: flex;
        align-items: flex-start;
        gap: 10px;
        margin-bottom: 10px;
    }
    .dp-head-top h2 {
        flex: 1;
        font-size: 16px;
        font-weight: 700;
        line-height: 1.35;
        margin: 0;
    }
    .dp-close {
        background: rgba(255, 255, 255, 0.22);
        border: none;
        color: #fff;
        width: 28px;
        height: 28px;
        border-radius: 7px;
        flex-shrink: 0;
        cursor: pointer;
        font-size: 14px;
        display: flex;
        align-items: center;
        justify-content: center;
        transition: background 0.2s;
    }
    .dp-close:hover { background: rgba(255, 255, 255, 0.4); }
    .dp-meta {
        display: flex;
        align-items: center;
        gap: 8px;
        flex-wrap: wrap;
    }
    .dp-meta-item {
        font-size: 12px;
        opacity: 0.9;
        display: flex;
        align-items: center;
        gap: 4px;
    }

    /* badge ระดับความเสี่ยงในหัว panel */
    .dp-risk-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 3px 10px;
        border-radius: 999px;
        font-size: 12px;
        font-weight: 700;
        background: rgba(255, 255, 255, 0.22);
        color: #fff;
        margin-right: 6px;
    }
    .dp-cat {
        font-size: 12px;
        color: rgba(255, 255, 255, 0.9);
    }
    .dp-code {
        font-size: 11px;
        font-family: 'Courier New', monospace;
        background: rgba(255, 255, 255, 0.22);
        color: #fff;
        padding: 2px 8px;
        border-radius: 5px;
    }

    /* เนื้อหา panel (เลื่อนได้) */
    .dp-body {
        flex: 1;
        overflow-y: auto;
        padding: 18px 18px 24px;
    }
    .dp-body::-webkit-scrollbar { width: 4px; }
    .dp-body::-webkit-scrollbar-thumb {
        background: rgba(56, 116, 245, 0.3);
        border-radius: 2px;
    }

    /* ── หัวข้อหมวด ── */
    .dp-section-title {
        font-size: 12px;
        font-weight: 700;
        color: #60256c;
        text-transform: uppercase;
        letter-spacing: 0.06em;
        margin: 0 0 14px;
        padding-bottom: 6px;
        border-bottom: 2px solid #60256c;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .dp-section-title:not(:first-child) {
        margin-top: 22px;
    }

    /* ── รายการ key-value (รายละเอียด) ── */
    .dp-rows {
        display: flex;
        flex-direction: column;
    }
    .dp-row {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 9px 0;
        border-bottom: 1px dashed #e3e8ef;
    }
    .dp-row:last-child { border-bottom: none; }
    .dp-row .lbl {
        font-size: 12px;
        color: #7c8a9c;
        font-weight: 600;
        flex-shrink: 0;
    }
    .dp-row .val {
        font-size: 13px;
        color: #1f3656;
        text-align: right;
        word-break: break-word;
    }

    /* ── TIMELINE ประวัติการรายงาน ── */
    .timeline {
        position: relative;
        padding-left: 28px;
    }
    .timeline::before {
        content: '';
        position: absolute;
        left: 10px;
        top: 6px;
        bottom: 6px;
        width: 2px;
        background: linear-gradient(to bottom, #60256c, rgba(96, 37, 108, 0.1));
        border-radius: 1px;
    }

    .tl-item {
        position: relative;
        margin-bottom: 18px;
    }
    .tl-item:last-child { margin-bottom: 0; }

    .tl-dot {
        position: absolute;
        left: -22px;
        top: 8px;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        border: 3px solid #fff;
        z-index: 1;
    }
    .tl-dot.latest {
        width: 18px;
        height: 18px;
        left: -24px;
        top: 6px;
        animation: tl-pulse 2s ease-in-out infinite;
    }
    @keyframes tl-pulse {
        0%, 100% { box-shadow: 0 0 0 3px var(--tl-dot-color, #60256c), 0 0 0 6px rgba(0,0,0,0.05); }
        50%      { box-shadow: 0 0 0 3px var(--tl-dot-color, #60256c), 0 0 0 10px rgba(0,0,0,0); }
    }

    .tl-card {
        background: rgba(255, 255, 255, 0.7);
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 10px;
        padding: 12px 14px;
        transition: box-shadow 0.2s;
    }
    .tl-card:hover { box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1); }
    .tl-card.latest-card {
        box-shadow: 0 0 0 1px rgba(96, 37, 108, 0.15);
    }

    .tl-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 8px;
    }
    .tl-round {
        font-size: 11px;
        font-weight: 700;
        color: #60256c;
        background: rgba(96, 37, 108, 0.08);
        padding: 2px 10px;
        border-radius: 999px;
    }
    .tl-date {
        font-size: 11px;
        color: #94a3b8;
        display: flex;
        align-items: center;
        gap: 4px;
    }

    .tl-field { margin-bottom: 8px; }
    .tl-field:last-of-type { margin-bottom: 0; }
    .tl-key {
        font-size: 11px;
        color: #94a3b8;
        font-weight: 600;
        margin-bottom: 2px;
    }
    .tl-val {
        font-size: 13px;
        color: #1e293b;
        line-height: 1.4;
    }

    .tl-notes {
        font-size: 12px;
        color: #64748b;
        font-style: italic;
        background: rgba(0, 0, 0, 0.03);
        border-radius: 6px;
        padding: 6px 10px;
        border-left: 2px solid rgba(96, 37, 108, 0.3);
        margin-top: 8px;
        display: flex;
        align-items: flex-start;
        gap: 6px;
    }
    .tl-notes i { opacity: 0.6; margin-top: 2px; }

    .tl-risk-badge {
        display: inline-flex;
        align-items: center;
        gap: 4px;
        padding: 3px 10px;
        border-radius: 999px;
        font-size: 11px;
        font-weight: 600;
        margin-top: 8px;
    }

    .tl-empty {
        text-align: center;
        color: #94a3b8;
        font-size: 12px;
        font-style: italic;
        padding: 20px 0;
    }

    @media (max-width: 600px) {
        #detailPanel { width: 100vw; }
    }

/* ============================================================
   SHOW-MAP3.PHP STYLES
   ทุก rule ถูก scope ภายใต้ body.page-map3 / .page-map3
   เพื่อไม่ให้กระทบหน้าอื่น (show-map.php / show-map2.php) ที่ก็ใช้ไฟล์นี้
   keyframes ที่ชื่อชนกันถูกเปลี่ยนเป็น m3-spin / m3-tl-pulse
   ============================================================ */
body.page-map3 {
  --primary:      #60256c;
  --primary-dark: #3d1645;
  --glass-bg:     rgba(255,255,255,0.92);
  --glass-border: rgba(255,255,255,0.6);
  --shadow:       0 8px 32px rgba(0,0,0,0.18);
  --radius:       14px;
  --risk-critical:#dc2626;
  --risk-high:    #ea580c;
  --risk-medium:  #d97706;
  --risk-low:     #16a34a;
  --risk-unknown: #64748b;

  height: 100%; width: 100%; overflow: hidden;
  font-family: 'Noto Sans Thai', 'Sarabun', sans-serif;
}
body.page-map3.dark {
  --glass-bg:     rgba(15,23,42,0.90);
  --glass-border: rgba(255,255,255,0.10);
}
html:has(body.page-map3) { height: 100%; overflow: hidden; }

.page-map3 *, .page-map3 *::before, .page-map3 *::after {
  box-sizing: border-box; margin: 0; padding: 0;
}

.page-map3 #map { position: absolute; inset: 0; }

/* ── LOADER ── */
.page-map3 #loader {
  position: fixed; inset: 0; z-index: 9999;
  background: linear-gradient(135deg, #3d1645, #60256c);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 16px;
  transition: opacity .4s;
}
.page-map3 #loader.out { opacity: 0; pointer-events: none; }
.page-map3 .loader-ring {
  width: 56px; height: 56px;
  border: 5px solid rgba(255,255,255,.2);
  border-top-color: #fff;
  border-radius: 50%;
  animation: m3-spin .7s linear infinite;
}
.page-map3 .loader-text { color: rgba(255,255,255,.8); font-size: 14px; }
@keyframes m3-spin { to { transform: rotate(360deg); } }

/* ── GLASS CARD BASE ── */
.page-map3 .glass {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: #1e293b;
}
body.page-map3.dark .glass { color: #f1f5f9; }

/* ── TOP BAR ── */
.page-map3 #topbar {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  padding: 10px 18px;
  display: flex; align-items: center; gap: 14px;
  min-width: 340px; max-width: calc(100vw - 24px);
}
.page-map3 .brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 17px; flex-shrink: 0;
}
.page-map3 .brand-info { flex: 1; min-width: 0; }
.page-map3 .brand-info h1 { font-size: 14px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.page-map3 .brand-info p  { font-size: 11px; color: #64748b; }
body.page-map3.dark .brand-info p { color: #94a3b8; }
body.page-map3.dark .brand-info h1 { color: #c084fc; }

.page-map3 .icon-btn {
  width: 34px; height: 34px;
  border: 1px solid rgba(0,0,0,.1);
  background: rgba(255,255,255,.6);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px; color: #475569;
  transition: all .2s; flex-shrink: 0;
  text-decoration: none;
}
body.page-map3.dark .icon-btn { background: rgba(255,255,255,.08); color: #94a3b8; border-color: rgba(255,255,255,.1); }
.page-map3 .icon-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); transform: scale(1.08); }

/* ── LEGEND CARD ── */
.page-map3 #legendCard {
  position: fixed; bottom: 24px; left: 12px; z-index: 200;
  padding: 11px 14px; width: 224px;
}
.page-map3 .lc-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 9px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}
body.page-map3.dark .lc-head { border-color: rgba(255,255,255,.08); }
.page-map3 .lc-title { font-size: 11px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 5px; }
body.page-map3.dark .lc-title { color: #c084fc; }
.page-map3 .lc-total { font-size: 11px; color: #64748b; }
body.page-map3.dark .lc-total { color: #94a3b8; }
.page-map3 .lc-total b { font-weight: 700; color: var(--primary); }
body.page-map3.dark .lc-total b { color: #c084fc; }

.page-map3 .lc-row {
  display: flex; align-items: center; gap: 7px; margin-bottom: 6px;
  cursor: pointer; padding: 3px 4px; border-radius: 5px;
  transition: background .15s;
  user-select: none;
}
.page-map3 .lc-row:hover { background: rgba(96,37,108,.08); }
.page-map3 .lc-row.muted { opacity: .35; }
.page-map3 .lc-row:last-of-type { margin-bottom: 0; }
.page-map3 .leg-pin { width: 12px; height: 16px; border-radius: 6px 6px 6px 0; flex-shrink: 0; }
.page-map3 .lc-label { flex: 1; font-size: 11px; color: #475569; }
body.page-map3.dark .lc-label { color: #94a3b8; }
.page-map3 .lc-bar-wrap { width: 48px; height: 5px; background: rgba(0,0,0,.08); border-radius: 3px; overflow: hidden; }
body.page-map3.dark .lc-bar-wrap { background: rgba(255,255,255,.1); }
.page-map3 .lc-bar { height: 100%; border-radius: 3px; transition: width .4s ease; }
.page-map3 .lc-num { font-size: 12px; font-weight: 700; min-width: 22px; text-align: right; }
.page-map3 .lc-time { margin-top: 8px; padding-top: 7px; border-top: 1px solid rgba(0,0,0,.08); font-size: 10px; color: #94a3b8; text-align: center; }
body.page-map3.dark .lc-time { border-color: rgba(255,255,255,.08); }

/* ── FILTER PANEL ── */
.page-map3 #filterOverlay {
  position: fixed; inset: 0; z-index: 240;
  background: rgba(0,0,0,.3); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s;
}
.page-map3 #filterOverlay.open { opacity: 1; pointer-events: auto; }

.page-map3 #filterPanel {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(.97);
  z-index: 250; width: 820px; max-width: calc(100vw - 24px);
  padding: 0; overflow: hidden;
  opacity: 0; pointer-events: none;
  transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .25s;
}
.page-map3 #filterPanel.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1; pointer-events: auto;
}

.page-map3 .fp-head {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff; padding: 13px 18px;
  display: flex; align-items: center; justify-content: space-between;
}
.page-map3 .fp-head h3 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.page-map3 .fp-close {
  background: rgba(255,255,255,.2); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 7px;
  cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.page-map3 .fp-close:hover { background: rgba(255,255,255,.4); }

.page-map3 .fp-body { padding: 18px 20px 14px; }

.page-map3 .fp-grid {
  display: grid; grid-template-columns: 1fr 1.6fr 1.3fr;
  gap: 0 20px;
}
.page-map3 .fp-col { display: flex; flex-direction: column; }

.page-map3 .fp-title {
  font-size: 11px; font-weight: 700; color: var(--primary);
  margin-bottom: 8px; text-transform: uppercase; letter-spacing: .05em;
  display: flex; align-items: center; gap: 5px;
}
body.page-map3.dark .fp-title { color: #c084fc; }

.page-map3 .fp-sub-row { display: flex; gap: 10px; flex: 1; }
.page-map3 .fp-sub-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.page-map3 .fp-sub-col .fp-title { margin-bottom: 6px; }

.page-map3 .fp-date-label { font-size: 11px; font-weight: 600; color: #64748b; margin-bottom: 5px; }
body.page-map3.dark .fp-date-label { color: #94a3b8; }
.page-map3 .fp-hint { font-size: 10px; color: #94a3b8; margin-top: 5px; }

.page-map3 .chk-row {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px; cursor: pointer; user-select: none;
}
.page-map3 .chk-row input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--primary); cursor: pointer; }
.page-map3 .chk-label { font-size: 12px; }

.page-map3 .fp-select, .page-map3 .fp-input {
  width: 100%; padding: 7px 10px;
  border: 1px solid rgba(0,0,0,.12); border-radius: 8px;
  font: 12px 'Noto Sans Thai', sans-serif;
  background: white; color: #1e293b;
}
.page-map3 .fp-select[multiple] {
  padding: 4px 6px; height: 130px;
  border-radius: 8px; overflow-y: auto;
}
.page-map3 .fp-select[multiple] option { padding: 4px 6px; border-radius: 4px; }
.page-map3 .fp-select[multiple] option:checked { background: var(--primary); color: #fff; }
body.page-map3.dark .fp-select,
body.page-map3.dark .fp-input { background: #334155; color: #f1f5f9; border-color: rgba(255,255,255,.12); }

.page-map3 .fp-actions {
  display: flex; gap: 10px;
  padding: 14px 20px 16px;
  border-top: 1px solid rgba(0,0,0,.07);
}
body.page-map3.dark .fp-actions { border-color: rgba(255,255,255,.08); }
.page-map3 .fp-btn {
  flex: 1; padding: 9px;
  background: var(--primary); color: #fff;
  border: none; border-radius: 9px;
  font: 600 13px 'Noto Sans Thai', sans-serif;
  cursor: pointer; transition: background .2s;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}
.page-map3 .fp-btn:hover { background: var(--primary-dark); }
.page-map3 .fp-btn.ghost {
  background: transparent; color: var(--primary);
  border: 1.5px solid var(--primary); flex: 0 0 auto; padding: 9px 20px;
}
.page-map3 .fp-btn.ghost:hover { background: var(--primary); color: #fff; }

@media (max-width: 700px) {
  .page-map3 .fp-grid { grid-template-columns: 1fr; gap: 0; }
  .page-map3 .fp-col { margin-bottom: 14px; }
  .page-map3 .fp-sub-row { flex-direction: column; gap: 10px; }
}

/* ── LIST MODAL ── */
.page-map3 #listOverlay {
  position: fixed; inset: 0; z-index: 240;
  background: rgba(0,0,0,.3); backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .25s;
}
.page-map3 #listOverlay.open { opacity: 1; pointer-events: auto; }

.page-map3 #listModal {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -48%) scale(.97);
  z-index: 250; width: 1000px; max-width: calc(100vw - 24px);
  max-height: 86vh; display: flex; flex-direction: column;
  padding: 0; overflow: hidden;
  opacity: 0; pointer-events: none;
  transition: transform .25s cubic-bezier(.4,0,.2,1), opacity .25s;
}
.page-map3 #listModal.open { transform: translate(-50%,-50%) scale(1); opacity: 1; pointer-events: auto; }

.page-map3 .lm-head {
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff; padding: 13px 18px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
}
.page-map3 .lm-head h3 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.page-map3 .lm-head-right { display: flex; align-items: center; gap: 10px; }
.page-map3 .lm-count { font-size: 12px; opacity: .8; background: rgba(255,255,255,.2); padding: 3px 10px; border-radius: 999px; }
.page-map3 .lm-close {
  background: rgba(255,255,255,.2); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 7px; cursor: pointer;
  font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: background .15s;
}
.page-map3 .lm-close:hover { background: rgba(255,255,255,.4); }

.page-map3 .lm-search-bar {
  padding: 10px 16px; flex-shrink: 0;
  border-bottom: 1px solid rgba(0,0,0,.07);
  display: flex; align-items: center; gap: 10px;
}
body.page-map3.dark .lm-search-bar { border-color: rgba(255,255,255,.08); }
.page-map3 .lm-search-wrap { position: relative; flex: 1; }
.page-map3 .lm-search-wrap i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: #94a3b8; font-size: 13px; }
.page-map3 .lm-search-input {
  width: 100%; padding: 7px 10px 7px 30px;
  border: 1px solid rgba(0,0,0,.12); border-radius: 8px;
  font: 13px 'Noto Sans Thai', sans-serif;
  background: white; color: #1e293b; outline: none;
}
.page-map3 .lm-search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(96,37,108,.12); }
body.page-map3.dark .lm-search-input { background: #334155; color: #f1f5f9; border-color: rgba(255,255,255,.12); }

.page-map3 .lm-table-wrap { flex: 1; overflow-y: auto; }
.page-map3 table.lm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.page-map3 table.lm-table thead th {
  background: var(--primary); color: #fff;
  padding: 10px 13px; font-weight: 500; white-space: nowrap;
  text-align: left; position: sticky; top: 0; z-index: 1;
}
body.page-map3.dark table.lm-table thead th { background: var(--primary-dark); }
.page-map3 table.lm-table tbody tr { border-bottom: 1px solid rgba(0,0,0,.06); transition: background .12s; }
body.page-map3.dark table.lm-table tbody tr { border-color: rgba(255,255,255,.06); }
.page-map3 table.lm-table tbody tr:hover { background: rgba(96,37,108,.06); }
.page-map3 table.lm-table td { padding: 10px 13px; vertical-align: middle; }

.page-map3 .lm-code {
  display: inline-block; background: rgba(0,0,0,.05); color: #64748b;
  border: 1px solid rgba(0,0,0,.1); border-radius: 5px;
  padding: 1px 7px; font-size: 11px; font-family: monospace; white-space: nowrap;
}
body.page-map3.dark .lm-code { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.1); color: #94a3b8; }
.page-map3 .lm-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; white-space: nowrap;
}
.page-map3 .lm-badge.critical { background: #fee2e2; color: #dc2626; }
.page-map3 .lm-badge.high     { background: #ffedd5; color: #ea580c; }
.page-map3 .lm-badge.medium   { background: #fef9c3; color: #ca8a04; }
.page-map3 .lm-badge.low      { background: #dcfce7; color: #16a34a; }
.page-map3 .lm-badge.unknown  { background: #f1f5f9; color: #6b7280; }

.page-map3 .lm-btn-detail {
  background: var(--primary); color: #fff;
  border: none; border-radius: 6px; padding: 4px 11px;
  font: 500 11px 'Noto Sans Thai', sans-serif;
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
  transition: background .2s;
}
.page-map3 .lm-btn-detail:hover { background: var(--primary-dark); }

.page-map3 .lm-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; flex-shrink: 0;
  border-top: 1px solid rgba(0,0,0,.07);
  font-size: 12px; color: #64748b;
}
body.page-map3.dark .lm-pagination { border-color: rgba(255,255,255,.08); color: #94a3b8; }
.page-map3 .lm-page-btns { display: flex; gap: 3px; }
.page-map3 .lm-pg {
  background: transparent; color: #475569;
  border: 1px solid rgba(0,0,0,.12); border-radius: 5px;
  padding: 4px 9px; font: 12px 'Noto Sans Thai', sans-serif;
  cursor: pointer; transition: all .15s; min-width: 30px; text-align: center;
}
body.page-map3.dark .lm-pg { color: #94a3b8; border-color: rgba(255,255,255,.12); }
.page-map3 .lm-pg:hover:not(:disabled) { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-map3 .lm-pg.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-map3 .lm-pg:disabled { opacity: .35; cursor: default; }

/* ── DETAIL PANEL ── */
.page-map3 #detailPanel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 400px; max-width: 100vw;
  z-index: 300;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-left: 1px solid var(--glass-border);
  box-shadow: -8px 0 32px rgba(0,0,0,0.18);
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform .35s cubic-bezier(.4,0,.2,1);
  color: #1e293b;
}
body.page-map3.dark #detailPanel { color: #f1f5f9; }
.page-map3 #detailPanel.open { transform: translateX(0); }

.page-map3 #detailOverlay {
  position: fixed; inset: 0; z-index: 299;
  background: rgba(0,0,0,.25);
  opacity: 0; pointer-events: none;
  transition: opacity .35s;
}
.page-map3 #detailOverlay.open { opacity: 1; pointer-events: auto; }

.page-map3 .dp-head {
  padding: 18px 18px 14px;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary));
  color: #fff;
  flex-shrink: 0;
}
.page-map3 .dp-head-top { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.page-map3 .dp-head-top h2 { flex: 1; font-size: 15px; font-weight: 700; line-height: 1.35; }
.page-map3 .dp-close {
  background: rgba(255,255,255,.2); border: none; color: #fff;
  width: 28px; height: 28px; border-radius: 7px; flex-shrink: 0;
  cursor: pointer; font-size: 14px; display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.page-map3 .dp-close:hover { background: rgba(255,255,255,.4); }
.page-map3 .dp-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-map3 .dp-meta-item { font-size: 11px; opacity: .85; display: flex; align-items: center; gap: 4px; }
.page-map3 .dp-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}
.page-map3 .dp-code {
  font-size: 11px; font-family: monospace;
  background: rgba(255,255,255,.2); padding: 2px 8px; border-radius: 5px;
}

.page-map3 .dp-body { flex: 1; overflow-y: auto; padding: 18px 18px 24px; }
.page-map3 .dp-body::-webkit-scrollbar { width: 4px; }
.page-map3 .dp-body::-webkit-scrollbar-thumb { background: rgba(96,37,108,.3); border-radius: 2px; }

.page-map3 .dp-section-title {
  font-size: 11px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: .06em;
  margin-bottom: 14px; padding-bottom: 6px;
  border-bottom: 2px solid var(--primary);
  display: flex; align-items: center; gap: 6px;
}
body.page-map3.dark .dp-section-title { color: #c084fc; border-color: #c084fc; }

.page-map3 .timeline { position: relative; padding-left: 28px; }
.page-map3 .timeline::before {
  content: ''; position: absolute; left: 10px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(to bottom, var(--primary), rgba(96,37,108,.1));
  border-radius: 1px;
}
.page-map3 .tl-item { position: relative; margin-bottom: 18px; }
.page-map3 .tl-item:last-child { margin-bottom: 0; }
.page-map3 .tl-dot {
  position: absolute; left: -22px; top: 8px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--primary);
  background: var(--primary);
  z-index: 1;
}
body.page-map3.dark .tl-dot { border-color: rgba(15,23,42,.9); }
.page-map3 .tl-dot.latest {
  width: 18px; height: 18px; left: -24px; top: 6px;
  box-shadow: 0 0 0 3px var(--primary), 0 0 0 6px rgba(96,37,108,.15);
  animation: m3-tl-pulse 2s ease-in-out infinite;
}
@keyframes m3-tl-pulse {
  0%,100% { box-shadow: 0 0 0 3px var(--primary), 0 0 0 6px rgba(96,37,108,.15); }
  50%      { box-shadow: 0 0 0 3px var(--primary), 0 0 0 10px rgba(96,37,108,0); }
}
.page-map3 .tl-card {
  background: rgba(255,255,255,.7);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 10px; padding: 12px 14px;
  transition: box-shadow .2s;
}
body.page-map3.dark .tl-card { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); }
.page-map3 .tl-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.1); }
.page-map3 .tl-card.latest-card {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(96,37,108,.2);
}
.page-map3 .tl-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.page-map3 .tl-round {
  font-size: 11px; font-weight: 700; color: var(--primary);
  background: rgba(96,37,108,.08); padding: 2px 8px; border-radius: 5px;
}
body.page-map3.dark .tl-round { color: #c084fc; background: rgba(192,132,252,.1); }
.page-map3 .tl-date { font-size: 11px; color: #94a3b8; display: flex; align-items: center; gap: 4px; }
.page-map3 .tl-field { margin-bottom: 7px; }
.page-map3 .tl-field:last-child { margin-bottom: 0; }
.page-map3 .tl-key { font-size: 10px; color: #94a3b8; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.page-map3 .tl-val { font-size: 12px; color: #1e293b; line-height: 1.4; }
body.page-map3.dark .tl-val { color: #e2e8f0; }
.page-map3 .tl-empty { color: #94a3b8; font-size: 12px; padding: 12px 4px; }

/* ── ZOOM CONTROLS ── */
.page-map3 #zoomCtrl {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200;
  display: flex; gap: 4px;
  padding: 6px;
}
.page-map3 .zbtn {
  width: 34px; height: 34px;
  background: white; border: 1px solid rgba(0,0,0,.1);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 16px; color: #475569;
  transition: all .15s;
}
body.page-map3.dark .zbtn { background: #1e293b; color: #94a3b8; border-color: rgba(255,255,255,.1); }
.page-map3 .zbtn:hover { background: var(--primary); color: #fff; }

@media (max-width: 600px) {
  .page-map3 #legendCard { width: 180px; }
  .page-map3 #filterPanel { width: calc(100vw - 24px); }
  .page-map3 #topbar { min-width: 280px; }
  .page-map3 #detailPanel { width: 100vw; }
}

