:root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Tahoma,sans-serif;color:#1b3a2c;background:#f3f7f4;font-size:16px}*{box-sizing:border-box}body{margin:0}button,input,select{font:inherit}button{cursor:pointer;border:0;background:#e9f1ec;color:#17664c;padding:13px;border-radius:12px;font-weight:750}button:disabled{opacity:.48;cursor:wait}.primary{background:#17664c;color:#fff}.wide{width:100%;margin-top:10px}.top{background:#fff;border-bottom:1px solid #e4ece5;padding:17px max(16px,calc((100% - 560px)/2));display:flex;justify-content:space-between;align-items:center;gap:9px}.logo{font-weight:850;font-size:21px}.logo small{display:block;font-size:11px;color:#83938b;font-weight:500;margin-top:2px}.status{font-size:11px;background:#e9f1ea;padding:7px;border-radius:30px;white-space:nowrap}.wrap{max-width:560px;padding:15px 14px 80px;margin:auto}.card{background:#fff;border-radius:19px;box-shadow:0 3px 16px #0d48200b;padding:18px;margin:0 0 14px}.card h2{font-size:18px;margin:0 0 14px}.heading{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;gap:10px}.heading h2{margin:0}.small{font-size:12px;padding:9px 11px}.hidden{display:none!important}label{display:block;font-size:13px;color:#567063;font-weight:750;margin:12px 0 7px}input:not([type=radio]),select{border:1.5px solid #dfe8e1;border-radius:11px;width:100%;min-width:0;padding:13px 12px;outline:0;background:white;color:#173a2a}input:focus,select:focus{border-color:#258260}.grid{display:grid;grid-template-columns:1fr 1fr;gap:9px}.muted{font-size:13px;line-height:1.5;color:#819188}.panel{padding:13px;background:#eff7f1;border-radius:13px;margin:12px 0}.amount{display:flex;align-items:center;justify-content:space-between;background:#edf6ef;border-radius:15px;padding:17px 14px;margin:18px 0}.amount strong{font-size:29px;color:#116b4b}.choice{font-size:13px;background:#f0f5f0;border-radius:11px;padding:12px 8px;margin:0;display:flex;gap:5px;align-items:center}.choice input{accent-color:#116b4b}.switch{display:flex;gap:6px;background:#e1eee6;padding:5px;border-radius:15px;margin-bottom:13px}.switch button{flex:1;background:transparent;color:#627a6d}.switch button.selected{background:#17664c;color:white}.metrics{display:grid;grid-template-columns:1fr 1fr;gap:9px}.metrics>div{background:#f0f7f1;border-radius:13px;padding:12px}.metrics small{display:block;color:#6b8275}.metrics b{display:block;font-size:21px;color:#146449;margin-top:5px}.ledger{padding:14px 0;border-bottom:1px solid #edf0ed}.ledger:last-child{border:0}.ledger strong{display:block;margin-bottom:3px}.ledger .debt{color:#b54838;font-weight:850}.ledger .actions{display:flex;gap:5px;flex-wrap:wrap;margin-top:10px}.ledger .actions button{font-size:12px;padding:9px 10px}.rowItem{padding:11px 0;border-bottom:1px solid #edf0ed;display:flex;gap:10px;justify-content:space-between;align-items:center}.rowItem:last-child{border:0}.rowItem strong{display:block;font-size:14px}.rowItem small{display:block;font-size:12px;color:#83948a}.footer{display:flex;justify-content:space-between;align-items:center;color:#728177;font-size:12px}.link{background:transparent;padding:8px;text-decoration:underline;color:#1f6e52}.sep{text-align:center;margin:20px;color:#849589}.code{word-break:break-all;font-family:monospace;font-size:20px;font-weight:800;letter-spacing:1px}.toast{position:fixed;bottom:18px;left:50%;transform:translateX(-50%);background:#193d2d;color:white;border-radius:12px;padding:12px 18px;box-shadow:0 5px 25px #0003;z-index:40;max-width:90%;text-align:center}.overlay{position:fixed;inset:0;background:#062416bb;display:flex;justify-content:center;align-items:center;z-index:30;padding:14px}.dialog{background:white;border-radius:18px;padding:20px;max-height:92vh;overflow:auto;width:min(100%,450px)}.dialog h2{margin:2px 0 10px;font-size:20px}.dialog .qr{display:flex;justify-content:center;margin:17px auto}.dialog .center{text-align:center}.dialog .actions{display:flex;gap:8px}.dialog .actions button{flex:1}.notice{font-size:12px;background:#fff8e8;padding:10px;border-radius:10px;color:#80612c}.badge{font-size:11px;background:#f3deda;color:#9a3b30;border-radius:9px;padding:3px 7px}#printArea{display:none}@media print{body>*:not(#printArea){display:none!important}#printArea{display:block!important;width:72mm;color:#000;font:12px Tahoma,sans-serif}#printArea h2{text-align:center;font-size:16px}#printArea img{width:45mm;height:45mm;display:block;margin:10px auto}@page{size:80mm auto;margin:3mm}}

