/* ==========================================================================
   หน้าฝ่ายขาย (sale.html) — ส่วนเพิ่มเฉพาะหน้า บนภาษา UI ของ DATA Center (datacenter.css)
   กติกา: ทุกสีมาจากโทเคน app.css · องค์ประกอบร่วม (การ์ด ตาราง ปุ่ม ชิป ช่องกรอก โมดัล) ใช้คลาส dc-* ของ DATA Center
   ไฟล์นี้มีแค่การจัดวางที่ DATA Center ไม่มี: เมนูมีตัวเลข · กล่องแหล่งงาน 2D/3D · สีเลขลำดับตามสถานะ · popup งาน
   ========================================================================== */

/* ---------- แถบข้าง (ไม่มีแถบชื่อใหญ่ — เจ้าของสั่งเอาออก) ---------- */
.sale-page .dc-shell{padding-top:16px}
/* หน้าโปรเจกต์: ซ่อนเมนูซ้าย เนื้อหาเต็มความกว้าง (เจ้าของสั่ง 2026-09-12) — กลับหน้าหลักแล้วเมนูกลับมา */
body.sl-projectview .dc-side{display:none}
body.sl-projectview .dc-shell{grid-template-columns:minmax(0,1fr)}
.sl-newbtn{display:inline-flex;align-items:center;justify-content:center;gap:8px;background-image:none;padding:0 14px}
.sl-newbtn .dc-ic{font-size:18px}
.sl-badge{flex:none;min-width:22px;height:22px;padding:0 7px;border-radius:999px;background:var(--tint);color:var(--navy-text);font-size:11px;font-weight:800;display:inline-flex;align-items:center;justify-content:center}
.sl-badge:empty{display:none}
.sl-badge.hot{background:var(--bad-bg);color:var(--bad)}
.sl-person .nm{font-size:14px;font-weight:700;color:var(--navy-text);line-height:1.3}
.sl-person .sl-viewing{color:var(--warn);font-weight:700}

/* ---------- หัวหมวด ---------- */
.dc-viewhead .sl-refresh{margin-left:auto}
/* ---------- การ์ดหมวด (เหมือนโหมดแถวเดียวของ DATA Center) ---------- */
.sl-card{background:var(--card);border:1px solid var(--line);border-radius:6px;box-shadow:var(--e1);padding:12px 14px 16px;margin-bottom:14px}
.sl-card .dc-toolbar{margin-top:0}
.sl-card .dc-stackhead{margin-bottom:10px}
.sl-card .dc-stackhead .sl-count{margin-left:auto;font-size:11px;font-weight:700;color:var(--muted)}
.sl-card .dc-stackhead .dc-btn,.sl-card .dc-stackhead a.dc-btn{margin-left:10px}
.sl-empty{color:var(--muted);font-size:13px;text-align:center;padding:26px 8px}
.sl-muted{color:var(--muted)}
.sl-mnote{margin:-10px 0 16px}

/* ---------- ตาราง: แถวกดได้ · เลขลำดับสีตามสถานะ (กฎ td.c-idx.yellow/.red/.done ย้ายไป datacenter.css ให้ทุกหน้าใช้ร่วม — ไดอะแกรม 28.09.69) ---------- */
.dc-table tr.sl-rowlink{cursor:pointer}
.dc-table tr.sl-rowlink.on td{background:var(--tint)}
.dc-table .c-date small.late{color:var(--bad);font-weight:700}
.dc-table .c-date small.soon{color:var(--warn);font-weight:700}
.dc-table .c-name small.sl-rvnote{color:var(--bad);font-weight:700;white-space:normal}
.dc-table .c-name small{white-space:normal}
.sl-chips{display:inline-flex;gap:4px;flex-wrap:wrap;justify-content:center}
.sl-acts{white-space:nowrap}
.sl-cell{display:inline-flex;align-items:center;gap:6px;flex-wrap:wrap;justify-content:center}
.sl-date{height:32px;width:132px;font-size:12px;padding:0 8px}
.sl-prog{display:inline-flex;align-items:center;gap:8px;font-size:12px;color:var(--ink)}
.sl-prog .bar{width:64px;height:6px;border-radius:99px;background:var(--surf3);overflow:hidden}
.sl-prog .bar i{display:block;height:100%;background:var(--ok-on-card,var(--ok));border-radius:99px}
.sl-prog b{font-variant-numeric:tabular-nums}

/* ---------- ข้อมูลพนักงาน ---------- */

