:root {
    --bg: #f0f4f8;
    --surface: #fff;
    --surface2: #f7fafc;
    --border: #d1dce8;
    --border2: #e8eef6;
    --text: #1a2535;
    --text2: #4a607a;
    --text3: #8099b4;
    --accent: #1057b8;
    --accent-l: #e8f0fb;
    --green: #0d7a4e;
    --green-l: #e6f5ef;
    --orange: #c26000;
    --orange-l: #fff3e0;
    --red: #c0392b;
    --red-l: #fdecea;
    --shadow: 0 2px 8px rgba(16, 40, 80, .08);
    --shadow-lg: 0 8px 30px rgba(16, 40, 80, .13);
    --r: 12px;
    --mono: 'IBM Plex Mono', monospace;
    --sans: 'Sarabun', sans-serif;
}

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

body {
    background: var(--bg);
    font-family: var(--sans);
    color: var(--text);
    min-height: 100vh;
    font-size: 16px
}

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

::-webkit-scrollbar-track {
    background: var(--border2)
}

::-webkit-scrollbar-thumb {
    background: #b0c4d8;
    border-radius: 4px
}

.topbar {
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 28px;
    box-shadow: 0 3px 12px rgba(16, 40, 120, .18);
    position: sticky;
    top: 0;
    z-index: 200
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px
}

.tlogo {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: rgba(255, 255, 255, .15);
    border: 1px solid rgba(255, 255, 255, .3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px
}

.ttitle {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: .5px
}

.tsub {
    font-size: .8rem;
    opacity: .75;
    margin-top: 1px
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 16px
}

.ttime {
    font-family: var(--mono);
    font-size: .85rem;
    opacity: .85;
    background: rgba(255, 255, 255, .12);
    padding: 6px 12px;
    border-radius: 8px
}

.btn-add {
    background: #fff;
    color: var(--accent);
    border: none;
    border-radius: 9px;
    padding: 9px 20px;
    font-family: var(--sans);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15)
}

.btn-add:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .2)
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    padding: 22px 28px 0
}

.kpi {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    padding: 20px 22px;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden
}

.kpi::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    border-radius: 12px 12px 0 0
}

.kpi:nth-child(1)::after {
    background: var(--accent)
}

.kpi:nth-child(2)::after {
    background: var(--green)
}

.kpi:nth-child(3)::after {
    background: #7c3aed
}

.kpi:nth-child(4)::after {
    background: var(--accent)
}

.kpi:nth-child(5)::after {
    background: var(--orange)
}

.kpi-ico {
    font-size: 1.5rem;
    margin-bottom: 8px
}

.kpi-lbl {
    font-size: .76rem;
    font-weight: 700;
    color: var(--text2);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 5px
}

.kpi-val {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    font-family: var(--mono)
}

.kpi:nth-child(1) .kpi-val {
    color: var(--accent)
}

.kpi:nth-child(2) .kpi-val {
    color: var(--green)
}

.kpi:nth-child(3) .kpi-val {
    color: #7c3aed
}

.kpi:nth-child(4) .kpi-val {
    color: var(--accent)
}

.kpi:nth-child(5) .kpi-val {
    color: var(--orange)
}

.kpi-unit {
    font-size: .78rem;
    color: var(--text3);
    margin-top: 4px
}

.kpi-bar-bg {
    margin-top: 12px;
    height: 5px;
    background: var(--border2);
    border-radius: 3px;
    overflow: hidden
}

.kpi-bar-fill {
    height: 5px;
    border-radius: 3px;
    transition: width .8s ease
}

.main {
    padding: 20px 28px 40px
}

.fp {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    padding: 20px 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow)
}

.fp-head {
    font-size: .8rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px
}

.fg-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end
}

.fg {
    display: flex;
    flex-direction: column;
    gap: 5px
}

.fg label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text2)
}

.fg input,
.fg select {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--sans);
    font-size: .9rem;
    padding: 9px 12px;
    outline: none;
    transition: border-color .15s;
    min-width: 140px
}

.fg input:focus,
.fg select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 87, 184, .1)
}

.fg select option {
    background: #fff
}

.btn-search {
    padding: 9px 20px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--sans);
    transition: all .15s
}

