/* ============================================================
   RENTERP · ระบบจัดเก็บและบริหาร Stock อสังหาริมทรัพย์
   โทนสีน้ำเงิน–ฟ้า สีเรียบ ไม่ใช้ gradient
   ============================================================ */

:root{
  --font-display:'Prompt','IBM Plex Sans Thai',system-ui,sans-serif;
  --font-sans:'IBM Plex Sans Thai','Prompt',system-ui,-apple-system,sans-serif;
  --font-mono:'IBM Plex Mono',ui-monospace,SFMono-Regular,Menlo,monospace;

  /* พื้นหลัง / พื้นผิว */
  --bg:#eef3f9;
  --surface:#ffffff;
  --surface-2:#f5f8fc;
  --surface-3:#e6eef7;
  --rail:#0d2d52;
  --rail-2:#143a66;
  --rail-fg:#e8f1fb;
  --rail-muted:#9db6d4;

  /* ตัวอักษร */
  --fg:#0f2439;
  --fg-2:#38536f;
  --muted:#6a8299;

  /* เส้นขอบ */
  --border:#d3dee9;
  --border-2:#b9cada;

  /* สีหลัก */
  --brand:#0a5fc4;
  --brand-strong:#07478f;
  --brand-soft:#e2edfb;
  --sky:#0d93cf;
  --sky-soft:#dcf1fb;

  /* สถานะ */
  --ok:#0b7a46;      --ok-bg:#dbf0e5;
  --warn:#8f5300;    --warn-bg:#fbeed2;
  --info:#2149cf;    --info-bg:#e3e8fc;
  --idle:#49607a;    --idle-bg:#e3eaf1;
  --stop:#a32e26;    --stop-bg:#fae2df;

  --shadow-1:0 1px 2px rgba(15,36,57,.08);
  --shadow-2:0 4px 10px -4px rgba(15,36,57,.18), 0 18px 40px -26px rgba(15,36,57,.45);
  --r:10px; --r-sm:7px; --r-lg:14px;
  --h-top:60px;
}

/* ---------- reset ---------- */
*,*::before,*::after{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--fg);font-family:var(--font-sans);font-size:14px;line-height:1.55;-webkit-font-smoothing:antialiased}
img{max-width:100%;display:block}
button,input,select,textarea{font:inherit;color:inherit}
button{cursor:pointer}
a{color:var(--brand);text-decoration:none}
a:hover{text-decoration:underline}
h1,h2,h3,h4{font-family:var(--font-display);margin:0;font-weight:600;letter-spacing:-.01em;text-wrap:balance}
[hidden]{display:none!important}
:focus-visible{outline:2px solid var(--brand);outline-offset:2px;border-radius:4px}
::-webkit-scrollbar{width:10px;height:10px}
::-webkit-scrollbar-thumb{background:#c2d2e2;border-radius:10px;border:2px solid var(--bg)}
.num{font-family:var(--font-mono);font-variant-numeric:tabular-nums}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}