/* ---------- ฟอร์ม ---------- */
.sl-grid2{display:grid;grid-template-columns:1fr 1fr;gap:0 14px}
.sl-edit-fields{border:0;padding:0;margin:0;min-width:0}
.sl-form-error{color:var(--bad);font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere}
.sl-project-actions{display:inline-flex;align-items:center;justify-content:center;gap:6px}
.sl-delete-summary{color:var(--bad);overflow-wrap:anywhere}
.sl-cleanup-row{padding:12px 0;border-bottom:1px solid var(--line);overflow-wrap:anywhere}
.sl-cleanup-row small{display:block;margin:6px 0}
.sl-catform{margin-top:14px;border-top:1px solid var(--line);padding-top:14px}
.dc-mfoot .dc-linkbtn.danger{color:var(--bad)}

/* ---------- หน้าโปรเจกต์: การ์ดแฟ้มงาน · การ์ด 2D/3D · ขั้นตอน · DATA Center ---------- */
.sl-project{margin-bottom:14px}
.sl-project .dc-proj-l h2{font-size:22px}
.sl-project .dc-proj-r{flex-wrap:wrap;gap:8px 0}
.sl-project .dc-kv{padding:0 16px}
.sl-project .dc-kv b span{white-space:normal}
.sl-project .dc-btn{margin-left:8px}
/* ---------- แหล่งงาน 2 กล่องแถวเดียว: ขั้น 1 แปลน 2D │ ขั้น 2 ภาพบ้าน 3D (สเปก §7 · เจ้าของขอรีดีไซน์ 2569-09-15) ---------- */
.sl-sources{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-bottom:14px}
.sl-src{display:flex;flex-direction:column;min-width:0;background:var(--card);border-radius:6px;box-shadow:var(--e2);overflow:hidden}
.sl-src-head{display:flex;align-items:center;gap:10px;padding:12px 16px 10px}
.sl-src-step{flex:none;width:22px;height:22px;border-radius:50%;background:var(--navy);color:var(--on-navy);font-size:11px;font-weight:800;display:inline-flex;align-items:center;justify-content:center;font-variant-numeric:tabular-nums}
.sl-src-ic{flex:none;width:36px;height:36px;border-radius:6px;background:var(--tint);color:var(--navy-text);display:inline-flex;align-items:center;justify-content:center}
.sl-src-ic .dc-ic{font-size:22px}
.sl-src-title{flex:1;min-width:0}
.sl-src-title b{display:block;font-size:15px;font-weight:700;color:var(--navy-text);line-height:1.15}
.sl-src-title small{display:block;font-size:9.5px;letter-spacing:.6px;text-transform:uppercase;color:var(--navy-text);margin-top:2px}
.sl-src-head .dc-chip{flex:none;max-width:45%;overflow:hidden;text-overflow:ellipsis}
.sl-src-media{position:relative;margin:0 16px;aspect-ratio:2/1;max-height:300px;border-radius:4px;background:var(--tint);overflow:hidden;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:8px;color:var(--accent-ink);cursor:zoom-in}
.sl-src-media.ph{cursor:default}
.sl-src-media>.dc-ic{font-size:46px;opacity:.6}
.sl-src-media img{width:100%;height:100%;object-fit:cover;display:block}
.sl-src-media img.sl-planimg{object-fit:contain;background:var(--card)} /* ผังแปลน: พื้นตามธีม ไม่ใช่ #fff */
.sl-src-msg{font-size:12px;line-height:1.6;color:var(--muted);text-align:center;padding:0 16px}
.sl-src-msg .dc-btn{margin-top:6px}
.sl-src-body{flex:1;display:flex;flex-direction:column;padding:12px 16px 16px} /* เจ้าของสั่ง 2569-09-15: ใต้ภาพเหลือแค่ปุ่ม */
.sl-src-body:empty{padding-bottom:16px}
.sl-src-acts{display:flex;flex-wrap:wrap;gap:8px;margin-top:auto;padding-top:2px}
.sl-src-acts a{text-decoration:none}
.sl-src-acts .dc-btn{height:36px;padding:0 14px;font-size:12px}
.sl-libnote p{font-size:13px;color:var(--muted);line-height:1.7;margin:0 0 12px}
.sl-libwrap{margin-top:12px}
.sl-rows .c-name{min-width:260px}
.sl-dc{padding-bottom:0}
.sl-dc iframe{display:block;width:100%;height:560px;border:0;background:var(--surf2);margin:0 -14px;width:calc(100% + 28px)} /* ความสูงจริงมาจากแฟ้มในกรอบ (dc:height) */

