* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Prompt', sans-serif; }
body { background: #f8fafc; color: #1e293b; overflow-x: hidden; }

/* ด่านรหัสผ่าน */
#authGate { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.94); z-index: 9999; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-box { background: #ffffff; border-radius: 16px; padding: 28px 32px; max-width: 400px; width: 100%; text-align: center; box-shadow: 0 20px 40px rgba(0,0,0,0.3); }
.auth-badge { display: inline-block; background: #fef3c7; color: #b45309; font-size: 11px; font-weight: 600; padding: 4px 10px; border-radius: 99px; margin-bottom: 10px; }
.auth-input { width: 100%; padding: 10px 14px; font-size: 18px; text-align: center; letter-spacing: 4px; border: 2px solid #cbd5e1; border-radius: 10px; margin: 14px 0; outline: none; }
.auth-input:focus { border-color: #059669; }
.auth-btn { width: 100%; padding: 11px; background: #059669; color: #fff; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; }
.auth-btn:hover { background: #047857; }

/* แถบวิ่งโปรโมชันด้านบน (30px) */
.promo-bar { height: 30px; background: #0f172a; color: #f8fafc; display: flex; align-items: center; overflow: hidden; position: relative; font-size: 12px; border-bottom: 1px solid #1e293b; }
.promo-track-wrap { flex: 1; overflow: hidden; white-space: nowrap; cursor: pointer; padding-left: 12px; }
.promo-track { display: inline-block; animation: marqueeScroll 36s linear infinite; }
.promo-track.paused { animation-play-state: paused; }
@keyframes marqueeScroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.promo-tag { background: #059669; color: #fff; padding: 1px 7px; border-radius: 4px; font-weight: 600; margin-right: 6px; font-size: 11px; }
#tickerToggleBtn { background: #1e293b; color: #e2e8f0; border: 1px solid #334155; padding: 2px 10px; font-size: 11px; border-radius: 4px; margin-right: 8px; cursor: pointer; z-index: 2; white-space: nowrap; }

/* แถบเมนูหัวข้อ */
.top-header { background: #ffffff; border-bottom: 1px solid #e2e8f0; padding: 6px 14px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.brand-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.brand-logo { font-size: 19px; font-weight: 700; color: #059669; letter-spacing: -0.5px; }
.brand-logo span { color: #0f172a; }
.brand-domain { font-size: 11px; color: #64748b; }
.license-pill { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; font-size: 11px; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.nav-actions { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.nav-btn { padding: 5px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 500; border: 1px solid #cbd5e1; background: #ffffff; color: #1e293b; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: 0.15s; }
.nav-btn:hover { background: #f1f5f9; }
.nav-btn.cta-99 { background: #f59e0b; border-color: #d97706; color: #ffffff; font-weight: 600; }
.nav-btn.cta-pkg { background: #0f172a; border-color: #0f172a; color: #ffffff; font-weight: 600; }

/* โครงสร้างหลัก 2 คอลัมน์ (ชิดแนวเส้นสีน้ำเงิน 0.92fr : 1.08fr) */
.studio-grid { display: grid; grid-template-columns: 0.92fr 1.08fr; gap: 12px; padding: 10px 14px; max-width: 1680px; margin: 0 auto; min-height: calc(100vh - 82px); align-items: stretch; }

/* ฝั่งซ้าย */
.left-col { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.house-header-card { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 10px 14px; }
.house-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
#houseTitle { font-size: 17px; font-weight: 700; color: #0f172a; }
#houseSpec { font-size: 11.5px; color: #475569; margin-top: 2px; }
#housePrice { font-size: 12.5px; font-weight: 600; color: #059669; margin-top: 3px; }
#seismicStatus { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 99px; }

/* แถวป้อนขนาด กxยxสูง และเลือกจังหวัด-อำเภอ-ตำบล */
.control-strip { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-top: 8px; padding-top: 8px; border-top: 1px dashed #e2e8f0; }
.dim-group { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; color: #334155; }
.dim-input { width: 40px; padding: 4px 4px; border: 1px solid #cbd5e1; border-radius: 6px; text-align: center; font-size: 11.5px; }
.calc-btn { background: #059669; color: #fff; border: none; padding: 5px 8px; border-radius: 6px; font-size: 11px; font-weight: 600; cursor: pointer; }
.loc-select { padding: 4px 5px; border: 1px solid #cbd5e1; border-radius: 6px; font-size: 11px; background: #f8fafc; color: #0f172a; max-width: 118px; }
.loc-select:disabled { opacity: 0.55; cursor: not-allowed; }

/* รูปบ้าน 3D + ปุ่มงบประมาณ 6 ระดับ */
.hero-stage { display: grid; grid-template-columns: 1fr 94px; gap: 8px; align-items: center; background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 8px 10px; flex: 1; min-height: 250px; }
.hero-img-wrap { display: flex; align-items: center; justify-content: center; height: 100%; overflow: hidden; }
#houseHeroImg { max-width: 100%; max-height: 265px; object-fit: contain; mix-blend-mode: multiply; transition: opacity 0.25s ease; }
.budget-col { display: flex; flex-direction: column; gap: 4px; }
.budget-head { font-size: 10px; color: #64748b; text-align: center; font-weight: 600; }
.budget-btn { padding: 5px 4px; border: 1px solid #cbd5e1; background: #f8fafc; border-radius: 6px; font-size: 10.5px; font-weight: 600; color: #334155; cursor: pointer; text-align: center; }
.budget-btn.active { background: #059669; color: #ffffff; border-color: #059669; }

/* ปุ่มสไตล์ 4 แบบ + โมดูล 6-8 + การ์ด 9 กลุ่มลูกค้า */
.bottom-controls { background: #ffffff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 8px 10px; display: flex; flex-direction: column; gap: 7px; }
.style-bar-head { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
#toggleSlideBtn { background: #f1f5f9; border: 1px solid #cbd5e1; padding: 2px 8px; border-radius: 6px; font-size: 10.5px; cursor: pointer; }
.style-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.style-btn { padding: 5px 7px; border: 1px solid #cbd5e1; border-radius: 8px; background: #f8fafc; text-align: left; cursor: pointer; transition: 0.15s; }
.style-btn.active { border: 2px solid #059669; background: #ecfdf5; }
.style-name { font-size: 11px; font-weight: 600; color: #0f172a; }
.style-sub { font-size: 10px; color: #059669; font-weight: 500; }

.modules-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.mod-btn { padding: 5px 7px; border: 1px solid #cbd5e1; border-radius: 8px; background: #ffffff; text-align: left; cursor: pointer; transition: 0.15s; }
.mod-btn:hover { border-color: #059669; background: #f0fdf4; }
.mod-title { font-size: 10.5px; font-weight: 600; color: #0f172a; }
.mod-desc { font-size: 9.5px; color: #64748b; margin-top: 1px; }

.roles-head { display: flex; justify-content: space-between; align-items: center; font-size: 10.5px; color: #475569; }
.roles-strip { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; }
.role-card { border: 1px solid #e2e8f0; border-radius: 7px; padding: 3px 1px; text-align: center; cursor: pointer; background: #ffffff; transition: 0.15s; }
.role-card.active { border: 2px solid #059669; background: #ecfdf5; }
.role-card img { width: 32px; height: 32px; object-fit: cover; border-radius: 5px; display: block; margin: 0 auto 2px; }
.role-card span { font-size: 9.5px; font-weight: 600; color: #1e293b; display: block; }

/* ฝั่งขวา: แปลนชั้น 1-2 + น้องไอติ๊งค์ & แชต */
.right-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.plans-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; flex: 1; min-height: 310px; }
.plan-card { border-radius: 12px; padding: 12px; display: flex; flex-direction: column; justify-content: space-between; position: relative; }
#planBox1 { background: #f0fdf4; border: 1px dashed #86efac; }
#planBox2 { background: #fefce8; border: 1px dashed #fde047; }
.plan-label { font-size: 12.5px; font-weight: 700; color: #0f172a; }
.plan-placeholder { text-align: center; color: #64748b; font-size: 11.5px; margin: auto 0; }
.plan-placeholder .icon { font-size: 24px; margin-bottom: 4px; opacity: 0.6; }

.assistant-zone { display: grid; grid-template-columns: 225px 1fr; gap: 6px; align-items: end; }
.presenter-wrap { display: flex; align-items: flex-end; justify-content: center; height: 225px; overflow: visible; position: relative; z-index: 10; pointer-events: none; }
#presenterImg, #presenterVid { height: 450px !important; max-height: none !important; width: auto !important; max-width: none !important; object-fit: contain; mix-blend-mode: multiply; }

#presenterVid { display: none; border-radius: 10px; }

.chat-box { background: #ecfdf5; border: 1px solid #a7f3d0; border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; height: 225px; }
.chat-header { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: #065f46; border-bottom: 1px solid #d1fae5; padding-bottom: 4px; }
.lic-tag { background: #ffffff; padding: 1px 7px; border-radius: 99px; font-size: 10.5px; border: 1px solid #a7f3d0; }
#chatMessages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.msg-ai { background: #ffffff; border: 1px solid #d1fae5; color: #1e293b; padding: 7px 10px; border-radius: 10px; font-size: 11.5px; line-height: 1.45; }
.msg-user { background: #059669; color: #ffffff; padding: 6px 10px; border-radius: 10px; font-size: 11.5px; align-self: flex-end; max-width: 82%; }
.quick-chips { display: flex; gap: 4px; flex-wrap: wrap; }
.chip-btn { background: #ffffff; border: 1px solid #a7f3d0; color: #065f46; font-size: 10px; padding: 2px 7px; border-radius: 99px; cursor: pointer; }
.chip-btn:hover { background: #d1fae5; }
.chat-input-row { display: flex; gap: 5px; }
#chatInput { flex: 1; padding: 6px 10px; border: 1px solid #a7f3d0; border-radius: 8px; font-size: 11.5px; outline: none; background: #ffffff; }
.chat-send-btn { background: #059669; color: #ffffff; border: none; padding: 6px 12px; border-radius: 8px; font-size: 11.5px; font-weight: 600; cursor: pointer; }

/* หน้าต่าง Modal */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.65); z-index: 5000; display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-card { background: #ffffff; border-radius: 14px; max-width: 680px; width: 100%; max-height: 88vh; overflow-y: auto; padding: 20px; box-shadow: 0 20px 35px rgba(0,0,0,0.25); }
.modal-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e2e8f0; padding-bottom: 10px; margin-bottom: 12px; }
.modal-close { background: #f1f5f9; border: none; width: 28px; height: 28px; border-radius: 50%; font-size: 16px; cursor: pointer; }
.pkg-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0; }
.pkg-card { border: 1px solid #cbd5e1; border-radius: 10px; padding: 10px; cursor: pointer; }
.pkg-card.active { border: 2px solid #059669; background: #ecfdf5; }
.form-input { width: 100%; padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; font-size: 12.5px; margin: 6px 0 10px; }
.boq-table { width: 100%; border-collapse: collapse; font-size: 11.5px; margin-top: 8px; }
.boq-table th, .boq-table td { border: 1px solid #e2e8f0; padding: 6px 8px; text-align: left; }
.boq-table th { background: #f8fafc; }

@media (max-width: 1024px) {
    .studio-grid { grid-template-columns: 1fr; }
    .roles-strip { grid-template-columns: repeat(5, 1fr); }
}
.assistant-zone { grid-template-columns: 165px 1fr !important; margin-top: 10px !important; }
.presenter-wrap { overflow: visible !important; height: 220px !important; display: flex !important; align-items: flex-end !important; justify-content: center !important; }
#presenterImg { height: 275px !important; min-height: 0 !important; max-height: none !important; width: auto !important; margin: 0 !important; mix-blend-mode: multiply !important; }
#presenterImg { transition: opacity 0.3s ease !important; }
.right-col:has(#planBox1:active) #presenterImg, .right-col:has(#planBox1:focus-within) #presenterImg { opacity: 0 !important; }