.btn-search:hover {
    background: #0d46a0;
    box-shadow: 0 4px 12px rgba(16, 87, 184, .3)
}

.btn-reset {
    padding: 9px 16px;
    background: var(--surface2);
    color: var(--text2);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--sans);
    transition: all .15s
}

.btn-reset:hover {
    background: var(--border2);
    color: var(--text)
}

.tcard {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: var(--r);
    box-shadow: var(--shadow);
    overflow: hidden
}

.thead2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 22px;
    border-bottom: 1.5px solid var(--border);
    background: var(--surface2)
}

.ttitle2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px
}

.rc {
    background: var(--accent-l);
    color: var(--accent);
    border-radius: 20px;
    padding: 2px 12px;
    font-size: .78rem;
    font-weight: 700
}

.exp-btns {
    display: flex;
    gap: 6px
}

.btn-exp {
    padding: 6px 14px;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 7px;
    font-size: .8rem;
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    transition: all .15s;
    font-family: var(--sans)
}

.btn-exp:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-l)
}

.twrap {
    overflow-x: auto
}

table {
    width: 100%;
    border-collapse: collapse
}

thead th {
    background: #eef3fb;
    padding: 12px 14px;
    font-size: .74rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .8px;
    border-bottom: 2px solid #c8d9f0;
    white-space: nowrap;
    text-align: center
}

thead th.left {
    text-align: left
}

tbody tr {
    border-bottom: 1px solid var(--border2);
    transition: background .1s
}

tbody tr:hover {
    background: #f4f8ff
}

tbody td {
    padding: 13px 14px;
    font-size: .9rem;
    vertical-align: middle
}

.c-id {
    font-family: var(--mono);
    font-size: .75rem;
    color: var(--text3);
    text-align: center;
    padding-left: 22px !important
}

.c-area .nm {
    font-size: .95rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35
}

.c-area .ato {
    font-family: var(--mono);
    font-size: .72rem;
    color: var(--accent);
    margin-top: 3px
}

.c-area .stag {
    display: inline-block;
    background: var(--accent-l);
    color: var(--accent);
    border: 1px solid #c0d4f5;
    border-radius: 5px;
    padding: 1px 8px;
    font-size: .68rem;
    font-weight: 700;
    margin-top: 4px
}

.c-date {
    text-align: center;
    font-family: var(--mono);
    font-size: .82rem;
    color: var(--text)
}

.c-num {
    text-align: center;
    font-family: var(--mono);
    font-size: .95rem;
    font-weight: 700;
    color: var(--accent)
}

.ficons {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: wrap
}

.fi {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 7px;
    font-size: .85rem;
    cursor: pointer;
    transition: all .15s;
    text-decoration: none;
    border: 1.5px solid
}

.fi.ok {
    background: var(--green-l);
    color: var(--green);
    border-color: #a8dcc7
}

.fi.ok:hover {
    transform: scale(1.12);
    box-shadow: 0 3px 8px rgba(13, 122, 78, .2)
}

.fi.no {
    background: #f4f7fb;
    color: #b0c4d8;
    border-color: #d8e4f0
}

.pm {
    min-width: 100px
}

.pm-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 5px
}

.pm-lbl {
    font-size: .72rem;
    font-weight: 700;
    color: var(--text2);
    width: 18px;
    flex-shrink: 0
}

.pm-bg {
    flex: 1;
    height: 7px;
    background: var(--border2);
    border-radius: 4px;
    overflow: hidden
}

.pm-fill {
    height: 7px;
    border-radius: 4px;
    transition: width .5s
}

.pm-pct {
    font-size: .7rem;
    font-family: var(--mono);
    font-weight: 700;
    width: 32px;
    text-align: right;
    flex-shrink: 0
}

.stt {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 700;
    white-space: nowrap
}

.stt.ok {
    background: var(--green-l);
    color: var(--green);
    border: 1.5px solid #a8dcc7
}

.stt.pr {
    background: var(--orange-l);
    color: var(--orange);
    border: 1.5px solid #f5c980
}

.stt.ok::before,
.stt.pr::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0
}

.stt.ok::before {
    background: var(--green)
}

.stt.pr::before {
    background: var(--orange);
    animation: blink 1.2s ease infinite
}