/* ---------- popup รายละเอียดงาน ---------- */
.sl-td-sec{border-top:1px solid var(--line);margin-top:16px;padding-top:4px}
.sl-td-sec .dc-blockhead{margin:12px 0 10px}
.sl-td-ckbar{height:6px;border-radius:99px;background:var(--surf3);overflow:hidden;margin-bottom:8px}
.sl-td-ckbar span{display:block;height:100%;background:var(--ok-on-card,var(--ok));border-radius:99px;transition:width .25s ease}
.sl-td-ck{max-height:300px;overflow:auto;border:1px solid var(--line);border-radius:4px}
.sl-td-ck .cat{position:sticky;top:0;z-index:1;font-size:12px;font-weight:700;color:var(--navy-text);padding:7px 12px;background:var(--surf2);border-bottom:1px solid var(--line)}
.sl-td-ck label{display:flex;gap:10px;align-items:center;padding:7px 12px;font-size:13px;color:var(--ink);border-bottom:1px solid var(--line-soft,var(--line));margin:0;cursor:pointer}
.sl-td-ck label:last-child{border-bottom:0}
.sl-td-ck label.ro{cursor:default}
.sl-td-ck label input{width:15px;height:15px;min-width:15px;margin:0;accent-color:var(--ok-on-card,var(--ok))}
.sl-td-ck label.done .nm{text-decoration:line-through;color:var(--muted)}
.sl-td-ck .no{flex:none;min-width:28px;text-align:center;font-size:11px;font-weight:800;color:var(--navy-text)}
.sl-td-ck .nm{flex:1}
.sl-back{color:var(--bad);background:var(--bad-bg);border-color:var(--bad-line)}
.sl-note{color:var(--ink);background:var(--surf2);border-color:var(--line)}
.sl-tdacts{border-top:1px solid var(--line);padding-top:14px}
.sl-im-grid{display:grid;grid-template-columns:1fr 1fr;gap:12px;align-items:start}
.sl-im-part{border:1px solid var(--line);border-radius:4px;padding:10px 12px;background:var(--surf)}
.sl-im-part .dc-blockhead{margin:0 0 8px}
.sl-im-part .dc-blockhead>.dc-ic{font-size:28px}
.sl-im-img{width:100%;border:1px solid var(--line);border-radius:4px;background:var(--card);margin:6px 0 8px;min-height:120px;object-fit:contain;display:block;cursor:zoom-in}
.sl-im-img[hidden]{display:none!important}
.sl-im-rooms{margin-top:8px;border-top:1px solid var(--line);padding-top:8px;max-height:180px;overflow:auto}
.sl-im-rooms .fl{font-size:11.5px;font-weight:800;color:var(--muted);margin:6px 0 2px}
.sl-im-room{display:flex;justify-content:space-between;gap:10px;font-size:12.5px;padding:2px 0;color:var(--ink)}
.sl-im-room span:last-child{color:var(--muted);white-space:nowrap}
#imZoom{position:fixed;inset:0;background:var(--scrim);display:none;align-items:center;justify-content:center;z-index:70;cursor:zoom-out;padding:24px}
#imZoom.on{display:flex}
#imZoom img{max-width:96%;max-height:92vh;border-radius:4px}
.cg-dashboard-notice{display:flex;flex-direction:column;gap:10px;padding:24px;margin:10px 0;border:1px solid var(--line);border-radius:4px;background:var(--surf2);color:var(--ink);font-size:13px}
.cg-dashboard-notice[hidden]{display:none}

/* ---------- มาตรฐานงาน: ตารางบนการ์ดโปรเจกต์ + รายการในโมดัลจัดการ (2569-09-17 · ทุกสีจาก token) ---------- */
.sl-std .c-name{min-width:200px}
.sl-std .c-name small{display:block;color:var(--muted);font-weight:400;white-space:normal}
.sl-std .c-date small{display:block;color:var(--muted);font-size:11px}
.sl-std .c-act{white-space:nowrap}
.sl-std .c-act .dc-rbtn[disabled]{opacity:.3;cursor:default}
.dc-table tr.off td{opacity:.55} /* แถวที่ปิดใช้ (เห็นเฉพาะ ADMIN ในโมดัลจัดการ) */
.sl-std-pick{display:flex;align-items:center;gap:10px;flex-wrap:wrap}
.sl-std-pick span{font-size:12px;color:var(--muted);min-width:0;overflow:hidden;text-overflow:ellipsis}