/* ---------- ปุ่ม ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:7px;height:38px;padding:0 15px;border:1px solid var(--border-2);background:var(--surface);color:var(--fg-2);border-radius:var(--r-sm);font-weight:500;white-space:nowrap;transition:background .12s,border-color .12s,color .12s}
.btn:hover{background:var(--surface-2);border-color:#9fb6cc;color:var(--fg)}
.btn-primary{background:var(--brand);border-color:var(--brand);color:#fff}
.btn-primary:hover{background:var(--brand-strong);border-color:var(--brand-strong);color:#fff}
.btn-sky{background:var(--sky);border-color:var(--sky);color:#fff}
.btn-sky:hover{background:#0a7cb0;border-color:#0a7cb0;color:#fff}
.btn-ghost{background:transparent;border-color:transparent;color:var(--fg-2)}
.btn-ghost:hover{background:var(--surface-3);border-color:transparent}
.btn-danger{color:var(--stop);border-color:#e3b7b2;background:#fff}
.btn-danger:hover{background:var(--stop-bg);border-color:#d79b95;color:var(--stop)}
.btn-sm{height:32px;padding:0 11px;font-size:13px}
.btn-lg{height:46px;padding:0 22px;font-size:15px}
.btn:disabled{opacity:.45;cursor:not-allowed}
.btn-block{width:100%}

/* ---------- ฟอร์ม ---------- */
.field{display:flex;flex-direction:column;gap:5px;min-width:0}
.field>label,.lbl{font-size:12.5px;font-weight:500;color:var(--fg-2)}
.lbl-hint{color:var(--muted);font-weight:400}
.inp,select.inp,textarea.inp{width:100%;height:38px;padding:0 11px;background:var(--surface);border:1px solid var(--border-2);border-radius:var(--r-sm);transition:border-color .12s,box-shadow .12s}
textarea.inp{height:auto;padding:9px 11px;resize:vertical;min-height:76px;line-height:1.6}
select.inp{appearance:none;background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4.2l4 4 4-4' fill='none' stroke='%236a8299' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/></svg>");background-repeat:no-repeat;background-position:right 10px center;padding-right:28px}
.inp:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft)}
.inp::placeholder{color:#93a8bd}
.inp-err{border-color:#d08a84;background:#fffafa}
.err-msg{font-size:12px;color:var(--stop)}
.row2{display:grid;grid-template-columns:1fr 1fr;gap:10px}
.row3{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.rng{display:grid;grid-template-columns:1fr 14px 1fr;align-items:center;gap:6px}
.rng span{text-align:center;color:var(--muted)}

/* chip เลือกได้ */
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{display:inline-flex;align-items:center;gap:5px;height:30px;padding:0 11px;border:1px solid var(--border-2);background:var(--surface);border-radius:999px;font-size:13px;color:var(--fg-2)}
.chip:hover{border-color:var(--brand);color:var(--brand)}
.chip[aria-pressed="true"]{background:var(--brand);border-color:var(--brand);color:#fff;font-weight:500}
.chip .c{font-size:11.5px;opacity:.75}

/* ---------- ป้ายสถานะ ---------- */
.pill{display:inline-flex;align-items:center;gap:6px;height:24px;padding:0 9px;border-radius:5px;font-size:12px;font-weight:600;white-space:nowrap}
.pill::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor}
.st-t-ok{background:var(--ok-bg);color:var(--ok)}
.st-t-warn{background:var(--warn-bg);color:var(--warn)}
.st-t-info{background:var(--info-bg);color:var(--info)}
.st-t-idle{background:var(--idle-bg);color:var(--idle)}
.st-t-stop{background:var(--stop-bg);color:var(--stop)}
.st-t-brand{background:var(--brand-soft);color:var(--brand-strong)}
.tag{display:inline-flex;align-items:center;height:22px;padding:0 8px;border-radius:5px;background:var(--brand-soft);color:var(--brand-strong);font-size:11.5px;font-weight:600}
.tag-sky{background:var(--sky-soft);color:#075f8a}
.tag-plain{background:var(--surface-3);color:var(--fg-2)}

/* ============================================================
   เข้าสู่ระบบ
   ============================================================ */
.login{position:fixed;inset:0;z-index:90;display:grid;grid-template-columns:1fr 1fr;background:var(--surface);overflow:auto}
.login-art,.login-form{min-height:100vh;display:grid;grid-template-rows:auto 1fr auto;gap:30px;padding:clamp(28px,3.2vw,52px);align-content:stretch}
.la-row{width:100%;max-width:450px;justify-self:center}
.lf-row{width:100%;max-width:382px;justify-self:center}
.login-art{background:var(--rail);color:var(--rail-fg)}
.login-art .mid{align-self:center}
.login-art h2{font-size:clamp(23px,2.1vw,30px);line-height:1.34;color:#fff}
.login-art p{color:var(--rail-muted);margin:15px 0 0;font-size:14px;line-height:1.75}
.brandmark{display:flex;align-items:center;gap:11px;font-family:var(--font-display);font-weight:600;letter-spacing:.02em}
.brandmark i{width:30px;height:30px;border-radius:7px;background:var(--sky);display:grid;place-items:center;font-style:normal;font-size:14px;font-weight:700;color:#06263d}
.login-stats{display:grid;grid-template-columns:repeat(3,1fr);gap:1px;background:rgba(255,255,255,.14);border-radius:var(--r);overflow:hidden}
.login-stats div{background:var(--rail-2);padding:13px 15px}
.login-stats b{display:block;font-family:var(--font-mono);font-size:21px;color:#fff;font-weight:600;line-height:1.3}
.login-stats span{font-size:12px;color:var(--rail-muted)}

.login-form{background:var(--surface)}
.lf-top{display:flex;align-items:center;min-height:30px;font-size:12.5px;color:var(--muted);align-self:start}
.lf-brand{display:none;color:var(--fg)}
.lf-brand i{background:var(--brand);color:#fff}
.lf-mid{align-self:center}
.login-form h1{font-size:23px;margin-bottom:4px}
.login-form .sub{color:var(--muted);margin:0 0 22px;font-size:13.5px}
.role-pick{display:flex;flex-direction:column;gap:8px;margin-bottom:20px}
.role{display:flex;gap:12px;align-items:center;min-height:58px;padding:10px 14px;border:1px solid var(--border-2);border-radius:var(--r);background:var(--surface);text-align:left}
.role:hover{border-color:var(--brand-strong)}
.role[aria-pressed="true"]{border-color:var(--brand);background:var(--brand-soft);box-shadow:inset 0 0 0 1px var(--brand)}
.role b{display:block;font-size:14px;color:var(--fg);line-height:1.5}
.role small{display:block;color:var(--muted);font-size:12.5px;line-height:1.5}
.role em{width:22px;height:22px;border-radius:50%;border:1px solid var(--border-2);background:#fff;flex:0 0 auto;position:relative}
.role[aria-pressed="true"] em{border-color:var(--brand);background:var(--brand)}
.role[aria-pressed="true"] em::after{content:"";position:absolute;inset:0;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'><path d='M5 13l4 4 10-10'/></svg>") center/13px no-repeat}
.login-form .field{margin-bottom:14px}
.login-form .field+.field{margin-bottom:22px}
.login-note{align-self:end;font-size:12.5px;line-height:1.7;color:var(--muted);margin:0;padding-top:15px;border-top:1px solid var(--border)}

/* ============================================================
   โครงหน้าจอหลัก
   ============================================================ */
.app{display:grid;grid-template-columns:238px 1fr;min-height:100%}
.rail{background:var(--rail);color:var(--rail-fg);display:flex;flex-direction:column;position:sticky;top:0;height:100vh;overflow-y:auto}
.rail-head{display:flex;align-items:center;height:var(--h-top);padding:0 18px;border-bottom:1px solid rgba(255,255,255,.09);flex:0 0 auto}
.rail-nav{padding:6px 0 14px;display:flex;flex-direction:column;flex:1}
.rail-nav .grp{font-size:10.5px;letter-spacing:.11em;text-transform:uppercase;color:#7093b9;padding:17px 18px 7px}
.nav-i{display:flex;align-items:center;gap:10px;width:100%;padding:11px 18px;border:0;border-left:3px solid transparent;background:transparent;color:#c3d8ef;font-size:14px;font-weight:500;text-align:left}
.nav-i b{font-weight:500;flex:1;min-width:0}
.nav-i:hover{background:rgba(255,255,255,.07);color:#fff}
.nav-i[aria-current="page"]{background:var(--brand);border-left-color:var(--sky);color:#fff}
.nav-i .n{font-family:var(--font-mono);font-size:11.5px;background:rgba(255,255,255,.13);padding:1px 6px;border-radius:4px;color:#dceaf8}
.nav-i[aria-current="page"] .n{background:rgba(255,255,255,.24);color:#fff}
.nav-i:disabled{opacity:.34;cursor:not-allowed}
.caret{width:7px;height:7px;border-right:1.7px solid currentColor;border-bottom:1.7px solid currentColor;transform:rotate(-45deg);opacity:.45;flex:0 0 auto;margin-left:2px}
.nav-i[aria-current="page"] .caret{opacity:.9}
.rail-foot{padding:14px 18px;border-top:1px solid rgba(255,255,255,.09);font-size:12px;color:var(--rail-muted)}
.rail-foot b{color:#fff;display:block;font-weight:500;font-size:13px}

.main{min-width:0;display:flex;flex-direction:column}
.top{position:sticky;top:0;z-index:40;height:var(--h-top);display:flex;align-items:center;gap:12px;padding:0 20px;background:var(--surface);border-bottom:1px solid var(--border)}
.top .q{flex:1;max-width:440px;position:relative;min-width:0}
.top .q .inp{height:36px;padding-left:35px;background:var(--surface-2)}
.top .q .q-i{position:absolute;left:12px;top:50%;margin-top:-8px;width:16px;height:16px;color:var(--muted);pointer-events:none}
.top-spacer{flex:1}
.who{display:flex;align-items:center;gap:9px;padding:5px 10px 5px 6px;border:1px solid var(--border);border-radius:999px;background:var(--surface)}
.who:hover{background:var(--surface-2)}
.who i{width:28px;height:28px;border-radius:50%;background:var(--brand-soft);color:var(--brand-strong);display:grid;place-items:center;font-style:normal;font-weight:600;font-size:12.5px}
.who span{font-size:13px;font-weight:500}
.who small{display:block;font-size:11px;color:var(--muted);line-height:1.2}
.menu{position:absolute;top:calc(var(--h-top) - 6px);right:20px;z-index:60;background:var(--surface);border:1px solid var(--border);border-radius:var(--r);box-shadow:var(--shadow-2);min-width:230px;padding:6px;display:flex;flex-direction:column}
.menu .hd{padding:10px 11px;border-bottom:1px solid var(--border);margin-bottom:4px}
.menu .hd b{display:block}
.menu .hd small{color:var(--muted)}
.menu button{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 11px;border:0;background:transparent;border-radius:var(--r-sm);text-align:left;font-size:13.5px;color:var(--fg-2)}
.menu button:hover{background:var(--surface-2);color:var(--fg)}
.menu .sep{height:1px;background:var(--border);margin:5px 0}
.menu-role{padding:4px 11px 8px}
.menu-role .lbl{display:block;margin-bottom:6px}

.page{padding:20px;display:none;min-width:0}
.page.page-flat{padding:0}
.page.on{display:block}
.page-hd{display:flex;align-items:flex-end;gap:14px;flex-wrap:wrap;margin-bottom:16px}
.page-hd h1{font-size:21px}
.page-hd p{margin:3px 0 0;color:var(--muted);font-size:13px}
.page-hd .sp{flex:1}
.hd-tools{display:flex;gap:8px;flex-wrap:wrap;align-items:center}

/* ---------- การ์ด/แผง ---------- */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);box-shadow:var(--shadow-1)}
.card-hd{display:flex;align-items:center;gap:10px;padding:13px 16px;border-bottom:1px solid var(--border)}
.card-hd h3{font-size:15px}
.card-hd .sp{flex:1}
.card-bd{padding:16px}
.sec-t{font-family:var(--font-display);font-size:12px;font-weight:600;letter-spacing:.07em;text-transform:uppercase;color:var(--muted);margin:0 0 10px}

/* ---------- ไอคอน ---------- */
.sprite{position:absolute;width:0;height:0;overflow:hidden}
.i{width:1em;height:1em;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:0 0 auto}

/* ---------- แถบแท็บสถานะ (หัวตาราง Stock) ---------- */
.tabline{display:flex;overflow-x:auto;border-bottom:1px solid var(--border);scrollbar-width:none}
.tabline::-webkit-scrollbar{height:0;display:none}
.tabline button{flex:0 0 auto;display:inline-flex;align-items:center;gap:8px;height:46px;padding:0 15px;border:0;border-bottom:2px solid transparent;background:transparent;color:var(--fg-2);font-size:13.5px;font-weight:500;white-space:nowrap}
.tabline button:hover{color:var(--fg);background:var(--surface-2)}
.tabline button .dot{width:7px;height:7px;border-radius:2px;background:var(--border-2)}
.tabline button .c{font-family:var(--font-mono);font-size:11.5px;background:var(--surface-3);color:var(--fg-2);border-radius:5px;padding:1px 6px}
.tabline button[aria-current="true"]{color:var(--brand-strong);border-bottom-color:var(--brand)}
.tabline button[aria-current="true"] .c{background:var(--brand-soft);color:var(--brand-strong)}
.tabline .t-ok .dot{background:var(--ok)}
.tabline .t-warn .dot{background:var(--warn)}
.tabline .t-info .dot{background:var(--info)}
.tabline .t-idle .dot{background:var(--idle)}
.tabline .t-stop .dot{background:var(--stop)}
.tabline .t-brand .dot{background:var(--brand)}

/* ============================================================
   ตั้งค่าระบบ: sidebar ชั้นที่สอง
   ============================================================ */
.set-wrap{display:grid;grid-template-columns:232px 1fr;align-items:start;min-height:calc(100vh - var(--h-top))}
.subrail{position:sticky;top:var(--h-top);height:calc(100vh - var(--h-top));display:flex;flex-direction:column;background:var(--surface);border-right:1px solid var(--border)}
.sr-hd{padding:17px 18px 14px;border-bottom:1px solid var(--border)}
.sr-hd b{display:block;font-family:var(--font-display);font-size:15px;font-weight:600}
.sr-hd small{display:block;margin-top:3px;font-size:12px;color:var(--muted);line-height:1.5}
.sr-nav{flex:1;overflow:auto;padding:9px 0}
.sr-g{padding:13px 18px 6px;font-size:11px;font-weight:600;letter-spacing:.06em;color:var(--muted)}
.sr-g:first-child{padding-top:4px}
.sr-i{display:flex;align-items:center;gap:9px;width:100%;padding:10px 18px;border:0;border-left:3px solid transparent;background:transparent;color:var(--fg-2);font-size:13.5px;font-weight:500;text-align:left;transition:background .12s,color .12s}
.sr-i:hover{background:var(--surface-2);color:var(--fg)}
.sr-i .n{margin-left:auto;font-family:var(--font-mono);font-size:11px;color:var(--muted);background:var(--surface-3);border-radius:5px;padding:1px 6px}
.sr-i[aria-current="true"]{background:var(--brand-soft);border-left-color:var(--brand);color:var(--brand-strong);font-weight:600}
.sr-i[aria-current="true"] .n{background:#fff;color:var(--brand-strong)}
.sr-foot{padding:12px 18px;border-top:1px solid var(--border);font-size:11.5px;color:var(--muted);line-height:1.6}
.set-main{padding:20px;min-width:0}
.card-ft{padding:11px 15px;border-top:1px solid var(--border);background:var(--surface-2);font-size:12px;color:var(--muted);line-height:1.65;border-radius:0 0 var(--r) var(--r)}
.tbl-act{display:flex;gap:4px;align-items:center}
.ico-b{width:30px;height:30px;display:grid;place-items:center;border:1px solid var(--border-2);background:var(--surface);border-radius:7px;color:var(--fg-2);font-size:13px;line-height:1;transition:background .12s,color .12s,border-color .12s}
.ico-b:hover:not(:disabled){background:var(--surface-2);color:var(--fg);border-color:var(--border-2)}
.ico-b:disabled{opacity:.35}
.ico-b.danger:hover:not(:disabled){background:var(--stop-bg);border-color:var(--stop);color:var(--stop)}
.ord{font-family:var(--font-mono);font-size:12px;color:var(--muted)}
.tone-pick{display:flex;gap:8px;flex-wrap:wrap}
.tone-pick button{display:inline-flex;align-items:center;gap:7px;height:34px;padding:0 12px;border:1px solid var(--border-2);background:var(--surface);border-radius:999px;font-size:12.5px;color:var(--fg-2)}
.tone-pick button i{width:10px;height:10px;border-radius:50%}
.tone-pick button[aria-pressed="true"]{border-color:var(--brand);background:var(--brand-soft);color:var(--brand-strong);font-weight:600}

/* ============================================================
   แผนที่และการค้นหาตามรัศมี
   ============================================================ */
.geobar{display:flex;flex-wrap:wrap;align-items:center;gap:9px 14px;padding:10px 14px;margin-bottom:10px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r)}
.geobar .gb-row{min-width:0}
.geobar .gb-row:first-child{flex:1 1 210px}
.gb-sep{width:1px;height:26px;background:var(--border);flex:0 0 auto}
.gb-row{display:flex;align-items:center;gap:8px;flex-wrap:wrap}
.gb-lb{font-size:12.5px;font-weight:500;color:var(--fg-2);flex:0 0 auto}
.gb-pt{display:inline-flex;align-items:center;gap:8px;min-width:0;font-size:13.5px;color:var(--fg)}
.gb-pt .i{width:17px;height:17px;color:var(--muted)}
.gb-pt b{font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.gb-pt.on .i{color:var(--brand)}
.gb-pt small{color:var(--muted);font-family:var(--font-mono);font-size:11.5px;flex:0 0 auto}
.gb-acts .btn .i{width:15px;height:15px}
.gb-acts .btn[aria-pressed="true"]{border-color:var(--brand);background:var(--brand-soft);color:var(--brand-strong)}
.gb-acts select.inp{width:auto;max-width:230px;height:32px;font-size:12.5px}
.gb-rad{flex-wrap:nowrap}
.gb-rad .gb-lb{display:inline-flex;align-items:baseline;gap:3px}
.gb-rad .gb-lb small{font-size:11px;color:var(--muted);font-weight:400}
.gb-rad .chips{gap:6px;flex-wrap:nowrap;min-width:0}
.gb-rad .chip{height:30px;min-width:34px;padding:0 10px;font-size:12.5px;white-space:nowrap;justify-content:center}

.res-main{min-width:0}
@media (min-width:981px){
  #page-search.map-on .search-wrap{grid-template-columns:1fr}
  #page-search.map-on .f-toggle{display:inline-flex}
  #page-search.map-on .filters{position:fixed;top:var(--h-top);left:238px;right:auto;bottom:0;width:312px;max-height:none;z-index:86;display:none;flex-direction:column;border-top:0;border-bottom:0;border-left:0;border-radius:0;box-shadow:18px 0 44px -30px rgba(10,30,52,.55)}
  #page-search.map-on .filters.open{display:flex}
  #page-search.map-on .filters .f-body{display:block;overflow:auto;flex:1}
  #page-search.map-on .filters .f-ft{display:block;padding:11px 14px;border-top:1px solid var(--border);background:var(--surface)}
  #page-search.map-on .filters .f-x{display:grid}
  #page-search.map-on .filters .f-grp:last-child{display:none}
}
.res-listcol{min-width:0}
.ml-hd{display:none}
.res-sec.map-on .res-main{display:grid;grid-template-columns:minmax(0,1fr) 384px;gap:14px;align-items:start}
.mapbox{position:relative;border:1px solid var(--border);border-radius:var(--r);overflow:hidden;background:var(--surface-3)}
.res-sec.map-on .mapbox{position:sticky;top:calc(var(--h-top) + 14px);height:calc(100vh - var(--h-top) - 104px);min-height:520px}
#map{position:absolute;inset:0;z-index:1}
.map-redo{position:absolute;top:12px;left:50%;transform:translateX(-50%);z-index:3;height:34px;padding:0 15px;border:1px solid var(--border-2);background:var(--surface);color:var(--brand-strong);border-radius:999px;font-size:13px;font-weight:600;box-shadow:var(--shadow-2);animation:riseIn .18s ease-out both}
.map-tip{position:absolute;top:12px;left:50%;transform:translateX(-50%);z-index:3;padding:7px 14px;background:var(--rail);color:#fff;border-radius:999px;font-size:12.5px;box-shadow:var(--shadow-2)}
.map-note{position:absolute;left:10px;bottom:9px;z-index:3;font-size:10.5px;color:var(--muted);background:rgba(255,255,255,.86);padding:2px 8px;border-radius:5px}
.leaflet-container{font-family:var(--font-body);background:#eef3f8}
.leaflet-control-attribution{font-size:10px}

/* หมุดราคา */
.mk{display:block}
.mk i{display:inline-flex;align-items:center;justify-content:center;gap:5px;width:100%;height:100%;box-sizing:border-box;padding:0 7px;background:var(--surface);border:1px solid var(--border-2);border-radius:999px;font-family:var(--font-mono);font-size:11.5px;font-weight:600;color:var(--fg);font-style:normal;white-space:nowrap;box-shadow:0 1px 4px rgba(13,45,82,.22);transition:transform .12s}
.mk i::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--idle)}
.mk.t-ok i::before{background:var(--ok)}
.mk.t-warn i::before{background:var(--warn)}
.mk.t-info i::before{background:var(--info)}
.mk.t-stop i::before{background:var(--stop)}
.mk.t-brand i::before{background:var(--brand)}
.mk:hover i{transform:translateY(-1px)}
.mk.on i{background:var(--brand);border-color:var(--brand);color:#fff;z-index:5}
.mk.on i::before{background:#fff}
.mk-cl i{display:grid;place-items:center;width:100%;height:100%;padding:0;border-radius:50%;background:var(--brand);border:2px solid #fff;color:#fff;font-family:var(--font-mono);font-size:12.5px;font-weight:600;font-style:normal;box-shadow:0 2px 8px rgba(13,45,82,.3)}
.mk-cl i::before{display:none}
.mk-cl.big i{font-size:13.5px}
.mk-cl.sm i{font-size:11.5px;border-width:2px;background:var(--brand-strong)}
.mk-me i{display:block;width:100%;height:100%;padding:0;box-sizing:border-box;border-radius:50%;background:var(--brand);border:3px solid #fff;box-shadow:0 0 0 4px rgba(10,95,196,.22),0 2px 6px rgba(13,45,82,.35)}
.mk-me i::before{display:none}

/* สรุปสิ่งที่อยู่ในรัศมี: แถบเดียว กดกางดูรายละเอียดได้ */
.radius-sum{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);margin-bottom:10px;overflow:hidden}
.rs-top{display:flex;align-items:center;gap:10px;width:100%;padding:10px 13px;border:0;background:transparent;text-align:left}
.rs-top:hover{background:var(--surface-2)}
.rs-top .n{font-family:var(--font-mono);font-size:19px;font-weight:600;color:var(--brand-strong);flex:0 0 auto}
.rs-top .tx{min-width:0;flex:1}
.rs-top .tx b{display:block;font-size:12.5px;font-weight:500;color:var(--fg);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.rs-top .tx small{display:block;font-size:11.5px;color:var(--muted);margin-top:1px}
.rs-top .cv{width:8px;height:8px;border-right:1.8px solid var(--muted);border-bottom:1.8px solid var(--muted);transform:rotate(45deg) translate(-2px,-2px);transition:transform .16s;flex:0 0 auto}
.radius-sum.open .rs-top .cv{transform:rotate(-135deg) translate(-2px,-2px)}
.rs-body{display:none;padding:2px 13px 13px;border-top:1px solid var(--border)}
.radius-sum.open .rs-body{display:block;animation:fadeIn .16s ease-out}
.rs-grp{margin-top:11px}
.rs-grp>.lb{display:block;font-size:11.5px;font-weight:600;color:var(--muted);margin-bottom:6px}
.rs-bars{display:flex;flex-direction:column;gap:6px}
.rs-b{display:grid;grid-template-columns:1fr 46px;align-items:center;gap:8px;width:100%;border:0;background:transparent;padding:0;text-align:left}
.rs-b .nm{position:relative;height:24px;display:flex;align-items:center;padding:0 9px;border-radius:6px;background:var(--surface-2);font-size:12.5px;color:var(--fg-2);overflow:hidden}
.rs-b .nm em{position:absolute;left:0;top:0;bottom:0;background:var(--brand-soft);font-style:normal}
.rs-b .nm span{position:relative}
.rs-b .vl{font-family:var(--font-mono);font-size:12px;color:var(--fg-2);text-align:right}
.rs-b:hover .nm{color:var(--fg)}
.rs-stat{display:grid;grid-template-columns:repeat(3,1fr);gap:1px;background:var(--border);border-radius:8px;overflow:hidden;margin-top:11px}
.rs-stat div{background:var(--surface-2);padding:8px 9px}
.rs-stat b{display:block;font-family:var(--font-mono);font-size:14px;color:var(--fg)}
.rs-stat span{font-size:10.5px;color:var(--muted)}

/* ป้ายระยะทางบนการ์ดและแถวรายการ */
.d-tag{display:inline-flex;align-items:center;gap:4px;height:21px;padding:0 8px;border-radius:999px;background:var(--brand-soft);color:var(--brand-strong);font-family:var(--font-mono);font-size:11px;font-weight:600;white-space:nowrap}
.p-thumb .d-tag{position:absolute;right:8px;top:8px;background:rgba(255,255,255,.94);color:var(--brand-strong);box-shadow:var(--shadow-1)}
.p-row .mid .hdl{display:flex;align-items:center;gap:7px;min-width:0}
.p-row .mid .hdl .p-code{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis}

/* แถวรายการในคอลัมน์ข้างแผนที่ */
.res-sec.map-on .res-listcol .list{gap:9px}
.res-sec.map-on .res-listcol .p-row{grid-template-columns:104px 1fr;gap:11px;padding:9px;align-items:start}
.res-sec.map-on .res-listcol .p-row .th{aspect-ratio:1/1}
.res-sec.map-on .res-listcol .p-row .p-name{font-size:14px!important}
.res-sec.map-on .res-listcol .p-row .meta{gap:2px 9px;font-size:11.5px}
.res-sec.map-on .res-listcol .p-row .rt{grid-column:1/-1;flex-direction:row;align-items:center;justify-content:space-between;text-align:left;gap:8px;flex-wrap:wrap}
.res-sec.map-on .res-listcol .p-row .rt .p-price{font-size:16px}
.res-sec.map-on .res-listcol .p-row .p-owner{display:none}
.map-fab{display:none;position:fixed;right:12px;bottom:132px;z-index:82;height:40px;padding:0 16px;border:0;border-radius:999px;background:var(--rail);color:#fff;font-size:13.5px;font-weight:600;box-shadow:0 6px 18px -6px rgba(10,30,52,.6);align-items:center;gap:8px}
.map-fab .i{width:17px;height:17px}

/* ============================================================
   ค้นหาทรัพย์
   ============================================================ */
.search-wrap{display:grid;grid-template-columns:276px 1fr;gap:16px;align-items:start}
.filters{position:sticky;top:calc(var(--h-top) + 20px);max-height:calc(100vh - var(--h-top) - 40px);overflow:auto;background:var(--surface);border:1px solid var(--border);border-radius:var(--r)}
.filters .f-hd{display:flex;align-items:center;gap:8px;padding:12px 14px;border-bottom:1px solid var(--border);position:sticky;top:0;background:var(--surface);z-index:2}
.filters .f-hd h3{font-size:14px;flex:1}
.f-grp{padding:13px 14px;border-bottom:1px solid var(--border)}
.f-grp:last-child{border-bottom:0}
.f-grp>.lbl{display:block;margin-bottom:7px}
.f-grp .stack{display:flex;flex-direction:column;gap:8px}
.f-count{font-family:var(--font-mono);font-size:11.5px;color:var(--brand-strong);background:var(--brand-soft);border-radius:5px;padding:1px 6px}

.res-bar{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:12px}
.res-bar .t{font-size:13.5px;color:var(--fg-2)}
.res-bar .t b{font-family:var(--font-mono);font-size:16px;color:var(--fg)}
.res-bar .sp{flex:1}
.active-chips{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:12px}
.ac{display:inline-flex;align-items:center;gap:7px;height:28px;padding:0 6px 0 10px;background:var(--brand-soft);color:var(--brand-strong);border:1px solid #c4dcf8;border-radius:999px;font-size:12.5px}
.ac button{border:0;background:transparent;color:inherit;width:18px;height:18px;border-radius:50%;display:grid;place-items:center;font-size:14px;line-height:1;opacity:.7}
.ac button:hover{background:#fff;opacity:1}

.view-tog{display:inline-flex;border:1px solid var(--border-2);border-radius:var(--r-sm);overflow:hidden;background:var(--surface)}
.view-tog button{display:inline-flex;align-items:center;gap:6px;height:36px;padding:0 13px;border:0;background:transparent;color:var(--fg-2);font-size:13px;font-weight:500}
.view-tog .i{width:15px;height:15px;color:var(--muted)}
.view-tog button[aria-pressed="true"] .i{color:#fff}
.view-tog button+button{border-left:1px solid var(--border)}
.view-tog button[aria-pressed="true"]{background:var(--brand);color:#fff}

/* grid การ์ดทรัพย์ */
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(258px,1fr));gap:14px}
.p-card{background:var(--surface);border:1px solid var(--border);border-radius:var(--r);overflow:hidden;text-align:left;padding:0;display:flex;flex-direction:column;transition:border-color .12s,box-shadow .12s,transform .12s}
.p-card:hover{border-color:var(--border-2);box-shadow:var(--shadow-2);transform:translateY(-1px)}
.p-thumb{position:relative;aspect-ratio:4/3;background:var(--surface-3);overflow:hidden}
.p-thumb img{width:100%;height:100%;object-fit:cover}
.p-thumb .pill{position:absolute;top:9px;left:9px;background:rgba(255,255,255,.94);box-shadow:var(--shadow-1)}
.p-thumb .n-img{position:absolute;bottom:9px;right:9px;background:rgba(10,36,61,.78);color:#fff;font-family:var(--font-mono);font-size:11px;padding:2px 7px;border-radius:5px}
.p-bd{padding:12px 13px 13px;display:flex;flex-direction:column;gap:7px;flex:1}
.p-code{font-family:var(--font-mono);font-size:11.5px;color:var(--muted);letter-spacing:.02em}
.p-name{font-family:var(--font-display);font-weight:600;font-size:15px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.p-loc{font-size:12.5px;color:var(--muted);display:-webkit-box;-webkit-line-clamp:1;-webkit-box-orient:vertical;overflow:hidden}
.p-price{font-family:var(--font-mono);font-size:17px;font-weight:600;color:var(--brand-strong)}
.p-price small{font-family:var(--font-sans);font-size:11.5px;color:var(--muted);font-weight:400}
.p-specs{display:flex;flex-wrap:wrap;gap:4px 11px;font-size:12px;color:var(--fg-2);padding-top:8px;border-top:1px solid var(--border);margin-top:auto}
.p-specs span{display:inline-flex;align-items:center;gap:4px}
.p-specs .i{width:14px;height:14px;color:var(--muted);stroke-width:1.9}
.p-specs span b{font-family:var(--font-mono);font-weight:600}
.p-owner{display:flex;align-items:center;gap:6px;font-size:11.5px;color:var(--muted)}

/* list view */
.list{display:flex;flex-direction:column;gap:8px}
.p-row{display:grid;grid-template-columns:124px 1fr auto;gap:14px;background:var(--surface);border:1px solid var(--border);border-radius:var(--r);padding:10px;text-align:left;align-items:center}
.p-row:hover{border-color:var(--border-2);box-shadow:var(--shadow-1)}
.p-row .th{aspect-ratio:4/3;border-radius:var(--r-sm);overflow:hidden;background:var(--surface-3)}
.p-row .th img{width:100%;height:100%;object-fit:cover}
.p-row .mid{min-width:0;display:flex;flex-direction:column;gap:4px}
.p-row .rt{text-align:right;display:flex;flex-direction:column;gap:6px;align-items:flex-end}
.p-row .meta{display:flex;gap:12px;flex-wrap:wrap;font-size:12.5px;color:var(--muted)}

.pager{display:flex;align-items:center;justify-content:center;gap:6px;margin-top:18px;flex-wrap:wrap}
.pager button{min-width:34px;height:34px;padding:0 9px;border:1px solid var(--border-2);background:var(--surface);border-radius:var(--r-sm);font-family:var(--font-mono);font-size:13px;color:var(--fg-2)}
.pager button:hover{border-color:var(--brand);color:var(--brand)}
.pager button[aria-current="true"]{background:var(--brand);border-color:var(--brand);color:#fff}
.pager .gap{color:var(--muted);padding:0 2px}

.empty{padding:52px 20px;text-align:center;background:var(--surface);border:1px dashed var(--border-2);border-radius:var(--r)}
.empty b{display:block;font-family:var(--font-display);font-size:16px;margin-bottom:5px}
.empty p{color:var(--muted);margin:0 0 14px}

/* ============================================================
   รายละเอียดทรัพย์ (ชีตเต็มจอ)
   ============================================================ */
.sheet{position:fixed;inset:0;z-index:90;display:none}
.sheet.on{display:block}
.sheet .bd{position:absolute;inset:0;background:rgba(10,30,52,.55)}
.sheet .pane{position:absolute;top:0;right:0;bottom:0;width:min(980px,100%);background:var(--bg);display:flex;flex-direction:column;box-shadow:-18px 0 50px -28px rgba(10,30,52,.6)}
.sheet-hd{display:flex;align-items:center;gap:10px;padding:12px 18px;background:var(--surface);border-bottom:1px solid var(--border);flex-wrap:wrap}
.sheet-hd .sp{flex:1}
.sheet-bd{flex:1;overflow:auto;padding:18px}
.x{width:36px;height:36px;border:1px solid var(--border-2);background:var(--surface);border-radius:var(--r-sm);display:grid;place-items:center;font-size:17px;line-height:1;color:var(--fg-2)}
.x:hover{background:var(--surface-2)}

.gal{display:grid;grid-template-columns:1fr 92px;gap:10px;margin-bottom:16px}
.gal-main{position:relative;aspect-ratio:16/10;background:var(--surface-3);border-radius:var(--r);overflow:hidden;border:1px solid var(--border)}
.gal-main img{width:100%;height:100%;object-fit:cover}
.gal-nav{position:absolute;inset:0;display:flex;align-items:center;justify-content:space-between;padding:0 10px;pointer-events:none}
.gal-nav button{pointer-events:auto;width:38px;height:38px;border-radius:50%;border:0;background:rgba(255,255,255,.92);box-shadow:var(--shadow-1);font-size:16px;color:var(--fg);display:grid;place-items:center}
.gal-nav button:hover{background:#fff}
.gal-cnt{position:absolute;bottom:10px;right:10px;background:rgba(10,36,61,.8);color:#fff;font-family:var(--font-mono);font-size:12px;padding:3px 9px;border-radius:5px}
.gal-thumbs{display:flex;flex-direction:column;gap:8px;max-height:100%;overflow:auto}
.gal-thumbs button{aspect-ratio:4/3;border-radius:var(--r-sm);overflow:hidden;border:2px solid transparent;padding:0;background:var(--surface-3)}
.gal-thumbs button[aria-current="true"]{border-color:var(--brand)}
.gal-thumbs img{width:100%;height:100%;object-fit:cover}

.d-grid{display:grid;grid-template-columns:1fr 310px;gap:16px;align-items:start}
.kv{display:grid;grid-template-columns:120px 1fr;gap:8px 14px;font-size:13.5px}
.kv dt{color:var(--muted)}
.kv dd{margin:0;color:var(--fg)}
.kv dd b{font-family:var(--font-mono);font-weight:600}
.spec-grid{display:flex;flex-wrap:wrap;gap:1px;background:var(--border);border-radius:var(--r);overflow:hidden}
.spec-grid div{flex:1 1 104px;background:var(--surface);padding:11px 13px}
.spec-grid b{display:block;font-family:var(--font-mono);font-size:17px;font-weight:600}
.spec-grid span{font-size:12px;color:var(--muted)}
.feat{display:flex;flex-wrap:wrap;gap:6px}
.feat span{display:inline-flex;align-items:center;gap:6px;padding:5px 10px;background:var(--surface-2);border:1px solid var(--border);border-radius:999px;font-size:12.5px;color:var(--fg-2)}
.feat span::before{content:"";width:13px;height:13px;flex:0 0 auto;background:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230b7a46' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><path d='M5 13l4 4 10-10'/></svg>") center/13px no-repeat}
.map{aspect-ratio:16/9;border-radius:var(--r);overflow:hidden;border:1px solid var(--border);background:#e8eef5;position:relative}
.map svg{width:100%;height:100%;display:block}
.locked{background:var(--surface-2);border:1px dashed var(--border-2);border-radius:var(--r);padding:14px;font-size:13px;color:var(--muted)}
.locked b{display:block;color:var(--fg-2);font-family:var(--font-display);margin-bottom:3px}
.mask{font-family:var(--font-mono);letter-spacing:.04em}
.log{display:flex;flex-direction:column;gap:0}
.log li{list-style:none;display:grid;grid-template-columns:14px 1fr;gap:10px;padding:0 0 14px;position:relative}
.log li:last-child{padding-bottom:0}
.log li::before{content:"";width:9px;height:9px;border-radius:50%;background:var(--brand);margin-top:5px;margin-left:2px;z-index:1}
.log li:not(:last-child)::after{content:"";position:absolute;left:6px;top:14px;bottom:0;width:1px;background:var(--border-2)}
.log b{font-weight:500;font-size:13px}
.log small{display:block;color:var(--muted);font-size:12px}
.log ul{margin:0;padding:0}

/* ============================================================
   ตาราง (จัดการ Stock / ผู้ใช้งาน)
   ============================================================ */
.tbl-wrap{overflow-x:auto;border:1px solid var(--border);border-radius:var(--r);background:var(--surface)}
table.tbl{width:100%;border-collapse:collapse;min-width:900px;font-size:13.5px}
table.tbl th{text-align:left;font-family:var(--font-display);font-size:12px;font-weight:600;color:var(--fg-2);background:var(--surface-2);padding:10px 12px;border-bottom:1px solid var(--border);white-space:nowrap;position:sticky;top:0;z-index:1}
table.tbl td{padding:9px 12px;border-bottom:1px solid var(--border);vertical-align:middle}
table.tbl tr:last-child td{border-bottom:0}
table.tbl tbody tr:hover{background:var(--surface-2)}
table.tbl tr[data-sel="1"]{background:var(--brand-soft)}
.t-name{display:flex;align-items:center;gap:10px;min-width:0}
.t-name .th{width:46px;height:36px;border-radius:5px;overflow:hidden;background:var(--surface-3);flex:0 0 auto}
.t-name .th img{width:100%;height:100%;object-fit:cover}
.t-name b{display:block;font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:260px}
.t-name small{color:var(--muted);font-family:var(--font-mono);font-size:11.5px}
.t-act{display:flex;gap:6px;justify-content:flex-end}
select.st-sel{height:30px;font-size:12.5px;font-weight:600;border-radius:5px;padding:0 24px 0 9px;border:1px solid var(--border-2);background-color:var(--surface)}
.bulk{position:sticky;bottom:0;z-index:5;display:flex;align-items:center;gap:10px;flex-wrap:wrap;background:var(--rail);color:#fff;border-radius:var(--r);padding:11px 14px;margin-top:12px;box-shadow:var(--shadow-2)}
.bulk b{font-family:var(--font-mono)}
.bulk .sp{flex:1}
.ck{width:17px;height:17px;accent-color:var(--brand)}

/* ============================================================
   ฟอร์มเพิ่ม/แก้ไขทรัพย์
   ============================================================ */
.form-wrap{display:grid;grid-template-columns:1fr 300px;gap:16px;align-items:start}
.fsec{margin-bottom:0}
.fsec+.fsec{margin-top:14px}
.fsec-hd{display:flex;align-items:baseline;gap:10px;padding:13px 16px;border-bottom:1px solid var(--border)}
.fsec-hd h3{font-size:14.5px}
.fsec-hd span{font-size:12px;color:var(--muted)}
.fsec-bd{padding:16px;display:flex;flex-direction:column;gap:12px}
.drop{border:1.5px dashed var(--border-2);border-radius:var(--r);background:var(--surface-2);padding:22px;text-align:center}
.drop.hot{border-color:var(--brand);background:var(--brand-soft)}
.drop b{display:block;font-family:var(--font-display);margin-bottom:3px}
.drop p{color:var(--muted);margin:0 0 12px;font-size:12.5px}
.ups{display:grid;grid-template-columns:repeat(auto-fill,minmax(112px,1fr));gap:9px;margin-top:12px}
.up{position:relative;border:1px solid var(--border);border-radius:var(--r-sm);overflow:hidden;background:var(--surface-3)}
.up .im{aspect-ratio:4/3}
.up .im img{width:100%;height:100%;object-fit:cover}
.up .pdf{aspect-ratio:4/3;display:grid;place-items:center;background:var(--surface-2);font-family:var(--font-mono);font-size:11px;color:var(--fg-2);text-align:center;padding:6px;word-break:break-all}
.up .bar{display:flex;gap:1px;background:var(--border)}
.up .bar button{flex:1;height:26px;border:0;background:var(--surface);font-size:11.5px;color:var(--fg-2)}
.up .bar button:hover{background:var(--surface-2);color:var(--brand)}
.up[data-cover="1"]{outline:2px solid var(--brand);outline-offset:-2px}
.up .cv{position:absolute;top:5px;left:5px;background:var(--brand);color:#fff;font-size:10.5px;font-weight:600;padding:1px 6px;border-radius:4px}
.side-note{font-size:12.5px;color:var(--muted);line-height:1.6}
.side-note b{color:var(--fg-2)}
.code-prev{font-family:var(--font-mono);font-size:19px;font-weight:600;color:var(--brand-strong);background:var(--brand-soft);border-radius:var(--r-sm);padding:9px 12px;text-align:center;letter-spacing:.03em}

/* ============================================================
   ผู้ใช้งาน / ตั้งค่า
   ============================================================ */
.perm{width:100%;border-collapse:collapse;font-size:13px}
.perm th,.perm td{padding:8px 10px;border-bottom:1px solid var(--border);text-align:center}
.perm th:first-child,.perm td:first-child{text-align:left}
.perm thead th{background:var(--surface-2);font-family:var(--font-display);font-size:12px;color:var(--fg-2)}
.yes,.no{display:inline-grid;place-items:center;width:20px;height:20px;border-radius:5px;font-size:12px;font-weight:700}
.yes{background:var(--ok-bg);color:var(--ok)}
.no{background:var(--surface-3);color:#9bb0c5}
.sw{position:relative;width:40px;height:22px;border-radius:999px;background:var(--border-2);border:0;transition:background .15s;flex:0 0 auto}
.sw::after{content:"";position:absolute;top:2px;left:2px;width:18px;height:18px;border-radius:50%;background:#fff;box-shadow:var(--shadow-1);transition:transform .15s}
.sw[aria-pressed="true"]{background:var(--brand)}
.sw[aria-pressed="true"]::after{transform:translateX(18px)}
.set-row{display:flex;align-items:center;gap:12px;padding:12px 0;border-bottom:1px solid var(--border)}
.set-row:last-child{border-bottom:0}
.set-row .tx{flex:1;min-width:0}
.set-row b{display:block;font-weight:500}
.set-row small{color:var(--muted)}
.tag-edit{display:flex;flex-wrap:wrap;gap:6px}
.tag-edit .t{display:inline-flex;align-items:center;gap:7px;height:30px;padding:0 6px 0 11px;background:var(--surface-2);border:1px solid var(--border-2);border-radius:999px;font-size:13px}
.tag-edit .t .lb{border:0;background:transparent;padding:0;font-size:13px;color:var(--fg);line-height:1.2;transition:color .12s}
.tag-edit .t:hover{border-color:var(--brand);background:var(--brand-soft)}
.tag-edit .t:hover .lb{color:var(--brand-strong)}
.tag-edit .t .x{border:0;background:transparent;width:18px;height:18px;border-radius:50%;color:var(--muted);font-size:13px;line-height:1;display:grid;place-items:center}
.tag-edit .t .x:hover{background:var(--stop-bg);color:var(--stop)}

/* ============================================================
   โมดัล / แจ้งเตือน
   ============================================================ */
.modal{position:fixed;inset:0;z-index:92;display:none;align-items:center;justify-content:center;padding:20px}
.modal.on{display:flex}
.modal .bd{position:absolute;inset:0;background:rgba(10,30,52,.55)}
.modal .box{position:relative;background:var(--surface);border-radius:var(--r-lg);box-shadow:var(--shadow-2);width:min(620px,100%);max-height:calc(100vh - 40px);display:flex;flex-direction:column;overflow:hidden}
.modal .box.wide{width:min(880px,100%)}
.modal-hd{display:flex;align-items:center;gap:10px;padding:14px 18px;border-bottom:1px solid var(--border)}
.modal-hd h3{flex:1;font-size:16px}
.modal-bd{padding:18px;overflow:auto;display:flex;flex-direction:column;gap:12px}
.modal-ft{display:flex;gap:8px;justify-content:flex-end;padding:13px 18px;border-top:1px solid var(--border);background:var(--surface-2);flex-wrap:wrap}
.data-ta{width:100%;min-height:180px;font-family:var(--font-mono);font-size:11.5px;line-height:1.7;white-space:pre;overflow:auto;background:var(--surface-2);border:1px solid var(--border-2);border-radius:var(--r-sm);padding:11px}
.toasts{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);z-index:95;display:flex;flex-direction:column;gap:8px;align-items:center;pointer-events:none;width:calc(100% - 32px);max-width:460px}
.toast{background:var(--rail);color:#fff;border-radius:var(--r);padding:11px 16px;box-shadow:var(--shadow-2);font-size:13.5px;display:flex;align-items:center;gap:10px;animation:up .22s ease-out}
.toast.ok{background:#0b6b3f}
.toast.err{background:#942a22}
@keyframes up{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
/* ---------- การเคลื่อนไหว ---------- */
@keyframes riseIn{from{opacity:0;transform:translateY(9px)}to{opacity:1;transform:none}}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.page.on{animation:fadeIn .16s ease-out}
.grid>*,.list>*{animation:riseIn .22s cubic-bezier(.2,.8,.3,1) both}
.grid>*:nth-child(2),.list>*:nth-child(2){animation-delay:.03s}
.grid>*:nth-child(3),.list>*:nth-child(3){animation-delay:.06s}
.grid>*:nth-child(4),.list>*:nth-child(4){animation-delay:.09s}
.grid>*:nth-child(5),.list>*:nth-child(5){animation-delay:.11s}
.grid>*:nth-child(6),.list>*:nth-child(6){animation-delay:.13s}
.grid>*:nth-child(7),.list>*:nth-child(7){animation-delay:.15s}
.grid>*:nth-child(n+8),.list>*:nth-child(n+8){animation-delay:.17s}
.btn:active,.chip:active{transform:scale(.97)}
.p-card:active,.p-row:active{transform:scale(.99)}
.sr-i:active,.tabline button:active{opacity:.75}

@media (prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;transition-duration:.01ms!important}}

.burger{display:none;width:38px;height:38px;border:1px solid var(--border-2);background:var(--surface);border-radius:var(--r-sm);place-items:center}
.burger span{display:block;width:17px;height:1.8px;background:var(--fg-2);box-shadow:0 5px 0 var(--fg-2),0 -5px 0 var(--fg-2)}
.f-toggle{display:none}
.f-body{display:contents}
.f-ft{display:none}
.f-x{display:none;width:32px;height:32px;font-size:15px}
.set-sec{display:none}
.set-sec.on{display:block}
.tab .n:empty{visibility:hidden}
.f-grab{display:none}
.sheet-acts{display:contents}
.subtabs{display:none}

/* ============================================================
   แถบเมนูล่าง (มือถือ / แท็บเล็ต)
   ============================================================ */
.tabbar{display:none;position:fixed;left:0;right:0;bottom:0;z-index:83;background:var(--surface);border-top:1px solid var(--border);box-shadow:0 -2px 14px -8px rgba(15,36,57,.5);padding-bottom:env(safe-area-inset-bottom)}
.tabbar .in{display:flex;padding:5px 2px 3px}
.tab{flex:1 1 0;min-width:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;height:54px;border:0;background:transparent;color:var(--muted);font-size:11.5px;font-weight:500;padding:0 2px}
.tab .ic{position:relative;display:grid;place-items:center;width:52px;max-width:100%;height:28px;border-radius:999px;transition:background .14s}
.tab .i{width:21px;height:21px;stroke-width:1.75}
.tab .tl{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%}
.tab .n{position:absolute;top:-1px;right:6px;min-width:16px;height:16px;padding:0 4px;border-radius:9px;background:var(--brand);color:#fff;font-family:var(--font-mono);font-style:normal;font-size:10px;line-height:16px;text-align:center;box-shadow:0 0 0 2px var(--surface)}
.tab .n:empty{display:none}
.tab .ic{transition:transform .16s cubic-bezier(.2,.8,.3,1)}
.tab .tl{transition:color .16s,font-weight .16s}
.tab[aria-current="true"]{color:var(--brand-strong);font-weight:600}
.tab[aria-current="true"] .i{stroke-width:2.1}
.tab[aria-current="true"] .ic{transform:translateY(-1px)}
.tab:active .ic{transform:scale(.9)}
@media (max-width:400px){.tab{font-size:11px}.tab .ic{width:46px}}

/* ============================================================
   responsive
   ============================================================ */
@media (max-width:1180px){
  .d-grid{grid-template-columns:1fr}
  .form-wrap{grid-template-columns:1fr}
}
/* จอกว้างไม่พอวางสองคอลัมน์: วางแผนที่ไว้บน รายการอยู่ล่างแบบ 2 คอลัมน์ */
@media (min-width:981px) and (max-width:1199px){
  .res-sec.map-on .res-main{grid-template-columns:minmax(0,1fr)}
  .res-sec.map-on .mapbox{position:relative;top:auto;height:58vh;min-height:360px}
  .res-sec.map-on .res-listcol .list{display:grid;grid-template-columns:1fr 1fr;gap:10px}
}

@media (max-width:980px){
  .login{grid-template-columns:1fr}
  .login-art{display:none}
  .login-form{padding:26px 20px;gap:24px}
  .lf-row{max-width:420px}
  .lf-top{flex-direction:column;align-items:flex-start;gap:13px}
  .lf-brand{display:flex}
  .app{grid-template-columns:1fr}
  .rail{position:fixed;top:0;left:0;bottom:0;width:272px;height:100%;z-index:85;transform:translateX(-100%);transition:transform .2s}
  .rail.open{transform:none}
  .main{padding-bottom:58px}
  .tabbar{display:block}
  .subtabs{display:flex;gap:7px;overflow-x:auto;margin:0 0 14px;padding-bottom:2px;-webkit-overflow-scrolling:touch}
  .subtabs button{flex:0 0 auto;height:34px;padding:0 13px;border:1px solid var(--border-2);background:var(--surface);border-radius:999px;font-size:13px;color:var(--fg-2);white-space:nowrap}
  .subtabs button[aria-current="true"]{background:var(--brand);border-color:var(--brand);color:#fff}
  .page{padding:14px}
  .set-wrap{grid-template-columns:1fr;min-height:0}
  .subrail{display:none}
  .set-main{padding:14px}
  .page-hd{margin-bottom:12px}
  .search-wrap{grid-template-columns:1fr}
  .res-sec.map-on .res-main{display:block}
  .mapbox{height:58vh}
  #page-search.map-on .page-hd,#page-search.map-on .res-bar,#page-search.map-on .active-chips{display:none}
  #page-search.map-on{padding:0}
  .res-sec.map-on .mapbox{position:fixed;left:0;right:0;top:var(--h-top);bottom:0;height:auto;min-height:0;border:0;border-radius:0;z-index:70}
  .res-sec.map-on .geobar{position:fixed;top:calc(var(--h-top) + 9px);left:10px;right:10px;z-index:73;margin:0;padding:9px 11px;gap:7px;flex-direction:column;align-items:stretch;box-shadow:0 6px 20px -10px rgba(10,30,52,.5)}
  .geobar .gb-sep{display:none}
  .geobar .gb-row:first-child{flex:none}
  .res-sec.map-on .geobar .gb-acts{display:grid;grid-template-columns:1fr 1fr 1fr;gap:6px}
  .res-sec.map-on .geobar .gb-acts>*{min-width:0;width:100%}
  .res-sec.map-on .geobar .gb-rad{flex-wrap:nowrap}
  .res-sec.map-on .geobar .gb-rad .chips{flex-wrap:nowrap;overflow-x:auto;padding:1px 2px 2px 0}
  .res-sec.map-on .geobar .gb-rad .chip{flex:1 1 0;min-width:34px;padding:0 6px}
  .res-sec.map-on .geobar .gb-acts .btn{padding:0 11px;font-size:12.5px;height:34px}
  .res-sec.map-on .geobar select.inp{height:34px;max-width:none;font-size:12px;padding:0 22px 0 9px;background-position:right 8px center}
  .res-sec.map-on .geobar .gb-acts .btn{padding:0 7px;font-size:12px;gap:5px}
  .res-sec.map-on .geobar .gb-acts .btn .i{width:14px;height:14px}
  .res-sec.map-on .map-note{display:none}
  .res-sec.map-on .res-listcol{position:fixed;left:0;right:0;bottom:58px;z-index:74;max-height:72vh;display:flex;flex-direction:column;background:var(--surface);border-radius:17px 17px 0 0;box-shadow:0 -10px 34px -16px rgba(10,30,52,.55);overflow:hidden;transform:translateY(calc(100% - 62px));transition:transform .26s cubic-bezier(.2,.8,.3,1)}
  .res-sec.map-on .res-listcol.open{transform:none;overflow-y:auto;-webkit-overflow-scrolling:touch}
  .res-sec.map-on .ml-hd{display:flex;flex-direction:column;align-items:center;gap:2px;width:100%;padding:8px 14px 9px;border:0;background:var(--surface);flex:0 0 auto;position:sticky;top:0;z-index:3}
  .ml-grab{display:block;width:38px;height:4px;border-radius:4px;background:var(--border-2);margin-bottom:5px}
  .ml-hd b{font-family:var(--font-display);font-size:14px}
  .ml-more{font-size:11.5px;color:var(--muted)}
  .res-sec.map-on .radius-sum{margin:0 12px 10px;flex:0 0 auto}
  .res-sec.map-on #results{padding:0 12px 12px}
  .res-sec.map-on #results .grid{grid-template-columns:1fr}
  .res-sec.map-on .pager{display:none}
  .map-fab:not([hidden]){display:inline-flex}
  .grid{grid-template-columns:repeat(auto-fill,minmax(206px,1fr))}
  .p-owner{display:none}
  .top .q{max-width:none}
  .sheet .pane{width:100%;animation:paneUp .22s cubic-bezier(.2,.8,.3,1)}
  .gal{grid-template-columns:1fr}
  .gal-thumbs{flex-direction:row;max-height:none}
  .gal-thumbs button{width:84px;flex:0 0 auto}
  .toasts{bottom:70px}

  /* ตัวกรองกลายเป็นแผ่นเลื่อนขึ้นจากด้านล่าง */
  .filters{position:fixed;left:0;right:0;bottom:0;top:auto;z-index:88;width:auto;max-height:86vh;display:none;flex-direction:column;border:0;border-radius:15px 15px 0 0;box-shadow:0 -12px 44px -18px rgba(10,30,52,.6);overflow:hidden;padding-bottom:env(safe-area-inset-bottom)}
  .filters.open{display:flex;animation:sheetUp .24s cubic-bezier(.2,.8,.3,1)}
  .f-grab{display:block;width:38px;height:4px;border-radius:4px;background:var(--border-2);margin:9px auto 0}
  .filters .f-hd{position:static;padding:11px 15px 12px}
  .f-body{display:block;overflow:auto;flex:1;-webkit-overflow-scrolling:touch}
  .f-grp{padding:14px 15px}
  .f-grp:last-child{display:none}
  .f-x{display:grid}
  .f-ft{display:block;padding:11px 15px;border-top:1px solid var(--border);background:var(--surface)}
}
@keyframes sheetUp{from{transform:translateY(100%)}to{transform:none}}
@keyframes paneUp{from{transform:translateY(22px);opacity:.4}to{transform:none;opacity:1}}
@media (max-width:620px){
  :root{--h-top:54px}
  .xs-hide{display:none}
  .top{padding:0 12px;gap:9px}
  .top .q .inp{height:38px;border-radius:999px;font-size:13.5px;padding-left:36px}
  .top .q .q-i{left:13px}
  .page{padding:12px 12px 14px}
  .top-spacer{display:none}
  #top-add{display:none}
  .who span,.who small{display:none}
  .page-hd{align-items:flex-start;gap:10px;margin-bottom:10px}
  .page-hd h1{font-size:18px}
  .page-hd>div:first-child p{display:none}
  .hd-tools{width:100%;overflow-x:auto;padding-bottom:2px;gap:7px}
  .hd-tools>*{flex:0 0 auto}
  .hd-tools .btn,.hd-tools select.inp{height:34px;border-radius:999px;font-size:12.5px;padding:0 13px}
  .hd-tools select.inp{padding-right:28px;background-position:right 11px center;width:auto}
  .view-tog{border-radius:999px;height:34px;background:var(--surface-2);border-color:var(--border)}
  .view-tog button{height:32px;padding:0 11px;font-size:12.5px;border-radius:999px;gap:5px}
  .view-tog .i{width:14px;height:14px}
  .view-tog button+button{border-left:0}
  .view-tog button[aria-pressed="true"]{border-radius:999px}
  .res-bar{margin-bottom:10px}
  .res-bar .t{font-size:12.5px}
  .res-bar .t b{font-size:15px}
  .res-bar .btn{height:30px;padding:0 11px;font-size:12px;border:0;background:transparent;color:var(--brand-strong);font-weight:600}
  .active-chips{margin-bottom:10px;overflow-x:auto;flex-wrap:nowrap;padding-bottom:2px}
  .active-chips .ac{flex:0 0 auto}
  .p-card{border-radius:14px}
  .p-card,.p-row{box-shadow:0 1px 2px rgba(16,41,67,.05)}
  .grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
  .p-bd{padding:9px 10px 10px;gap:4px}
  .p-code{font-size:10px}
  .p-name{font-size:13px}
  .p-loc{font-size:11px;-webkit-line-clamp:1}
  .p-price{font-size:14.5px}
  .p-price small{display:none}
  .p-specs{font-size:10.5px;gap:3px 8px;padding-top:7px}
  .p-specs .i{width:12.5px;height:12.5px}
  .p-specs span:nth-child(n+4){display:none}
  #res-time{display:none}
  .res-bar{gap:8px}
  .p-thumb .pill{top:6px;left:6px;font-size:10px;padding:1px 6px}
  .p-thumb .n-img{bottom:6px;right:6px;font-size:10px;padding:1px 5px}
  .p-row{grid-template-columns:92px 1fr}
  .p-row .rt{grid-column:1/-1;flex-direction:row;align-items:center;justify-content:space-between;text-align:left}
  .row2,.row3{grid-template-columns:1fr}
  .kv{grid-template-columns:96px 1fr}
  .sheet-hd{padding:10px 13px;gap:8px}
  .sheet-acts{display:flex;width:100%;gap:7px;overflow-x:auto;padding-bottom:2px}
  .sheet-acts .btn{flex:1 0 auto}
  .sheet-bd{padding:13px}
  .modal{padding:10px}
  .tabline button{padding:0 12px;font-size:13px}
  .card-hd{flex-wrap:wrap}
  .card-hd .inp{width:100%!important}
}
.scrim{position:fixed;inset:0;background:rgba(10,30,52,.45);z-index:84;display:none}
.scrim.on{display:block}
.subtabs,.hd-tools,.gal-thumbs,.sheet-acts{scrollbar-width:none}
.subtabs::-webkit-scrollbar,.hd-tools::-webkit-scrollbar,.gal-thumbs::-webkit-scrollbar,.sheet-acts::-webkit-scrollbar{height:0;display:none}