@keyframes blink {

    0%,
    100% {
        opacity: 1
    }

    50% {
        opacity: .2
    }
}

.acts {
    display: flex;
    gap: 4px;
    justify-content: center;
    flex-wrap: wrap
}

.ab {
    padding: 5px 10px;
    border-radius: 6px;
    font-size: .75rem;
    font-weight: 700;
    border: 1.5px solid;
    cursor: pointer;
    transition: all .12s;
    font-family: var(--sans);
    display: inline-flex;
    align-items: center;
    gap: 4px
}

.ab-i {
    background: var(--accent-l);
    color: var(--accent);
    border-color: #c0d4f5
}

.ab-i:hover {
    background: var(--accent);
    color: #fff
}

.ab-w {
    background: var(--orange-l);
    color: var(--orange);
    border-color: #f5c980
}

.ab-w:hover {
    background: var(--orange);
    color: #fff
}

.ab-s {
    background: var(--green-l);
    color: var(--green);
    border-color: #a8dcc7
}

.ab-s:hover {
    background: var(--green);
    color: #fff
}

.ab-d {
    background: var(--red-l);
    color: var(--red);
    border-color: #f5aba3
}

.ab-d:hover {
    background: var(--red);
    color: #fff
}

.tfoot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 22px;
    border-top: 1.5px solid var(--border);
    background: var(--surface2);
    flex-wrap: wrap;
    gap: 10px
}

.pg-info {
    font-size: .82rem;
    color: var(--text2);
    font-family: var(--mono)
}

.pagination {
    display: flex;
    gap: 4px
}

.pgb {
    min-width: 34px;
    height: 34px;
    border-radius: 7px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    cursor: pointer;
    font-size: .85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
    font-family: var(--mono);
    font-weight: 600;
    padding: 0 8px
}

.pgb:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-l)
}

.pgb.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent)
}

.pgb:disabled {
    opacity: .3;
    cursor: not-allowed
}

.empty {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: var(--text3);
    gap: 10px
}

.empty .ei {
    font-size: 2.5rem;
    opacity: .4
}

.empty .et {
    font-size: .9rem;
    font-weight: 600
}

/* MODAL */
.overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    background: rgba(10, 25, 50, .55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s
}

.overlay.open {
    opacity: 1;
    pointer-events: all
}

.mbox {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    width: 100%;
    max-width: 880px;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(14px);
    transition: transform .2s;
    box-shadow: var(--shadow-lg)
}

.overlay.open .mbox {
    transform: translateY(0)
}

.mhead {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1.5px solid var(--border);
    background: var(--surface2);
    border-radius: 14px 14px 0 0;
    position: sticky;
    top: 0;
    z-index: 10
}

.mhtitle {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px
}

.mhtag {
    background: var(--accent-l);
    color: var(--accent);
    border-radius: 6px;
    padding: 2px 10px;
    font-size: .75rem;
    font-weight: 700;
    font-family: var(--mono)
}

.mclose {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text2);
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s
}

.mclose:hover {
    background: var(--red-l);
    color: var(--red);
    border-color: #f5aba3
}

.mbody {
    padding: 24px
}

.ds {
    margin-bottom: 22px
}

.ds-title {
    font-size: .78rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #dce9f8;
    padding-bottom: 8px;
    margin-bottom: 14px
}

.dg {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 10px
}

.di {
    background: var(--surface2);
    border: 1.5px solid var(--border2);
    border-radius: 9px;
    padding: 12px 14px
}

.di .dl {
    font-size: .7rem;
    font-weight: 700;
    color: var(--text3);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 5px
}

.di .dv {
    font-size: .92rem;
    font-weight: 700;
    color: var(--text)
}

.di .dv.mono {
    font-family: var(--mono);
    color: var(--accent)
}

.di .dv.ok {
    color: var(--green)
}

.pd {
    margin-bottom: 12px
}

.pd .pdh {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    align-items: center
}

.pd .pdl {
    font-size: .9rem;
    font-weight: 600;
    color: var(--text)
}

.pd .pdv {
    font-family: var(--mono);
    font-size: .82rem;
    font-weight: 700;
    color: var(--accent)
}

.pd .pdb {
    height: 10px;
    background: var(--border2);
    border-radius: 5px;
    overflow: hidden
}