/* ---------- ตัวดูมาตรฐานงาน: หน้า PDF เป็นรูป ซูม/ลาก/เต็มจอ (2569-09-17 — ความกว้างหน้าเป็น % ของกรอบ ซูมด้วย width ของ .sl-pv-stack) ---------- */
.sl-pv-sheet{max-width:1240px;width:96%;max-height:94vh;display:flex;flex-direction:column;padding:14px 16px 16px}
.sl-pv-sheet:fullscreen{max-width:none;width:100%;height:100%;max-height:none;border-radius:0;padding:10px 12px;background:var(--card)}
.sl-pv-head{display:flex;align-items:center;gap:6px;flex-wrap:wrap;margin-bottom:6px}
.sl-pv-head>b{font-size:14px;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:40%}
.sl-pv-pages{font-size:11px;color:var(--muted);white-space:nowrap}
.sl-pv-head .spacer{flex:1}
.sl-pv-zoom{display:inline-flex;align-items:center;gap:4px}
.sl-pv-zoom>b{min-width:44px;text-align:center;font-size:12px;color:var(--ink);font-variant-numeric:tabular-nums}
.sl-pv-hint{margin:0 0 8px;font-size:11px;color:var(--muted)}
.sl-pv-body{flex:1;min-height:320px;overflow:auto;background:var(--surf2);border:1px solid var(--line);border-radius:var(--r-sm);padding:12px;cursor:zoom-in;overscroll-behavior:contain}
.sl-pv-body.zoomed{cursor:grab}
.sl-pv-body.zoomed.dragging{cursor:grabbing}
.sl-pv-body:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.sl-pv-stack{display:flex;flex-direction:column;gap:12px;width:100%;margin:0 auto}
.sl-pv-stack img{display:block;width:100%;height:auto;background:var(--card);box-shadow:var(--e2);user-select:none;-webkit-user-drag:none}
.sl-pv-msg{color:var(--muted);font-size:13px;text-align:center;padding:60px 0}
@media (max-width:640px){
  .sl-pv-sheet{padding:10px}
  .sl-pv-body{padding:8px;min-height:240px}
  .sl-pv-hint{display:none}
}

/* ---------- จอแคบ ---------- */
@media (max-width:900px){
  .sl-sources{grid-template-columns:1fr}
  .sl-im-grid{grid-template-columns:1fr}
  .sl-grid2{grid-template-columns:1fr}
  .sl-project .dc-proj-r{width:100%}
}
@media (max-width:640px){
  .sl-card{padding:10px 10px 14px}
  .sl-dc iframe{margin:0 -10px;width:calc(100% + 20px)}
}

/* ==========================================================================
   UI V.2 (2569-10-11 · เจ้าของสั่ง "ปรับ ui ใหม่ให้เป็นเวอร์ชั่นล่าสุด เหมือนของแผนกอื่น") — สเปก docs/SALE-UI-V2-SPEC-2026-10-11.md
   sale.html โหลด dashboard.css (ไฟล์ร่วม V.2.1 แบบ site.html/account.html) + body.db-page → กฎ .db-page ทั้งชุดมีผลเอง
   (พื้นภาพ · แผงข้างขาว · การ์ดเมนู · ตารางหัวกรมท่า+สลับสี · ปุ่มปิด/ยืนยันเม็ดยา · การ์ดตัวตน .db-person)
   บล็อกนี้ = ส่วนต่างเฉพาะหน้า ครอบด้วย .sale-page.db-page (ห้ามแก้ dashboard.css — ใช้ร่วมสี่หน้า)
   สีจากโทเคน app.css · เงามันของเม็ดยา = ชั้น rgba(255,255,255,.x) บนพื้นกรมท่าเท่านั้น · ไม่มี block ธีมมืด
   ========================================================================== */
.sale-page a.dc-navitem{text-decoration:none}

/* แถบข้าง: การ์ดเมนูมน 14 · ใบที่เลือกกรมท่ามันแนวตั้ง (ชุดเดียวกับ site.css V.2) */
.sale-page.db-page .dc-navitem{border-radius:14px;min-height:56px;background:linear-gradient(180deg,var(--card) 10%,var(--surf3) 38%,var(--surf3) 70%,var(--card) 94%)}
.sale-page.db-page .dc-navitem:hover{background:linear-gradient(180deg,var(--card) 10%,var(--tint))}
.sale-page.db-page .dc-navitem.active,.sale-page.db-page .dc-navitem.active:hover{
  background:linear-gradient(180deg,rgba(255,255,255,.18),rgba(255,255,255,0) 38%,rgba(255,255,255,0) 64%,rgba(255,255,255,.12)),var(--navy)}