/* บ้านสวนเห็ด - หน้าแรกสำหรับ iPhone */
.home-card{text-align:center;padding:25px 20px 30px;margin-top:12px}.home-card h1{font-size:29px;margin:14px 0 3px;color:#173b2e}.home-logo{display:block;margin:0 auto;width:min(245px,85%);aspect-ratio:1;object-fit:contain;border-radius:12px;background:#fff}.home-buttons{display:grid;gap:13px;margin:28px auto 23px}.home-btn{width:100%;min-height:88px;text-align:left;padding:17px 21px;font-size:21px;display:block;border-radius:15px}.home-btn small{display:block;font-size:13px;font-weight:500;margin-top:5px;opacity:.8}.home-buttons button:not(.primary){background:#e4eee8;color:#165a42}.home-foot{font-size:11px;margin-top:18px}.join-details{text-align:left;background:#f4f7f3;padding:12px;border-radius:12px;font-size:13px}.join-details summary{cursor:pointer;font-weight:700}.join-details input{margin:12px 0 8px}.app-title{margin:0 0 12px}.app-title strong{font-size:17px}.top{max-width:580px} .logo{font-weight:800} .hidden{display:none!important}

button.delete-customer{background:#fff0ef!important;color:#a32b27!important;border:1px solid #f0c5c1!important}

/* V8 รายงานลูกค้า และรับชำระบางส่วน */
.report-open{font-size:16px}.report-metrics{margin:12px 0}.report-table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch}.report-table{border-collapse:collapse;width:100%;min-width:520px;font-size:13px;text-align:left}.report-table th{background:#e8f3ed;color:#154d38}.report-table th,.report-table td{padding:10px 8px;border-bottom:1px solid #e2ebe4;vertical-align:top}.report-table td.amount-cell{text-align:right;white-space:nowrap}.report-table td .muted{font-size:11px}.report-actions{margin-top:12px}.pay-remaining{border-radius:12px;background:#eaf5ee;padding:14px;margin:12px 0;display:flex;justify-content:space-between;align-items:center;font-weight:700}.pay-quick{display:flex;gap:8px;margin:8px 0 12px}.pay-quick button{flex:1}.report-total{font-size:14px;font-weight:700;margin:12px 0}.pay-info{font-size:13px;color:#536b60}.ledger .summary-line{margin-top:5px;font-size:13px}

/* V9 กล่องยืนยันแบบกำหนดเอง ใช้งานบน iPhone */
.confirm-overlay{z-index:60;background:rgba(10,38,28,.62);backdrop-filter:blur(7px);-webkit-backdrop-filter:blur(7px);padding:20px}
.confirm-card{background:#fff;border-radius:26px;width:min(100%,390px);padding:29px 23px 22px;text-align:center;box-shadow:0 22px 70px rgba(6,37,22,.25);animation:confirm-rise .2s ease-out}
@keyframes confirm-rise{from{opacity:0;transform:translateY(16px) scale(.97)}to{opacity:1;transform:translateY(0) scale(1)}}
.confirm-symbol{display:flex;justify-content:center;align-items:center;width:62px;height:62px;margin:0 auto 15px;border-radius:50%;background:#e6f5ec;color:#158255;font-size:35px;font-weight:800}
.confirm-symbol.payment{background:#e7f4ed;color:#116b4b}.confirm-symbol.danger{background:#ffeded;color:#b33436}
.confirm-card h2{font-size:20px;line-height:1.35;margin:0 0 10px;color:#183b2b}
.confirm-description{font-size:14px;line-height:1.65;color:#63796b;margin:0 0 14px;overflow-wrap:anywhere}
.confirm-detail{font-size:15px;font-weight:750;background:#f0f7f2;border-radius:14px;padding:14px 12px;color:#1a5f43;line-height:1.65;overflow-wrap:anywhere}
.confirm-actions{display:flex;gap:10px;margin-top:20px}.confirm-actions button{flex:1;min-height:49px;font-size:14px;border-radius:13px}.confirm-actions button:first-child{background:#edf1ed;color:#4c6759}
.confirm-actions .danger-action{background:#b93636;color:#fff}
@media (prefers-reduced-motion:reduce){.confirm-card{animation:none}}

/* V10: ป้ายสถานะยอดชำระในรายการรับเห็ดบนหน้าบ้าน */
.recent-sale{align-items:center}.sale-state{display:inline-flex;align-items:center;justify-content:center;margin-top:7px;padding:6px 11px;border-radius:999px;font-size:12px;font-weight:800;line-height:1.25;white-space:nowrap}.sale-state-paid{background:#dbf5e4;color:#096b35;border:1px solid #95dfaf}.sale-state-partial{background:#fff1d6;color:#915807;border:1px solid #f3d38d}.sale-state-unpaid{background:#ffe9e8;color:#aa3434;border:1px solid #f5b7b3}

/* V11: fit landing page on typical iPhone/Android screens */
html{min-height:100%;-webkit-text-size-adjust:100%;text-size-adjust:100%}
body{min-height:100dvh;overscroll-behavior-y:contain}
#homePage.home-card{margin:0 auto;padding:clamp(12px,2.2vh,22px) 18px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:clamp(3px,1vh,9px);min-height:calc(100dvh - 112px)}
#homePage.hidden{display:none!important}
#homePage .home-logo{width:auto;height:clamp(92px,22dvh,190px);max-width:58vw;aspect-ratio:1;object-fit:contain}
#homePage h1{font-size:clamp(22px,4.4vh,28px);margin:0;line-height:1.15}
#homePage>.muted{margin:0;text-align:center;font-size:12px}
#homePage .home-buttons{width:100%;margin:clamp(6px,1.4vh,14px) 0;gap:9px}
#homePage .home-btn{min-height:64px;padding:11px 17px;font-size:18px}
#homePage .home-btn small{margin-top:3px;font-size:12px}
#homePage .join-details{width:100%;padding:8px 10px;font-size:11px}
#homePage .join-details p{margin:5px 0}
#homePage .home-foot{font-size:10px;margin:0;text-align:center}
@media(max-height:670px){.top{padding-top:9px;padding-bottom:9px}.wrap{padding-top:9px;padding-bottom:16px}#homePage.home-card{min-height:calc(100dvh - 78px);gap:4px}#homePage .home-logo{height:clamp(68px,17dvh,125px)}#homePage .home-btn{min-height:56px;padding:8px 14px}#homePage .home-buttons{margin:5px 0}#homePage .join-details{padding:6px 8px}}
@media(max-width:380px){.top .logo{font-size:17px}.top .logo small{font-size:9px}.status{font-size:10px}#homePage .home-btn{font-size:17px}}
@media (prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;animation-duration:0.01ms!important}}

/* V12: high contrast kg, price and debt, optimized for mobile */
#saleForm.sale-highlight{border:2px solid #b6d7c3;box-shadow:0 7px 22px #195c3620}
#saleForm.sale-highlight>h2{color:#124d35;font-weight:850}
#saleForm .sale-fields label{font-size:14px;font-weight:850;color:#103e2c;margin:9px 0 8px}
#saleForm .sale-fields input{border:2px solid #36835e;background:#f0faef;color:#103b29;font-size:23px;font-weight:850;min-height:62px;text-align:center;box-shadow:0 2px 0 #d8eade}
#saleForm .sale-fields input:focus{border-color:#0e6542;background:#fff;box-shadow:0 0 0 4px #6db99333}
#saleForm .credit-amount{border:2px solid #f0b4a4;background:#fff0e9;gap:10px;flex-wrap:wrap}
#saleForm .credit-amount span{font-size:15px;font-weight:850;color:#a43726}
#saleForm .credit-amount strong{font-size:clamp(28px,7vw,36px);color:#ac2d20}
#saleForm .credit-note{margin:8px 0 15px;background:#fff2d7;border-left:4px solid #e08d27;border-radius:8px;padding:10px;color:#79450d;font-weight:800;font-size:13px;line-height:1.5}
#saleForm #saveSale{min-height:54px;font-size:17px;box-shadow:0 5px 12px #14604022}
@media(max-width:360px){#saleForm .sale-fields{grid-template-columns:1fr}#saleForm .sale-fields input{text-align:left}}