.pd .pdf {
    height: 10px;
    border-radius: 5px;
    transition: width .6s ease
}

.rpt-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    min-height: 60vh
}

.rpt-list {
    overflow-y: auto;
    max-height: 60vh;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--surface2)
}

.rpt-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border2);
    cursor: pointer;
    transition: background .12s
}

.rpt-item:hover {
    background: #edf4ff
}

.rpt-item input {
    margin-top: 3px;
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer;
    flex-shrink: 0
}

.ri-id {
    font-family: var(--mono);
    font-size: .7rem;
    color: var(--text3)
}

.ri-nm {
    font-size: .88rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35
}

.ri-sub {
    font-size: .74rem;
    color: var(--text2);
    margin-top: 2px
}

.rpt-ta {
    width: 100%;
    height: 100%;
    min-height: 60vh;
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-family: 'Sarabun', sans-serif;
    font-size: .92rem;
    padding: 14px;
    resize: none;
    outline: none;
    line-height: 1.75
}

.rpt-ta:focus {
    border-color: var(--accent)
}

.ig {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px
}

.ig-item {
    background: var(--surface2);
    border: 1.5px solid var(--border2);
    border-radius: 10px;
    overflow: hidden;
    transition: all .15s
}

.ig-item:hover {
    border-color: var(--accent);
    transform: scale(1.02)
}

.ig-ph {
    width: 100%;
    padding-bottom: 65%;
    background: linear-gradient(135deg, var(--accent-l), var(--green-l));
    position: relative
}

.ig-ph-in {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 1.8rem;
    color: var(--text3)
}

.ig-name {
    padding: 8px 10px;
    font-size: .7rem;
    color: var(--text2);
    font-family: var(--mono);
    word-break: break-all;
    line-height: 1.4
}

.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 14px 20px;
    max-width: 320px;
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(12px);
    opacity: 0;
    transition: all .25s;
    box-shadow: var(--shadow-lg)
}

.toast.show {
    transform: translateY(0);
    opacity: 1
}

.toast-msg {
    font-size: .88rem;
    font-weight: 600;
    color: var(--text)
}

@keyframes rowIn {
    from {
        opacity: 0;
        transform: translateY(5px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

/* �� FORM STYLES �� */
.fs-sec {
    margin-bottom: 22px
}

.fs-sec-title {
    font-size: .78rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 2px solid #dce9f8;
    padding-bottom: 8px;
    margin-bottom: 14px
}

.fg-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 12px
}

.ff {
    display: flex;
    flex-direction: column;
    gap: 5px
}

.ff.ff-wide {
    grid-column: span 2
}

.ff label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--text2)
}

.ff input,
.ff select {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: var(--sans);
    font-size: .88rem;
    padding: 9px 12px;
    outline: none;
    transition: border-color .15s;
    width: 100%
}

.ff input:focus,
.ff select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(16, 87, 184, .1)
}

.ff select option {
    background: #fff
}

.req {
    color: var(--red);
    font-weight: 700
}

.radio-group {
    display: flex;
    gap: 16px;
    padding: 9px 0;
    align-items: center
}

.radio-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .88rem;
    font-weight: 600;
    color: var(--text);
    cursor: pointer
}

.radio-label input[type=radio] {
    accent-color: var(--accent);
    width: 16px;
    height: 16px;
    cursor: pointer
}

.file-input-wrap input[type=file] {
    background: var(--surface2);
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    width: 100%;
    cursor: pointer;
    font-family: var(--sans);
    font-size: .82rem;
    color: var(--text2)
}

.file-input-wrap input[type=file]:hover {
    border-color: var(--accent);
    background: var(--accent-l)
}

.file-hint {
    font-size: .7rem;
    color: var(--text3);
    margin-top: 3px
}

.mfoot {
    display: flex;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1.5px solid var(--border);
    background: var(--surface2);
    border-radius: 0 0 14px 14px;
    position: sticky;
    bottom: 0;
    z-index: 10
}

@media(max-width:900px) {
    .kpi-row {
        grid-template-columns: repeat(3, 1fr)
    }

    .rpt-layout {
        grid-template-columns: 1fr;
        min-height: auto
    }
}

