/* หน้าหลัก — แผนที่และแผงข้อมูลพื้นที่ */
html,body{height:100%}
body{display:flex;flex-direction:column;overflow:hidden;background:var(--bg-2)}
.topbar{display:flex;align-items:center;gap:16px;padding:8px 16px;background:#fff;border-bottom:1px solid var(--line);min-height:60px;z-index:1000}
.brand{display:flex;align-items:center;gap:10px;text-decoration:none;color:var(--ink);min-width:0}
.brand img{width:38px;height:38px;object-fit:contain;flex:none}
.brand span{display:flex;flex-direction:column;min-width:0}
.brand b{font-size:15.5px;font-weight:600;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:34vw}
.brand small{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:34vw}
.search{position:relative;flex:1;max-width:520px;margin-left:auto}
.search input{width:100%;height:42px;border:1px solid var(--line-2);border-radius:999px;padding:0 16px 0 40px;font:inherit;background:var(--bg-2)}
.search input:focus{outline:none;border-color:var(--brand);background:#fff;box-shadow:0 0 0 3px rgba(39,80,58,.15)}
.search-ic{position:absolute;left:14px;top:12px;width:18px;height:18px;background:no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236B776F' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E")}
.qres{position:absolute;left:0;right:0;top:48px;background:#fff;border:1px solid var(--line);border-radius:14px;box-shadow:var(--shadow);max-height:60vh;overflow:auto;z-index:2000;padding:6px}
.qres button{display:flex;width:100%;text-align:left;gap:10px;align-items:center;padding:9px 10px;border:0;background:none;border-radius:10px;font:inherit;cursor:pointer}
.qres button:hover,.qres button.on{background:var(--bg-2)}
.qres .lv{font-size:11px;padding:1px 7px;border-radius:6px;background:var(--brand-soft);color:var(--brand);flex:none;min-width:52px;text-align:center}
.qres .sub{font-size:12.5px;color:var(--muted)}
.admin-link{flex:none}

.explore{flex:1;display:flex;min-height:0}
.panel{width:420px;flex:none;background:#fff;border-right:1px solid var(--line);overflow:auto;display:flex;flex-direction:column}
.mapwrap{flex:1;position:relative;min-width:0}
#map{position:absolute;inset:0}
.map-tools{position:absolute;top:12px;right:12px;z-index:800}
.legend-wrap{position:absolute;left:12px;bottom:24px;z-index:800}
.map-loading{position:absolute;top:12px;left:50%;transform:translateX(-50%);z-index:900;background:#fff;padding:8px 14px;border-radius:999px;box-shadow:var(--shadow);display:flex;gap:8px;align-items:center;font-size:13px}
.map-loading .spinner{width:16px;height:16px;border-width:2px}

.crumbs{display:flex;flex-wrap:wrap;gap:2px;align-items:center;padding:12px 16px 0;font-size:13px}
.crumbs a{color:var(--muted);text-decoration:none;padding:2px 4px;border-radius:6px}
.crumbs a:hover{background:var(--bg-2);color:var(--ink)}
.crumbs svg{width:12px;height:12px;color:var(--line-2)}
.crumbs b{font-weight:500;padding:2px 4px}
.pad{padding:12px 16px 16px}
.ptitle{font-size:24px;font-weight:600;margin:4px 0 2px}
.psub{color:var(--muted);font-size:13.5px}
.sect{border-top:1px solid var(--line);padding:14px 16px}
.sect h3{font-size:14px;font-weight:600;margin-bottom:10px;display:flex;align-items:center;gap:8px}
.sect h3 .muted{font-weight:400;font-size:12.5px;margin-left:auto}
.fbar{display:flex;height:12px;border-radius:6px;overflow:hidden;background:var(--bg-2);margin:8px 0 6px}
.fbar i{display:block;height:100%}
.flegend{display:flex;gap:14px;flex-wrap:wrap;font-size:12.5px;color:var(--ink-2)}
.flegend span{display:flex;align-items:center;gap:6px}
.metric{display:flex;gap:4px;flex-wrap:wrap;margin-bottom:10px}
.metric button{font:inherit;font-size:12.5px;padding:4px 10px;border-radius:999px;border:1px solid var(--line-2);background:#fff;cursor:pointer}
.metric button.on{background:var(--ink);border-color:var(--ink);color:#fff}
.clist{display:flex;flex-direction:column}
.citem{display:grid;grid-template-columns:1fr auto;gap:2px 10px;padding:9px 8px;border-radius:10px;text-decoration:none;color:inherit;cursor:pointer;border:0;background:none;font:inherit;text-align:left;width:100%}
.citem:hover,.citem.hl{background:var(--bg-2)}
.citem .n{font-weight:500}
.citem .v{font-variant-numeric:tabular-nums;font-size:13.5px;text-align:right;color:var(--ink-2)}
.citem .b{grid-column:1 / -1;height:5px;border-radius:3px;background:var(--bg-2);overflow:hidden}
.citem .b i{display:block;height:100%}
.citem .s{font-size:12px;color:var(--muted)}
.flist .fi{display:flex;gap:10px;align-items:flex-start;padding:8px 0;border-bottom:1px dashed var(--line)}
.flist .fi:last-child{border:0}
.flist .sw{width:14px;height:14px;border-radius:3px;flex:none;margin-top:4px}
.rec{display:flex;gap:10px;padding:10px 8px;border-radius:10px;cursor:pointer}
.rec:hover{background:var(--bg-2)}
.rec .ic{width:34px;height:34px;border-radius:10px;display:flex;align-items:center;justify-content:center;color:#fff;flex:none}
.rec .ic svg{width:18px;height:18px}
.rec .t{font-weight:500}
.catchips{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:8px}
.catchips button{font:inherit;font-size:12.5px;padding:3px 10px;border-radius:999px;border:1px solid var(--line-2);background:#fff;cursor:pointer;display:flex;gap:6px;align-items:center}
.catchips button.on{border-color:var(--ink);box-shadow:inset 0 0 0 1px var(--ink)}
.note{font-size:12.5px;color:var(--muted);background:var(--bg-2);border-radius:10px;padding:10px 12px;margin-top:10px}
.popup-photos{display:flex;gap:4px;margin-top:6px;flex-wrap:wrap}
.popup-photos img{width:64px;height:64px;object-fit:cover;border-radius:6px;cursor:zoom-in}
.kv{display:grid;grid-template-columns:auto 1fr;gap:2px 10px;font-size:13px;margin-top:6px}
.kv dt{color:var(--muted)} .kv dd{margin:0}
.cta{display:flex;gap:12px;align-items:center;background:var(--brand-soft);border-radius:12px;padding:12px 14px;margin-top:12px;font-size:13.5px}
.cta svg{width:28px;height:28px;color:var(--brand);flex:none}
.footer-note{padding:14px 16px 24px;font-size:12px;color:var(--muted);border-top:1px solid var(--line);margin-top:auto}

@media (max-width: 900px){
  body{overflow:auto;height:auto}
  .explore{flex-direction:column-reverse}
  .mapwrap{height:58vh;min-height:320px;flex:none}
  .panel{width:100%;border-right:0;overflow:visible}
  .topbar{flex-wrap:wrap;gap:8px 10px;padding:8px 12px}
  .search{order:3;flex-basis:100%;max-width:none}
  .brand b,.brand small{max-width:60vw}
  .admin-link{margin-left:auto}
  .legend{max-width:170px;font-size:11.5px}
}
.sect h3 svg{width:17px;height:17px;color:var(--brand);flex:none}
.lb-toggle{display:flex;align-items:center;gap:8px;border:0;background:none;font:inherit;font-weight:500;cursor:pointer;padding:2px 0;width:100%;color:var(--ink)}
.lb-toggle svg{width:16px;height:16px}.lb-toggle svg:last-child{margin-left:auto;color:var(--muted)}
.lb-body{margin-top:6px}
.layerbox{padding:8px 12px}