.sale-page.db-page .dc-navitem b{font-size:17px}
.sale-page.db-page .dc-navitem small{font-size:11px}
/* ตัวเลขบนการ์ดเมนู (โปรเจกต์ยังไม่มอบ) ลอยมุมขวาบนแบบ .db-badge — ชื่อเมนูใช้ความกว้างเต็ม */
.sale-page.db-page .sl-badge{position:absolute;top:6px;right:8px;min-width:20px;height:20px;padding:0 6px;font-size:10px}
/* ช่องเลือกโปรเจกต์ในการ์ดโปรเจกต์ (เจ้าของสั่ง 2569-10-11) — หน้าตาเดียวกับช่องเลือกโครงการของ site.css V.2 (ยื่นใต้ไอคอนตาม dashboard.css) */
.sale-page.db-page .sl-navpick .db-pick{max-width:none;height:30px;border-radius:8px;background-color:var(--card);box-shadow:inset 0 -10px 10px -9px var(--surf3),var(--e2);font-size:13px}
/* เริ่มโครงการ = ปุ่มหลักเม็ดยากรมท่าบนแผงขาว */
.sale-page.db-page .sl-newbtn{height:40px;border:0;border-radius:999px;color:var(--on-navy);font-size:14px;font-weight:700;box-shadow:var(--e1);
  background:linear-gradient(180deg,rgba(255,255,255,.18),rgba(255,255,255,0) 40%,rgba(255,255,255,0) 62%,rgba(255,255,255,.12)),var(--navy)}
.sale-page.db-page .sl-newbtn:hover{background:var(--navy-hov)}
.sale-page.db-page .sl-newbtn .dc-ic{color:inherit}

/* หัวมุมมอง: หน้าโปรเจกต์แสดงแถวหัวกลับ (V.2.1 ซ่อนแถวนี้ แต่หน้า sale ซ่อนแถบข้างตอนเปิดโปรเจกต์ — ปุ่มกลับหน้าหลักเป็นทางกลับทางเดียว) */
.sale-page.db-page #viewProject>.dc-viewhead{display:flex;margin:4px 0 14px;min-height:0}
/* รีเฟรช / กลับหน้าหลัก = เม็ดยากรมท่า (แบบ .st-refresh) */
.sale-page.db-page .dc-viewhead .dc-btn{height:28px;padding:0 14px;border-color:var(--navy);border-radius:6px;font-size:12px;color:var(--on-navy);box-shadow:var(--e1);
  background:linear-gradient(180deg,rgba(255,255,255,.18),rgba(255,255,255,0) 40%,rgba(255,255,255,0) 62%,rgba(255,255,255,.12)),var(--navy)}
.sale-page.db-page .dc-viewhead .dc-btn:hover{background:var(--navy-hov);border-color:var(--navy-hov)}
.sale-page.db-page .dc-viewhead .dc-btn .dc-ic{color:inherit}

/* การ์ดขาวมุมเหลี่ยม ไม่มีเส้นขอบ เงา e2 · หัวการ์ดขนาดเดียวกับ .db-cardhead */
.sale-page.db-page .sl-card{border:0;border-radius:0;box-shadow:var(--e2);padding:14px 16px 18px;margin-bottom:16px}
.sale-page.db-page .sl-card .dc-stackhead{margin-bottom:12px;padding-bottom:10px}
.sale-page.db-page .sl-card .dc-stackhead>.dc-ic{font-size:30px}
.sale-page.db-page .sl-card .dc-stackhead b{font-size:18px}
.sale-page.db-page .sl-card .dc-stackhead small{font-size:11px}
.sale-page.db-page .sl-card .dc-blockhead b{font-size:18px}
/* กล่องแปลน 2D / ภาพบ้าน 3D มุมเหลี่ยม */
.sale-page.db-page .sl-src,.sale-page.db-page .sl-src-media{border-radius:0}
/* กรอบ DATA Center: ระยะขอบการ์ดเปลี่ยน → กรอบยืดเต็มการ์ดเท่าเดิม */
.sale-page.db-page .sl-dc{padding-bottom:0}
.sale-page.db-page .sl-dc iframe{margin:0 -16px;width:calc(100% + 32px)}
/* ถ่ายรูปเข้างาน: การ์ดกลาง (.dcm-card .dcm-cibox) อยู่ในการ์ดขาวของหน้าแล้ว — ไม่ซ้อนขอบ/เงาอีกชั้น */
.sale-page.db-page #hvCheckin .dcm-card{border:0;box-shadow:none;margin:0;background:none}
@media (max-width:640px){
  .sale-page.db-page .sl-card{padding:10px 10px 14px}
  .sale-page.db-page .sl-dc iframe{margin:0 -10px;width:calc(100% + 20px)}
}