@media(max-width:600px) {
    .kpi-row {
        grid-template-columns: repeat(2, 1fr)
    }

    .topbar {
        padding: 10px 14px
    }

    .main {
        padding: 14px 14px 30px
    }

    .kpi-row {
        padding: 14px 14px 0
    }
}

/* ════════════════════════════════════════════════
   เพิ่มใน lidar_info.css (ส่วนที่เพิ่มใหม่)
   ════════════════════════════════════════════════ */

/* ── ปุ่มแผนที่ใน TopBar ── */
.btn-map {
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.4);
    border-radius: 9px;
    padding: 9px 18px;
    font-family: var(--sans);
    font-size: .9rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
}

.btn-map:hover {
    background: rgba(255, 255, 255, 0.28);
    transform: translateY(-1px);
}

/* ── Map Filter Checkboxes ── */
.map-chk {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text2);
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 7px;
    border: 1.5px solid var(--border);
    background: var(--surface);
}

.map-chk input {
    accent-color: var(--green);
    width: 15px;
    height: 15px;
    cursor: pointer;
}

.map-chk-done {
    color: var(--green);
    border-color: #a8dcc7;
    background: var(--green-l);
}

.map-chk-proc {
    color: var(--orange);
    border-color: #f5c980;
    background: var(--orange-l);
}

/* ── Map Side List Items ── */
.map-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border2);
    cursor: pointer;
    transition: background .1s;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.map-item:hover {
    background: #f0f7ff;
}

.map-item.selected {
    background: var(--accent-l);
    border-left: 3px solid var(--accent);
}

.map-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.mi-id {
    font-family: var(--mono);
    font-size: .65rem;
    color: var(--text3);
}

.mi-nm {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.35;
}

.mi-sub {
    font-size: .72rem;
    color: var(--text2);
    margin-top: 2px;
}

/* Lightbox */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    animation: fadeIn .2s ease;
}

.lightbox-overlay img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .6);
    object-fit: contain;
    cursor: default;
}

.lightbox-close {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 10000;
    color: #fff;
    font-size: 2rem;
    font-weight: 300;
    cursor: pointer;
    line-height: 1;
    opacity: .8;
    transition: opacity .15s;
}

.lightbox-close:hover {
    opacity: 1;
}

/* ── TASK CARDS ── */
.task-card {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
    transition: box-shadow .15s;
}

.task-card:hover {
    box-shadow: 0 4px 16px rgba(16, 40, 80, .12);
}

.task-card.done-card {
    background: #f8fdf9;
    border-color: #c8e6c9;
    opacity: .85;
}

/* priority left border */
.task-card.pri-สำคัญ {
    border-left: 4px solid #c0392b;
}

.task-card.pri-ด่วน {
    border-left: 4px solid #c26000;
}

.task-card.pri-เพื่อทราบ {
    border-left: 4px solid #0d7a4e;
}

.task-priority-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
}

.task-priority-badge.สำคัญ {
    background: var(--red-l);
    color: var(--red);
    border: 1px solid #f5aba3;
}

.task-priority-badge.ด่วน {
    background: var(--orange-l);
    color: var(--orange);
    border: 1px solid #f5c980;
}

.task-priority-badge.เพื่อทราบ {
    background: var(--green-l);
    color: var(--green);
    border: 1px solid #a8dcc7;
}

.task-note {
    font-size: .92rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.5;
}

.task-note.done {
    text-decoration: line-through;
    color: var(--text3);
}

.task-meta {
    font-size: .78rem;
    color: var(--text2);
    margin-top: 5px;
}

.task-imgs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.task-imgs img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    cursor: zoom-in;
    border: 1.5px solid var(--border);
    transition: transform .15s;
}

.task-imgs img:hover {
    transform: scale(1.05);
}

/* fade animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: none
    }
}

.task-card {
    animation: fadeInUp .22s ease both;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: scale(.96)
    }
}

.fade-out {
    animation: fadeOut .3s ease forwards;
}

/* ── PROCESSING PANEL ── */
.proc-panel {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.proc-panel-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1.5px solid var(--border);
    background: var(--surface2);
}

/* area group */
.proc-group {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border2);
}

.proc-group:last-child {
    border-bottom: none;
}

