/* ============================================================
   CMC Customer Portal — Design System
   สอดคล้องกับต้นแบบ UI (Artifact) และเอกสารออกแบบระบบ หัวข้อ 9
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Taviraj:wght@500;600;700&family=Prompt:wght@400;500;600;700&display=swap');

:root{
  --cream-50:#FBF6EE; --cream-100:#F3E9DA;
  --brown-900:#3D2817; --brown-700:#6B4423; --brown-500:#8B5E34;
  --gold-500:#C08A34; --gold-300:#E0B368;
  --ink-900:#2B211A; --ink-600:#6B5D4F;
  --sage-600:#4F7A5B; --sage-100:#E3EDE4;
  --coral-600:#B8503A; --coral-100:#F5E1DA;
  --white:#FFFFFF;
  --radius-lg:18px; --radius-md:14px; --radius-sm:10px;
  --shadow-1: 0 10px 30px -16px rgba(61,40,23,.25);
}

*{box-sizing:border-box;}
html,body{margin:0;padding:0;}
body{
  background:var(--cream-50); color:var(--ink-900);
  font-family:'Prompt','Noto Sans Thai',sans-serif;
  -webkit-font-smoothing:antialiased;
  min-height:100vh;
}
body.sheet-open{ overflow:hidden; }
a{color:inherit;}
button{font-family:inherit;}
input,select,textarea{font-family:inherit;}

.app-shell{
  max-width:480px; margin:0 auto; min-height:100vh;
  background:var(--cream-50); position:relative;
  padding-bottom:82px; /* เผื่อพื้นที่ bottom nav */
}
.app-shell.no-nav{
  padding-bottom:0;
  background:
    radial-gradient(120% 46% at 50% 0%, rgba(192,138,52,.16), transparent 68%),
    radial-gradient(70% 40% at 88% 4%, rgba(79,122,91,.08), transparent 60%),
    var(--cream-50);
}

