:root {
  --brand: #f26b1d;
  --brand-dark: #d4560c;
  --brand-soft: #fff1e8;
  --ink: #1f2328;
  --muted: #6b7280;
  --line: #e5e7eb;
  --bg: #f6f7f9;
  --card: #ffffff;
  --ok: #15803d;
  --err: #b91c1c;
  --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Prompt", "Sarabun", system-ui, sans-serif; font-size: 16px; line-height: 1.55;
}
a { color: var(--brand-dark); }
img { max-width: 100%; }

.topbar { background: #16181d; color: #fff; }
.topbar .in { max-width: 1100px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo { font-weight: 700; font-size: 20px; letter-spacing: .3px; color: #fff; text-decoration: none; }
.logo b { color: var(--brand); }
.topbar nav { display: flex; gap: 14px; margin-left: auto; align-items: center; flex-wrap: wrap; }
.topbar nav a { color: #d1d5db; text-decoration: none; font-size: 15px; }
.topbar nav a:hover, .topbar nav a.on { color: #fff; }
.topbar form { margin: 0; }

.wrap { max-width: 1100px; margin: 0 auto; padding: 20px 16px 60px; }
.narrow { max-width: 760px; }
.wide { max-width: 1480px; }
body:has(main.wide) .topbar .in { max-width: 1480px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 19px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 20px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; }
.card h2 { display: flex; align-items: center; gap: 10px; }
.num { display: inline-grid; place-items: center; min-width: 28px; height: 28px; padding: 0 6px; border-radius: 999px; background: var(--brand); color: #fff; font-size: 14px; font-weight: 600; }

.grid { display: grid; gap: 14px 16px; grid-template-columns: 1fr 1fr; }
.grid .full { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

label.f { display: block; font-weight: 500; margin-bottom: 4px; }
label.f .req { color: var(--brand-dark); }
.hint { color: var(--muted); font-size: 13px; }
input[type=text], input[type=tel], input[type=email], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid #d1d5db; border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
textarea { min-height: 90px; resize: vertical; }
.err-msg { color: var(--err); font-size: 13px; margin-top: 4px; }
.has-err input, .has-err select, .has-err .drop { border-color: var(--err); }

.seg { display: flex; gap: 8px; flex-wrap: wrap; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: inline-block; padding: 9px 18px; border: 1px solid #d1d5db; border-radius: 999px; cursor: pointer; background: #fff; user-select: none; }
.seg input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--brand-dark); outline-offset: 2px; }

.drop { position: relative; border: 2px dashed #d1d5db; border-radius: 12px; padding: 14px; text-align: center; background: #fafafa; cursor: pointer; min-height: 120px; display: grid; place-items: center; }
.drop:hover { border-color: var(--brand); background: var(--brand-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop .ph { color: var(--muted); font-size: 14px; }
.drop img.prev { max-height: 160px; border-radius: 8px; }
.drop.filled { border-style: solid; border-color: var(--brand); background: #fff; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: #fff; border-color: #d1d5db; color: var(--ink); }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--err); }
.btn-sm { padding: 6px 12px; font-size: 14px; font-weight: 500; }
.btn-link { background: none; border: 0; color: #d1d5db; cursor: pointer; font: inherit; font-size: 15px; padding: 0; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }

.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 16px; }
.alert-err { background: #fef2f2; color: var(--err); border: 1px solid #fecaca; }
.alert-ok { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }
.alert-info { background: var(--brand-soft); color: #7c2d12; border: 1px solid #fed7aa; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* staff */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.toolbar input[type=search] { max-width: 320px; }
.toolbar select { width: auto; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip { padding: 5px 12px; border-radius: 999px; background: #fff; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 14px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.tbl-wrap { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
th { background: #fafafa; font-weight: 600; font-size: 14px; color: var(--muted); }
tr:last-child td { border-bottom: 0; }
td.wrap-ok { white-space: normal; min-width: 160px; }
tbody tr:hover { background: #fafafa; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 13px; background: #f3f4f6; }
.badge.new { background: var(--brand-soft); color: #9a3412; }
.badge.won { background: #dcfce7; color: #166534; }
.badge.lost { background: #f3f4f6; color: #6b7280; }
.badge.proposed, .badge.designing, .badge.contacted { background: #e0f2fe; color: #075985; }
.pager { display: flex; gap: 8px; justify-content: center; margin-top: 14px; }

dl.kv { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; word-break: break-word; }
@media (max-width: 640px) { dl.kv { grid-template-columns: 1fr; } dl.kv dt { margin-top: 6px; } }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.photos figure { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fafafa; }
.photos img { display: block; width: 100%; height: 150px; object-fit: cover; }
.photos figcaption { padding: 8px 10px; font-size: 13px; }
.photos .none { height: 150px; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.reco { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.reco .box { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fff; }
.reco .box h3 { margin: 0 0 8px; font-size: 17px; color: var(--brand-dark); }
.reco .big { font-size: 22px; font-weight: 700; }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }
@media (max-width: 860px) { .two-col { grid-template-columns: 1fr; } }
.login-box { max-width: 380px; margin: 60px auto; }
.footer-note { color: var(--muted); font-size: 13px; text-align: center; margin-top: 30px; }

/* Phase 3: ออกแบบระบบ */
.calc-out { font-size: 22px; font-weight: 700; color: var(--brand-dark); padding: 6px 0; }
.item-row { display: grid; grid-template-columns: 1fr 80px 130px auto; gap: 8px; margin-bottom: 8px; align-items: center; }
@media (max-width: 640px) { .item-row { grid-template-columns: 1fr 70px; } .item-row select[name=item_zone] { grid-column: 1; } }
.zone-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-width: 420px; aspect-ratio: 3 / 2; background: #e5e7eb; padding: 4px; border-radius: 10px; }
.zone-grid > div { background: #fff; border-radius: 6px; padding: 6px; font-size: 12px; display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.zone-grid .zl { color: var(--muted); }
.zone-grid .zi { color: var(--ink); font-weight: 500; }
.zone-grid > div.used { background: var(--brand-soft); outline: 2px solid var(--brand); }
.sticky { position: sticky; top: 12px; }
@media (max-width: 860px) { .sticky { position: static; } }

/* Phase 5: Mock-up */
.mk-stage { position: relative; width: 100%; overflow: hidden; border-radius: 10px; background: #111; touch-action: none; user-select: none; }
.mk-stage > img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mk-item { position: absolute; cursor: grab; outline: 1px dashed rgba(255,255,255,.7); }
.mk-item img { width: 100%; height: 100%; object-fit: contain; display: block; pointer-events: none; filter: drop-shadow(2px 3px 3px rgba(0,0,0,.45)); }
.mk-item.box { background: #f4f5f7; border: 1px solid #969ca6; border-radius: 4px; color: #374151; font-size: 11px; display: flex; align-items: center; justify-content: center; text-align: center; padding: 2px; line-height: 1.2; }
.mk-item.sel { outline: 2px solid var(--brand); }
.mk-item:active { cursor: grabbing; }
.mk-row { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.mk-row:hover, .mk-row.sel { background: var(--brand-soft); }
.mk-choose { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mk-choose label { border: 2px solid var(--line); border-radius: 10px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.mk-choose label.on { border-color: var(--brand); background: var(--brand-soft); }
.mk-choose input { position: absolute; opacity: 0; }
.mk-choose img { width: 100%; border-radius: 6px; display: block; }
.roof-wrap { position: relative; width: 100%; }
.roof-wrap canvas { width: 100%; height: auto; display: block; border-radius: 10px; touch-action: none; cursor: crosshair; background: #111; }
.arr-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.arr-row.sel { border-color: var(--brand); background: var(--brand-soft); }
.arr-row .grid { grid-template-columns: 1fr 1fr auto; align-items: end; }
.mk-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.mk-thumbs a { display: block; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; text-decoration: none; color: var(--ink); background: #fafafa; }
.mk-thumbs img, .mk-thumbs .none { width: 100%; height: 110px; object-fit: cover; display: grid; place-items: center; color: var(--muted); font-size: 13px; }
.mk-thumbs span { display: block; padding: 6px 8px; font-size: 13px; }
.mk-item .mk-n { position: absolute; top: -9px; left: -9px; width: 20px; height: 20px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 600; display: grid; place-items: center; border: 2px solid #fff; pointer-events: none; }
.mk-floor { position: absolute; left: 0; right: 0; height: 14px; margin-top: -7px; cursor: ns-resize; z-index: 3; }
.mk-floor::before { content: ""; position: absolute; left: 0; right: 0; top: 6px; border-top: 2px dashed var(--brand); }
.mk-floor span { position: absolute; left: 6px; top: -18px; background: rgba(17,24,39,.8); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 4px; white-space: nowrap; }

/* ขั้นตอนงานในหน้าลูกค้า */
.steps { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.steps > li > span { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 15px; height: 100%; }
.steps .done > span { border-color: #bbf7d0; background: #f0fdf4; }
.steps .done > span b { background: var(--ok); color: #fff; }
.steps.s4 { grid-template-columns: repeat(4, 1fr); }
.steps.s7 { grid-template-columns: repeat(7, 1fr); }
.steps a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px; height: 100%; }
.steps b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #e5e7eb; color: var(--muted); font-size: 13px; margin-bottom: 2px; }
.steps small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
.steps .done a { border-color: #bbf7d0; background: #f0fdf4; }
.steps .done b { background: var(--ok); color: #fff; }
.steps a:hover { border-color: var(--brand); }
@media (max-width: 1100px) { .steps.s7 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px) { .steps, .steps.s4, .steps.s7 { grid-template-columns: 1fr 1fr; } }

/* ใบเสนอราคา */
.badge.q-draft { background: #f3f4f6; color: #374151; }
.badge.q-sent { background: #e0f2fe; color: #075985; }
.badge.q-accepted { background: #dcfce7; color: #166534; }
.badge.q-cancelled { background: #f3f4f6; color: #9ca3af; text-decoration: line-through; }
.q-lines { width: 100%; border-collapse: collapse; }
.q-lines th { font-size: 13px; }
.q-lines td { white-space: normal; padding: 8px 6px; vertical-align: top; }
.q-lines input, .q-lines textarea { padding: 8px 9px; font-size: 15px; }
.q-lines textarea { min-height: 38px; margin-top: 6px; font-size: 13.5px; }
.q-lines .n { width: 32px; color: var(--muted); padding-top: 16px; }
.q-lines .qty { width: 84px; }
.q-lines .unit { width: 84px; }
.q-lines .price { width: 140px; }
.q-lines .amt { width: 130px; text-align: right; padding-top: 16px; font-weight: 600; }
.q-lines .tools { width: 76px; padding-top: 10px; white-space: nowrap; }
.q-lines .tools button { padding: 4px 8px; }
.q-lines tr.has-err input { border-color: var(--err); }
@media (max-width: 760px) {
  .q-lines thead { display: none; }
  .q-lines tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; border-bottom: 1px solid var(--line); padding: 8px 0; }
  .q-lines td { border: 0; padding: 0; width: auto !important; }
  .q-lines .n { display: none; }
  .q-lines td.desc { grid-column: 1 / -1; }
  .q-lines .amt, .q-lines .tools { padding-top: 0; }
}
.q-total { display: grid; grid-template-columns: 1fr auto; gap: 6px 18px; max-width: 380px; margin-left: auto; font-size: 15px; }
.q-total dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.q-total .grand { font-size: 20px; font-weight: 700; color: var(--brand-dark); }
.settings-grid .grid { grid-template-columns: 220px 1fr; align-items: start; }
@media (max-width: 640px) { .settings-grid .grid { grid-template-columns: 1fr; } }
.two-col.even { grid-template-columns: 1fr 1fr; }
.q-sum { margin-top: 18px; grid-template-columns: 1fr 1fr; align-items: start; }
@media (max-width: 860px) { .two-col.even { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .q-sum { grid-template-columns: 1fr; } .q-total { max-width: none; } }

/* ---------------- ฟอร์มลูกค้า v2: หน้าแรก + ทีละส่วน (2026-10-15) */
[hidden] { display: none !important; }
.center { text-align: center; }
.btn-lg { padding: 13px 26px; font-size: 17px; border-radius: 12px; }
.row-gap { display: flex; gap: 8px; }
.hero { position: relative; background: #0d0f13; }
.hero img { display: block; width: 100%; height: auto; max-height: 560px; object-fit: cover; object-position: left center; }
.hero-cta { position: absolute; left: 5.8%; bottom: 14%; }
@media (max-width: 640px) {
  .hero img { min-height: 220px; }
  .hero-cta { position: static; padding: 14px 16px 18px; text-align: center; background: #0d0f13; }
  .hero-cta .btn { width: 100%; }
}
.landing { max-width: 1000px; margin: 0 auto; padding: 26px 16px 4px; }
.landing > h2 { font-size: 22px; margin-bottom: 14px; }
.slider { max-width: 680px; margin: 0 auto 28px; }
.slides { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: 14px; scrollbar-width: none; }
.slides::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; margin: 0; scroll-snap-align: start; }
.slide img { display: block; width: 100%; height: auto; }
.dots { display: flex; gap: 6px; justify-content: center; margin-top: 8px; }
.dots i { width: 8px; height: 8px; border-radius: 50%; background: #d1d5db; }
.dots i.on { background: var(--brand); width: 20px; border-radius: 4px; }
.explain { background: linear-gradient(180deg, #fff 0%, #fffaf5 100%); border: 1px solid var(--line); border-radius: 18px; padding: 22px 18px; }
.explain .kicker { margin: 0; font-weight: 600; font-size: 15px; }
.explain .kicker b { color: var(--brand); }
.explain h2 { font-size: clamp(22px, 4.6vw, 34px); margin: 2px 0 2px; line-height: 1.25; }
.explain h2 .dot { color: var(--brand); }
.explain .sub { margin-bottom: 16px; }
.explain-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 760px) { .explain-grid { grid-template-columns: 1fr; } }
.ex { border: 1px solid #fed7aa; border-radius: 14px; padding: 14px; background: #fffaf5; }
.ex.ex-hybrid { border-color: #dbe4ef; background: #f6f9fc; }
.ex header { display: flex; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.ex h3 { margin: 0; font-size: 20px; }
.ex header p { margin: 0; color: var(--brand); font-weight: 600; font-size: 14px; }
.ico { display: inline-grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); flex: none; }
.ex-hybrid .ico { background: #e8eef6; color: #1f2937; }
.ex-backup .ico { color: #1f2937; }
.ex dl { margin: 0; }
.ex dt { font-weight: 600; font-size: 14.5px; margin-top: 8px; }
.ex dd { margin: 0; color: #4b5563; font-size: 13.5px; }
.notice { display: flex; gap: 10px; align-items: flex-start; background: #f3f4f6; border-radius: 12px; padding: 10px 14px; font-size: 13.5px; color: #374151; margin: 12px 0 0; }
.notice.warn { background: var(--brand-soft); color: #9a3412; margin-bottom: 16px; }
.bang { flex: none; display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 700; }
.bang.i { background: #9ca3af; font-style: italic; font-family: Georgia, serif; }
.calc-bar { background: var(--brand); color: #fff; text-align: center; font-weight: 600; font-size: 19px; padding: 11px 16px; border-radius: 12px; margin: 6px 0 14px; scroll-margin-top: 12px; }
.calc-head h1 { font-size: 21px; }
.unit-in { display: flex; align-items: center; border: 1px solid #d1d5db; border-radius: 10px; background: #fff; }
.unit-in input { border: 0 !important; outline: none; border-radius: 10px; }
.unit-in:focus-within { outline: 2px solid var(--brand); border-color: var(--brand); }
.unit-in span { padding: 0 12px; color: var(--muted); font-size: 14px; white-space: nowrap; }
.has-err .unit-in { border-color: var(--err); }
.unit-in .unit-sel { width: auto; border: 0; border-left: 1px solid #e5e7eb; border-radius: 0 10px 10px 0; background: #f9fafb; color: var(--ink); font-size: 14px; padding: 0 10px; align-self: stretch; }
.seg-wrap span { padding: 8px 14px; font-size: 14.5px; }
.sys-pick { display: grid; gap: 8px; }
.sys-opt { position: relative; display: block; cursor: pointer; }
.sys-opt input { position: absolute; opacity: 0; }
.sys-opt span { display: flex; flex-direction: column; border: 1.5px solid #d1d5db; border-radius: 12px; padding: 10px 14px 10px 44px; position: relative; }
.sys-opt span::before { content: ""; position: absolute; left: 14px; top: 13px; width: 18px; height: 18px; border: 2px solid #9ca3af; border-radius: 5px; background: #fff; }
.sys-opt small { color: var(--muted); }
.sys-opt input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.sys-opt input:checked + span::before { background: var(--brand) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 8.5l3 3 6-7' fill='none' stroke='%23fff' stroke-width='2.2'/%3E%3C/svg%3E") center/14px no-repeat; border-color: var(--brand); }
.sys-opt input:focus-visible + span { outline: 2px solid var(--brand-dark); outline-offset: 2px; }
.sub-group { border: 1px dashed #fdba74; border-radius: 12px; padding: 12px 14px; background: #fffbf7; }
.group-title { margin: 0 0 8px; font-weight: 600; color: #9a3412; }
.step-nav { align-items: center; }
.step-count { margin-right: auto; color: var(--muted); font-size: 14px; }
.stepper .step { scroll-margin-top: 12px; }

/* ---------------- หน้าผลประเมิน */
.res-head { text-align: center; margin: 6px 0 14px; }
.res-head h1 { font-size: clamp(22px, 5vw, 30px); }
.res-head p { margin: 0; color: #1e3a8a; font-size: 17px; }
.res-head .o { color: var(--brand); }
.house-card { padding: 14px; }
.house-wrap { position: relative; }
#house { display: block; width: 100%; height: auto; font-family: "Prompt", sans-serif; }
.phase { display: block; margin: 8px 0 0; background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 10px; padding: 6px 10px; font-size: 13.5px; color: #166534; min-height: 2.6em; }
.phase .sys-tag { display: inline-block; background: var(--brand); color: #fff; border-radius: 6px; padding: 0 8px; margin-right: 6px; font-size: 12.5px; }
.flows { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.flows:has(.fl-bat[hidden]) { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 480px) { .flows { grid-template-columns: 1fr 1fr; } .flows:has(.fl-bat[hidden]) { grid-template-columns: 1fr 1fr 1fr; } }
.fl { border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; background: #fff; }
.fl small { display: block; color: var(--muted); font-size: 12.5px; }
.fl b { font-size: 19px; font-variant-numeric: tabular-nums; }
.fl-solar b { color: #d97706; } .fl-home b { color: #0f172a; } .fl-grid b { color: #475569; }
.fl-bat.chg b { color: #15803d; } .fl-bat.dis b { color: #ea580c; }
.house-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.house-stats div { background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.house-stats small { display: block; color: var(--muted); font-size: 12.5px; }
.house-stats b { font-size: 18px; }
/* สี SVG */
#house .sky1 { stop-color: #e0f2fe; } #house .sky2 { stop-color: #f8fafc; }
#house.ph-night .sky1, #house.ph-outage .sky1 { stop-color: #1e293b; } #house.ph-night .sky2, #house.ph-outage .sky2 { stop-color: #475569; }
#house stop { transition: stop-color .8s; }
#house .sun { fill: #fbbf24; } #house .moon { fill: #e2e8f0; opacity: 0; }
#house.ph-night .sun, #house.ph-outage .sun { opacity: 0; } #house.ph-night .moon, #house.ph-outage .moon { opacity: 1; }
#house .ground { fill: #e2e8f0; opacity: .7; }
#house .wall-front { fill: #f1f5f9; stroke: #cbd5e1; } #house .wall-side { fill: #e2e8f0; stroke: #cbd5e1; }
#house .roof-front { fill: #cbd5e1; stroke: #94a3b8; } #house .roof-back { fill: #94a3b8; }
#house .door { fill: #94a3b8; } #house .win { fill: #bae6fd; stroke: #94a3b8; } #house .win.side { fill: #a5d8f3; }
#house.ph-night .win, #house.ph-outage .win { fill: #fde68a; }
#house .panel { fill: #1e3a8a; stroke: #93c5fd; stroke-width: .6; }
#house .inv { fill: #fff; stroke: #64748b; }
#house .bat-front { fill: #fff; stroke: #94a3b8; } #house .bat-side { fill: #e5e7eb; stroke: #94a3b8; } #house .bat-top { fill: #f8fafc; stroke: #94a3b8; }
#house .bat-led { fill: #22c55e; }
#house .pole-post { fill: #64748b; }
#house .flow-base { fill: none; stroke: #94a3b8; stroke-width: 1.2; opacity: .35; }
#house .flow { fill: none; stroke: #0ea5e9; stroke-width: 2.6; stroke-linecap: round; stroke-dasharray: 5 9; opacity: 0; }
#house .flow-g.on .flow { opacity: 1; animation: flow 0.9s linear infinite; }
#house .flow-g.on .flow-base { opacity: .8; stroke: #7dd3fc; }
@keyframes flow { to { stroke-dashoffset: -14; } }
@media (prefers-reduced-motion: reduce) { #house .flow-g.on .flow { animation: none; stroke-dasharray: none; } }
#house .cut { fill: #ef4444; font-size: 16px; font-weight: 700; opacity: 0; }
#house.ph-outage .cut { opacity: 1; }
#house.ph-outage .f-grid .flow-base { stroke: #ef4444; opacity: .7; stroke-dasharray: 3 3; }
#house .lbl { font-size: 11px; fill: #0f172a; font-weight: 500; paint-order: stroke; stroke: rgba(255,255,255,.85); stroke-width: 3px; }
#house .lbl.big { font-size: 13px; font-weight: 600; }
#house .lbl.small { font-size: 10px; fill: #475569; }
#house .lbl.dy { transform: translateY(13px); }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.brand-row h2 { font-size: 22px; }
.opt { display: flex; flex-direction: column; align-items: stretch; width: 100%; gap: 10px; background: #fff; border: 1.5px solid var(--line); border-radius: 14px; padding: 12px; }
.opt.live { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(242,107,29,.15); }
.opt > span { width: 100%; }
.opt-top { display: flex; gap: 10px; align-items: center; }
.opt-top b { display: block; font-size: 18px; }
.opt-top small { color: #1e3a8a; }
.opt-size { background: linear-gradient(180deg, #fff1e8, #fff); border-radius: 10px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.opt-size small { font-weight: 600; font-size: 13px; }
.opt-size strong { color: var(--brand); font-size: 30px; line-height: 1.25; }
.opt-size em, .opt-save em { font-style: normal; font-size: .62em; }
.opt-save { display: flex; gap: 10px; align-items: center; justify-content: center; text-align: center; border: 1.5px solid #fdba74; border-radius: 10px; padding: 8px 10px; }
.opt-note { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: -4px; }
.opt-save small { display: block; font-size: 12.5px; }
.opt-save b { color: var(--brand); font-size: 22px; }
.coin { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 700; flex: none; }
.goal-grid, .brand-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.brand-grid { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 640px) { .goal-grid, .brand-grid { grid-template-columns: 1fr; } }
.goal-grid > div, .brand-grid > div { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.goal-grid .ico { width: 38px; height: 38px; margin-bottom: 4px; }
.goal-grid small, .brand-grid small { color: #1e3a8a; }
.goal-grid p, .brand-grid p { margin: 6px 0 0; font-size: 13.5px; color: #4b5563; }
.vs-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .vs-grid { grid-template-columns: 1fr; } }
.vs-grid h3 { margin: 0; font-size: 18px; }
.ticks { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; font-size: 14px; }
.ticks li { padding-left: 24px; position: relative; }
.ticks li::before { content: "✓"; position: absolute; left: 0; top: 1px; width: 17px; height: 17px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 11px; display: grid; place-items: center; }
/* ช่องกรอกในแถวเดียวกันให้ตรงกัน แม้ป้ายชื่อซ้าย/ขวายาวไม่เท่ากัน (ป้ายยืดเต็มที่ ช่องกรอกชิดล่าง) */
#customer-form .grid > div:not(.full) { display: flex; flex-direction: column; }
#customer-form .grid > div:not(.full) > label.f { flex: 1 0 auto; }
#customer-form .hint + .unit-in { margin-top: 4px; }
.notice.prep { background: #eff6ff; color: #1e3a8a; margin: 0 0 14px; }
.notice.prep .bang.i { background: #3b82f6; }
.res-btn { display: inline-block; padding: 2px 10px; border-radius: 999px; background: var(--brand-soft); border: 1px solid #fdba74; color: #9a3412; font-size: 13px; text-decoration: none; white-space: nowrap; }
.res-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }

/* ---------------- ภาพบ้านจำลองแบบภาพจริง + ตัวเลข 4 มุม (2026-10-16) */
.house-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 640px) { .house-grid { grid-template-columns: 1fr; } }
.house-img { position: relative; border-radius: 12px; overflow: hidden; background: #eef2f7; container-type: inline-size; }
.house-img img { display: block; width: 100%; height: auto; }
.house-img #house { position: absolute; inset: 0; width: 100%; height: 100%; }
#house .night { fill: #0b1530; opacity: 0; transition: opacity .8s; }
#house.ph-night .night, #house.ph-outage .night { opacity: .45; }
#house .flow-base { stroke-width: 2; }
#house .flow { stroke-width: 4; stroke-dasharray: 8 12; }
@keyframes flow { to { stroke-dashoffset: -20; } }
#house .cut { font-size: 30px; }
.hl { position: absolute; display: flex; flex-direction: column; line-height: 1.15; color: #111827; pointer-events: none; transition: color .8s; }
.hl b { font-size: clamp(14px, 4.4cqw, 22px); font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hl small { font-size: clamp(10px, 2.5cqw, 13px); color: #6b7280; transition: color .8s; }
.hl-solar { left: 25.5%; top: 8.5%; }
.hl-home { left: 69%; top: 4.5%; }
.hl-bat { left: 31%; top: 85.5%; }
.hl-grid { left: 72%; top: 85.5%; }
.house-img.ph-night .hl, .house-img.ph-outage .hl { color: #fff; }
.house-img.ph-night .hl small, .house-img.ph-outage .hl small { color: #cbd5e1; }
.hl em { font-style: normal; }
.hl em.chg { color: #16a34a; } .hl em.dis { color: #f97316; }
.house-img.ph-night .hl em.dis, .house-img.ph-outage .hl em.dis { color: #fdba74; }
.soc { display: inline-block; vertical-align: middle; width: 24px; height: 10px; border: 1.5px solid #22c55e; border-radius: 3px; padding: 1px; margin: 0 2px; }
.soc i { display: block; height: 100%; background: #22c55e; border-radius: 1px; transition: width .8s; }
.time-chip { position: absolute; left: 50%; transform: translateX(-50%); top: 10px; white-space: nowrap; background: rgba(255,255,255,.9); border-radius: 999px; padding: 2px 12px; font-size: 13px; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.house-side { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.side-logo { width: 170px; max-width: 70%; height: auto; margin: 4px auto 0; }
.side-title { margin: 0; font-weight: 500; font-size: 16px; }
.house-side .phase { text-align: left; margin: 0; }
.side-stats { display: grid; gap: 8px; text-align: left; }
.side-stats div { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #fafbfc; }
.side-stats small { display: block; color: var(--muted); font-size: 12.5px; }
.side-stats b { font-size: 18px; }
@media (max-width: 640px) { .side-stats { grid-template-columns: repeat(3, 1fr); } .side-stats b { font-size: 15px; } }

/* ---------- ข้อมูลหลังบ้าน (Node 2) */
.req { color: var(--brand-dark); }
.pick { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); gap: 8px; }
.pick > .err-msg { grid-column: 1 / -1; }
.pick .pick-model[hidden] { display: none; }
.pick:has(.pick-model[hidden]) { grid-template-columns: 1fr; }
.main-item { padding: 10px 0; border-bottom: 1px dashed #e5e7eb; }
.main-item:last-of-type { border-bottom: 0; }
.mi-extra { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 8px; }
.mi-extra[hidden] { display: none; }
.plan-rows { display: grid; gap: 6px; }
.plan-row { display: grid; grid-template-columns: 80px minmax(0, 1fr) 40px; align-items: center; gap: 8px; margin: 0; font-weight: 400; }
.plan-row[hidden] { display: none; }
.plan-row.last { grid-template-columns: 80px 1fr; }
.plan-row .unit { font-style: normal; color: var(--muted); }
[data-tier][hidden], #popt-box[hidden] { display: none; }
@media (max-width: 560px) { .pick { grid-template-columns: 1fr; } }

/* ---------- เอกสาร: อนุมัติ / ชำระเงิน */
.flow-note { background: #f8fafc; border: 1px solid #e5e7eb; border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
.flow-note b { color: var(--brand-dark); }
.badge.q-pending { background: #fef3c7; color: #92400e; }
.badge.q-approved { background: #dbeafe; color: #1e40af; }
.badge.inv-pending { background: #fef3c7; color: #92400e; }
.badge.inv-paid { background: #dcfce7; color: #166534; }
.badge.inv-cancelled { background: #f3f4f6; color: #6b7280; }
.copy-link { display: flex; gap: 6px; align-items: center; }
.copy-link input { flex: 1; min-width: 0; font-size: 13px; padding: 7px 9px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; flex-wrap: wrap; }
.inline-form input[type=file] { max-width: 220px; font-size: 13px; }
.two-col > * { min-width: 0; }
.watt-ref { min-width: 0; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; background: #fafafa; }
.watt-ref summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); font-size: 15px; }
.watt-ref table { width: 100%; table-layout: fixed; margin-top: 8px; border-collapse: collapse; font-size: 14px; }
.watt-ref th:first-child { width: 60%; }
.watt-ref th, .watt-ref td { overflow-wrap: anywhere; padding: 6px 6px; border-bottom: 1px solid var(--line); text-align: left; }
.watt-ref td:last-child, .watt-ref th:last-child { text-align: right; }
.watt-ref td:last-child { white-space: nowrap; }

/* ปุ่มขอใบเสนอราคา Package (หน้าผลประเมิน) + ป้ายในรายชื่อ Staff */
.badge.req { background: #ffedd5; color: #c2410c; font-weight: 600; }
.badge.req.off { background: #f3f4f6; color: #6b7280; font-weight: 400; }
.q-form { margin: 0; }
.opt > span[id^="q-"] { margin-top: auto; }  /* ปุ่มชิดล่างการ์ดเท่ากันทุกใบ */
.q-btn { width: 100%; padding: 12px 14px; font-size: 16px; }
.q-done { display: block; text-align: center; background: #dcfce7; color: #166534; border-radius: 10px; padding: 10px 12px; font-weight: 600; font-size: 14.5px; }
.q-done small { display: block; font-weight: 400; font-size: 12.5px; }
.q-req-card { border: 1.5px solid #fdba74; background: #fff7ed; }
.q-done.q-thanks { text-align: left; line-height: 1.55; padding: 12px 14px; }
.q-done.q-thanks small { margin-top: 4px; font-size: 13.5px; color: #14532d; }

/* ข้อมูลหลังบ้าน: แท็บแบรนด์ + การ์ด Package (2026-10-19) */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs .tab { padding: 8px 14px; border-radius: 10px 10px 0 0; text-decoration: none; color: var(--ink); font-weight: 600; border: 1px solid transparent; border-bottom: 0; margin-bottom: -1px; }
.tabs .tab.on { background: #fff; border-color: var(--line); color: var(--brand); }
.pkg { border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; display: grid; gap: 8px; }
.pkg.ok { border-color: #bbf7d0; background: #f7fef9; }
.pkg-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.pkg-head b { font-size: 17px; }
.pkg-body { display: flex; gap: 6px 14px; flex-wrap: wrap; align-items: center; font-size: 14.5px; }
.pkg-acts { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.pkg-q { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 14.5px; }
.pkg-tbl td { white-space: normal; }
.pq { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 10px; }
.pq-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pq-row { display: flex; gap: 6px 16px; flex-wrap: wrap; justify-content: space-between; align-items: center; border-top: 1px dashed var(--line); margin-top: 8px; padding-top: 8px; font-size: 14.5px; }
.pq-row > span { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.inline-form select { padding: 5px 8px; font-size: 14px; width: auto; }
.date-in { width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 10px; font: inherit; }
.bill-plan td { white-space: normal; }

/* หน้า Package: อุปกรณ์เป็นตารางแนวนอน — อุปกรณ์ | ยี่ห้อ | รุ่น | จำนวน | ค่าที่ได้ */
.eq-head, .eq-row { display: grid; grid-template-columns: 120px minmax(0, 1fr) minmax(0, 1.7fr) 80px 120px; gap: 8px; align-items: start; }
.eq-head { font-size: 13px; color: #6b7280; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.eq-row { padding: 8px 0; border-bottom: 1px dashed #e5e7eb; }
.eq-row > label.f { margin: 10px 0 0; }
.eq-row .pick { display: contents; }
.eq-row .pick .pick-model[hidden] { display: block; visibility: hidden; }
.eq-row .mi-extra { display: block; margin: 0; }
.eq-row .mi-extra[hidden] { display: block; visibility: hidden; }
.eq-row .calc-out { display: flex; flex-direction: column; padding-top: 8px; min-height: 0; }
.eq-row .calc-out .hint { font-size: 11px; }
.eq-row input[type=number] { width: 100%; }
@media (max-width: 760px) {
  .eq-head { display: none; }
  .eq-row { grid-template-columns: 1fr 1fr; }
  .eq-row > label.f, .eq-row .pick-brand, .eq-row .pick-model, .eq-row .pick > .err-msg { grid-column: 1 / -1; }
  .eq-row > label.f { margin: 0; font-weight: 600; }
  .eq-row .pick .pick-model[hidden] { display: none; }
}

/* หน้า Package: เรียงเต็มหน้า — สรุป (แถวเดียว) → อุปกรณ์ → ราคา → ชำระเงิน → ภาพ */
.one-col > * { min-width: 0; }
.sum-items { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: center; }
.sum-items > div { display: flex; flex-direction: column; }
.sum-items strong { font-size: 18px; }
.sum-items .sum-msg { flex: 1 1 220px; }
.one-col .eq-head, .one-col .eq-row { grid-template-columns: 140px minmax(0, 1fr) minmax(0, 2fr) 90px 150px; }
@media (max-width: 760px) { .one-col .eq-row { grid-template-columns: 1fr 1fr; } }
.price-row { display: flex; flex-wrap: wrap; gap: 10px 20px; align-items: flex-end; }
.price-row > div { min-width: 0; }
.price-row input[type=text] { width: 190px; max-width: 100%; }

.env-banner { background: #b91c1c; color: #fff; text-align: center; font-weight: 600; font-size: 14px; padding: 6px 10px; position: sticky; top: 0; z-index: 100; }