.proc-group-title {
    font-size: .72rem;
    font-weight: 800;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .8px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.proc-group-ato {
    font-family: var(--mono);
    background: var(--accent-l);
    color: var(--accent);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: .65rem;
    font-weight: 600;
}

/* progress row */
.proc-row {
    margin-bottom: 10px;
}

.proc-row:last-child {
    margin-bottom: 0;
}

.proc-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 5px;
}

.proc-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: .78rem;
    font-weight: 700;
    color: var(--text);
}

.proc-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .55rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.proc-pct {
    font-family: var(--mono);
    font-size: .78rem;
    font-weight: 700;
}

.proc-bar-bg {
    height: 8px;
    background: var(--border2);
    border-radius: 4px;
    overflow: hidden;
}

.proc-bar-fill {
    height: 8px;
    border-radius: 4px;
    transition: width .6s ease;
}

.proc-img-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 5px;
    font-size: .65rem;
    font-weight: 700;
    text-decoration: none;
    margin-top: 4px;
    cursor: pointer;
    border: none;
}

/* ======================================= */
/* =============== PART II =============== */
/* ======================================= */
/* ── VIEW TOGGLE ── */
.view-tabs {
    display: flex;
    gap: 0;
    background: rgba(0, 0, 0, 0.15);
    border-radius: 9px;
    padding: 3px;
}

.view-tab {
    padding: 7px 18px;
    border: none;
    border-radius: 7px;
    font-family: var(--sans);
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all .15s;
    color: rgba(255, 255, 255, .65);
    background: transparent;
}

.view-tab.active {
    background: #fff;
    color: var(--accent);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .15);
}

.view-tab:not(.active):hover {
    color: #fff;
    background: rgba(255, 255, 255, .12);
}

/* ── VIEW PANELS ── */
#view-table {
    display: block;
}

#view-map {
    display: none;
    flex-direction: column;
}

#view-map.active {
    display: flex;
}

/* ── MAP FULL PAGE ── */
.map-full-wrap {
    display: grid;
    grid-template-columns: 300px 1fr;
    height: calc(100vh - 62px);
    /* topbar height */
    overflow: hidden;
}

/* ── MAP SIDEBAR ── */
.map-sidebar {
    background: var(--surface);
    border-right: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.map-sidebar-head {
    padding: 14px 16px;
    border-bottom: 1.5px solid var(--border);
    background: var(--surface2);
    flex-shrink: 0;
}

.map-sidebar-head h3 {
    font-size: .9rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 10px;
}

/* sidebar filters */
.sf-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.sf-row label {
    font-size: .72rem;
    font-weight: 700;
    color: var(--text2);
}

.sf-row input,
.sf-row select {
    background: var(--surface2);
    border: 1.5px solid var(--border);
    border-radius: 7px;
    color: var(--text);
    font-family: var(--sans);
    font-size: .82rem;
    padding: 7px 10px;
    outline: none;
    width: 100%;
    transition: border-color .15s;
}

.sf-row input:focus,
.sf-row select:focus {
    border-color: var(--accent);
}

.sf-btns {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.sf-btn {
    flex: 1;
    padding: 7px;
    border-radius: 7px;
    font-size: .78rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-family: var(--sans);
}

.sf-btn-search {
    background: var(--accent);
    color: #fff;
}

.sf-btn-reset {
    background: var(--border2);
    color: var(--text2);
}

.ltog {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    font-size: .7rem;
    font-weight: 700;
    cursor: pointer;
    background: var(--surface);
    transition: all .12s;
}

.ltog input {
    accent-color: var(--accent);
    cursor: pointer;
    width: 12px;
    height: 12px;
}

.ltog.ok {
    color: var(--green);
    border-color: #a8dcc7;
    background: var(--green-l);
}

.ltog.warn {
    color: var(--orange);
    border-color: #f5c980;
    background: var(--orange-l);
}

.ltog.info {
    color: var(--accent);
    border-color: #c0d4f5;
    background: var(--accent-l);
}

/* area list */
.map-area-list {
    overflow-y: auto;
    flex: 1;
}

.map-area-item {
    padding: 10px 16px;
    border-bottom: 1px solid var(--border2);
    cursor: pointer;
    transition: background .1s;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.map-area-item:hover {
    background: #f0f7ff;
}

.map-area-item.selected {
    background: var(--accent-l);
    border-left: 3px solid var(--accent);
}

.mai-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
    margin-top: 4px;
}

.mai-id {
    font-family: var(--mono);
    font-size: .62rem;
    color: var(--text3);
}

.mai-name {
    font-size: .82rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
}

.mai-sub {
    font-size: .7rem;
    color: var(--text2);
    margin-top: 2px;
}

/* status chips in sidebar */
.mai-status {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 20px;
    font-size: .62rem;
    font-weight: 700;
}

.mai-status.ok {
    background: var(--green-l);
    color: var(--green);
}

.mai-status.pr {
    background: var(--orange-l);
    color: var(--orange);
}

/* sidebar footer stat */
.map-sidebar-foot {
    padding: 8px 16px;
    border-top: 1.5px solid var(--border);
    background: var(--surface2);
    font-size: .75rem;
    color: var(--text2);
    display: flex;
    justify-content: space-between;
    flex-shrink: 0;
}

/* ── MAP CONTAINER ── */
#leafletMapFull {
    width: 100%;
    height: 100%;
    z-index: 1;
}

/* ── Leaflet popup custom ── */
.leaflet-popup-content {
    font-family: 'Sarabun', sans-serif !important;
}

/* ── MAP LEGEND (Leaflet Control) ── */
.map-legend {
    background: var(--surface);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    padding: 10px 14px;
    box-shadow: var(--shadow);
    font-size: .75rem;
    color: var(--text2);
    margin: 0 0 8px 8px;
    /* margin จาก Leaflet control container */
}

.map-legend-title {
    font-weight: 800;
    color: var(--text);
    margin-bottom: 6px;
    font-size: .78rem;
}

.ml-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.ml-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
}

