:root{--g1:#e8f7ec;--g2:#c8ecd2;--g3:#7bc98f;--g4:#3f9a58;--g5:#2a6f41;
--elec:#c4650f;--water:#1673ad;--red:#c93c3c;--txt:#22332a;--muted:#5d6d64;--line:#dbe8e0;--bg:#f4fbf6;--card:#fff;
--nav-h:62px;--side-w:220px}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html{-webkit-text-size-adjust:100%}
body{margin:0;font-family:'Sarabun',-apple-system,sans-serif;background:var(--bg);color:var(--txt);font-size:15px;line-height:1.5;
  padding-bottom:calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px)}
body.nologin{padding-bottom:0}
.hide{display:none!important}
button,input,select,textarea{font-family:inherit}
:focus-visible{outline:3px solid var(--g3);outline-offset:2px}

/* ---------- ปุ่ม ---------- */
.btn{border:0;border-radius:10px;min-height:44px;padding:10px 16px;font-size:15px;font-weight:600;cursor:pointer;background:var(--g4);color:#fff;
  display:inline-flex;align-items:center;justify-content:center;gap:6px;text-decoration:none;line-height:1.2;text-align:center}
.btn:active{transform:scale(.97)}
.btn:disabled{opacity:.6;cursor:default}
.btn.sm{white-space:nowrap;min-height:38px;padding:7px 12px;font-size:14px;border-radius:9px}
.btn.gray{background:#e6eee9;color:#34463b}.btn.red{background:var(--red)}.btn.blue{background:var(--water)}
.btn.line{background:#fff;color:var(--g5);border:1.5px solid var(--g3)}
.btn.lineg{background:#06c755;color:#fff}
.btn.ghost{background:transparent;color:var(--g5)}
.btn.redline{background:#fff;color:var(--red);border:1.5px solid #f0c4c4}
.btn.block{width:100%;display:flex}
.btns{display:flex;gap:8px;flex-wrap:wrap}.btns>.btn{flex:1 1 0;min-width:0;padding-left:8px;padding-right:8px}
.iconbtn{border:0;background:transparent;width:44px;height:44px;border-radius:10px;font-size:22px;cursor:pointer;color:inherit;line-height:1}

/* ---------- โครงหน้า ---------- */
header{position:sticky;top:0;z-index:20;background:var(--g4);color:#fff;padding:10px 16px;padding-top:calc(10px + env(safe-area-inset-top));
  display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:56px}
header h1{font-size:18px;margin:0;font-weight:700;line-height:1.25}
header small{display:block;opacity:.92;font-size:12.5px}
header .hdact{display:flex;gap:6px}
main{padding:12px;max-width:1100px;margin:0 auto}
aside#side{display:none}
nav#tabs{position:fixed;bottom:0;left:0;right:0;background:#fff;display:flex;border-top:1px solid var(--line);z-index:30;
  padding-bottom:env(safe-area-inset-bottom);box-shadow:0 -2px 10px rgba(30,70,45,.06)}
nav#tabs button{flex:1;border:0;background:0;min-height:var(--nav-h);padding:6px 2px;font-size:12px;color:var(--muted);cursor:pointer;font-weight:600}
nav#tabs button i{display:block;font-size:21px;font-style:normal;line-height:1.3}
nav#tabs button.on{color:var(--g5)}
nav#tabs button.on i{background:var(--g1);border-radius:14px;width:52px;margin:0 auto}
.pagehead{display:none}

/* ---------- การ์ด / ตัวเลข ---------- */
.card{background:var(--card);border-radius:14px;padding:14px;margin-bottom:12px;box-shadow:0 1px 4px rgba(45,90,60,.07);border:1px solid #e3efe7}
.card h3{margin:0 0 6px;font-size:16.5px;color:var(--g5);line-height:1.35}
.card h3 .muted{font-weight:400}
.row{display:flex;gap:8px}.row>*{flex:1}
.grid2{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px}
.cards{display:block}
.stat{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:10px;margin-bottom:12px}
.stat .box{background:#fff;border-radius:13px;padding:12px 14px;border:1px solid #e3efe7;box-shadow:0 1px 4px rgba(45,90,60,.06);text-align:left;font:inherit;color:inherit}
.stat button.box{cursor:pointer}
.stat .box b{display:block;font-size:22px;color:var(--g5);line-height:1.3}
.stat .box span{font-size:13px;color:var(--muted)}
.stat .box.warn b{color:var(--elec)}.stat .box.dang b{color:var(--red)}
.split{display:block}

/* ---------- ฟอร์ม ---------- */
label{display:block;font-size:13.5px;color:var(--muted);margin:10px 0 4px;font-weight:600}
input,select,textarea{width:100%;min-height:46px;padding:10px 12px;border:1.5px solid var(--line);border-radius:10px;font-size:16px;background:#fff;color:var(--txt)}
input:focus,select:focus,textarea:focus{outline:0;border-color:var(--g4);box-shadow:0 0 0 3px rgba(74,168,99,.18)}
input[type=checkbox]{min-height:0}
.chkline{display:flex;align-items:center;gap:10px;margin-top:12px;font-size:15px;color:var(--txt);font-weight:600;min-height:44px;cursor:pointer}
.chkline input{width:22px;height:22px;accent-color:var(--g4);margin:0;flex:0 0 auto}
.pwwrap{position:relative}
.pwwrap input{padding-right:52px}
.pweye{position:absolute;right:2px;top:50%;transform:translateY(-50%);background:0;border:0;font-size:20px;width:46px;height:44px;cursor:pointer;line-height:1;opacity:.7}
.filebtn{position:relative;overflow:hidden}
.filebtn input{position:absolute;inset:0;opacity:0;cursor:pointer;min-height:0}
.fieldset{border-top:1px solid #eaf3ed;margin-top:14px;padding-top:4px}
.fieldset>.legend{font-size:14px;font-weight:700;color:var(--g5);margin-top:8px}

/* ---------- รายการ / ตาราง ---------- */
.inv-line{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 0;border-bottom:1px dashed #e0ece4;font-size:15px}
.inv-line:last-child{border-bottom:0}
.inv-line>div:first-child{min-width:0}
.inv-total{display:flex;justify-content:space-between;padding:12px 0 0;font-size:19px;font-weight:800;color:var(--g5)}
.sub{font-size:13px;color:var(--muted);margin-top:2px}
table{width:100%;border-collapse:collapse;font-size:14px}
th{background:var(--g1);color:var(--g5);padding:9px 8px;text-align:right;font-size:13px;white-space:nowrap;position:sticky;top:0}
th:first-child,td:first-child,th.tl,td.tl{text-align:left}
td{padding:9px 8px;border-bottom:1px solid #edf4ef;text-align:right;white-space:nowrap;vertical-align:top}
tr.click{cursor:pointer}tr.click:hover td{background:#f7fcf8}
.e{color:var(--elec);font-weight:600}.w{color:var(--water);font-weight:600}
.tag{display:inline-block;padding:3px 10px;border-radius:20px;font-size:12.5px;font-weight:700;white-space:nowrap}
.tag.unpaid{background:#fdecec;color:var(--red)}.tag.paid{background:var(--g1);color:var(--g5)}
.tag.void{background:#eee;color:#666}.tag.new{background:#fff3e2;color:#9a4f0b}
.muted{color:var(--muted);font-size:13.5px}
.right{text-align:right}.center{text-align:center}
.scroll{overflow-x:auto;-webkit-overflow-scrolling:touch}
.chip{display:inline-block;background:var(--g1);color:var(--g5);border-radius:8px;padding:4px 10px;font-size:13px;margin:3px 4px 3px 0}
.chip.e{background:#fff3e6;color:#9a4f0b}.chip.w{background:#e7f3fb;color:#11598a}
hr{border:0;border-top:1px solid #eaf3ed;margin:12px 0}
.paybox{background:var(--g1);border-radius:11px;padding:11px 12px;margin-top:12px;font-size:14px;line-height:1.65}
.paybox b{color:var(--g5)}
.empty{text-align:center;padding:28px 16px;color:var(--muted)}
.empty .big{font-size:38px;line-height:1.2}
.empty b{display:block;color:var(--txt);font-size:16px;margin:6px 0 4px}
.loading{text-align:center;color:var(--muted);padding:40px}
.loading:before{content:'';display:block;width:28px;height:28px;margin:0 auto 10px;border:3px solid var(--g2);border-top-color:var(--g4);border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}
details.more>summary{cursor:pointer;color:var(--g5);font-weight:600;font-size:14px;list-style:none;min-height:40px;display:flex;align-items:center;gap:6px}
details.more>summary::-webkit-details-marker{display:none}
details.more>summary:before{content:'›';display:inline-block;transition:.2s;font-size:18px}
details.more[open]>summary:before{transform:rotate(90deg)}
.only-desk{display:none}
.hist-card{border:1px solid #e3efe7;border-radius:12px;padding:12px;margin-bottom:10px;background:#fff}
.hist-card .top{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.hist-card .bot{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:8px}
.hist-card .amt{font-size:18px;font-weight:800;color:var(--g5)}
.meter-done .inv-line{flex-wrap:wrap}
.drow{padding:10px 0;border-bottom:1px dashed #e0ece4}.drow:last-child{border-bottom:0}
.drow-top{display:flex;justify-content:space-between;align-items:center;gap:8px}
.btn.okchip{background:var(--g1);color:var(--g5)}
.g{color:var(--g5)}.red{color:var(--red)}
/* แดชบอร์ด */
.dgrid{display:grid;gap:12px;grid-template-columns:minmax(0,1fr)}
.dgrid>.card,.dgrid .dC>.card{margin-bottom:0}.dC{display:grid;gap:12px;align-content:start}.dC:empty{display:none}
.dA{order:1}.dB{order:2}.dC{order:3}
.score{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:4px;text-align:center}
.score>div{padding:4px 2px;min-height:52px}
.infobox{border-top:1px dashed #dbe8e0;margin-top:8px;padding-top:4px}
.score button{border:0;background:transparent;font:inherit;color:inherit;cursor:pointer;padding:4px 2px;border-radius:10px;min-height:52px}
.score button:active{background:var(--g1)}
.score b{display:block;font-size:20px;line-height:1.3}.score span{font-size:13px;color:var(--muted)}
.prow{padding:11px 0;border-bottom:1px solid #edf4ef}.prow:last-child{border-bottom:0}
.ptop{display:flex;justify-content:space-between;align-items:baseline;gap:8px;font-size:16px}
.prow.ok{padding:9px 0}.prow.ok .ptop{font-size:15px}.okt{color:var(--g5);font-weight:600;font-size:13.5px;white-space:nowrap}
.steps{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}
.stp{display:inline-flex;align-items:center;justify-content:center;min-height:38px;padding:0 13px;border-radius:19px;border:0;font:inherit;font-size:14px;font-weight:700;white-space:nowrap}
button.stp{cursor:pointer}button.stp:active{transform:scale(.97)}
.stp.done{background:var(--g1);color:var(--g5)}
.stp.todo{background:#fff3e6;color:#9a4f0b;border:1.5px solid #f0c9a0}
.stp.pay{background:var(--g4);color:#fff}
.stp.off{background:#f0f3f1;color:#9aa6a0;font-weight:600}
.oldbox{background:#fff6f6;border:1px solid #f3d3d3;border-radius:12px;padding:6px 10px;margin:4px 0 8px}
.oldh{font-size:13px;font-weight:700;color:var(--red);padding-top:2px}
.note{font-size:14px;padding:5px 0}.note+.note{border-top:1px dashed #e3efe7}
/* ตัวกรอง / ปุ่มเลือก */
.fbar{padding:10px 12px}
.seg{display:flex;background:#e9f1ec;border-radius:12px;padding:3px;gap:3px}
.seg button{flex:1;min-height:40px;border:0;background:transparent;border-radius:9px;font:inherit;font-weight:700;font-size:14.5px;color:var(--muted);cursor:pointer}
.seg button.on{background:#fff;color:var(--g5);box-shadow:0 1px 3px rgba(45,90,60,.15)}
.chips{display:flex;flex-wrap:wrap;gap:8px}.scrollx{flex-wrap:nowrap;overflow-x:auto;-webkit-overflow-scrolling:touch;padding-bottom:2px}
.cbtn{flex:0 0 auto;min-height:40px;padding:0 15px;border:1.5px solid var(--line);background:#fff;border-radius:20px;font:inherit;font-weight:700;font-size:14.5px;color:var(--txt);cursor:pointer}
.chips.eq{flex-wrap:nowrap;gap:6px}.chips.eq .cbtn{flex:1 1 0;min-width:0;padding:0 2px;font-size:14px;white-space:nowrap}
.cbtn.on{background:var(--g1);border-color:var(--g3);color:var(--g5)}
.navrow{display:flex;align-items:center;gap:2px;margin-top:8px}
.navrow b{min-width:86px;text-align:center;font-size:16px;color:var(--g5)}
.navrow select{flex:1;min-width:0;margin-left:6px}
.navrow .iconbtn:disabled{opacity:.3;cursor:default}
/* ค่าใช้จ่าย */
.listhead{display:flex;justify-content:space-between;align-items:baseline;padding:4px 0 8px;border-bottom:1px solid #e3efe7}.listhead b{font-size:17px;color:var(--g5)}
.erow{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:10px 0;border-bottom:1px dashed #e0ece4}.erow:last-child{border-bottom:0}
.eamt{font-size:16px;white-space:nowrap}
.tag.exp{background:#fff3e2;color:#9a4f0b}
/* สรุป */
.srow{display:flex;justify-content:space-between;align-items:center;gap:10px;padding:7px 0;border-bottom:1px dashed #e0ece4;font-size:15.5px}
.srow:last-child{border-bottom:0}.srow.tot{border-top:2px solid #dbe8e0;border-bottom:0;font-size:16px;font-weight:700;margin-top:2px}
.pbar{height:6px;background:#edf4ef;border-radius:3px;margin-top:5px;overflow:hidden}.pbar i{display:block;height:100%;background:#e6a15a;border-radius:3px}
.bars{display:flex;align-items:flex-end;gap:6px;height:110px;margin-top:6px}
.bcol{flex:1;min-width:0;display:flex;flex-direction:column;align-items:center;height:100%}
.bpair{flex:1;width:100%;display:flex;align-items:flex-end;gap:2px}
.bpair i{flex:1;display:block;border-radius:3px 3px 0 0;min-height:0}
.bi,.clegend .bi{background:var(--g4)}.be,.clegend .be{background:#e07b7b}
.bcol span{font-size:11.5px;color:var(--muted);margin-top:3px;white-space:nowrap}
.bars.y{gap:3px}.bars.y .bcol span{font-size:10.5px}.bars.y .bpair{gap:1px}
.clegend{display:flex;gap:14px;justify-content:center;font-size:13px;color:var(--muted);margin-top:6px}
.clegend i{display:inline-block;width:11px;height:11px;border-radius:3px;margin-right:5px;vertical-align:-1px}
.mtab td,.mtab th{padding:5px 4px;font-size:14px}.mtab th{position:static}.mtab tr.tot td{font-weight:700;border-top:2px solid #dbe8e0}
@media (min-width:900px){
  .dgrid{grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);align-items:start}
  .dB{grid-column:1;grid-row:1/span 2}.dA{grid-column:2;grid-row:1}.dC{grid-column:2;grid-row:2}
  .bars{height:150px}
}
/* หน้าหลัก: รายการ + การ์ดรายละเอียด */
.hgrid{display:grid;gap:12px;grid-template-columns:minmax(0,1fr)}
.hgrid>div>.card{margin-bottom:0}
.hdetail{display:none}
.hrow{display:flex;align-items:center;gap:7px;padding:10px 2px;border-bottom:1px solid #edf4ef;cursor:pointer;border-radius:10px}
.hrow:last-of-type{border-bottom:0}
.hrow:active{background:var(--g1)}.hrow.sel{background:#eaf5ee;box-shadow:inset 3px 0 0 var(--g4);padding-left:9px}
.hname{flex:1;min-width:0;font-size:15.5px;line-height:1.3;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.hchips{display:flex;gap:4px;flex:0 0 auto}
.hc{font-size:13px;font-weight:700;padding:5px 8px;border-radius:14px;white-space:nowrap;line-height:1.2}
.hc.ok{background:var(--g1);color:var(--g5)}.hc.no{background:#fff1df;color:#a35209;border:1px solid #f0c9a0;padding:4px 7px}
.hc .l{display:none}.hc .s{display:inline}
.hamt{flex:0 0 auto;min-width:52px;text-align:right;font-weight:700;font-size:14.5px}
.dstep{display:flex;align-items:center;gap:8px;margin:12px 0 6px;flex-wrap:wrap}.dstep:first-child{margin-top:4px}
.dstep>b{font-size:15.5px}
.dot{width:24px;height:24px;border-radius:50%;display:inline-flex;align-items:center;justify-content:center;font-size:13px;font-weight:700;flex:0 0 auto}
.dot.ok{background:var(--g4);color:#fff}.dot.no{background:#fff1df;color:#a35209;border:1.5px solid #f0c9a0}
.dhead{display:flex;justify-content:space-between;align-items:flex-start;gap:8px;margin-bottom:4px}
.lrow{display:flex;justify-content:space-between;align-items:center;gap:8px;flex-wrap:wrap;padding:3px 0;font-size:15px}
.htab td,.htab th{padding:6px 3px;font-size:13.5px;vertical-align:top;white-space:normal}.htab th{position:static}.htab td .sub{line-height:1.35}
.ph{display:inline-block;padding:3px 4px;text-decoration:none;cursor:pointer;position:relative}
.ph.add{opacity:.4}.ph input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;min-height:0}
.fsheet{position:fixed;inset:0;z-index:40;background:var(--bg);display:flex;flex-direction:column;animation:up .2s ease-out}
.fsheet .fh{background:var(--g4);color:#fff;display:flex;align-items:center;gap:4px;padding:6px 10px 6px 4px;padding-top:calc(6px + env(safe-area-inset-top));min-height:56px}
.fsheet .fh b{font-size:18px;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.fsheet .iconbtn{color:#fff;font-size:30px}
.fsheet .fb{flex:1;overflow:auto;-webkit-overflow-scrolling:touch;padding:12px;padding-bottom:calc(24px + env(safe-area-inset-bottom))}
.fsheet .fb>.card{margin-bottom:12px}
/* จอคอม: คอลัมน์รายการกว้างตามข้อมูลจริง (ไม่ตัด/ขึ้นบรรทัดใหม่) แต่ไม่เกินจนการ์ดรายละเอียดแคบกว่า 380px */
/* ประวัติบิล */
.hctl{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.rbtns{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;width:100%}
.rb{min-height:36px;border:1.5px solid var(--line);background:#fff;border-radius:18px;font:inherit;font-size:13.5px;font-weight:700;color:var(--txt);cursor:pointer;padding:0 6px;white-space:nowrap}
.rb.on{background:var(--g1);border-color:var(--g3);color:var(--g5)}
.hsel{flex:1 1 140px;min-width:0;min-height:40px;padding:6px 10px;font-size:14.5px}
.hcust{display:flex;align-items:center;gap:6px;width:100%}.hcust select{flex:1;min-width:0;min-height:40px;font-size:14.5px;padding:6px 10px}
.hcount{font-size:13px;margin:0 2px 6px}
.htable{white-space:nowrap}.htable th{position:static}.htable td,.htable th{padding:8px 9px;font-size:14px}
.htable th.r{text-align:right}
.htable th.gh{text-align:center;border-bottom:1px solid #cfe3d6}
.hl{display:grid;grid-template-columns:62px 76px minmax(0,1fr);gap:6px;align-items:baseline;padding:3px 0;font-size:14.5px}
.hl span{color:var(--muted)}.hl b{text-align:right}.hl small{color:var(--muted);font-size:13px}
@media (min-width:900px){
  /* จอคอม: องค์ประกอบกว้างเท่าข้อมูล ชิดซ้าย ไม่ถูกดึงไปสุดขอบขวา */
  .cards{grid-template-columns:repeat(auto-fill,minmax(360px,500px));justify-content:start}
  .split{grid-template-columns:repeat(2,minmax(0,560px));justify-content:start}
  .fbar{width:fit-content;max-width:100%}
  .fbar .seg{display:inline-flex}.fbar .seg button{flex:none;padding:0 22px}
  .fbar select{width:auto;min-width:170px}
  .fbar .grid2{display:flex;gap:8px}
  .chips.eq .cbtn{flex:none;padding:0 18px}
  .navrow select{flex:0 0 200px}
  .mtop{width:fit-content;min-width:360px;max-width:100%}.mtop select{width:auto;min-width:200px}
  .meter-done{width:fit-content;min-width:420px;max-width:100%}
  .narrow .btns>.btn{flex:0 0 auto}
  main .pagehead{justify-content:flex-start;gap:18px}
  .hgrid{grid-template-columns:fit-content(calc(100% - 400px)) minmax(380px,640px)}
  .fitc{width:fit-content;max-width:100%}
  .htable,.mtab,.htab{width:auto}
  .htable td,.htable th{padding:8px 14px}.mtab td,.mtab th{padding:5px 14px}.htab td,.htab th{padding:6px 12px}
  .rbtns{display:flex;width:auto}.rb{padding:0 14px}
  .hsel{flex:0 0 210px}.hcust{width:auto}.hcust select{flex:0 0 130px}
}
.fitc{min-width:min(100%,520px)}
.narrow{max-width:760px}   /* หน้ารายการเรียงยาว: จำกัดความกว้าง ชิดซ้าย ไม่ให้ชื่อกับตัวเลขห่างกันเกินไป */
.sep{display:none}.mbr{display:inline}
@media (min-width:900px){
  .hgrid{grid-template-columns:fit-content(calc(100% - 400px)) minmax(380px,1fr);align-items:start}
  .nw{contain:inline-size}
  .hname{display:block;-webkit-line-clamp:unset;white-space:nowrap;text-overflow:ellipsis}
  .hrow{padding-right:6px}
  .sep{display:inline}.mbr{display:none}.htab td{white-space:nowrap}

  .hdetail{display:grid;gap:12px;position:sticky;top:16px;max-height:calc(100vh - 32px);overflow:auto;align-content:start}
  .hdetail>.card{margin-bottom:0}
  .hamt{min-width:64px;font-size:15.5px}.hname{font-size:16px}
}
/* จอกว้างมากพอจึงใช้ป้ายคำเต็ม ไม่งั้นใช้คำสั้นเพื่อให้ชื่อที่เช่าไม่ถูกบีบ */
@media (min-width:1250px){.hc .l{display:inline}.hc .s{display:none}.hc{font-size:13.5px;padding:5px 11px}.hc.no{padding:4px 10px}}
.rowbtns{display:flex;gap:6px;flex:0 0 auto}.rowbtns .btn{flex:none;padding-left:10px;padding-right:10px}
.tap{cursor:pointer}.tap:hover{color:var(--g5)}
.inv-line.pick{cursor:pointer;align-items:flex-start}
.inv-line.pick input{width:22px;height:22px;min-height:0;margin:2px 0 0;accent-color:var(--g4);flex:0 0 auto}
.pinpad.locked{opacity:.35;pointer-events:none}
.linkbtn.small{font-size:12.5px;color:var(--muted);font-weight:400}
@media (max-width:599px){.dstat{gap:8px}.dstat .box{padding:8px 12px}.dstat .box b{font-size:19px}.dstat .box span{font-size:12.5px}}
.photoslot{position:relative;overflow:hidden;display:flex;align-items:center;gap:10px;margin:8px 0 0;min-height:52px;padding:6px 10px;
  border:1.5px dashed var(--line);border-radius:10px;color:var(--muted);font-size:14px;font-weight:600;cursor:pointer;background:#fff}
.photoslot.has{border-style:solid;border-color:var(--g2);background:#f7fcf8;color:var(--g5)}
.photoslot input,.filebtn input{position:absolute;inset:0;opacity:0;cursor:pointer;min-height:0;width:100%}
.pthumb{width:40px;height:40px;object-fit:cover;border-radius:7px;flex:0 0 auto;background:var(--g1);display:inline-flex;align-items:center;justify-content:center;font-size:18px}
.dphotos{display:flex;gap:6px;align-items:center;flex-wrap:wrap;margin-top:6px}

/* ---------- หน้าต่าง / กล่องยืนยัน ---------- */
.modal{position:fixed;inset:0;background:rgba(20,40,28,.5);z-index:50;display:flex;align-items:flex-end;justify-content:center}
.modal .inner{background:#fff;width:100%;max-height:92vh;max-height:92dvh;display:flex;flex-direction:column;border-radius:18px 18px 0 0;animation:up .2s ease-out}
.modal .mh{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:8px 8px 8px 16px;border-bottom:1px solid #eaf3ed}
.modal .mh h3{margin:0;font-size:17px;color:var(--g5)}
.modal .mb{padding:4px 16px 16px;overflow:auto;-webkit-overflow-scrolling:touch}
.modal .mf{padding:10px 16px calc(10px + env(safe-area-inset-bottom));border-top:1px solid #eaf3ed;background:#fff;border-radius:0}
.dlg{z-index:60;align-items:center;padding:16px}
.dlg .inner{max-width:400px;border-radius:16px;padding:20px 18px 16px}
.dlg .msg{font-size:16px;line-height:1.6;white-space:pre-line;margin-bottom:16px}
@keyframes up{from{transform:translateY(30px);opacity:0}}
.sheetmenu button{display:flex;align-items:center;gap:12px;width:100%;border:0;background:0;min-height:52px;font-size:16px;padding:0 4px;border-bottom:1px solid #eef5f0;cursor:pointer;color:var(--txt);font-weight:600}
.sheetmenu button i{font-style:normal;font-size:20px;width:28px;text-align:center}
.sheetmenu button.danger{color:var(--red)}

/* ---------- toast ---------- */
.toast{position:fixed;bottom:calc(var(--nav-h) + env(safe-area-inset-bottom) + 14px);left:50%;transform:translate(-50%,10px);background:#22332a;color:#fff;
  padding:10px 12px 10px 18px;border-radius:14px;font-size:14.5px;z-index:99;opacity:0;transition:.25s;width:max-content;max-width:calc(100% - 32px);
  display:flex;align-items:center;gap:12px;pointer-events:none}
.toast.show{opacity:1;transform:translate(-50%,0);pointer-events:auto}
.toast.bad{background:#a83232}
.toast button{border:0;background:rgba(255,255,255,.18);color:#fff;font-weight:700;border-radius:9px;padding:8px 12px;font-size:14px;cursor:pointer;flex:0 0 auto}

/* ---------- login ---------- */
.login-wrap{max-width:400px;margin:0 auto;padding:9vh 16px 24px}
.logo{text-align:center;font-size:46px;margin-bottom:4px}
.logo-img{display:block;margin:0 auto 8px;border-radius:20px}
aside#side .brand img{vertical-align:-8px;border-radius:7px;margin-right:4px}
.login-wrap h2{margin:0 0 18px;color:var(--g5);text-align:center}
.userlist{display:grid;gap:10px}
.userlist button{min-height:56px;border:1.5px solid var(--line);background:#fff;border-radius:14px;font-size:17px;font-weight:700;color:var(--txt);cursor:pointer;
  display:flex;align-items:center;gap:12px;padding:0 16px;text-align:left}
.userlist button:active{background:var(--g1)}
.userlist .av{width:36px;height:36px;border-radius:50%;background:var(--g1);color:var(--g5);display:flex;align-items:center;justify-content:center;font-size:16px;flex:0 0 auto}
.linkbtn{border:0;background:0;color:var(--g5);font-weight:600;font-size:14px;text-decoration:underline;cursor:pointer;min-height:40px;padding:0 8px}
.pindots{display:flex;gap:18px;justify-content:center;margin:18px 0 6px}
.pindots span{width:16px;height:16px;border-radius:50%;border:2px solid var(--g4);transition:.1s}
.pindots span.f{background:var(--g4)}
.pindots.busy span{animation:pulse .8s infinite alternate}
.pindots.bad{animation:shake .35s}.pindots.bad span{border-color:var(--red)}
@keyframes pulse{to{opacity:.3}}
@keyframes shake{25%{transform:translateX(-8px)}75%{transform:translateX(8px)}}
.pinerr{color:var(--red);font-weight:600;min-height:22px;font-size:14px}
.pinpad{display:grid;grid-template-columns:repeat(3,72px);gap:14px 22px;justify-content:center;margin:8px 0 6px;
  user-select:none;-webkit-user-select:none;touch-action:manipulation}
.pinpad button{width:72px;height:72px;border-radius:50%;border:0;background:#fff;box-shadow:0 1px 4px rgba(45,90,60,.12);font-size:28px;font-weight:600;color:var(--txt);cursor:pointer}
.pinpad button:active{background:var(--g2)}
.pinpad button.ghost{background:transparent;box-shadow:none;font-size:22px}
.pinpad button:disabled{opacity:.5}

/* ---------- คอม / แท็บเล็ตแนวนอน ---------- */
@media (min-width:900px){
  body{padding-bottom:0;padding-left:var(--side-w)}
  body.nologin{padding-left:0}
  nav#tabs{display:none}
  aside#side{display:flex;flex-direction:column;position:fixed;left:0;top:0;bottom:0;width:var(--side-w);background:#fff;border-right:1px solid var(--line);z-index:25;padding:16px 10px}
  aside#side .brand{font-size:18px;font-weight:800;color:var(--g5);padding:4px 10px 16px}
  aside#side nav button{display:flex;align-items:center;gap:10px;width:100%;border:0;background:0;min-height:44px;padding:0 12px;border-radius:10px;font-size:15px;color:var(--txt);cursor:pointer;font-weight:600;margin-bottom:2px}
  aside#side nav button i{font-style:normal;font-size:18px;width:22px;text-align:center}
  aside#side nav button:hover{background:#f2f8f4}
  aside#side nav button.on{background:var(--g1);color:var(--g5)}
  aside#side .me{margin-top:auto;border-top:1px solid var(--line);padding:12px 10px 0;font-size:13.5px;color:var(--muted)}
  aside#side .me b{display:block;color:var(--txt);font-size:14.5px}
  header{display:none}
  .pagehead{display:flex;justify-content:space-between;align-items:center;gap:12px;margin:8px 0 16px}
  .pagehead h1{margin:0;font-size:24px;color:var(--g5)}
  main{padding:20px 28px 40px;max-width:1800px;margin:0}   /* จอคอม: ชิดซ้ายถัดจากเมนู ใช้พื้นที่เต็ม ไม่จัดกลางจอ */
  .stat{grid-template-columns:repeat(auto-fit,minmax(160px,1fr))}
  .dstat{grid-template-columns:repeat(5,minmax(0,1fr))}
  .split{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:14px;align-items:start}
  .cards{display:grid;grid-template-columns:repeat(auto-fill,minmax(360px,1fr));gap:14px;align-items:start}
  .cards>.card{margin-bottom:0}
  .only-desk{display:block}.only-mob{display:none!important}
  .modal{align-items:center;padding:24px}
  .modal .inner{max-width:600px;border-radius:16px;max-height:88vh}
  .modal .mf{border-radius:0 0 16px 16px}
  .dlg .inner{max-width:420px}
  .toast{bottom:24px}
  .filters{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,2fr) minmax(0,1fr);gap:12px;align-items:end}
  .filters label{margin-top:0}
}
@media (min-width:600px) and (max-width:899px){
  main{padding:16px 20px}
  .cards{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:12px;align-items:start}
  .cards>.card{margin-bottom:0}
  .stat{grid-template-columns:repeat(3,minmax(0,1fr))}
}

/* v24: จอคอม — หน้าหลักการ์ดขวาไม่ยืดสุดขอบ, ประวัติบิล/ค่าใช้จ่าย กรอบตัวกรองกว้างเท่าตาราง, สรุปรายรับ-จ่ายแบบตารางซ้าย กราฟขวา */
.bpair.stk{flex-direction:column-reverse;align-items:stretch;gap:1px}
.bpair.stk i{flex:none;border-radius:2px}
.mtab th.r,.mtab td.r{text-align:right}
.mtab tr.selm td{background:#eaf5ee;font-weight:700}
.sgrid{display:grid;gap:12px;grid-template-columns:minmax(0,1fr)}.sgrid>.card{margin-bottom:0}
.sinfo{margin:0 0 10px}.sinfo .note{margin-bottom:6px}
.sbar{display:flex;flex-direction:column;gap:8px}.sbar .navrow{margin-top:0}
.sc{margin-top:4px}
@media (min-width:900px){
  .hgrid{grid-template-columns:fit-content(calc(100% - 400px)) minmax(380px,640px)}
  .bw{width:fit-content;min-width:min(100%,460px);max-width:600px}
  .hwrap{width:fit-content;min-width:min(100%,560px);max-width:100%}
  .hwrap .fbar{width:100%}
  .ewrap{width:min(100%,640px)}.ewrap .fbar{width:100%;display:flex;flex-wrap:wrap;align-items:center;gap:8px}
  .ewrap .fbar>*{margin-top:0!important}
  .ewrap .xchips{flex:1 1 100%}.ewrap .xchips .cbtn{flex:1 1 0}
  .ewrap .card{width:100%}
  .sbar{flex-direction:row;flex-wrap:wrap;align-items:center;gap:10px 12px;width:fit-content;max-width:100%}
  .sbar .sc{margin:0;display:flex;gap:8px}.sbar .sc>div{min-width:84px;padding:2px 8px;background:#f1f7f3;border-radius:10px;min-height:0}
  .sbar .sc b{font-size:17px}
  .sbar .seg button{padding:0 13px}.sbar .navrow select{flex:0 0 160px;min-width:0}.sbar .sc>div{min-width:70px}
  .sgrid{grid-template-columns:fit-content(62%) minmax(340px,520px);justify-content:start;align-items:start}
  .sgrid .bars{height:200px}
}

/* v25: การ์ดรายละเอียดหน้าหลัก — แถวขั้นตอน 3 ช่อง + ตารางย้อนหลัง */
.st{display:grid;gap:8px;grid-template-columns:minmax(0,1fr)}
.t{border:1px solid var(--line);border-radius:12px;padding:9px 11px;background:#fafcfb}
.t .tn{display:flex;align-items:center;gap:7px;font-size:14.5px}
.t .tv{margin:7px 0 2px;font-size:15px}.t .sub{line-height:1.35}
.t .tb{display:flex;flex-wrap:wrap;gap:5px;margin-top:7px}.t .tb .btn{flex:0 0 auto;min-height:34px;padding:0 10px;font-size:13.5px}
.t.done{background:#f0f8f3;border-color:#cfe6d6}.t.todo{background:#fff6ea;border-color:#f0c9a0}.t.idle{background:#f7f9f8;opacity:.7}
.mform{margin-top:12px;padding-top:6px;border-top:1px dashed #dbe8e0}
.nl{position:relative;display:inline-block;margin:0!important;padding:0!important;cursor:pointer;font-weight:700;color:inherit;font-size:inherit;line-height:inherit}
.dh td{vertical-align:middle}.t .tb .btn,.t .tb label.btn{display:inline-flex;align-items:center;margin:0!important}
a.nl,.nl.has{color:var(--g5);text-decoration:underline solid var(--g4);text-decoration-thickness:2px;text-underline-offset:3px}
.nl.add{text-decoration:underline dashed #222;text-decoration-thickness:1.5px;text-underline-offset:3px}
.lk{text-decoration:underline dashed #222;text-decoration-thickness:1.5px;text-underline-offset:3px;cursor:pointer}
.nlhint{margin-top:6px;line-height:1.7}.nlhint .nl{cursor:default}
.nl input{position:absolute;inset:0;opacity:0;width:100%;min-height:0;cursor:pointer}
.dh{width:100%;border-collapse:collapse}.dh th,.dh td{padding:6px 9px;font-size:14px;text-align:right;white-space:nowrap}
.dh th{position:static;background:#eef6f1}.dh th:first-child,.dh td:first-child{text-align:left}
.dh tr+tr td{border-top:1px solid #edf4ef}.dh td.ctr{text-align:center}
.dh th.e,.dh td.e{color:var(--elec)}.dh th.w,.dh td.w{color:var(--water)}
@media (min-width:600px){.st.c3{grid-template-columns:repeat(3,minmax(0,1fr))}.st.c2{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media (min-width:900px){
  .hgrid{grid-template-columns:fit-content(calc(100% - 520px)) minmax(480px,640px)}
  .hdetail{justify-self:start;width:max-content;min-width:480px;max-width:640px}
  .hdetail>.card{width:auto}
}
/* v26: เว้นช่องว่างระหว่างชื่อที่เช่ากับป้ายสถานะ */
@media (min-width:900px){.hrow{gap:10px}.hname{margin-right:22px}.hamt{margin-left:6px}}
@media (max-width:899px){.hname{margin-right:6px}}

/* ไอคอนลายเส้น (เมนูลัด / เมนูข้าง / เมนูอื่น ๆ) */
.ic{width:20px;height:20px;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;display:inline-block;vertical-align:-4px;flex:0 0 auto}
nav#tabs button i{display:flex;align-items:center;justify-content:center;height:28px;margin:0 auto 2px;font-size:0;line-height:1}
nav#tabs button.on i{background:var(--g1);border-radius:14px;width:52px;margin:0 auto 2px}
aside#side nav button i{display:inline-flex;align-items:center;justify-content:center;font-size:0}
aside#side nav button .ic{width:21px;height:21px}
.sheetmenu button i{display:inline-flex;align-items:center;justify-content:center;font-size:0}
.sheetmenu button i .ic{width:23px;height:23px}
/* ไอคอนลายเส้นในเนื้อหา */
.empty .big .ic{width:42px;height:42px;stroke-width:1.4;opacity:.55;display:block;margin:0 auto}
nav#tabs button i .ic,aside#side nav button i .ic,.sheetmenu button i .ic{display:block;vertical-align:baseline}
.btn .ic{width:18px;height:18px;vertical-align:-3px}.btn.sm .ic{width:16px;height:16px}
.pweye .ic,.iconbtn .ic{width:22px;height:22px;display:block;margin:auto}
.pinpad button .ic{width:26px;height:26px;display:block;margin:auto}
.hc .ic{width:14px;height:14px;vertical-align:-2px}.dot .ic{width:15px;height:15px;vertical-align:-3px}
h3 .ic{width:21px;height:21px;margin-right:4px;vertical-align:-4px}
.toast .ic{width:19px;height:19px;margin-right:8px;vertical-align:-4px}
.pthumb .ic{width:20px;height:20px}
.note .ic,.sub .ic,label .ic{width:17px;height:17px;vertical-align:-3px}
.e .ic,.w .ic{width:18px;height:18px}
.warn{color:var(--red)}
