/*
VOICE: công cụ làm việc cho sale BĐS — gọn, rõ, đọc nhanh trạng thái căn.
IDEA: sa bàn dự án đặt trên bản đồ thật, bảng hàng như bảng điện ở sàn giao dịch.
PICTURE: bản đồ 3D toàn màn hình, các bảng nổi bên trên.
COLOUR: xanh lục đậm #0f5b4f chủ đạo, trắng, cam san hô #e4572e làm điểm nhấn; màu trạng thái căn riêng.
TYPE: Be Vietnam Pro. LAYOUT: thanh tìm kiếm trên, danh sách trái, bảng hàng phải, thanh công cụ dưới.
*/
:root{--brand:#0f5b4f;--brand2:#e7f1ee;--acc:#e4572e;--ink:#1d2327;--mut:#68727a;--line:#e3e6e8;--bg:#fff;
--con:#22a06b;--ban:#e05252;--khoa:#7b4bd6;--docquyen:#f2b632;--r:14px;--sh:0 6px 24px rgba(20,30,40,.14)}
*{box-sizing:border-box;min-width:0}
html,body{margin:0;height:100%;overflow:hidden;font:14px/1.45 "Be Vietnam Pro",system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--ink);background:#eef0ea}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer;border:0;background:none}
:focus-visible{outline:2px solid var(--acc);outline-offset:2px}
#map{position:absolute;inset:0}
.card{background:var(--bg);border-radius:var(--r);box-shadow:var(--sh)}
.hide{display:none!important}

/* top bar */
#top{position:absolute;top:12px;left:12px;right:12px;display:flex;gap:10px;align-items:flex-start;z-index:5;pointer-events:none}
#top>*{pointer-events:auto}
#brand{display:flex;align-items:center;gap:10px;padding:8px 14px 8px 10px;height:56px}
#brand .logo{width:36px;height:36px;border-radius:10px;background:var(--brand);color:#fff;display:grid;place-items:center;font-weight:700}
#brand b{display:block;font-size:15px}#brand small{color:var(--mut)}
#filters{display:flex;align-items:stretch;height:56px;padding:0 6px;flex:0 1 760px}
#filters .f{padding:7px 12px;border-right:1px solid var(--line);display:flex;flex-direction:column;justify-content:center;position:relative}
#filters .f:last-child{border:0}
#filters label{font-size:12px;color:var(--mut);font-weight:600}
#filters input[type=search]{border:0;outline:0;padding:0;width:100%;min-width:180px;background:none;font-weight:600}
#filters select{border:0;background:none;font-weight:600;padding:0;outline:0;max-width:170px}
.fs{flex:1}
.sw{display:flex;align-items:center;gap:8px;font-weight:600;white-space:nowrap}
.sw input{appearance:none;width:36px;height:20px;border-radius:20px;background:#cfd5d9;position:relative;margin:0;cursor:pointer;transition:.2s}
.sw input::after{content:"";position:absolute;top:2px;left:2px;width:16px;height:16px;border-radius:50%;background:#fff;transition:.2s}
.sw input:checked{background:var(--brand)}.sw input:checked::after{left:18px}
#sugg{position:absolute;top:58px;left:0;width:min(420px,90vw);max-height:340px;overflow:auto;padding:6px;z-index:9}
#sugg button{display:block;width:100%;text-align:left;padding:8px 10px;border-radius:8px}
#sugg button:hover,#sugg button.on{background:var(--brand2)}
#sugg small{color:var(--mut);display:block}
#adminBtn{margin-left:auto;height:44px;padding:0 16px;border-radius:22px;background:#fff;box-shadow:var(--sh);font-weight:600}
#adminBtn.on{background:var(--acc);color:#fff}

/* left list */
#left{position:absolute;top:80px;left:12px;bottom:12px;width:340px;display:flex;flex-direction:column;z-index:4;overflow:hidden}
.tabs{display:flex;gap:4px;padding:10px;background:#f4f6f6;margin:10px;border-radius:12px}
.tabs button{flex:1;padding:8px 6px;border-radius:9px;font-weight:600;color:var(--mut);white-space:nowrap}
.tabs button.on{background:var(--brand);color:#fff}
.chips{display:flex;gap:6px;padding:0 10px 8px;overflow-x:auto;scrollbar-width:none}
.chip{flex:none;border:1px solid var(--line);border-radius:20px;padding:5px 11px;font-weight:600;background:#fff;white-space:nowrap}
.chip.on{border-color:var(--brand);color:var(--brand);background:var(--brand2)}
.chip span{color:var(--mut);font-weight:500;margin-left:3px}
.scrollY{overflow-y:auto;flex:1;padding:0 10px 12px}
h4{margin:14px 2px 8px;font-size:12px;color:var(--mut);letter-spacing:.02em}
.recent{display:flex;gap:8px;overflow-x:auto}
.recent button{flex:none;width:96px;text-align:left;border:1px solid var(--line);border-radius:10px;padding:6px;font-size:12px;font-weight:600}
.recent img,.pitem img{width:100%;aspect-ratio:16/10;border-radius:7px;object-fit:cover;background:#dde3e1;display:block;margin-bottom:4px}
.pitem{display:flex;gap:10px;align-items:center;padding:8px;border-radius:12px;cursor:pointer}
.pitem:hover{background:#f4f6f6}
.pitem img{width:60px;height:60px;margin:0;flex:none}
.pitem b{display:block}.pitem small{color:var(--mut)}
.pitem .meta{flex:1}
.heart{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;color:#a8b0b6}
.heart.on{color:var(--acc)}
.empty{padding:24px 8px;color:var(--mut);text-align:center}

/* project panel */
#proj{position:absolute;top:80px;left:12px;bottom:12px;display:flex;gap:8px;z-index:4}
#rail{width:72px;padding:8px 6px;display:flex;flex-direction:column;gap:4px;align-self:flex-start}
#rail button{padding:8px 2px;border-radius:12px;font-size:12px;font-weight:600;color:var(--mut);display:flex;flex-direction:column;align-items:center;gap:3px}
#rail button svg{width:22px;height:22px}
#rail button.on{background:var(--brand2);color:var(--brand)}
#pane{width:330px;display:flex;flex-direction:column;overflow:hidden}
.phead{display:flex;align-items:center;gap:8px;padding:12px 12px 6px}
.phead b{flex:1;font-size:16px}
.x{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;font-size:20px;color:var(--mut)}
.x:hover{background:#f0f2f3}
.sub{display:flex;gap:6px;padding:4px 12px 8px;overflow-x:auto}
.sub button{border:1px solid var(--line);border-radius:9px;padding:6px 10px;font-weight:600;white-space:nowrap}
.sub button.on{background:var(--brand);border-color:var(--brand);color:#fff}
.gal{display:flex;overflow-x:auto;scroll-snap-type:x mandatory;gap:8px;border-radius:12px}
.gal img{flex:none;width:100%;aspect-ratio:4/3;object-fit:cover;scroll-snap-align:start;border-radius:12px;background:#dde3e1}
.kv{display:flex;justify-content:space-between;gap:12px;padding:9px 2px;border-bottom:1px solid var(--line)}
.kv span{color:var(--mut)}.kv b{text-align:right}
.tl{border-left:2px solid var(--brand2);margin:8px 0 0 6px;padding-left:14px}
.tl div{position:relative;padding:4px 0 10px}
.tl div::before{content:"";position:absolute;left:-20px;top:9px;width:10px;height:10px;border-radius:50%;background:var(--brand)}
.tl small{color:var(--mut);display:block}
.li{padding:10px;border:1px solid var(--line);border-radius:10px;margin-bottom:8px}
.stat{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin:10px 0}
.stat div{background:#f4f6f6;border-radius:10px;padding:8px 10px}
.stat b{font-size:20px;display:block}.stat small{color:var(--mut)}
.seg{display:flex;background:#f4f6f6;border-radius:10px;padding:4px;margin:6px 0 10px}
.seg button{flex:1;padding:8px;border-radius:8px;font-weight:600;color:var(--mut)}
.seg button.on{background:var(--brand);color:#fff}
.plan{width:100%;background:#f7f9f8;border-radius:12px;display:block}
.plan .u{cursor:pointer}.plan .u:hover rect{stroke:var(--ink);stroke-width:2}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:0 14px;border-radius:10px;font-weight:600;background:var(--brand);color:#fff}
.btn.ghost{background:#fff;color:var(--brand);border:1px solid var(--brand)}
.btn.warn{background:#fff;color:var(--ban);border:1px solid var(--ban)}
.note{font-size:12px;color:var(--mut)}

/* guide */
#guide{position:absolute;top:80px;left:430px;width:250px;padding:12px 14px;z-index:3}
#guide ol{margin:6px 0;padding:0;list-style:none;counter-reset:s}
#guide li{counter-increment:s;padding:5px 0 5px 30px;position:relative;color:var(--mut)}
#guide li::before{content:counter(s);position:absolute;left:0;top:4px;width:22px;height:22px;border-radius:50%;border:1.5px solid var(--line);display:grid;place-items:center;font-size:12px}
#guide li.on{color:var(--ink);font-weight:600}#guide li.on::before{border-color:var(--acc);color:var(--acc)}
#guide li.ok::before{content:"✓";background:var(--con);border-color:var(--con);color:#fff}
#guide a{font-size:12px;color:var(--mut);cursor:pointer;text-decoration:underline}

/* stock board */
#board{position:absolute;top:80px;right:12px;bottom:84px;width:min(620px,calc(100vw - 460px));display:flex;flex-direction:column;z-index:4;overflow:hidden}
#board.full{left:12px;width:auto;z-index:6}
.bhead{display:flex;align-items:center;gap:6px;padding:10px 12px;border-bottom:1px solid var(--line)}
.bhead select{border:0;font-weight:700;font-size:16px;color:var(--brand);background:none}
.bhead .t{flex:1}.bhead small{color:var(--mut);display:block}
.ib{width:36px;height:36px;border-radius:9px;display:grid;place-items:center;color:var(--mut);font-weight:700}
.ib:hover{background:#f0f2f3}
.legend{display:flex;flex-wrap:wrap;gap:6px 14px;padding:8px 12px;align-items:center}
.legend i{display:inline-block;width:12px;height:12px;border-radius:3px;margin-right:5px;vertical-align:-1px}
.legend button{font-weight:600;padding:3px 6px;border-radius:6px}
.legend button.off{opacity:.35}
.gridwrap{overflow:auto;flex:1;position:relative}
table.g{border-collapse:separate;border-spacing:2px;font-size:12px}
table.g th{position:sticky;top:0;background:#24453f;color:#fff;padding:4px 6px;min-width:62px;z-index:1;font-weight:600;line-height:1.2;cursor:pointer}
table.g th small{display:block;font-weight:400;opacity:.8}
table.g th.c0,table.g td.c0{position:sticky;left:0;z-index:2;min-width:56px}
table.g th.c0{z-index:3}
table.g td.c0{background:#f4e7b8;font-weight:700;text-align:center;cursor:pointer}
table.g td.c0.on{background:var(--acc);color:#fff}
table.g td.u{height:30px;text-align:center;color:#fff;font-weight:700;cursor:pointer;border-radius:3px;white-space:nowrap}
table.g td.u:hover{outline:2px solid var(--ink)}
table.g td.dim{opacity:.18}
table.g td.hl{outline:2px solid var(--acc);outline-offset:-1px}
.s-con{background:var(--con)}.s-ban{background:var(--ban)}.s-khoa{background:var(--khoa)}.s-docquyen{background:var(--docquyen);color:#3a2a00!important}

/* bottom tools */
#tools{position:absolute;bottom:14px;left:50%;transform:translateX(-50%);display:flex;padding:6px;z-index:4;gap:2px}
#tools button{padding:6px 12px;border-radius:10px;font-size:12px;font-weight:600;color:var(--mut);display:flex;flex-direction:column;align-items:center;gap:2px;min-width:70px}
#tools button svg{width:20px;height:20px}
#tools button.on{background:var(--brand2);color:var(--brand)}
#tools button:disabled{opacity:.4;cursor:default}
#sun{position:absolute;bottom:84px;left:50%;transform:translateX(-50%);padding:10px 16px;z-index:4;width:min(380px,92vw)}
#sun input{width:100%;accent-color:var(--acc)}
#links{position:absolute;bottom:84px;left:50%;transform:translateX(-50%);padding:10px 14px;z-index:4;width:min(380px,92vw);max-height:40vh;overflow:auto}
#compass{position:absolute;right:14px;bottom:14px;width:84px;height:84px;border-radius:50%;z-index:4;display:grid;place-items:center;font-size:11px;font-weight:700;color:var(--mut)}
#compass .ring{position:absolute;inset:6px;border-radius:50%;border:1px dashed var(--line);transition:transform .2s}
#compass .n{position:absolute;top:2px;left:50%;transform:translateX(-50%);color:var(--acc)}
#compass .dim3{background:var(--brand);color:#fff;border-radius:8px;padding:2px 8px;z-index:1}

/* markers */
.pm{background:#fff;border-radius:20px;padding:5px 12px 5px 6px;box-shadow:var(--sh);font-weight:700;font-size:13px;display:flex;align-items:center;gap:6px;cursor:pointer;white-space:nowrap;border:2px solid #fff}
.pm i{width:22px;height:22px;border-radius:50%;background:var(--brand);color:#fff;display:grid;place-items:center;font-style:normal;font-size:11px}
.pm.on{border-color:var(--acc)}
.tm{background:#fff;border:2px solid var(--brand);color:var(--brand);border-radius:20px;padding:4px 12px;font-weight:700;font-size:13px;cursor:pointer;white-space:nowrap;box-shadow:var(--sh)}
.tm.on{background:var(--acc);border-color:var(--acc);color:#fff}
.am{background:#fff;border-radius:16px;padding:3px 9px 3px 4px;font-size:12px;font-weight:600;box-shadow:var(--sh);display:flex;gap:5px;align-items:center;white-space:nowrap}
.am i{width:18px;height:18px;border-radius:50%;background:var(--acc);display:block}

/* modal & drawer */
#modal{position:fixed;inset:0;background:rgba(15,25,30,.38);z-index:20;display:grid;place-items:center;padding:16px}
#modal .card{width:min(440px,100%);max-height:90vh;overflow:auto;padding:18px}
#modal h3{margin:0 0 4px;font-size:20px}
.badge{display:inline-block;color:#fff;border-radius:6px;padding:2px 8px;font-weight:700;font-size:12px}
.fld{display:block;margin:10px 0}
.fld span{display:block;font-size:12px;color:var(--mut);font-weight:600;margin-bottom:3px}
.fld input,.fld select,.fld textarea{width:100%;border:1px solid var(--line);border-radius:9px;padding:9px 10px;font-size:16px;background:#fff}
.fld textarea{min-height:80px;font-size:14px}
.row{display:flex;gap:8px;flex-wrap:wrap}.row>*{flex:1}
#drawer{position:fixed;top:0;right:0;bottom:0;width:min(440px,100vw);z-index:15;border-radius:0;overflow:auto;padding:16px 18px 40px}
#drawer h3{margin:4px 0 10px}#drawer h5{margin:18px 0 4px;font-size:14px}
#toast{position:fixed;bottom:90px;left:50%;transform:translateX(-50%);background:var(--ink);color:#fff;padding:10px 16px;border-radius:10px;z-index:30;font-weight:600;transition:opacity .3s;pointer-events:none}
#banner{margin:0 10px 10px;background:#fff7e0;border:1px solid #f2d27a;padding:7px 10px;border-radius:10px;font-size:12px}
.maplibregl-ctrl-attrib{font-size:10px}

@media(max-width:1100px){#guide{display:none}#board{width:calc(100vw - 24px);left:12px;top:auto;height:52vh;z-index:7}}
@media(max-width:760px){
 #top{flex-wrap:wrap}#brand{display:none}#filters{flex:1 1 100%;height:auto;flex-wrap:wrap}
 #filters .f{border:0;padding:6px 8px}.fs{flex-basis:100%}
 #adminBtn{position:absolute;right:0;top:-2px;height:36px;display:none}
 #left,#proj{top:auto;height:46vh;left:8px;right:8px;width:auto}
 #pane{flex:1;width:auto}#rail{width:60px}
 #tools{bottom:auto;top:auto;bottom:calc(46vh + 20px)}
 #tools button{min-width:52px;padding:6px}#tools button span{display:none}
 #compass{display:none}
 #board{height:64vh;bottom:8px;left:8px;width:calc(100vw - 16px)}
}