.ml-line {
    width: 20px;
    height: 3px;
    flex-shrink: 0;
    border-radius: 2px;
}

.ml-poly {
    width: 16px;
    height: 12px;
    flex-shrink: 0;
    border-radius: 2px;
}

/* ── LOCATION PICKER ── */
#locMapAdd,
#locMapEdit {
    height: 220px;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    cursor: crosshair !important;
}

#locMapAdd .leaflet-container,
#locMapEdit .leaflet-container {
    cursor: crosshair !important;
}

.loc-result {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    background: var(--green-l);
    border: 1.5px solid #a8dcc7;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: .82rem;
    color: var(--green);
    font-weight: 600;
}

.loc-result.empty {
    background: var(--surface2);
    border-color: var(--border);
    color: var(--text3);
    font-weight: 400;
}

/* ── COORDINATE CONTEXT MENU ── */
.coord-popup {
    background: #0d1117;
    border: 1.5px solid #00ffcc44;
    border-radius: 10px;
    padding: 0;
    overflow: hidden;
    font-family: var(--mono);
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
}

.coord-popup-title {
    background: #00ffcc18;
    border-bottom: 1px solid #00ffcc33;
    padding: 8px 14px;
    font-size: .7rem;
    font-weight: 800;
    color: #00ffcc;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    gap: 8px;
}

.coord-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 7px 14px;
    border-bottom: 1px solid #ffffff0f;
    gap: 10px;
}

.coord-row:last-child {
    border-bottom: none
}

.coord-lbl {
    font-size: .65rem;
    font-weight: 800;
    color: #00ffcc;
    letter-spacing: 1px;
    min-width: 42px;
}

.coord-val {
    font-size: .75rem;
    color: #e2e8f0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.coord-copy {
    background: none;
    border: 1px solid #ffffff22;
    border-radius: 5px;
    color: #94a3b8;
    cursor: pointer;
    padding: 3px 7px;
    font-size: .65rem;
    transition: all .12s;
}

.coord-copy:hover {
    background: #00ffcc22;
    color: #00ffcc;
    border-color: #00ffcc55
}

/* ── GO TO COORD PANEL ── */
.goto-panel {
    position: absolute;
    bottom: 70px;
    /* ← เปลี่ยนจาก top:10px */
    right: 10px;
    /* ← เปลี่ยนจาก left:50% */
    transform: none;
    /* ← ลบ translateX(-50%) */
    z-index: 500;
    background: #0d1117;
    border: 1.5px solid #00ffcc55;
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, .5);
    min-width: 420px;
    display: none;
}