/* -------- top bar -------- */
.topbar{
  background:var(--brown-700); color:#fff;
  padding:16px 18px 18px; display:flex; align-items:center; gap:10px;
  position:sticky; top:0; z-index:20;
}
.topbar h1{font-family:'Prompt'; font-size:17px; font-weight:600; margin:0; flex:1;}
.topbar .back-btn{background:none; border:none; color:#fff; padding:4px; display:flex; cursor:pointer;}
.topbar .icon{width:20px; height:20px;}

.topbar-plain{
  padding:26px 20px 10px; display:flex; justify-content:space-between; align-items:flex-start;
}

/* -------- generic -------- */
.container{padding:16px 18px 24px; display:flex; flex-direction:column; gap:16px;}
.icon{width:20px; height:20px; stroke:currentColor; stroke-width:1.8; fill:none; stroke-linecap:round; stroke-linejoin:round; flex:none; display:inline-block; vertical-align:middle;}

h2.section-title{font-family:'Taviraj'; font-size:19px; font-weight:600; margin:0 0 2px; color:var(--ink-900);}
.muted{color:var(--ink-600); font-size:13px;}

.card{background:#fff; border:1px solid var(--cream-100); border-radius:var(--radius-lg); padding:16px 18px; box-shadow:0 6px 20px -16px rgba(61,40,23,.35);}
.card + .card{margin-top:0;}
.auth-card{box-shadow:var(--shadow-1);}

/* -------- titled info sections (รายละเอียดสัญญา / ข้อมูลราคา ฯลฯ) -------- */
.card-title{font-family:'Taviraj'; font-size:14.5px; font-weight:600; color:var(--brown-700); margin:2px 2px -2px; letter-spacing:.01em;}
.info-row{display:flex; justify-content:space-between; align-items:baseline; gap:14px; border-bottom:1px solid var(--cream-100); padding-bottom:10px;}
.info-row:last-child{border-bottom:none; padding-bottom:0;}
.info-row .k{color:var(--ink-600); font-size:12.5px; flex:none; max-width:46%;}
.info-row .v{font-weight:600; text-align:right; font-size:13.5px; color:var(--ink-900);}
.info-row .v.empty{color:#C9BCA4; font-weight:500; font-style:italic;}

.field-group{display:flex; flex-direction:column; gap:6px;}
.field-group label{font-size:12.5px; font-weight:600; color:var(--ink-600);}
.field{
  border:1.5px solid var(--cream-100); background:#fff; border-radius:var(--radius-sm);
  padding:12px 14px; font-size:14.5px; color:var(--ink-900); width:100%; outline:none;
  transition:border-color .15s;
}
.field:focus{border-color:var(--gold-500);}
.field::placeholder{color:#B4A78F;}
.field-error{border-color:var(--coral-600) !important;}
.error-text{color:var(--coral-600); font-size:12px; margin-top:-2px;}
.radio-row{display:flex; gap:18px; align-items:center; font-size:14px;}
.radio-row label{display:flex; align-items:center; gap:6px; font-weight:400;}

/* -------- grouped form sections (ลงทะเบียน / ยืนยันตัวตน) -------- */
.form-section{display:flex; flex-direction:column; gap:12px; padding-bottom:16px; border-bottom:1px solid var(--cream-100);}
.form-section:last-of-type{border-bottom:none; padding-bottom:0;}
.section-label{display:flex; align-items:center; gap:8px; font-family:'Taviraj'; font-size:14px; font-weight:600; color:var(--brown-700);}
.section-label .icon{width:17px; height:17px;}
.field-hint{font-size:11.5px; color:var(--ink-600); opacity:.85; line-height:1.5; margin-top:-1px;}
.field-mono{letter-spacing:1.5px; font-variant-numeric:tabular-nums;}

.verify-hero{text-align:center; display:flex; flex-direction:column; align-items:center; gap:9px; padding:24px 20px;}
.verify-icon-badge{
  width:58px; height:58px; border-radius:50%; flex:none;
  background:linear-gradient(135deg, var(--gold-300), var(--gold-500));
  display:flex; align-items:center; justify-content:center; color:var(--brown-900);
  box-shadow:0 8px 18px -10px rgba(192,138,52,.6);
}
.verify-icon-badge .icon{width:28px; height:28px; stroke-width:1.6;}
.verify-hero h2{font-family:'Taviraj'; font-weight:600; font-size:18px; color:var(--brown-900); margin:0;}
.verify-hero p{color:var(--ink-600); font-size:13px; line-height:1.65; margin:0; max-width:36em;}

.btn{
  border:none; border-radius:var(--radius-sm); padding:13px; font-weight:600; font-size:14.5px;
  cursor:pointer; text-align:center; display:flex; align-items:center; justify-content:center; gap:8px;
  transition:opacity .15s, transform .05s;
}
.btn:active{transform:scale(.98);}
.btn:disabled{opacity:.55; cursor:not-allowed;}
.btn-primary{background:var(--brown-700); color:#fff;}
.btn-primary:hover:not(:disabled){background:var(--brown-900);}
.btn-ghost{background:transparent; border:1.5px solid var(--brown-700); color:var(--brown-700);}
.btn-block{width:100%;}
.btn-sm{padding:9px 12px; font-size:12.5px; border-radius:9px;}
.btn-danger{background:var(--coral-100); color:var(--coral-600);}
.btn-success{background:var(--sage-100); color:var(--sage-600);}

.link-btn{background:none; border:none; color:var(--brown-700); font-weight:600; font-size:13px; cursor:pointer; padding:0;}

.alert{border-radius:var(--radius-sm); padding:12px 14px; font-size:13px; display:flex; gap:8px; align-items:flex-start;}
.alert-error{background:var(--coral-100); color:var(--coral-600);}
.alert-success{background:var(--sage-100); color:var(--sage-600);}
.alert-info{background:var(--cream-100); color:var(--ink-600);}

/* -------- brand / auth screens -------- */
.auth-hero{padding:10px 0 26px;}
.brand-badge{
  width:104px; height:104px; margin:0 auto 18px; border-radius:28px;
  background:#fff; display:flex; align-items:center; justify-content:center;
  box-shadow:0 16px 36px -16px rgba(61,40,23,.4), 0 1px 0 rgba(61,40,23,.03);
  border:1px solid var(--cream-100);
}
.brand-logo{width:76px; height:auto; display:block;}
.auth-hero .page-title{margin-top:2px;}
.auth-hero .muted{font-size:13.5px; letter-spacing:.1px;}
.center{text-align:center;}
h1.page-title{font-family:'Taviraj'; font-weight:600; font-size:22px; margin:4px 0 3px; color:var(--brown-900);}

/* -------- login page: แบนเนอร์ไล่สีน้ำตาล-ทอง (โทนเดียวกับโลโก้) + ตราสัญลักษณ์ลอยทับขอบ (ปรับปรุง 16 ก.ย. 2569) -------- */
.login-banner{
  position:relative; height:168px; margin:0 -18px; overflow:hidden;
  background:linear-gradient(135deg, var(--brown-900) 0%, var(--brown-700) 58%, var(--gold-500) 150%);
}
.login-banner::before{
  content:''; position:absolute; inset:0;
  background:
    radial-gradient(55% 85% at 8% -18%, rgba(224,179,104,.4), transparent 62%),
    radial-gradient(55% 75% at 108% 118%, rgba(79,122,91,.28), transparent 68%);
}
.login-banner-wave{position:absolute; left:0; bottom:-1px; width:100%; height:58px; display:block;}
.login-hero-badge-wrap{margin-top:-58px; position:relative; z-index:2;}
.login-hero-badge{width:104px; height:104px; margin:0 auto; box-shadow:0 18px 34px -14px rgba(61,40,23,.5), 0 0 0 5px rgba(251,246,238,.9);}
.login-hero-text{padding:12px 0 22px;}
.login-card{box-shadow:0 22px 46px -22px rgba(61,40,23,.5); border:1px solid rgba(192,138,52,.14);}

.otp-row{display:flex; gap:8px; justify-content:center;}
.otp-box{
  width:44px; height:52px; border-radius:10px; border:1.5px solid var(--cream-100);
  text-align:center; font-size:20px; font-weight:600; font-variant-numeric:tabular-nums;
  background:#fff; outline:none;
}
.otp-box:focus{border-color:var(--gold-500);}

/* -------- bottom nav -------- */
.bottomnav{
  position:fixed; left:50%; transform:translateX(-50%); bottom:0; width:100%; max-width:480px;
  display:flex; justify-content:space-around; align-items:center;
  padding:9px 8px calc(10px + env(safe-area-inset-bottom)); border-top:1px solid var(--cream-100);
  background:#fff; z-index:30;
}
.navitem{
  display:flex; flex-direction:column; align-items:center; gap:3px; font-size:10.5px;
  color:#B4A78F; font-weight:500; background:none; border:none; cursor:pointer; padding:4px 10px;
  text-decoration:none;
}
.navitem.active{color:var(--brown-700);}

/* -------- dashboard -------- */
.home-hero{
  margin:-16px -18px 2px; padding:20px 18px 22px;
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(192,138,52,.14), transparent 60%),
    radial-gradient(90% 80% at 0% 0%, rgba(79,122,91,.08), transparent 55%);
  border-radius:0 0 26px 26px;
}
.greet{display:flex; justify-content:space-between; align-items:flex-start;}
.greet .name{font-family:'Taviraj'; font-weight:600; font-size:21px; margin-top:2px;}
.avatar{
  width:42px; height:42px; border-radius:50%; flex:none;
  background:linear-gradient(135deg, var(--gold-300), var(--gold-500));
  display:flex; align-items:center; justify-content:center; color:var(--brown-900); font-weight:700; font-size:15px;
  box-shadow:0 8px 16px -8px rgba(192,138,52,.6);
}
.unit-card{
  background:linear-gradient(135deg, var(--brown-700), #55341A); color:#fff;
  border-radius:var(--radius-lg); padding:18px 19px; display:flex; flex-direction:column; gap:14px;
  cursor:pointer; text-decoration:none; position:relative; overflow:hidden;
  box-shadow:0 16px 32px -18px rgba(61,40,23,.55);
}
.unit-card::after{
  content:''; position:absolute; inset:0; pointer-events:none;
  background:radial-gradient(120% 60% at 100% 0%, rgba(255,255,255,.14), transparent 60%);
}
.unit-card-top{display:flex; justify-content:space-between; align-items:flex-start; gap:10px;}
.unit-card-icon{
  width:38px; height:38px; border-radius:12px; background:rgba(255,255,255,.15); flex:none;
  display:flex; align-items:center; justify-content:center;
}
.unit-card-icon .icon{width:19px; height:19px;}
.unit-card .proj{font-size:11px; letter-spacing:.06em; text-transform:uppercase; opacity:.75;}
.unit-card .room{font-family:'Taviraj'; font-size:19px; font-weight:600; margin-top:2px;}
.unit-card-foot{display:flex; justify-content:space-between; align-items:center; gap:10px; position:relative;}
.unit-card .badge{
  background:rgba(255,255,255,.16); border-radius:999px;
  padding:4px 10px; font-size:10.5px; font-weight:600; display:flex; align-items:center; gap:5px;
}
.unit-card-more{display:flex; align-items:center; gap:3px; font-size:10.5px; opacity:.82; font-weight:500; white-space:nowrap;}
.unit-card-more .icon{width:14px; height:14px;}
.icon-grid{display:grid; grid-template-columns:repeat(3,1fr); gap:12px;}
.icon-tile{
  background:#fff; border:1px solid var(--cream-100); border-radius:var(--radius-md);
  padding:16px 6px 12px; display:flex; flex-direction:column; align-items:center; gap:8px;
  position:relative; text-align:center; cursor:pointer; border-width:1px; text-decoration:none; color:inherit;
  box-shadow:0 6px 20px -16px rgba(61,40,23,.35); transition:transform .12s, box-shadow .12s;
}
.icon-tile:active{background:var(--cream-100); transform:scale(.97);}
@media (hover:hover){
  .icon-tile:hover{ transform:translateY(-2px); box-shadow:0 12px 26px -14px rgba(61,40,23,.4); }
}
.icon-tile .ic-wrap{
  width:40px; height:40px; border-radius:12px; background:var(--cream-100);
  display:flex; align-items:center; justify-content:center; color:var(--brown-700);
}
.icon-tile .ic-wrap.ic-gold{background:#FBEFD6; color:#946A16;}
.icon-tile .ic-wrap.ic-coral{background:var(--coral-100); color:var(--coral-600);}
.icon-tile .ic-wrap.ic-sage{background:var(--sage-100); color:var(--sage-600);}
.icon-tile .ic-wrap.ic-blue{background:#E3EEF5; color:#2E6F92;}
.icon-tile .ic-wrap.ic-toffee{background:#EAD9C4; color:#7A4A1E;}
.icon-tile span{font-size:11px; font-weight:500; line-height:1.3;}
.icon-tile .dot{
  position:absolute; top:8px; right:10px; background:var(--coral-600); color:#fff;
  font-size:9px; font-weight:700; min-width:16px; height:16px; border-radius:8px;
  display:flex; align-items:center; justify-content:center; padding:0 4px;
}

/* -------- lists -------- */
.list-row{
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  border:1px solid var(--cream-100); border-radius:var(--radius-md); padding:13px 15px; background:#fff;
}
.list-row .t1{font-size:13.5px; font-weight:600;}
.list-row .t2{font-size:11px; color:var(--ink-600); margin-top:2px;}
.list-row .amt{font-size:15px; font-weight:700; font-variant-numeric:tabular-nums; white-space:nowrap;}
.list-row.overdue{border-color:var(--coral-600);}
.list-row.paid{opacity:.55;}
.status-chip{font-size:10px; font-weight:700; border-radius:999px; padding:4px 9px; white-space:nowrap;}
.status-chip.paid{background:var(--sage-100); color:var(--sage-600);}
.status-chip.unpaid{background:#FBEFD6; color:#946A16;}
.status-chip.overdue{background:var(--coral-100); color:var(--coral-600);}
.status-chip.pending_review{background:#E3EEF5; color:#2E6F92;}
.status-chip.open{background:var(--coral-100); color:var(--coral-600);}
.status-chip.in_progress{background:#FBEFD6; color:#946A16;}
.status-chip.close{background:#E3EEF5; color:#2E6F92;}
.status-chip.complete{background:var(--sage-100); color:var(--sage-600);}

/* -------- payment type badge (ประวัติการชำระเงิน) -------- */
.type-badge{
  display:inline-flex; align-items:center; font-size:10px; font-weight:700; border-radius:999px;
  padding:4px 9px; white-space:nowrap; background:var(--cream-100); color:var(--brown-700); vertical-align:middle;
}
.type-badge.reserve{background:#FBEFD6; color:#946A16;}
.type-badge.down{background:var(--sage-100); color:var(--sage-600);}
.type-badge.transfer{background:#E3EEF5; color:#2E6F92;}
.type-badge.installment{background:var(--coral-100); color:var(--coral-600);}

.tabbar{display:flex; background:var(--cream-100); border-radius:11px; padding:3px; gap:2px;}
.tabbar .t{flex:1; text-align:center; font-size:12.5px; font-weight:600; padding:9px 0; border-radius:9px; color:var(--ink-600); cursor:pointer; background:none; border:none;}
.tabbar .t.on{background:#fff; color:var(--brown-700);}

/* -------- ใบแจ้งหนี้: การ์ด QR Code / Barcode จริง (สแกนใช้งานได้จริงผ่าน QRCode.js / JsBarcode) -------- */
.code-card{
  background:var(--white); border-radius:var(--radius-lg); border:1px solid var(--cream-100);
  box-shadow:var(--shadow-1); padding:22px; display:flex; justify-content:center; align-items:center;
  margin:4px auto; width:fit-content; max-width:100%;
}
.qr-box{
  width:208px; height:208px; max-width:100%; display:flex; align-items:center; justify-content:center;
  position:relative; padding:8px;
}
.qr-box::before, .qr-box::after{
  content:''; position:absolute; width:24px; height:24px; border:3px solid var(--gold-500); pointer-events:none;
}
.qr-box::before{top:0; left:0; border-right:none; border-bottom:none; border-top-left-radius:6px;}
.qr-box::after{bottom:0; right:0; border-left:none; border-top:none; border-bottom-right-radius:6px;}
.qr-box img, .qr-box canvas, .qr-box table{border-radius:6px; max-width:100%; height:auto !important;}
.barcode-box{
  width:100%; min-width:240px; display:flex; align-items:center; justify-content:center; padding:6px 4px;
}
.barcode-box svg{width:100%; height:auto; max-width:300px;}
.barcode-caption{
  margin-top:12px; text-align:center; font-family:'Prompt', monospace; font-size:12px; letter-spacing:.03em;
  color:var(--ink-600); font-variant-numeric:tabular-nums; word-break:break-all; padding:0 8px;
}
.code-actions{display:flex; flex-direction:column; gap:8px; margin-top:2px;}

/* -------- stat grid (summary) -------- */
.sum-hero{text-align:center; padding:4px 0 0;}
.sum-hero .big{font-family:'Taviraj'; font-weight:700; font-size:30px; color:var(--brown-700); font-variant-numeric:tabular-nums;}
.sum-hero .label{font-size:11.5px; color:var(--ink-600); margin-top:2px;}
.progress-track{height:10px; border-radius:6px; background:var(--cream-100); overflow:hidden;}
.progress-fill{height:100%; border-radius:6px; background:linear-gradient(90deg, var(--gold-500), var(--sage-600));}
.stat-grid{display:grid; grid-template-columns:1fr 1fr; gap:10px;}
.stat{border:1px solid var(--cream-100); border-radius:12px; padding:12px 13px; background:#fff;}
.stat .k{font-size:10.5px; color:var(--ink-600);}
.stat .v{font-size:15.5px; font-weight:700; margin-top:3px; font-variant-numeric:tabular-nums;}
.stat .v.pos{color:var(--sage-600);}
.stat .v.neg{color:var(--coral-600);}

/* -------- paired ค้าง/ชำระ stat block (ข้อมูลรวม) -------- */
.pair-stat{border:1px solid var(--cream-100); border-radius:12px; padding:13px 14px; background:#fff; display:flex; flex-direction:column; gap:9px; box-shadow:0 6px 20px -16px rgba(61,40,23,.35);}
.pair-stat .k{font-size:11px; color:var(--ink-600); font-weight:600;}
.pair-stat .split{display:flex; gap:10px;}
.pair-stat .split > div{flex:1; border-left:1px solid var(--cream-100); padding-left:10px;}
.pair-stat .split > div:first-child{border-left:none; padding-left:0;}
.pair-stat .split .lbl{font-size:9.5px; color:var(--ink-600); text-transform:uppercase; letter-spacing:.05em;}
.pair-stat .split .amt{font-size:14.5px; font-weight:700; font-variant-numeric:tabular-nums; margin-top:3px;}
.pair-stat .split .amt.pending{color:var(--coral-600);}
.pair-stat .split .amt.paid{color:var(--sage-600);}
.pair-stat .split .amt.empty{color:#C9BCA4; font-weight:500;}

/* -------- repair -------- */
.rep-item{
  display:flex; align-items:center; gap:13px; border:1px solid var(--cream-100); border-radius:var(--radius-lg);
  padding:13px 14px; background:#fff; cursor:pointer; box-shadow:0 6px 20px -16px rgba(61,40,23,.35);
  transition:transform .12s, box-shadow .12s, background .12s;
}
.rep-item:active{transform:scale(.98); background:var(--cream-50);}
.rep-icon{width:46px; height:46px; border-radius:13px; flex:none; display:flex; align-items:center; justify-content:center;}
.rep-icon .icon{width:22px; height:22px;}
.rep-icon--gold{background:#FBEFD6; color:#946A16;}
.rep-icon--blue{background:#E3EEF5; color:#2E6F92;}
.rep-icon--brown{background:var(--cream-100); color:var(--brown-700);}
.rep-icon--teal{background:var(--sage-100); color:var(--sage-600);}
.rep-icon--grey{background:#ECE6DC; color:#8A7A63;}
.rep-icon--lg{width:54px; height:54px; border-radius:16px;}
.rep-icon--lg .icon{width:26px; height:26px;}
.rep-info{flex:1; min-width:0;}
.rep-title{font-size:13.5px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.rep-meta{font-size:11px; color:var(--ink-600); margin-top:3px; display:flex; align-items:center; gap:6px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.rep-meta .rep-dot{opacity:.5;}
.rep-date{font-size:10.5px; color:var(--ink-600); margin-top:4px; display:flex; align-items:center; gap:4px; opacity:.85;}
.rep-date .icon{width:12px; height:12px;}
.rep-right{display:flex; flex-direction:column; align-items:flex-end; gap:9px; flex:none;}
.rep-right > .icon{width:16px; height:16px; color:#C9BCA4;}
.rep-detail-head{display:flex; align-items:center; gap:14px;}
.rep-detail-headtext{display:flex; flex-direction:column; gap:6px; align-items:flex-start;}
.rep-detail-loc{font-size:12.5px; color:var(--ink-600); font-weight:500;}
.rep-desc{font-size:13px; line-height:1.7; color:var(--ink-900); white-space:pre-wrap;}

/* -------- ตัวเลือกหมวดหมู่แจ้งซ่อม (แบบ chip grid มีไอคอน) -------- */
.cat-picker{display:grid; grid-template-columns:repeat(3,1fr); gap:8px;}
.cat-chip{
  display:flex; flex-direction:column; align-items:center; gap:6px; padding:12px 6px;
  border:1.5px solid var(--cream-100); border-radius:var(--radius-md); background:#fff; cursor:pointer;
  font-size:11px; color:var(--ink-600); font-weight:500; transition:border-color .15s, background .15s, color .15s;
}
.cat-chip .icon{width:20px; height:20px;}
.cat-chip.on{border-color:var(--gold-500); background:var(--cream-100); color:var(--brown-700); font-weight:600;}

.fab{
  position:fixed; right:calc(50% - 240px + 18px); bottom:96px; width:54px; height:54px; border-radius:18px;
  background:linear-gradient(135deg, var(--brown-500), var(--brown-700)); color:#fff;
  display:flex; align-items:center; justify-content:center;
  box-shadow:0 14px 28px -10px rgba(61,40,23,.6), 0 2px 8px rgba(61,40,23,.15);
  border:none; cursor:pointer; z-index:25; transition:transform .12s;
}
.fab:active{transform:scale(.93);}
@media (max-width:520px){
  .fab{ right:18px; }
}
.file-drop{
  border:1.5px dashed var(--cream-100); border-radius:var(--radius-md); padding:18px; text-align:center;
  color:var(--ink-600); font-size:12.5px; cursor:pointer; background:#fff;
}
.file-drop input{display:none;}
.thumb-row{display:flex; gap:8px; flex-wrap:wrap;}
.thumb-row img{width:58px; height:58px; border-radius:10px; object-fit:cover; border:1px solid var(--cream-100);}

/* -------- modal / bottom sheet -------- */
.overlay{
  position:fixed; inset:0; background:rgba(43,33,26,.5); z-index:40;
  display:flex; align-items:flex-end; justify-content:center;
  backdrop-filter:blur(3px); -webkit-backdrop-filter:blur(3px);
  animation:overlayFadeIn .16s ease;
}
@keyframes overlayFadeIn{ from{ opacity:0; } to{ opacity:1; } }
.sheet{
  width:100%; max-width:480px; background:#fff; border-radius:22px 22px 0 0;
  padding:14px 20px 26px; display:flex; flex-direction:column; gap:14px;
  max-height:86vh; overflow-y:auto;
  box-shadow:0 -12px 40px -18px rgba(43,33,26,.35);
}
.sheet .handle{width:40px; height:4px; background:var(--cream-100); border-radius:4px; margin:2px auto 4px;}
.sheet-header{display:flex; justify-content:space-between; align-items:center; padding-bottom:12px; border-bottom:1px solid var(--cream-100);}
.sheet-header h3{font-family:'Taviraj'; font-size:17px; font-weight:600; margin:0;}
.sheet-close{
  background:var(--cream-100); border:none; width:30px; height:30px; border-radius:50%;
  display:flex; align-items:center; justify-content:center; cursor:pointer; color:var(--ink-600);
  transition:background .15s, color .15s;
}
.sheet-close:hover{background:var(--gold-300); color:var(--brown-900);}
.sheet-close .icon{width:16px; height:16px;}

/* -------- modal แบบ popup กลางจอ (ใบแจ้งหนี้ QR/Barcode, ใบเสร็จรับเงิน, แจ้งซ่อม ฯลฯ) -------- */
.overlay--center{ align-items:center; padding:20px; }
.sheet--center{
  width:100%; max-width:400px; border-radius:var(--radius-lg);
  box-shadow:0 30px 70px -24px rgba(43,33,26,.5), 0 2px 8px rgba(43,33,26,.06);
  animation:sheetPopIn .22s cubic-bezier(.22,.9,.32,1);
  max-height:88vh;
}
.sheet--center .handle{display:none;}
.sheet--center .sheet-header{padding-bottom:14px;}
@keyframes sheetPopIn{
  from{ opacity:0; transform:translateY(14px) scale(.96); }
  to{ opacity:1; transform:translateY(0) scale(1); }
}
@media (max-width:400px){
  .overlay--center{ padding:14px; }
  .sheet--center{ padding-left:16px; padding-right:16px; }
}

/* -------- loading / empty -------- */
.spinner{
  width:26px; height:26px; border-radius:50%; border:3px solid var(--cream-100); border-top-color:var(--brown-700);
  animation:spin 0.7s linear infinite; margin:30px auto;
}
@keyframes spin{to{transform:rotate(360deg);}}
.empty-state{text-align:center; padding:40px 20px; color:var(--ink-600);}
.empty-state .icon{width:40px; height:40px; margin-bottom:10px; opacity:.5;}

/* -------- responsive: tablet/desktop -------- */
@media (min-width:640px){
  .app-shell{
    margin-top:28px; margin-bottom:28px; border-radius:26px; box-shadow:var(--shadow-1);
    min-height:auto; overflow:hidden; border:1px solid var(--cream-100);
  }
  .bottomnav{border-radius:0 0 26px 26px;}
}

::-webkit-scrollbar{width:8px;}
::-webkit-scrollbar-thumb{background:var(--cream-100); border-radius:8px;}

/* -------- PDPA: นโยบายความเป็นส่วนตัว -------- */
.policy-box{
  max-height:340px; overflow-y:auto; border:1px solid var(--cream-100); border-radius:var(--radius-md);
  padding:14px 16px; background:var(--cream-50);
}
.policy-meta{font-size:11.5px; color:var(--ink-600); font-weight:600; letter-spacing:.02em; margin-bottom:4px;}
.policy-section{margin-top:16px;}
.policy-section:first-of-type{margin-top:2px;}
.policy-section h3{
  font-family:'Taviraj'; font-size:14.5px; font-weight:600; color:var(--brown-700); margin:0 0 6px;
}
.policy-section p{font-size:13px; line-height:1.75; color:var(--ink-900); margin:0 0 8px;}
.policy-section p:last-child{margin-bottom:0;}
.policy-section ul{margin:0 0 8px; padding-left:20px; display:flex; flex-direction:column; gap:5px;}
.policy-section li{font-size:13px; line-height:1.65; color:var(--ink-900);}
.policy-section b{color:var(--brown-900);}

/* -------- คุกกี้: แบนเนอร์ไม่บังคับ ไม่บล็อกการใช้งาน -------- */
.cookie-banner{
  position:fixed; left:0; right:0; bottom:0; z-index:70; background:var(--brown-900); color:#fff;
  padding:14px 16px calc(14px + env(safe-area-inset-bottom));
  display:flex; flex-direction:column; gap:12px;
  box-shadow:0 -10px 26px -10px rgba(0,0,0,.35);
}
.cookie-banner-text{display:flex; align-items:flex-start; gap:10px; font-size:12.5px; line-height:1.6; color:#F3E9DA;}
.cookie-banner-text .icon{color:var(--gold-300); flex:none; margin-top:1px;}
.cookie-banner-text a{color:var(--gold-300); font-weight:600; text-decoration:underline;}
.cookie-banner-actions{display:flex; gap:10px;}
.cookie-banner-actions .btn{flex:1;}
.cookie-banner-actions .btn-ghost{border-color:rgba(255,255,255,.35); color:#fff;}
@media (min-width:640px){
  .cookie-banner{
    left:50%; right:auto; bottom:20px; transform:translateX(-50%); max-width:520px;
    border-radius:16px; flex-direction:row; align-items:center; justify-content:space-between;
  }
  .cookie-banner-actions{flex:none;}
  .cookie-banner-actions .btn{flex:none;}
}

/* -------- footer: ลิขสิทธิ์ + เวอร์ชัน (ทุกหน้า) -------- */
.app-footer{
  margin-top:6px; padding:16px 4px 4px; border-top:1px solid var(--cream-100);
  display:flex; flex-wrap:wrap; align-items:center; justify-content:center; gap:5px 9px;
  text-align:center;
}
.app-footer-copy{font-size:10.5px; color:var(--ink-600); letter-spacing:.01em;}
.app-footer-dot{color:var(--gold-500); font-size:9px; line-height:1;}
.app-footer-version{
  font-size:10px; font-weight:600; color:var(--brown-500); background:var(--cream-100);
  padding:2px 8px; border-radius:99px; font-variant-numeric:tabular-nums; letter-spacing:.02em;
}

/* -------- บริการลูกค้า: เมนู "บริการลูกค้า" (เพิ่มใหม่ 17 ก.ย. 2569) -------- */
.icon-tile .ic-wrap.ic-plum{background:#F1E4E8; color:#8B4B63;}
.icon-tile .ic-wrap.ic-teal{background:#DCEEEA; color:#2A7A6C;}
.rep-icon--coral{background:var(--coral-100); color:var(--coral-600);}
.status-chip.resolved{background:var(--sage-100); color:var(--sage-600);}

.thumb-video{
  width:58px; height:58px; border-radius:10px; border:1px solid var(--cream-100);
  display:flex; align-items:center; justify-content:center; background:var(--cream-50); color:var(--brown-500);
}
.thumb-video .icon{width:22px; height:22px;}

/* ให้คะแนนความพึงพอใจ */
.star-picker{display:flex; gap:6px;}
.star-btn{background:none; border:none; padding:2px; cursor:pointer; color:#D8CBB5;}
.star-btn .icon{width:28px; height:28px; fill:none; stroke:currentColor;}
.star-btn.on{color:var(--gold-500);}
.star-btn.on .icon{fill:var(--gold-500);}
.icon.star-on{color:var(--gold-500); fill:var(--gold-500);}
.icon.star-off{color:#D8CBB5; fill:none;}

/* ช่องทางการติดต่อ */
.contact-hero{
  background:linear-gradient(165deg, var(--brown-700) 0%, var(--brown-900) 60%, #1F140B 100%);
  border-radius:var(--radius-lg); padding:34px 22px 30px; text-align:center; color:#fff;
  display:flex; flex-direction:column; align-items:center; gap:6px;
  box-shadow:0 16px 30px -18px rgba(61,40,23,.5);
}
.contact-hero-logo{
  width:74px; height:74px; border-radius:50%; background:#fff; display:flex; align-items:center; justify-content:center;
  box-shadow:0 8px 18px -6px rgba(0,0,0,.35); margin-bottom:8px; overflow:hidden;
}
.contact-hero-logo img{width:56px; height:56px; object-fit:contain;}
.contact-hero-label{font-family:'Taviraj'; font-size:16px; font-weight:600; opacity:.92; margin-bottom:6px;}
.contact-phone-btn{
  display:inline-flex; align-items:center; gap:9px; background:var(--coral-600); color:#fff;
  font-size:17px; font-weight:700; padding:14px 26px; border-radius:999px; text-decoration:none;
  box-shadow:0 10px 22px -8px rgba(184,80,58,.6); letter-spacing:.02em;
}
.contact-phone-btn .icon{width:20px; height:20px;}

/* -------- ปฏิทินนัดหมาย (เพิ่มใหม่): ใช้ในหน้า #/calendar -- mobile-first, ดูง่ายบนมือถือ -------- */
.cal-wrap{padding:16px;}
.cal-head{display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; gap:10px;}
.cal-head .btn{padding:8px 10px;}
.cal-head .btn .icon{width:16px; height:16px;}
.cal-title{font-family:'Taviraj'; font-weight:600; font-size:15.5px; color:var(--brown-700); text-align:center; flex:1;}
.cal-grid{display:grid; grid-template-columns:repeat(7,1fr); gap:5px;}
.cal-grid-head{margin-bottom:6px;}
.cal-cell-head{text-align:center; font-size:10.5px; font-weight:700; color:var(--ink-600);}
.cal-cell{min-height:52px; border:1px solid var(--cream-100); border-radius:9px; padding:4px; display:flex; flex-direction:column; gap:3px; align-items:center;}
.cal-cell-empty{border:none;}
.cal-cell-today{border-color:var(--gold-500); background:var(--cream-50);}
.cal-daynum{font-size:11px; font-weight:700; color:var(--ink-600);}
.cal-cell-today .cal-daynum{color:var(--gold-500);}
.cal-events{display:flex; flex-direction:column; gap:2px; width:100%; align-items:center;}
.cal-ev{font-size:9px; padding:1px 4px; border-radius:5px; background:var(--sage-100); color:var(--sage-600); font-weight:700; cursor:pointer; width:100%; text-align:center;}
.cal-ev-complaint{background:var(--coral-100); color:var(--coral-600);}
.cal-ev-more{font-size:8.5px; color:var(--ink-600);}
@media (min-width:480px){
  .cal-cell{min-height:64px;}
  .cal-ev{font-size:10px;}
}

/* -------- [ใหม่ รอบที่ 37] การ์ดติดต่อช่างผู้รับผิดชอบ (แสดงในหน้ารายละเอียดแจ้งซ่อม/ร้องเรียนเมื่อมีเบอร์โทรช่าง) -------- */
.tech-contact-card{
  display:flex; align-items:center; gap:12px; padding:13px 14px; border-radius:var(--radius-md);
  background:linear-gradient(135deg, var(--sage-100) 0%, var(--cream-50) 130%); border:1px solid var(--sage-100);
}
.tech-contact-avatar{
  flex:none; width:42px; height:42px; border-radius:50%; background:#fff; color:var(--sage-600);
  display:flex; align-items:center; justify-content:center; box-shadow:0 3px 10px -6px rgba(61,40,23,.3);
}
.tech-contact-avatar .icon{width:22px; height:22px;}
.tech-contact-info{display:flex; flex-direction:column; gap:2px; flex:1; min-width:0;}
.tech-contact-label{font-size:11px; color:var(--sage-600); font-weight:600;}
.tech-contact-name{font-size:14px; font-weight:700; color:var(--brown-900); white-space:nowrap; overflow:hidden; text-overflow:ellipsis;}
.tech-contact-call{
  flex:none; display:inline-flex; align-items:center; gap:6px; padding:9px 15px; border-radius:999px;
  background:var(--brown-700); color:#fff; font-size:13px; font-weight:700; text-decoration:none;
  box-shadow:0 6px 14px -8px rgba(61,40,23,.55); transition:background .15s, transform .15s;
}
.tech-contact-call:hover{background:var(--brown-900); transform:translateY(-1px);}
.tech-contact-call .icon{width:15px; height:15px;}

/* -------- [ใหม่ รอบที่ 37] กลุ่มเช็กบ็อกซ์เลือกโครงการ (ใช้ในฟอร์มสมัครสมาชิกช่าง) -------- */
.chk-grid{display:flex; flex-direction:column; gap:6px; max-height:220px; overflow-y:auto; border:1px solid var(--cream-100); border-radius:8px; padding:10px;}
.chk-item{display:flex; align-items:center; gap:8px; font-size:13px; cursor:pointer;}
.chk-item input{width:16px; height:16px; cursor:pointer;}

.icon-inline{width:13px; height:13px; vertical-align:-2px; margin-right:2px;}

/* -------- [ใหม่ รอบที่ 39] หน้าโปรไฟล์ออกแบบใหม่ -- การ์ดหัว (ชื่อ/เบอร์/อีเมล ไม่ซ้ำซ้อนกับการ์ดด้านล่างอีกต่อไป) -------- */
.profile-hero{
  background:linear-gradient(135deg, var(--brown-900) 0%, var(--brown-700) 55%, var(--gold-500) 150%);
  color:#fff; border-radius:var(--radius-lg); padding:24px 20px 20px; display:flex; flex-direction:column; gap:3px;
  align-items:center; text-align:center; box-shadow:0 16px 32px -18px rgba(61,40,23,.55); position:relative; overflow:hidden;
}
.profile-hero::after{
  content:''; position:absolute; inset:0; pointer-events:none;
  background:radial-gradient(120% 60% at 100% 0%, rgba(255,255,255,.14), transparent 60%);
}
.profile-hero-avatar{
  width:64px; height:64px; border-radius:50%; flex:none; margin-bottom:8px;
  background:linear-gradient(135deg, var(--gold-300), var(--gold-500));
  display:flex; align-items:center; justify-content:center; color:var(--brown-900); font-weight:700; font-size:24px;
  box-shadow:0 8px 20px -8px rgba(0,0,0,.4); position:relative; z-index:1;
}
.profile-hero-row{display:flex; align-items:center; justify-content:center; gap:6px; position:relative; z-index:1;}
.profile-hero-name{font-family:'Taviraj'; font-weight:600; font-size:19px;}
.profile-hero-phone{font-size:13.5px; opacity:.88; font-variant-numeric:tabular-nums;}
.profile-hero-edit{
  width:24px; height:24px; border-radius:50%; background:rgba(255,255,255,.16); border:none; flex:none;
  display:flex; align-items:center; justify-content:center; color:#fff; cursor:pointer; transition:background .15s; padding:0;
}
.profile-hero-edit:hover{background:rgba(255,255,255,.28);}
.profile-hero-edit .icon{width:12px; height:12px;}
.profile-hero-meta{font-size:11.5px; opacity:.72; margin-top:3px; position:relative; z-index:1;}

/* -------- [ใหม่ รอบที่ 39] แถวเมนูตั้งค่าแบบกดได้ (ใช้แทนปุ่ม ghost เต็มแถวเดิมในการ์ด "บัญชีและความเป็นส่วนตัว") -------- */
.profile-menu-row{
  display:flex; align-items:center; gap:12px; padding:12px 2px; cursor:pointer; border:none; background:none;
  width:100%; text-align:left; color:inherit; font:inherit; transition:opacity .12s;
}
.profile-menu-row:active{opacity:.65;}
.profile-menu-row + .profile-menu-row{border-top:1px solid var(--cream-100);}
.profile-menu-row .ic-wrap{
  width:34px; height:34px; border-radius:10px; background:var(--cream-100); color:var(--brown-700); flex:none;
  display:flex; align-items:center; justify-content:center;
}
.profile-menu-row .ic-wrap .icon{width:16px; height:16px;}
.profile-menu-row-text{flex:1; font-size:13.5px; font-weight:500;}
.profile-menu-row > .icon{width:16px; height:16px; color:#C9BCA4; flex:none;}


/* -------- [รอบที่ 47] ช่องทางติดต่อเพิ่มเติม (หน้า #/service/contact) -------- */
.cc-section-title{font-family:'Taviraj'; font-weight:600; font-size:15.5px; color:var(--brown-900); margin:22px 4px 10px;}
.cc-cards{display:flex; flex-direction:column; gap:10px;}
.cc-card{display:flex; align-items:center; gap:13px; background:#fff; border:1px solid var(--cream-100); border-radius:var(--radius-md); padding:13px 14px; text-decoration:none; color:inherit; box-shadow:0 6px 16px -14px rgba(61,40,23,.45); transition:transform .12s, box-shadow .12s;}
a.cc-card:active{transform:scale(.99);}
a.cc-card:hover{box-shadow:0 10px 22px -14px rgba(61,40,23,.55);}
.cc-card-ic{width:42px; height:42px; border-radius:12px; flex:none; display:flex; align-items:center; justify-content:center; background:var(--cream-100); color:var(--brown-700);}
.cc-card-ic .icon{width:20px; height:20px;}
.cc-t-phone{background:#FBE7E1; color:var(--coral-600);}
.cc-t-line{background:#E1F5E6; color:#06A13B;}
.cc-t-email{background:#E4ECF7; color:#3E5C8A;}
.cc-t-facebook{background:#E3EBFA; color:#1C5FD6;}
.cc-t-website{background:#E6F0F2; color:#2F6F7E;}
.cc-t-address{background:#FBEBD2; color:#9A6412;}
.cc-t-hours{background:var(--sage-100); color:var(--sage-600);}
.cc-card-body{display:flex; flex-direction:column; gap:2px; min-width:0; flex:1;}
.cc-card-label{font-size:11.5px; color:var(--ink-600); font-weight:600;}
.cc-card-value{font-size:14.5px; font-weight:600; color:var(--brown-900); word-break:break-word;}
.cc-card-note{font-size:11.5px; color:var(--ink-600);}
.cc-card-act{flex:none; font-size:12px; font-weight:600; color:#fff; background:var(--brown-700); padding:7px 12px; border-radius:999px;}