.goto-panel.open {
    display: block
}

.goto-head {
    background: #00ffcc18;
    border-bottom: 1px solid #00ffcc33;
    padding: 10px 16px;
    font-size: .72rem;
    font-weight: 800;
    color: #00ffcc;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.goto-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 1rem
}

.goto-tabs {
    display: flex;
    border-bottom: 1px solid #00ffcc22
}

.goto-tab {
    flex: 1;
    padding: 8px;
    background: none;
    border: none;
    color: #64748b;
    font-size: .7rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--mono);
    letter-spacing: .5px;
    transition: all .12s;
    border-bottom: 2px solid transparent;
}

.goto-tab.active {
    color: #00ffcc;
    border-bottom-color: #00ffcc;
    background: #00ffcc0a
}

.goto-body {
    padding: 14px 16px
}

.goto-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px
}

.goto-input {
    background: #0f172a;
    border: 1.5px solid #ffffff22;
    border-radius: 7px;
    color: #e2e8f0;
    font-family: var(--mono);
    font-size: .8rem;
    padding: 8px 10px;
    outline: none;
    width: 100%;
    transition: border-color .12s;
}

.goto-input:focus {
    border-color: #00ffcc55
}

.goto-input.full {
    grid-column: 1/-1
}

.goto-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #00ffcc, #0099ff);
    color: #0d1117;
    font-size: .82rem;
    font-weight: 800;
    cursor: pointer;
    font-family: var(--mono);
    letter-spacing: 1px;
    transition: all .15s;
}

.goto-btn:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 14px rgba(0, 255, 204, .3)
}

.goto-hint {
    font-size: .65rem;
    color: #64748b;
    margin-top: 8px;
    text-align: center
}

/* ── GOTO button on map ── */
.btn-goto-coord {
    position: absolute;
    bottom: 30px;
    /* ← เปลี่ยนจาก top:10px */
    right: 10px;
    /* ← เปลี่ยนจาก right:44px */
    z-index: 400;
    background: #0d1117;
    border: 1.5px solid #00ffcc55;
    color: #00ffcc;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: .72rem;
    font-weight: 800;
    cursor: pointer;
    font-family: var(--mono);
    letter-spacing: .5px;
    transition: all .15s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .3);
}

.btn-goto-coord * {
    pointer-events: none;
}

.btn-goto-coord:hover {
    background: #00ffcc18;
    border-color: #00ffcc
}

.dark-popup .leaflet-popup-content-wrapper {
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.dark-popup .leaflet-popup-tip-container {
    display: none !important;
    /* ✅ ซ่อน tip ด้วย */
}

.dark-popup .leaflet-popup-tip {
    display: none !important;
}

.dark-popup .leaflet-popup-content {
    margin: 0 !important;
}

.admin-label {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    font-family: var(--sans) !important;
    pointer-events: none !important;
    white-space: nowrap !important;
}

.admin-label::before {
    display: none !important;
}

path.leaflet-interactive:focus {
    outline: none !important;
    box-shadow: none !important;
}

/* ซ่อนนิ้วชี้บน admin polygon */
.leaflet-interactive {
    cursor: default !important;
}

.measure-label {
    background: #0d1117cc;
    border: 1px solid #00ffcc55;
    border-radius: 6px;
    color: #e2e8f0;
    font-family: var(--mono);
    font-size: 11px;
    padding: 3px 7px;
    white-space: nowrap;
    pointer-events: none;
}

.measure-label-total {
    background: #00ffcc22;
    border: 1.5px solid #00ffcc88;
    color: #00ffcc;
    font-weight: 800;
}

.measure-wp {
    background: #00ffcc;
    border: 2.5px solid #0d1117;
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: 800;
    color: #0d1117;
    font-family: var(--mono);
    box-shadow: 0 0 6px rgba(0, 255, 204, .5);
    cursor: pointer;
}

.measure-wp-active {
    background: #ff6b6b;
    box-shadow: 0 0 6px rgba(255, 107, 107, .5);
}

.leaflet-div-icon {
    background: transparent !important;
    border: none !important;
}

.leaflet-marker-shadow {
    display: none !important;
}

.leaflet-div-icon {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}