/* research-doc.css — สไตล์เอกสารวิจัย (หน้ากระดาษ A4, ฟอนต์, สารบัญ, ไฮไลต์) ใช้ร่วมกันระหว่างระบบหลักและระบบกรรมการ */
/* ฟอนต์ TH SarabunPSK ฝังตัว (base64) — ต้องอยู่บรรทัดแรกสุดของไฟล์ตามกติกาของ @import
   เหตุผล: @font-face ด้านล่างชี้ไป fonts/THSarabunPSK.ttf ถ้าเซิร์ฟเวอร์ไม่มีไฟล์นั้น
   หรือบล็อกนามสกุล .ttf เบราว์เซอร์จะตกไปใช้ Sarabun (กว้างกว่าราว 40%) แบบเงียบ ๆ
   ทำให้หน้าปก/หน้าที่ระบบสร้าง หน้าตาไม่เหมือนหน้าบท — ดึงฟอนต์ฝังตัวมาไว้ให้ทุกหน้าที่ใช้ไฟล์นี้ */
@import url('govdoc-fonts.css');
/* ===== ฟอนต์เอกสารวิจัย =====
   ใช้ TH SarabunPSK (ฟอนต์แห่งชาติ ชุดเดียวกับที่ Word ใช้ — ความกว้างตัวอักษรเท่ากันเป๊ะ) จากโฟลเดอร์ fonts/ บนเซิร์ฟเวอร์
   ถ้าโหลดไม่ได้ค่อยใช้ฟอนต์ในเครื่อง แล้วสุดท้ายเป็น Sarabun (OFL) จาก CDN ย่อขนาด 70% ให้ใกล้เคียง */
@font-face { font-family: 'TH Sarabun Web'; src: url('fonts/THSarabunPSK.ttf') format('truetype'), url('./fonts/THSarabunPSK.ttf') format('truetype'), url('/fonts/THSarabunPSK.ttf') format('truetype'); font-weight: 400; font-style: normal; font-display: swap; ascent-override: 85%; descent-override: 46%; line-gap-override: 0%; }
@font-face { font-family: 'TH Sarabun Web'; src: url('fonts/THSarabunPSK-Bold.ttf') format('truetype'), url('./fonts/THSarabunPSK-Bold.ttf') format('truetype'), url('/fonts/THSarabunPSK-Bold.ttf') format('truetype'); font-weight: 700; font-style: normal; font-display: swap; ascent-override: 85%; descent-override: 46%; line-gap-override: 0%; }
@font-face { font-family: 'TH Sarabun Web'; src: url('fonts/THSarabunPSK-Italic.ttf') format('truetype'), url('./fonts/THSarabunPSK-Italic.ttf') format('truetype'), url('/fonts/THSarabunPSK-Italic.ttf') format('truetype'); font-weight: 400; font-style: italic; font-display: swap; ascent-override: 85%; descent-override: 46%; line-gap-override: 0%; }
@font-face { font-family: 'TH Sarabun Web'; src: url('fonts/THSarabunPSK-BoldItalic.ttf') format('truetype'), url('./fonts/THSarabunPSK-BoldItalic.ttf') format('truetype'), url('/fonts/THSarabunPSK-BoldItalic.ttf') format('truetype'); font-weight: 700; font-style: italic; font-display: swap; ascent-override: 85%; descent-override: 46%; line-gap-override: 0%; }
@font-face { font-family: 'Sarabun Doc'; src: url('https://cdn.jsdelivr.net/gh/lazywasabi/thai-web-fonts@7/fonts/Sarabun/Sarabun-Regular.woff2') format('woff2'); font-weight: 400; font-style: normal; size-adjust: 70%; ascent-override: 85%; descent-override: 46%; line-gap-override: 0%; font-display: swap; }
@font-face { font-family: 'Sarabun Doc'; src: url('https://cdn.jsdelivr.net/gh/lazywasabi/thai-web-fonts@7/fonts/Sarabun/Sarabun-Bold.woff2') format('woff2'); font-weight: 700; font-style: normal; size-adjust: 70%; ascent-override: 85%; descent-override: 46%; line-gap-override: 0%; font-display: swap; }
@font-face { font-family: 'Sarabun Doc'; src: url('https://cdn.jsdelivr.net/gh/lazywasabi/thai-web-fonts@7/fonts/Sarabun/Sarabun-Italic.woff2') format('woff2'); font-weight: 400; font-style: italic; size-adjust: 70%; ascent-override: 85%; descent-override: 46%; line-gap-override: 0%; font-display: swap; }
@font-face { font-family: 'Sarabun Doc'; src: url('https://cdn.jsdelivr.net/gh/lazywasabi/thai-web-fonts@7/fonts/Sarabun/Sarabun-BoldItalic.woff2') format('woff2'); font-weight: 700; font-style: italic; size-adjust: 70%; ascent-override: 85%; descent-override: 46%; line-gap-override: 0%; font-display: swap; }

/* ===== หน้ากระดาษแบบเอกสารวิจัย (A4, ขอบบน/ล่าง/ขวา 2.54 ซม. ซ้าย 3.81 ซม., ฟอนต์ตระกูล Sarabun 16pt) ===== */
/* ระยะขอบตามระเบียบวิจัย: บน 1.5 นิ้ว (3.81 ซม.) · ซ้าย 1.5 นิ้ว (3.81 ซม. เผื่อเข้าเล่ม) · ล่าง 1 นิ้ว (2.54 ซม.) · ขวา 1 นิ้ว (2.54 ซม.) */
/* กระดาษ A4 = 210 × 297 มม. ขอบ บน 38.1 / ซ้าย 38.1 / ล่าง 25.4 / ขวา 25.4 มม.
   หน้าเขียน: กระดาษยาวต่อเนื่อง แต่แสดง "แถบขอบล่าง+ขอบบนหน้าถัดไป" สีเทาทุก 297 มม. เหมือนช่องว่างระหว่างหน้าของ Word
   หน้าอ่านรวมเล่ม: JS แบ่งเป็นหน้าจริงทีละแผ่น (rs-doc-fixed) ใส่เลขหน้า */
.rs-doc-page { width: 210mm; max-width: 100%; min-height: 297mm; padding: 38.1mm 25.4mm 25.4mm 38.1mm; box-sizing: border-box; position: relative;
    background-color: #fff;
    background-image:
        linear-gradient(to right, transparent 38.1mm, rgba(148,163,184,.25) 38.1mm, rgba(148,163,184,.25) calc(38.1mm + 1px), transparent calc(38.1mm + 1px), transparent calc(210mm - 25.4mm - 1px), rgba(148,163,184,.25) calc(210mm - 25.4mm - 1px), rgba(148,163,184,.25) calc(210mm - 25.4mm), transparent calc(210mm - 25.4mm)),
        linear-gradient(to bottom, transparent calc(297mm - 2px), #cbd5e1 calc(297mm - 2px), #cbd5e1 297mm);   /* ขอบกระดาษขาวเหมือน Word — เส้นบางบอกท้ายหน้าเท่านั้น */
    background-size: 100% 297mm, 100% 297mm; background-repeat: repeat-y, repeat-y;
    font-family: 'TH Sarabun Web', 'TH Sarabun Gov', 'TH SarabunPSK', 'TH Sarabun New', 'Sarabun Doc', 'Sarabun', 'Noto Sans Thai', sans-serif; font-size: 16pt; color: #111827; }
.rs-doc-page .ql-container.ql-snow { border: 0; font-family: inherit; font-size: inherit; }
.rs-doc-page .ql-editor { padding: 0; min-height: 20cm; line-height: 1.31; letter-spacing: 0; word-spacing: normal; font-family: inherit; font-size: inherit; overflow: visible; }
/* ระยะบรรทัดกำหนดตายตัว (ไม่ใช้ normal ซึ่งต่างกันตามฟอนต์สำรอง) — ทุกหน้า/ทุกระบบจึงแสดงเท่ากัน */
.rs-doc-page { line-height: 1.31; }   /* = ระยะบรรทัด "1 เท่า" ของ Word สำหรับ TH SarabunPSK (winAscent+winDescent = 1.31 em) */
/* ระยะบรรทัดตามฟอนต์ (= "1 เท่า" ของ Word) — ผู้ใช้เลือกจากเมนู "ระยะบรรทัด" ได้ */
.rs-doc-page .ql-editor.ql-blank::before { left: 0; right: 0; color: #9ca3af; font-style: normal; }
/* หัวบท: "บทที่ N" บรรทัดบน ชื่อบทบรรทัดล่าง กึ่งกลาง ตัวหนา 20pt */
.rs-doc-chapter-head { text-align: center; font-weight: 700; font-size: 20pt; line-height: 1.1; margin-bottom: .5em; }   /* หัวบท 20pt — ใหญ่กว่าหัวข้อในบททุกระดับ (ตรงกับเว็บหลัก) */
/* หน้าต่อของสารบัญ / บรรณานุกรม: "สารบัญ (ต่อ)" · "บรรณานุกรม (ต่อ)" กึ่งกลางบนหน้า (research-book.js ใส่ให้ตอนแบ่งหน้า) */
.rs-doc-cont-title { text-align: center; font-weight: 700; font-size: 20pt; line-height: 1.1; margin: 0 0 .5em;
    font-family: 'TH Sarabun Web', 'TH Sarabun Gov', 'TH SarabunPSK', 'TH Sarabun New', 'Sarabun Doc', 'Sarabun', sans-serif !important; letter-spacing: 0; }
.rs-doc-chapter-head > div + div { margin-top: 0; }
/* ระดับหัวข้อตามระเบียบ: หัวข้อใหญ่ 18pt หนา · หัวข้อรอง 16pt หนา · หัวข้อย่อย 16pt หนาเอียง */
.rs-doc-page .ql-editor h1 { font-size: 18pt; font-weight: 700; margin: 1em 0 .3em; }
.rs-doc-page .ql-editor h2 { font-size: 16pt; font-weight: 700; margin: .8em 0 .2em; }
.rs-doc-page .ql-editor h3 { font-size: 16pt; font-weight: 700; font-style: italic; margin: .6em 0 .2em; }
/* หัวข้อที่นักศึกษากด B / I ให้เป็นตัวปกติ (class จากตัวแก้ไขของเว็บหลัก) — แสดงตรงกับตอนเขียน */
/* quill.snow.css ตั้งหัวข้อใต้ .ql-snow เป็น 2em / 1.5em / 1.17em — บังคับขนาดตามระเบียบ 18 / 16 / 16pt ให้เล็กกว่าหัวบท (ตรงกับเว็บหลัก) */
.rs-doc-page .ql-snow .ql-editor h1, .ql-snow .rs-doc-page .ql-editor h1 { font-size: 18pt; }
.rs-doc-page .ql-snow .ql-editor h2, .ql-snow .rs-doc-page .ql-editor h2,
.rs-doc-page .ql-snow .ql-editor h3, .ql-snow .rs-doc-page .ql-editor h3 { font-size: 16pt; }
.ql-editor .ql-upright-yes, .ql-editor .ql-upright-yes em, .ql-editor .ql-upright-yes i { font-style: normal !important; }
.ql-editor .ql-unbold-yes, .ql-editor .ql-unbold-yes strong, .ql-editor .ql-unbold-yes b { font-weight: 400 !important; }
/* ภาษาไทยไม่มีช่องว่างระหว่างคำ — justify จะยืดเฉพาะวรรคทำให้เกิดช่องโหว่ใหญ่ จึงใช้ชิดซ้ายพอดีคำเป็นค่าเริ่มต้น
   (ถ้าผู้ใช้เลือก "จัดเต็มบรรทัด" เอง จะกระจายระดับตัวอักษรในเบราว์เซอร์ที่รองรับ) */
.rs-doc-page .ql-editor p, .rs-doc-page .ql-editor li { text-align: left; overflow-wrap: break-word; word-break: normal; line-break: strict; }
.rs-doc-page .ql-editor .ql-align-justify { text-align: justify; text-justify: inter-character; text-justify: distribute; }
/* ย่อหน้าแรกเยื้อง 1.25 ซม. ตามระเบียบ (ยกเว้นย่อหน้าที่ผู้ใช้เยื้อง/จัดกึ่งกลาง/ชิดขวาเอง) */
/* ไม่เยื้องบรรทัดแรกให้อัตโนมัติ — นักศึกษากด Tab เยื้องเองตามต้องการ */
.rs-doc-page .ql-editor:focus, .rs-doc-page .ql-editor:focus-visible { outline: none; box-shadow: none; }
.rs-doc-page .ql-container:focus-within { outline: none; box-shadow: none; }
.rs-doc-page .ql-editor blockquote { border-left: 3px solid #d1d5db; padding-left: 1em; color: #374151; }
.rs-doc-page .ql-editor table { border-collapse: collapse; width: 100%; margin: .5em 0; }
.rs-doc-page .ql-editor td, .rs-doc-page .ql-editor th { border: 1px solid #374151; padding: 4px 8px; }
/* ระยะห่างบรรทัด (class จาก attributor "lineheight") */
/* เทียบมาตรฐาน Word: "1 เท่า" ของ TH SarabunPSK = 1.31 em (ตัวคูณอื่นคูณจากค่านี้) · "0" = ชิดตามความสูงตัวอักษร · "0.5" = กึ่งกลาง */
.ql-editor .ql-lineheight-0 { line-height: 1 !important; }
/* ระยะบรรทัด 0 / 0.5 ที่ตัวแก้ไขเก็บเป็น style="line-height: 0 | 0.66" — ค่าต่ำกว่า 1 ทำให้บรรทัดทับกัน แสดงแบบชิดที่สุดที่ไม่ทับ (ตรงกับเว็บหลัก) */
.ql-editor [style*="line-height: 0;"], .ql-editor [style$="line-height: 0"], .ql-editor [style*="line-height: 0."], .ql-editor [style*="line-height:0"] { line-height: 1 !important; }
.ql-editor [style*="line-height: 0.66"] { line-height: 1.15 !important; }
.ql-editor .ql-lineheight-0\.5 { line-height: 1.15 !important; }
.ql-editor .ql-lineheight-0\.75 { line-height: 1.15 !important; }
.ql-editor .ql-lineheight-0\.8 { line-height: 1.05 !important; }
.ql-editor .ql-lineheight-0\.9 { line-height: 1.18 !important; }
.ql-editor .ql-lineheight-1 { line-height: 1.31 !important; }
.ql-editor .ql-lineheight-1\.15 { line-height: 1.51 !important; }
.ql-editor .ql-lineheight-1\.5 { line-height: 1.97 !important; }
.ql-editor .ql-lineheight-2 { line-height: 2.62 !important; }
/* แถบเครื่องมือ */
#rs-chapter-toolbar.ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid #f3f4f6; padding: 8px 12px; font-family: inherit; }
#rs-chapter-toolbar .ql-picker.ql-header { width: 118px; }
#rs-chapter-toolbar .ql-picker.ql-header .ql-picker-label::before, #rs-chapter-toolbar .ql-picker.ql-header .ql-picker-item::before { content: 'เนื้อความ'; }
#rs-chapter-toolbar .ql-picker.ql-header .ql-picker-label[data-value="1"]::before, #rs-chapter-toolbar .ql-picker.ql-header .ql-picker-item[data-value="1"]::before { content: 'หัวข้อใหญ่'; }
#rs-chapter-toolbar .ql-picker.ql-header .ql-picker-label[data-value="2"]::before, #rs-chapter-toolbar .ql-picker.ql-header .ql-picker-item[data-value="2"]::before { content: 'หัวข้อรอง'; }
#rs-chapter-toolbar .ql-picker.ql-header .ql-picker-label[data-value="3"]::before, #rs-chapter-toolbar .ql-picker.ql-header .ql-picker-item[data-value="3"]::before { content: 'หัวข้อย่อย'; }
#rs-chapter-toolbar .ql-picker.ql-size { width: 74px; }
#rs-chapter-toolbar .ql-picker.ql-size .ql-picker-label::before, #rs-chapter-toolbar .ql-picker.ql-size .ql-picker-item::before { content: '16 pt'; font-size: 13px !important; }
#rs-chapter-toolbar .ql-picker.ql-size .ql-picker-label[data-value]::before, #rs-chapter-toolbar .ql-picker.ql-size .ql-picker-item[data-value]::before { content: attr(data-value); }
.rs-doc-page .ql-editor .ql-size-10pt { font-size: 10pt; } .rs-doc-page .ql-editor .ql-size-12pt { font-size: 12pt; } .rs-doc-page .ql-editor .ql-size-14pt { font-size: 14pt; }
.rs-doc-page .ql-editor .ql-size-18pt { font-size: 18pt; } .rs-doc-page .ql-editor .ql-size-20pt { font-size: 20pt; } .rs-doc-page .ql-editor .ql-size-24pt { font-size: 24pt; }
.rs-doc-page .ql-editor .ql-size-small { font-size: 14pt; } .rs-doc-page .ql-editor .ql-size-large { font-size: 18pt; } .rs-doc-page .ql-editor .ql-size-huge { font-size: 20pt; }
/* ฟอนต์ที่เลือกได้ */
#rs-chapter-toolbar .ql-picker.ql-font { width: 138px; }
#rs-chapter-toolbar .ql-picker.ql-font .ql-picker-label::before, #rs-chapter-toolbar .ql-picker.ql-font .ql-picker-item::before { content: 'TH SarabunPSK'; }
#rs-chapter-toolbar .ql-picker.ql-font [data-value="thsarabunpsk"]::before { content: 'TH SarabunPSK'; }
#rs-chapter-toolbar .ql-picker.ql-font [data-value="thsarabunnew"]::before { content: 'TH Sarabun New'; }
#rs-chapter-toolbar .ql-picker.ql-font [data-value="sarabun"]::before { content: 'Sarabun'; }
.rs-doc-page .ql-editor .ql-font-thsarabunpsk { font-family: 'TH Sarabun Web', 'TH Sarabun Gov', 'TH SarabunPSK', 'Sarabun Doc', sans-serif !important; }
.rs-doc-page .ql-editor .ql-font-thsarabunnew { font-family: 'TH Sarabun New', 'TH Sarabun Web', 'TH Sarabun Gov', 'TH SarabunPSK', 'Sarabun Doc', sans-serif !important; }
.rs-doc-page .ql-editor .ql-font-sarabun, .rs-doc-page .ql-editor .ql-font-angsana, .rs-doc-page .ql-editor .ql-font-tahoma, .rs-doc-page .ql-editor .ql-font-times, .rs-doc-page .ql-editor .ql-font-arial { font-family: var(--rs-f) !important; }
.rs-doc-page .ql-editor .ql-font-sarabun { --rs-f: 'Sarabun Doc', 'Sarabun', 'Noto Sans Thai', sans-serif; }
.rs-doc-page .ql-editor .ql-font-angsana { --rs-f: 'Angsana New', 'AngsanaUPC', 'Cordia New', serif; }
.rs-doc-page .ql-editor .ql-font-tahoma { --rs-f: Tahoma, 'Segoe UI', sans-serif; }
.rs-doc-page .ql-editor .ql-font-times { --rs-f: 'Times New Roman', Times, serif; }
.rs-doc-page .ql-editor .ql-font-arial { --rs-f: Arial, Helvetica, sans-serif; }
#rs-chapter-toolbar .ql-picker.ql-font [data-value="angsana"]::before { content: 'Angsana New'; }
#rs-chapter-toolbar .ql-picker.ql-font [data-value="tahoma"]::before { content: 'Tahoma'; }
#rs-chapter-toolbar .ql-picker.ql-font [data-value="times"]::before { content: 'Times New Roman'; }
#rs-chapter-toolbar .ql-picker.ql-font [data-value="arial"]::before { content: 'Arial'; }
/* "Sarabun" ในเมนูฟอนต์ = ฟอนต์เอกสารมาตรฐานชุดเดียวกับหน้ากระดาษ (TH SarabunPSK) — ขนาด 16pt จึงเท่ากันทุกหน้า/ทุกระบบ */
.rs-doc-page .ql-editor .ql-font-sarabun { font-family: 'Sarabun Doc', 'Sarabun', 'Noto Sans Thai', sans-serif; }   /* Sarabun (Google) — ย่อ 70% ให้ขนาดใกล้ TH Sarabun */
.rs-doc-page .ql-editor .ql-font-angsana { font-family: 'Angsana New', 'AngsanaUPC', 'TH Sarabun Web', 'TH Sarabun Gov', serif; }
.rs-doc-page .ql-editor .ql-font-tahoma { font-family: Tahoma, sans-serif; font-size: .8em; }
.rs-doc-page .ql-editor .ql-font-times { font-family: 'Times New Roman', Times, serif; }
.rs-doc-page .ql-editor .ql-font-arial { font-family: Arial, Helvetica, sans-serif; font-size: .8em; }
/* ระยะห่างอักษร (เทียบ "ระยะห่างอักขระ" ของ Word) — กฎ letter-spacing:0 !important ของหน้ากระดาษ
   ครอบทุก element จึงต้องประกาศทับด้วย !important เฉพาะช่วงที่ผู้ใช้เลือกเท่านั้น */
#rs-chapter-toolbar .ql-picker.ql-letterspacing { width: 132px; }
#rs-chapter-toolbar .ql-picker.ql-letterspacing .ql-picker-label::before,
#rs-chapter-toolbar .ql-picker.ql-letterspacing .ql-picker-item::before { content: 'ระยะห่างอักษร'; }
#rs-chapter-toolbar .ql-picker.ql-letterspacing [data-value="c05"]::before { content: 'กระชับ 0.5 pt'; }
#rs-chapter-toolbar .ql-picker.ql-letterspacing [data-value="c025"]::before { content: 'กระชับ 0.25 pt'; }
#rs-chapter-toolbar .ql-picker.ql-letterspacing [data-value="e025"]::before { content: 'ขยาย 0.25 pt'; }
#rs-chapter-toolbar .ql-picker.ql-letterspacing [data-value="e05"]::before { content: 'ขยาย 0.5 pt'; }
#rs-chapter-toolbar .ql-picker.ql-letterspacing [data-value="e1"]::before { content: 'ขยาย 1 pt'; }
#rs-chapter-toolbar .ql-picker.ql-letterspacing [data-value="e15"]::before { content: 'ขยาย 1.5 pt'; }
.rs-doc-page .ql-editor .ql-ls-c05  { letter-spacing: -0.5pt !important; }
.rs-doc-page .ql-editor .ql-ls-c025 { letter-spacing: -0.25pt !important; }
.rs-doc-page .ql-editor .ql-ls-e025 { letter-spacing: 0.25pt !important; }
.rs-doc-page .ql-editor .ql-ls-e05  { letter-spacing: 0.5pt !important; }
.rs-doc-page .ql-editor .ql-ls-e1   { letter-spacing: 1pt !important; }
.rs-doc-page .ql-editor .ql-ls-e15  { letter-spacing: 1.5pt !important; }
/* หน้าอ่าน/รวมเล่ม (ไม่มี .ql-editor ครอบ) ต้องแสดงระยะห่างเดียวกับตอนเขียน */
.rs-doc-page .ql-ls-c05  { letter-spacing: -0.5pt !important; }
.rs-doc-page .ql-ls-c025 { letter-spacing: -0.25pt !important; }
.rs-doc-page .ql-ls-e025 { letter-spacing: 0.25pt !important; }
.rs-doc-page .ql-ls-e05  { letter-spacing: 0.5pt !important; }
.rs-doc-page .ql-ls-e1   { letter-spacing: 1pt !important; }
.rs-doc-page .ql-ls-e15  { letter-spacing: 1.5pt !important; }

#rs-chapter-toolbar .ql-picker.ql-lineheight { width: 140px; }
#rs-chapter-toolbar .ql-picker.ql-lineheight .ql-picker-label::before, #rs-chapter-toolbar .ql-picker.ql-lineheight .ql-picker-item::before { content: 'ระยะบรรทัด'; }
/* 0 และ 0.5 เท่าแบบ Word (×1.31) — 0 = บรรทัดซ้อนกันพอดี ใช้กับบรรทัดว่างที่ต้องการให้ไม่กินที่ */
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="0"]::before { content: 'บรรทัด 0'; }
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="0.66"]::before { content: 'บรรทัด 0.5'; }
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="1"]::before { content: 'บรรทัด 0.75 (แคบ)'; }
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="1.15"]::before { content: 'บรรทัด 0.9 (แคบ)'; }
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="1.31"]::before { content: 'บรรทัด 1 (Word)'; }
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="3.28"]::before { content: 'บรรทัด 2.5'; }
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="3.93"]::before { content: 'บรรทัด 3'; }
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="custom"]::before { content: 'กำหนดเอง…'; }
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="1.51"]::before { content: 'บรรทัด 1.15'; }
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="1.97"]::before { content: 'บรรทัด 1.5'; }
#rs-chapter-toolbar .ql-picker.ql-lineheight [data-value="2.62"]::before { content: 'บรรทัด 2'; }
.rs-doc-body { font-family: inherit; font-size: inherit; }
/* มือถือ: หน้า "อ่าน" ยังเป็นกระดาษ A4 จริง (ย่อด้วย zoom ใน research-book.js) — เฉพาะหน้า "เขียน" ที่ยืดเต็มจอเพื่อให้พิมพ์สะดวก */
@media (max-width: 640px) { #rs-chapter-page.rs-doc-page { padding: 12mm; min-height: 60vh; width: 100%; background-image: none; } #rs-chapter-page .ql-editor { min-height: 50vh; } #rs-chapter-page .rs-doc-chapter-head { font-size: 18pt; } }
#rs-chapter-view-pages.rs-fitted { margin: 0 auto; }
#rs-chapter-view-pages.rs-fitted .rs-doc-page { max-width: none; }
@media print { #rs-chapter-view-pages { zoom: 1 !important; } }
/* สีตัวอักษรดำล้วนทั้งเล่ม */
.rs-doc-page, .rs-doc-page .ql-editor, .rs-doc-page a { color: #000; }
/* ตารางในเนื้อหา: กว้างเต็มหน้า แบ่งคอลัมน์เท่ากัน — ลากเส้นขอบขวาของช่องเพื่อปรับความกว้างคอลัมน์ได้ (เก็บเป็น width บน td) */
/* ตารางกว้างเกิน "เส้นขอบกระดาษ" ได้เหมือน Word — ลากขยายออกนอกคอลัมน์ข้อความได้
   เดิม max-width: 100% ล็อกไว้เท่าความกว้างคอลัมน์ข้อความพอดี ลากออกไม่ได้เลยสักนิด
   เพดาน 171.9 มม. = 210 (กว้างกระดาษ) − 38.1 (ขอบซ้าย) กันไม่ให้ล้นออกนอกแผ่นจนพิมพ์ขาด */
.rs-doc-page .ql-editor table { width: 100%; max-width: 171.9mm; table-layout: fixed; border-collapse: collapse; margin: .6em 0; }
.rs-doc-page .ql-editor td, .rs-doc-page .ql-editor th { border: 1px solid #000; padding: 4px 8px; vertical-align: top; min-width: 2em; word-break: break-word; }
.rs-doc-page .ql-editor td p { text-indent: 0; text-align: left; }
.rs-tbl-btn { display: inline-flex; align-items: center; gap: 3px; height: 24px; padding: 0 6px; margin-right: 2px; border-radius: 6px; font-size: 12px; color: #444; background: #fff; border: 1px solid #e5e7eb; cursor: pointer; }
.rs-tbl-btn:hover { color: #e11d48; border-color: #fecdd3; background: #fff1f2; }
.rs-tbl-btn small { font-size: 10px; }
/* หน้าโครงเล่ม */
.rs-doc-blank { min-height: 20cm; }
.rs-cover-block { margin-top: 2.2cm; line-height: 1.31; }
.rs-doc-cover .rs-cover-foot { font-size: 16pt; line-height: 1.31; }
/* หน้าอนุมัติ: หัวเรื่อง 16pt หนา · เนื้อหา 14pt · ลายเซ็นกึ่งกลาง · วันที่บรรทัดเดียว */
.rs-doc-approval { font-size: 14pt; line-height: 1.31; letter-spacing: 0; }   /* หน้าอนุมัติ 14pt (จัดวางพอดีหน้าเดียว) ระยะบรรทัด 1 เท่า */
.rs-appr-row { display: flex; gap: .5em; padding: 0; line-height: 1.31; }
.rs-appr-k { flex: 0 0 8.5em; font-weight: 700; }
.rs-appr-v { flex: 1; }
.rs-appr-hr { border: 0; border-top: 1px solid #000; margin: 1.2em 0; }
.rs-sign { text-align: center; margin-top: 3.4em; line-height: 1.31; }   /* เว้นที่ว่างเหนือเส้นประให้ลงนาม */
.rs-sign p { margin: 0; }
.rs-sign-right { margin-left: auto; width: 62%; white-space: nowrap; }
.rs-appr-note { margin-top: 1.4em; text-indent: 1.25cm; line-height: 1.31; text-align: justify; text-justify: inter-character; }
.rs-appr-hr { margin: 1.2em 0; }
.rs-doc-toc-row { cursor: pointer; }
.rs-toc-head { display: flex; justify-content: space-between; font-weight: 700; border-bottom: 1px solid #000; padding-bottom: .1em; margin-bottom: .2em; }
.rs-doc-toc-row.rs-toc-sub { padding-left: 4.5em; }
.rs-doc-toc-row.rs-toc-sub .rs-toc-no { display: none; }
.rs-doc-muted { color: #6b7280 !important; font-style: italic; text-indent: 0 !important; }
/* เครื่องมือการวิจัย (ภาคผนวก): ไม่ใช้ระยะขอบวิจัย — เหลือขอบ 10 มม. ให้วางแบบสอบถาม/ตารางกว้างได้ */
.rs-doc-page.rs-doc-tools { padding: 10mm; }
.rs-doc-page.rs-doc-tools:not(.rs-doc-fixed) { background-image: linear-gradient(to bottom, transparent calc(297mm - 2px), #cbd5e1 calc(297mm - 2px), #cbd5e1 297mm);
    background-size: 100% 297mm; }
.rs-doc-page.rs-doc-tools .rs-page-no { top: 3mm; right: 10mm; }
#rs-chapter-editor { position: relative; }
/* แถบเมนูตาราง/เส้นลากของ quill-table-better ต้องอยู่เหนือหน้ากระดาษ */
.ql-table-menus-container, .ql-table-properties-form, .ql-operate-line-container, .ql-table-tooltip { z-index: 10001 !important; }
/* หน้าอ่าน: กระดาษแผ่นละ 297 มม. พอดี (แบ่งหน้าด้วย JS) ไม่มีแถบเทา · เลขหน้ามุมขวาบนในระยะขอบ */
.rs-doc-page.rs-doc-fixed { height: 297mm; overflow: hidden; background-image: none; }
.rs-doc-page .rs-page-no { position: absolute; top: 25.4mm; right: 25.4mm; font-size: 16pt; color: #000; line-height: 1; }   /* เลขหน้า: มุมขวาบน ห่างขอบบน/ขวา 1 นิ้ว */
.rs-doc-page.rs-doc-cont .rs-doc-body { margin-top: 0; }
#rs-chapter-view-pages { display: flex; flex-direction: column; gap: 14mm; padding-bottom: 14mm; }
/* ไม่ให้ธีมของแอปย้อมสีแถวตาราง (แถวชมพู) — แต่คงสีพื้นที่ผู้ใช้กำหนดเองไว้ */
.rs-doc-page .ql-editor tr:not([style*="background"]), .rs-doc-page .ql-editor td:not([style*="background"]), .rs-doc-page .ql-editor th:not([style*="background"]) { background: transparent; }
.rs-doc-page .ql-editor tr:hover td:not([style*="background"]) { background: transparent; }
/* ตารางจาก quill-table-better: ความกว้างคอลัมน์จาก <col width> · ช่องผสาน (colspan/rowspan) · ไม่ล้นหน้ากระดาษ */
.rs-doc-page .ql-editor table.ql-table-better { table-layout: fixed; max-width: 171.9mm; }
.rs-doc-page .ql-editor table.ql-table-better td, .rs-doc-page .ql-editor table.ql-table-better th { border: 1px solid #000; }
/* ลูกเล่นธีม: การ์ดค่อย ๆ โผล่ · ปุ่มหลักไล่สีตามธีมเว็บ · แถวตารางบทมีไฮไลต์ตอนชี้ */
@keyframes rsFadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#page-research-progress .space-y-6 > *, #page-research-status .space-y-6 > *, #page-research-overview .space-y-6 > *, #rs-detail-body > *, #rs-my-detail-body > * { animation: rsFadeUp .35s ease both; }
#rs-detail-body > *:nth-child(2), #rs-my-detail-body > *:nth-child(2) { animation-delay: .06s; } #rs-detail-body > *:nth-child(3), #rs-my-detail-body > *:nth-child(3) { animation-delay: .12s; } #rs-detail-body > *:nth-child(4), #rs-my-detail-body > *:nth-child(4) { animation-delay: .18s; }
.rs-doc-page { animation: rsFadeUp .3s ease both; }
[id^="page-research"] .bg-rose-600 { background-image: linear-gradient(135deg, #e11d48, #db2777); }
[id^="page-research"] .bg-rose-600:hover { background-image: linear-gradient(135deg, #be123c, #be185d); }
[id^="page-research"] tbody tr { transition: background .15s; }
/* ไฮไลต์ + ความเห็น */
.rs-doc-page mark.rs-hl { color: inherit; padding: 0 1px; border-radius: 2px; cursor: help; }
.rs-doc-page mark.rs-hl .rs-hl-no { font-size: 9pt; color: #b45309; font-weight: 700; margin-left: 1px; }
.rs-sel-btn { position: absolute; z-index: 20; background: #111827; color: #fff; font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); font-family: -apple-system, sans-serif; }
.rs-sel-btn:hover { background: #e11d48; }
#rs-chapter-view-scroll { position: relative; }
.rs-doc-comments { background: #fff; border: 1px solid #fde68a; border-left: 4px solid #f59e0b; border-radius: 12px; padding: 14px 16px; margin-top: 14px; font-family: -apple-system, 'Sarabun', sans-serif; }
.rs-doc-comments-wrap { padding-bottom: 12mm; }
@media print { .rs-sel-btn { display: none !important; } }
/* ชื่อบทมาตรฐานล็อก: แสดงเป็นป้าย ไม่ใช่ช่องกรอก */
/* หัวบทมาตรฐาน (แก้ชื่อไม่ได้) — แสดงเป็นหัวเรื่องสวย ๆ แทนช่องกรอก */
#rs-chapter-title.rs-title-locked { background: transparent; border-color: transparent; cursor: default; padding-left: 0; font-size: 1.35rem; letter-spacing: -.01em; color: #111827; }
#rs-chapter-label { display: inline-flex; align-items: center; gap: 6px; background: linear-gradient(135deg, #e11d48, #db2777); color: #fff !important; padding: 3px 12px; border-radius: 999px; font-size: 11px; letter-spacing: .08em; box-shadow: 0 4px 12px rgba(225,29,72,.25); margin-bottom: 4px; }
#rs-chapter-label::before { content: '\f02d'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 10px; }
/* ตารางในเอกสาร: ช่องที่ "ไม่ได้กำหนดเส้นเอง" ให้มีเส้นครบทุกด้านเป็นค่าเริ่มต้น
   เดิมกฎนี้เป็น !important เพราะตารางที่วางจาก Word มาไม่มีเส้น — แต่ทำให้
   ลบเส้นบางด้าน/ทำตารางไม่มีเส้นแบบ Word ไม่ได้เลย (เมนู "เส้นขอบ" และรูปแบบจาก Word ถูกทับหมด)
   ตอนนี้ตารางจาก Word พารูปแบบมาเองแล้ว (research-paste-word.js) จึงใช้เป็นค่าเริ่มต้นพอ
   :not([style*="border"]) = ช่องไหนกำหนดเส้นเองไว้ ให้ค่าของช่องนั้นชนะ */
.rs-doc-page .ql-editor table td:not([style*="border"]), .rs-doc-page .ql-editor table th:not([style*="border"]) { border: 1px solid #000; }
/* ไม่วาดกรอบให้ตัว <table> เอง — ถ้าวาด สั่ง "ไม่มีเส้นขอบ" กับทุกช่องแล้วยังเหลือกรอบนอกติดอยู่
   เส้นทั้งหมดมาจากช่อง (td/th) อย่างเดียว จึงคุมด้วยเมนูเส้นขอบได้ครบเหมือน Word */
/* สารบัญ: หัวเรื่อง 16 หนา · รายการบท 16 · หัวข้อย่อย 14 · เลขหน้า 14 */
.rs-doc-toc-title { font-size: 18pt !important; }   /* หัว การอนุมัติ/บทคัดย่อ/กิตติกรรมประกาศ/สารบัญ = TH SarabunPSK 18pt หนา */
/* หน้าที่ระบบสร้างทั้งหน้า (ปก · การอนุมัติ · บทคัดย่อ · กิตติกรรมประกาศ · สารบัญ)
   ต้องเป็น TH SarabunPSK เสมอ ไม่เปลี่ยนตามฟอนต์ที่นักศึกษาเลือกในเนื้อหาบท
   คลาสนี้ใส่โดย buildBook() แทนคลาส rs-pf-* ที่เคยครอบหน้าพวกนี้
   หมายเหตุ: ข้อความในเนื้อความที่นักศึกษาตั้งฟอนต์เองไว้ (.ql-font-*) ยังชนะกฎนี้ตามเดิม */
.rs-doc-page.rs-doc-sys, .rs-doc-page.rs-doc-sys .rs-cover-title, .rs-doc-page.rs-doc-sys .rs-appr-k,
.rs-doc-page.rs-doc-sys .rs-appr-v, .rs-doc-page.rs-doc-sys .rs-cover-block, .rs-doc-page.rs-doc-sys .rs-cover-foot {
    font-family: 'TH Sarabun Web', 'TH Sarabun Gov', 'TH SarabunPSK', 'TH Sarabun New', 'Sarabun Doc', 'Sarabun', sans-serif !important;
}

/* หัวเรื่องที่ระบบสร้างต้องเป็น TH SarabunPSK เสมอตามระเบียบ — ไม่เปลี่ยนตามฟอนต์ที่นักศึกษา
   เลือกในเนื้อหาบท (buildBook ใส่คลาส .rs-pf-* ให้ทั้งเล่มจากฟอนต์เด่นของบทที่ 1)
   รวมหัวบท "บทที่ N / ชื่อบท" ไว้ด้วย เดิมตกหล่นจึงเพี้ยนตามเนื้อหา */
.rs-doc-toc-title, .rs-toc-head, .rs-doc-toc-row, .rs-doc-toc-row *,
.rs-doc-chapter-head, .rs-doc-chapter-head * { font-family: 'TH Sarabun Web', 'TH Sarabun Gov', 'TH SarabunPSK', 'TH Sarabun New', 'Sarabun Doc', 'Sarabun', sans-serif !important; letter-spacing: 0; }
/* ระยะห่างตัวอักษร/คำ เป็นค่ามาตรฐานของฟอนต์ทุกขนาด (ไม่ยืด/ไม่บีบ) */
.rs-doc-page, .rs-doc-page * { letter-spacing: 0 !important; word-spacing: normal !important; font-kerning: normal; }
.rs-toc-head { font-size: 14pt; }
.rs-doc-toc-row { font-size: 16pt; }
.rs-doc-toc-row.rs-toc-sub { font-size: 14pt; }
.rs-doc-toc-row .rs-toc-page, .rs-page-no { font-size: 14pt !important; }
/* Shift+Enter: บรรทัดต่อในย่อหน้าเดิม — ไม่เยื้องหน้า ไม่เว้นช่วง */
.rs-doc-page .ql-editor > p.ql-softline-yes { text-indent: 0 !important; margin-top: 0; }
.rs-doc-toc-row.rs-toc-sub-2 { padding-left: 7em; }
/* ขึ้นหน้าใหม่: แสดงป้ายเส้นประเหนือย่อหน้า (เฉพาะตอนเขียน) */
#rs-chapter-editor .ql-editor > .ql-pagebreak-before { position: relative; }
#rs-chapter-editor .ql-editor > .ql-pagebreak-before::before { content: '— ขึ้นหน้าใหม่ —'; position: absolute; left: 0; right: 0; top: -1.4em; text-align: center; font-size: 11px; color: #f43f5e; border-top: 1px dashed #fda4af; line-height: 1.2em; font-family: -apple-system, sans-serif; }
/* อ่านรวมทุกบท: หน้าปก / หน้าสารบัญ / บทละหน้า — แต่ละหน้าเป็นกระดาษ A4 แยกกัน */
.rs-doc-page.rs-doc-cover { display: flex; flex-direction: column; align-items: center; text-align: center; }
.rs-doc-cover .rs-cover-title { font-size: 20pt; font-weight: 700; margin-top: 3cm; line-height: 1.31; }
.rs-doc-cover .rs-cover-foot { margin-top: auto; font-size: 16pt; line-height: 1.31; }
.rs-doc-toc-title { text-align: center; font-size: 20pt; font-weight: 700; margin-bottom: .3em; }
.rs-doc-toc-row { display: flex; align-items: baseline; gap: .6em; padding: 0; line-height: 1.5; color: inherit; text-decoration: none; }
.rs-doc-toc-row .rs-toc-no { flex: 0 0 4.5em; font-weight: 700; }
.rs-doc-toc-row .rs-toc-fill { flex: 1; border-bottom: 1px dotted #6b7280; transform: translateY(-.35em); }
.rs-doc-toc-row .rs-toc-page { flex: 0 0 auto; }
.rs-doc-toc-row:hover { background: #f9fafb; }
@media print { @page { size: 210mm 297mm; margin: 0; } .rs-doc-page { box-shadow: none; page-break-after: always; margin: 0; background-image: none; } #rs-chapter-view-pages { display: block; gap: 0; padding: 0; } }

/* การเยื้อง (แถบ) ของ Quill — เผื่อหน้าที่ไม่ได้โหลด quill.snow.css (ระบบกรรมการ) */
.rs-doc-page .ql-editor .ql-indent-1 { padding-left: 3em; } .rs-doc-page .ql-editor .ql-indent-2 { padding-left: 6em; } .rs-doc-page .ql-editor .ql-indent-3 { padding-left: 9em; }
.rs-doc-page .ql-editor .ql-indent-4 { padding-left: 12em; } .rs-doc-page .ql-editor .ql-indent-5 { padding-left: 15em; } .rs-doc-page .ql-editor .ql-indent-6 { padding-left: 18em; }
.rs-doc-page .ql-editor .ql-align-center { text-align: center; } .rs-doc-page .ql-editor .ql-align-right { text-align: right; } .rs-doc-page .ql-editor .ql-align-justify { text-align: justify; text-justify: inter-character; }
.rs-doc-page .ql-editor ol, .rs-doc-page .ql-editor ul { padding-left: 1.5em; } .rs-doc-page .ql-editor blockquote { border-left: 3px solid #ccc; padding-left: 1em; }
.rs-doc-page .ql-editor { white-space: pre-wrap; word-wrap: break-word; tab-size: 1.27cm; -moz-tab-size: 1.27cm; }   /* แท็บ = 0.5 นิ้ว เท่า Word */
.rs-doc-page .ql-editor p, .rs-doc-page .ql-editor li, .rs-doc-page .ql-editor h1, .rs-doc-page .ql-editor h2, .rs-doc-page .ql-editor h3 { tab-size: 1.27cm; -moz-tab-size: 1.27cm; }
.rs-doc-page .ql-editor p { margin: 0; } .rs-doc-page .ql-editor h1, .rs-doc-page .ql-editor h2, .rs-doc-page .ql-editor h3 { text-indent: 0; }
.rs-doc-page .ql-editor .ql-size-small { font-size: 14pt; } .rs-doc-page .ql-editor .ql-size-large { font-size: 18pt; } .rs-doc-page .ql-editor .ql-size-huge { font-size: 20pt; }
.rs-doc-page .ql-editor sub { vertical-align: sub; font-size: .75em; } .rs-doc-page .ql-editor sup { vertical-align: super; font-size: .75em; }

/* ===== ความเห็นรายหน้า (เด่น) + สรุปรายบท ===== */
.rs-doc-cm-panel { width: 210mm; max-width: 100%; margin: -8mm auto 0; background: #fffbeb; border: 2px solid #fcd34d; border-left: 8px solid #f59e0b; border-radius: 14px; padding: 12px 16px; font-family: -apple-system, 'Sarabun', sans-serif; font-size: 14px; color: #1f2937; box-shadow: 0 6px 18px rgba(245,158,11,.12); }
.rs-doc-cm-panel.has-items { background: #fff7ed; border-color: #fb923c; border-left-color: #ea580c; }
.rs-cm-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rs-cm-title { font-weight: 800; color: #9a3412; }
.rs-cm-count { background: #ea580c; color: #fff; font-weight: 800; font-size: 12px; padding: 2px 9px; border-radius: 999px; }
.rs-cm-add { margin-left: auto; background: #111827; color: #fff; font-weight: 700; font-size: 12px; padding: 6px 12px; border-radius: 9px; border: 0; cursor: pointer; }
.rs-cm-add:hover { background: #e11d48; }
.rs-cm-empty { margin: 6px 0 0; font-size: 12px; color: #92400e; opacity: .8; }
.rs-cm-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rs-cm-item { display: flex; gap: 10px; align-items: flex-start; background: #fff; border: 1px solid #fde68a; border-radius: 10px; padding: 8px 10px; }
.rs-cm-item.rs-cm-done { opacity: .72; }
.rs-cm-item.rs-cm-done .rs-cm-text { text-decoration: line-through; text-decoration-color: rgba(5,150,105,.6); }
.rs-cm-no { width: 22px; height: 22px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; flex: 0 0 auto; margin-top: 2px; }
.rs-cm-body { min-width: 0; flex: 1; }
.rs-cm-quote { margin: 0; font-size: 12px; color: #6b7280; font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-cm-text { margin: 2px 0 0; font-size: 14px; white-space: pre-line; }
.rs-cm-meta { margin: 2px 0 0; font-size: 11px; color: #9ca3af; }
.rs-cm-resolved { margin-left: 6px; background: #d1fae5; color: #047857; font-weight: 700; padding: 1px 6px; border-radius: 6px; }
.rs-cm-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.rs-cm-actions button { border: 1px solid #fecaca; background: #fff1f2; color: #e11d48; cursor: pointer; font-size: 12px; width: 28px; height: 28px; border-radius: 8px; } .rs-cm-actions button:hover { background: #e11d48; color: #fff; }
.rs-cm-check { font-size: 11px; color: #4b5563; display: inline-flex; align-items: center; gap: 4px; cursor: pointer; white-space: nowrap; } .rs-cm-check input { accent-color: #059669; }
.rs-doc-cm-summary { width: 210mm; max-width: 100%; margin: 4mm auto 12mm; background: #fff; border: 2px solid #fecaca; border-radius: 16px; padding: 14px 18px; font-family: -apple-system, 'Sarabun', sans-serif; font-size: 14px; }
.rs-cm-sum-head { font-weight: 800; color: #9f1239; font-size: 15px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rs-cm-sum-badges { margin-left: auto; display: flex; gap: 6px; } .rs-cm-sum-badges span { font-size: 11px; padding: 2px 9px; border-radius: 999px; background: #f3f4f6; color: #374151; font-weight: 700; }
.rs-cm-sum-badges span.warn { background: #fee2e2; color: #b91c1c; } .rs-cm-sum-badges span.ok { background: #d1fae5; color: #047857; }
.rs-cm-sum-ch { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #e5e7eb; }
.rs-cm-sum-title { margin: 0; font-weight: 800; color: #1f2937; } .rs-cm-sum-title span { font-weight: 600; font-size: 12px; color: #6b7280; margin-left: 6px; }
@media print { .rs-doc-cm-panel, .rs-doc-cm-summary { display: none !important; } }

/* ===== การ์ดผลคะแนนสอบ (ฝั่งอาจารย์) ===== */
.rs-score-panel { background: #fff; border: 1px solid #fecdd3; border-radius: 18px; padding: 16px 18px; box-shadow: 0 10px 30px rgba(225,29,72,.08); font-family: -apple-system, 'Sarabun', sans-serif; }
.rs-score-summary { display: flex; align-items: center; gap: 18px; padding: 14px 18px; border-radius: 16px; background: var(--bg, #ffe4e6); border: 1.5px solid #fda4af; }
.rs-score-summary-wait { --c: #9ca3af; --bg: #f9fafb; color: #6b7280; }
.rs-score-sum-title { margin: 0; font-size: 12px; font-weight: 800; color: #4b5563; text-transform: uppercase; letter-spacing: .04em; }
.rs-score-sum-big { margin: 0; font-size: 34px; font-weight: 900; color: var(--c, #e11d48); line-height: 1.1; } .rs-score-sum-big span { font-size: 16px; margin-left: 2px; }
.rs-score-sum-sub { margin: 2px 0 0; font-size: 12px; color: #6b7280; }
.rs-score-ring { flex: 0 0 auto; border-radius: 50%; background: conic-gradient(var(--c) calc(var(--p) * 1%), #e5e7eb 0); display: grid; place-items: center; }
.rs-score-ring > div { width: calc(100% - 12px); height: calc(100% - 12px); border-radius: 50%; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.rs-score-ring b { font-size: 1.05em; font-weight: 900; color: #111827; } .rs-score-ring small { font-size: 10px; color: #9ca3af; margin-top: 2px; }
.rs-score-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-top: 12px; }
.rs-score-card { border: 1px solid #fecdd3; background: linear-gradient(180deg, #fff, #fff1f2); border-radius: 14px; padding: 12px 14px; box-shadow: 0 4px 14px rgba(225,29,72,.06); }
.rs-score-pct { text-align: right; line-height: 1; font-weight: 900; font-size: 22px; flex: 0 0 auto; margin-right: 6px; } .rs-score-pct span { font-size: 12px; margin-left: 1px; } .rs-score-pct small { display: block; font-weight: 600; font-size: 10px; color: #9ca3af; margin-top: 3px; }
.rs-score-card-wait { border-style: dashed; border-color: #fda4af; background: #fff; opacity: .85; }
.rs-score-card-head { display: flex; align-items: center; gap: 10px; }
.rs-score-card-head > .rs-score-info { flex: 1; }
.rs-score-ring { aspect-ratio: 1 / 1; }
.rs-score-avatar { width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(135deg, #e11d48, #db2777); color: #fff; font-weight: 800; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.rs-score-name { margin: 0; font-weight: 800; font-size: 13px; color: #1f2937; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-score-when { margin: 0; font-size: 11px; color: #9ca3af; }
.rs-score-wait { font-size: 11px; font-weight: 700; color: #d97706; background: #fef3c7; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.rs-score-items { list-style: none; margin: 10px 0 0; padding: 10px 0 0; border-top: 1px dashed #e5e7eb; display: flex; flex-direction: column; gap: 6px; }
.rs-score-items li { display: grid; grid-template-columns: 1fr 80px auto; align-items: center; gap: 8px; font-size: 12px; color: #4b5563; }
.rs-score-items li i { display: block; height: 6px; border-radius: 999px; background: #e5e7eb; position: relative; overflow: hidden; }
.rs-score-items li i::after { content: ''; position: absolute; inset: 0; width: var(--w, 0%); background: linear-gradient(90deg, #f43f5e, #db2777); border-radius: 999px; }
.rs-score-items li b { font-weight: 800; color: #111827; font-variant-numeric: tabular-nums; }

/* ความเห็น: กรรมการ = ฟ้า · อาจารย์ที่ปรึกษา = ชมพู */
.rs-cm-item.rs-cm-committee { border-color: #7dd3fc; border-left: 5px solid #0284c7; background: #f0f9ff; }
.rs-cm-item.rs-cm-teacher { border-color: #fda4af; border-left: 5px solid #e11d48; background: #fff1f2; }
.rs-cm-role { font-weight: 800; padding: 1px 7px; border-radius: 6px; margin-right: 2px; }
.rs-cm-committee .rs-cm-role { background: #0284c7; color: #fff; }
.rs-cm-teacher .rs-cm-role { background: #e11d48; color: #fff; }
.rs-cm-count-committee { background: #0284c7; } .rs-cm-count-teacher { background: #e11d48; }
.rs-result-opt input:checked + span { transform: translateY(-1px); }

/* ประวัติเข้าพบอาจารย์ที่ปรึกษา */
.rs-consult-list { display: flex; flex-direction: column; gap: 10px; }
.rs-consult-item { display: flex; gap: 12px; background: #fff; border: 1px solid #fecdd3; border-left: 5px solid #f59e0b; border-radius: 14px; padding: 12px 14px; font-family: -apple-system, 'Sarabun', sans-serif; }
.rs-consult-item.is-ack { border-left-color: #059669; }
.rs-consult-no { width: 28px; height: 28px; border-radius: 9px; background: linear-gradient(135deg, #e11d48, #db2777); color: #fff; font-weight: 800; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }

/* สถานะปัจจุบัน (นักศึกษา) */
.rs-stage-card { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, #fff1f2, #fdf2f8); border: 1px solid #fecdd3; border-radius: 16px; padding: 14px 16px; }
.rs-stage-icon { width: 46px; height: 46px; border-radius: 14px; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex: 0 0 auto; box-shadow: 0 8px 18px rgba(225,29,72,.2); }
/* เข้าพบอาจารย์ที่ปรึกษา */
.rs-consult-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 12px; color: #6b7280; }
.rs-consult-when { font-weight: 800; color: #1f2937; font-size: 14px; } .rs-consult-when i { color: #e11d48; margin-right: 5px; }
.rs-consult-who i { margin-right: 4px; }
.rs-consult-pin { display: inline-flex; align-items: center; gap: 5px; border: 1px solid #fecdd3; background: #fff1f2; color: #be123c; font-weight: 700; font-size: 11px; padding: 3px 9px; border-radius: 999px; cursor: pointer; }
.rs-consult-pin:hover { background: #e11d48; color: #fff; }
.rs-consult-pin.is-none { border-color: #e5e7eb; background: #f9fafb; color: #9ca3af; cursor: default; }
.rs-consult-badge { margin-left: auto; font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 999px; }
.rs-consult-badge.ok { background: #d1fae5; color: #047857; } .rs-consult-badge.wait { background: #fef3c7; color: #b45309; }
.rs-consult-map { margin-top: 10px; border: 1px solid #fecdd3; border-radius: 12px; overflow: hidden; background: #fff; }
.rs-consult-map iframe { width: 100%; height: 240px; border: 0; display: block; }
.rs-geo-chip { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12px; padding: 6px 12px; border-radius: 999px; background: #f3f4f6; color: #6b7280; }
.rs-geo-chip.is-ok { background: #d1fae5; color: #047857; } .rs-geo-chip.is-off { background: #fee2e2; color: #b91c1c; }

/* ไทม์ไลน์ประวัติ (แบบเรียบ ไม่มีกรอบ) */
.rs-tl { list-style: none; margin: 0; padding: 0; position: relative; }
.rs-tl::before { content: ''; position: absolute; left: 11px; top: 10px; bottom: 10px; width: 2px; background: #f3f4f6; }
.rs-tl-item { position: relative; display: flex; gap: 10px; align-items: flex-start; padding: 5px 0; }
.rs-tl-dot { width: 24px; height: 24px; border-radius: 50%; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 10px; flex: 0 0 auto; box-shadow: 0 0 0 3px #fff; z-index: 1; }
.rs-tl-body { flex: 1; min-width: 0; padding-top: 2px; }
.rs-tl-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.rs-tl-event { font-weight: 800; font-size: 13px; }
.rs-tl-when, .rs-tl-by { font-size: 11px; color: #9ca3af; white-space: nowrap; } .rs-tl-when i, .rs-tl-by i { margin-right: 4px; }
.rs-tl-latest { font-size: 10px; font-weight: 800; background: #e11d48; color: #fff; padding: 0 7px; border-radius: 999px; line-height: 16px; }
.rs-tl-detail { margin: 1px 0 0; font-size: 11.5px; color: #6b7280; line-height: 1.45; white-space: pre-line; }
/* ตารางเข้าพบอาจารย์ที่ปรึกษา */
.rs-consult-wrap { border: 1px solid #fecdd3; border-radius: 14px; overflow: auto; background: #fff; }
.rs-consult-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
.rs-consult-table th { background: #fff1f2; color: #9f1239; font-size: 11px; font-weight: 800; text-align: left; padding: 9px 12px; }
.rs-consult-table td { padding: 10px 12px; border-top: 1px solid #f3f4f6; vertical-align: top; }
.rs-consult-table tr.is-pending td { background: #fffbeb; }
.rs-consult-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.rs-consult-badge.bad { background: #fee2e2; color: #b91c1c; }

.rs-tl-link { font-size: 10px; font-weight: 800; color: #b45309; background: #fef3c7; border: 0; padding: 1px 8px; border-radius: 999px; cursor: pointer; } .rs-tl-link:hover { background: #f59e0b; color: #fff; }
/* ตัวแบ่งบรรทัดแบบ Word (Shift+Enter) */
.rs-doc-page .ql-editor br.ql-softbreak { display: inline; }

/* แถบสลับส่วน (เขียนทั้งหมด) */
.rs-nav-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid #fecdd3; background: #fff; color: #be123c; font-size: 12px; cursor: pointer; } .rs-nav-btn:disabled { opacity: .35; cursor: default; }
.rs-nav-chips { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; }
.rs-nav-chip { padding: 4px 11px; border-radius: 999px; border: 1px solid #fecdd3; background: #fff; color: #9f1239; font-size: 12px; font-weight: 700; cursor: pointer; }
.rs-nav-chip.is-ok { border-color: #6ee7b7; background: #ecfdf5; color: #047857; }
.rs-nav-chip.is-ok:hover { background: #d1fae5; }
.rs-nav-chip.is-on { background: linear-gradient(135deg, #059669, #10b981); color: #fff; border-color: transparent; box-shadow: 0 6px 14px rgba(5,150,105,.3); }
.rs-nav-chip.is-locked { border-color: #fecaca; background: #fef2f2; color: #b91c1c; cursor: not-allowed; opacity: .9; }

/* หน้าเขียน: ขอบซ้าย-ขวาเท่านั้น เส้นแบ่งหน้าคำนวณจากบรรทัดจริง (rs-page-mark) */
#rs-chapter-page { background-image: linear-gradient(to right, transparent 38.1mm, rgba(148,163,184,.25) 38.1mm, rgba(148,163,184,.25) calc(38.1mm + 1px), transparent calc(38.1mm + 1px), transparent calc(210mm - 25.4mm - 1px), rgba(148,163,184,.25) calc(210mm - 25.4mm - 1px), rgba(148,163,184,.25) calc(210mm - 25.4mm), transparent calc(210mm - 25.4mm)); background-size: 100% 100%; background-repeat: no-repeat; }
#rs-chapter-page.rs-doc-tools { background-image: none; }
.rs-page-band { position: absolute; left: 0; right: 0; background: #e5e7eb; pointer-events: none; z-index: 2; box-shadow: inset 0 1px 0 #cbd5e1, inset 0 -1px 0 #cbd5e1; }
/* ตัวคั่นหน้า (embed ชั่วคราว): บรรทัดเปล่าสูงเท่าขอบล่าง+แถบคั่น+ขอบบน วาดแถบเทากว้างเต็มกระดาษ */
.ql-editor .ql-pagegap { display: inline-block; vertical-align: top; width: calc(100% + var(--rs-ml, 0px) + var(--rs-mr, 0px)); margin-left: calc(-1 * var(--rs-ml, 0px)); height: var(--rs-gap, 260px); line-height: 0; font-size: 0;
    background: linear-gradient(to bottom, #fff 0, #fff var(--rs-mb, 96px), #e5e7eb var(--rs-mb, 96px), #e5e7eb calc(var(--rs-mb, 96px) + var(--rs-sep, 28px)), #fff calc(var(--rs-mb, 96px) + var(--rs-sep, 28px)));
    box-shadow: inset 0 var(--rs-mb, 96px) 0 -1px transparent; pointer-events: none; user-select: none; }
.rs-doc-fixed .ql-pagegap, .rs-doc-body .ql-pagegap { display: none; }
.rs-tl-cm .rs-cm-sum-head { font-size: 13px; } .rs-tl-cm .rs-cm-text { font-size: 13px; }

/* การ์ดเลือกกรรมการ (ทันสมัย) */
.rs-cm-card { display: block; cursor: pointer; }
.rs-cm-card-in { display: flex; align-items: center; gap: 10px; border: 2px solid #e5e7eb; border-radius: 14px; padding: 8px 10px; background: #fff; transition: all .15s; }
.rs-cm-card:hover .rs-cm-card-in { border-color: #fda4af; }
.rs-cm-avatar { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #e11d48, #db2777); color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.rs-cm-check { margin-left: auto; width: 22px; height: 22px; border-radius: 50%; border: 2px solid #e5e7eb; color: transparent; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; flex: 0 0 auto; }
.rs-cm-card input:checked + .rs-cm-card-in .rs-cm-check { background: #e11d48; border-color: #e11d48; color: #fff; }
/* แถบสลับส่วนในหน้าอ่าน (พอร์ทัลกรรมการ) */
.rc-jump { position: sticky; top: 8px; z-index: 20; display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; border-radius: 14px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border: 1px solid #fbcfe8; margin-bottom: 12px; }
.rc-jump button { font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 999px; border: 1px solid #fbcfe8; background: #fff; color: #9d174d; cursor: pointer; }
.rc-jump button:hover { background: #fdf2f8; } .rc-jump button.is-on { background: linear-gradient(135deg, #ec4899, #be185d); color: #fff; border-color: transparent; }

.rc-jump { top: 8px; }

/* ฟอร์มให้คะแนน (พอร์ทัลกรรมการ) */
.rc-score-row { display: flex; align-items: center; gap: 12px; border: 2px solid #f1f5f9; border-radius: 14px; padding: 10px 12px; background: #fff; transition: border-color .15s; }
.rc-score-row.is-done { border-color: #f9a8d4; background: #fdf2f8; }
.rc-score-no { width: 28px; height: 28px; border-radius: 9px; background: linear-gradient(135deg, #ec4899, #be185d); color: #fff; font-weight: 800; font-size: 12px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.rc-score-bar { height: 6px; border-radius: 999px; background: #e5e7eb; margin-top: 6px; overflow: hidden; } .rc-score-bar i { display: block; height: 100%; background: linear-gradient(90deg, #f472b6, #be185d); border-radius: 999px; transition: width .2s; }
.rc-score-input { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.rc-score-input button { width: 30px; height: 30px; border-radius: 9px; border: 1px solid #fbcfe8; background: #fff; color: #be185d; cursor: pointer; } .rc-score-input button:hover { background: #fdf2f8; }
.rc-score-input input { width: 64px; height: 40px; text-align: center; font-weight: 900; font-size: 18px; border: 2px solid #fbcfe8; border-radius: 12px; outline: none; color: #831843; -moz-appearance: textfield; }
.rc-score-input input::-webkit-outer-spin-button, .rc-score-input input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.rc-score-input input:focus { border-color: #ec4899; box-shadow: 0 0 0 4px rgba(236,72,153,.15); }
.rc-score-max { font-size: 12px; color: #9ca3af; font-weight: 700; white-space: nowrap; }
.rc-score-total { display: flex; align-items: center; gap: 14px; margin-top: 10px; padding: 12px 16px; border-radius: 16px; background: #fdf2f8; border: 1px solid #fbcfe8; }
.rc-score-ring { width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(#db2777 calc(var(--p) * 1%), #e5e7eb 0); display: grid; place-items: center; flex: 0 0 auto; }
.rc-score-ring > div { width: 50px; height: 50px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; color: #db2777; }
.rc-jump-score { margin-left: auto; background: linear-gradient(135deg, #ec4899, #be185d) !important; color: #fff !important; border-color: transparent !important; box-shadow: 0 6px 14px rgba(190,24,93,.3); }
.rc-jump-done { margin-left: auto; font-size: 12px; font-weight: 700; color: #047857; background: #d1fae5; padding: 4px 11px; border-radius: 999px; }

/* ป็อปอัปให้คะแนน (พอร์ทัล) */
.rc-score-popup { border-radius: 26px !important; padding: 0 0 1.4em !important; overflow: hidden; }
.rc-score-popup .swal2-html-container { margin: 0; padding: 0 1.4em; }
.rc-score-head { background: linear-gradient(120deg, #db2777, #be185d 60%, #9d174d); color: #fff; text-align: left; padding: 20px 24px 18px; margin: 0 -1.4em 14px; }
.rc-score-kicker { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .85; margin: 0; }
.rc-score-title { font-size: 20px; font-weight: 800; line-height: 1.25; margin: 4px 0 6px; }
.rc-score-sub { font-size: 13px; opacity: .9; margin: 0; }

/* การ์ดแสดงความยินดี (สอบจบผ่าน) */
.rs-congrats { position: relative; overflow: hidden; border-radius: 22px; color: #fff; text-align: center; padding: 26px 20px; background: linear-gradient(135deg, #e11d48 0%, #db2777 45%, #7c3aed 100%); box-shadow: 0 20px 40px -18px rgba(219,39,119,.6); }
.rs-congrats-bg { position: absolute; inset: 0; background: radial-gradient(circle at 20% 20%, rgba(255,255,255,.25), transparent 40%), radial-gradient(circle at 85% 70%, rgba(255,255,255,.18), transparent 45%); }
.rs-congrats-in { position: relative; z-index: 1; }
.rs-congrats-badge { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 10px; background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.5); display: flex; align-items: center; justify-content: center; font-size: 30px; animation: rs-pop .7s cubic-bezier(.2,.9,.3,1.3) both; }
.rs-congrats-kicker { font-size: 12px; font-weight: 800; letter-spacing: .2em; text-transform: uppercase; opacity: .9; margin: 0; }
.rs-congrats-title { font-size: 28px; font-weight: 900; margin: 2px 0 4px; }
.rs-congrats-sub { font-size: 14px; opacity: .92; margin: 0; }
.rs-confetti { position: absolute; top: -10px; font-size: 22px; animation: rs-fall 3.2s linear infinite; opacity: .9; }
@keyframes rs-fall { 0% { transform: translateY(-20px) rotate(0); } 100% { transform: translateY(260px) rotate(360deg); opacity: 0; } }
@keyframes rs-pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
/* พิมพ์เป็น PDF: แสดงเฉพาะตัวเล่มในหน้าอ่าน */
@media print {
    body.rs-printing > *:not(#modal-research-chapter-view) { display: none !important; }
    body.rs-printing { overflow: visible !important; height: auto !important; }
    body.rs-printing #modal-research-chapter-view { position: static !important; display: block !important; background: #fff !important; padding: 0 !important; backdrop-filter: none !important; }
    body.rs-printing #modal-research-chapter-view > div { max-width: none !important; height: auto !important; box-shadow: none !important; border-radius: 0 !important; overflow: visible !important; }
    body.rs-printing #modal-research-chapter-view > div > div:first-child { display: none !important; }
    body.rs-printing #rs-chapter-view-scroll { overflow: visible !important; padding: 0 !important; background: #fff !important; }
    body.rs-printing #rs-chapter-view-pages > * { margin: 0 !important; }
    body.rs-printing .rs-doc-page { width: 210mm !important; max-width: none !important; height: 297mm !important; min-height: 0 !important; overflow: hidden !important; animation: none !important; background-image: none !important; page-break-after: always; break-after: page; }
    body.rs-printing .rs-doc-page:last-child { page-break-after: auto; break-after: auto; }
    body.rs-printing .rs-doc-cm-panel, body.rs-printing .rs-doc-cm-summary, body.rs-printing .rs-sel-btn, body.rs-printing .rs-hl { display: none !important; }
    body.rs-printing mark[data-cid] { background: transparent !important; }
}

/* แดชบอร์ด: วงแหวนเข้าปรึกษา */
.rs-dash-ring { --p: 0; width: 46px; height: 46px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center;
    background: conic-gradient(#f43f5e calc(var(--p) * 1%), #fee2e2 0); }
.rs-dash-ring > span { width: 36px; height: 36px; border-radius: 50%; background: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 13px; color: #be123c; }
.rs-dash-ring small { font-size: 10px; color: #9ca3af; font-weight: 700; }
/* แดชบอร์ด: การ์ดขั้นตอน (คลิกเพื่อกรอง) */
.rs-dash-card { position: relative; text-align: left; background: #fff; border: 2px solid #f3f4f6; border-radius: 18px; padding: 14px 14px 12px; display: flex; flex-direction: column; gap: 4px; box-shadow: 0 4px 14px rgba(17,24,39,.04); transition: .18s; cursor: pointer; }
.rs-dash-card:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(225,29,72,.10); border-color: #fecdd3; }
.rs-dash-card-on { box-shadow: 0 10px 24px rgba(225,29,72,.14); }
.rs-dash-card-on::after { content: '\f00c'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; top: 10px; right: 12px; font-size: 11px; color: #e11d48; }
.rs-dash-step { position: absolute; top: 10px; right: 12px; width: 20px; height: 20px; border-radius: 50%; color: #fff; font-size: 10px; font-weight: 900; display: flex; align-items: center; justify-content: center; }
.rs-dash-card-on .rs-dash-step { display: none; }
.rs-dash-ico { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 15px; }
.rs-dash-num { font-size: 28px; font-weight: 900; color: #111827; line-height: 1.1; margin-top: 4px; }
.rs-dash-lbl { font-size: 13px; font-weight: 800; color: #374151; line-height: 1.2; }
.rs-dash-sub { display: flex; flex-wrap: wrap; gap: 4px; font-size: 10.5px; color: #6b7280; margin-top: 2px; min-height: 18px; }
.rs-dash-chip { background: #f9fafb; border: 1px solid #f3f4f6; border-radius: 999px; padding: 1px 7px; white-space: nowrap; }
.rs-dash-chip b { color: #111827; }
/* แบนเนอร์ "อนุมัติผลสอบจบแล้ว" (หน้าผลการลงทะเบียน / เข้าพบอาจารย์) */
.rs-approved-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 20px; color: #fff; background: linear-gradient(120deg, #059669, #14b8a6 60%, #0ea5e9); box-shadow: 0 16px 34px -16px rgba(5,150,105,.7); position: relative; overflow: hidden; }
.rs-approved-banner::before { content: ''; position: absolute; inset: -40% -20%; background: radial-gradient(circle at 15% 30%, rgba(255,255,255,.28), transparent 35%); pointer-events: none; }
.rs-approved-seal { width: 54px; height: 54px; border-radius: 50%; flex: none; background: rgba(255,255,255,.18); border: 2px solid rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center; font-size: 24px; animation: rs-pop .6s cubic-bezier(.2,.9,.3,1.3) both; }
.rs-approved-kicker { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; opacity: .9; }
.rs-approved-title { margin: 1px 0 2px; font-size: 19px; font-weight: 900; line-height: 1.2; }
.rs-approved-sub { margin: 0; font-size: 12px; opacity: .92; }
/* แดชบอร์ด: ลูกเล่นการ์ด/แถว */
.rs-dash-card { animation: rs-dash-in .45s cubic-bezier(.2,.8,.3,1) both; overflow: hidden; }
.rs-dash-card::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--rs-dash-accent, #e11d48); opacity: .85; }
.rs-dash-card::after { content: ''; position: absolute; top: -60%; left: -40%; width: 40%; height: 220%; background: linear-gradient(105deg, transparent, rgba(255,255,255,.55), transparent); transform: rotate(12deg); transition: left .6s; pointer-events: none; }
.rs-dash-card:hover::after { left: 120%; }
.rs-dash-card-on::before { height: 5px; }
.rs-dash-all { --rs-dash-accent: linear-gradient(90deg, #e11d48, #db2777); }
.rs-dash-gray { --rs-dash-accent: #9ca3af; } .rs-dash-amber { --rs-dash-accent: #f59e0b; } .rs-dash-sky { --rs-dash-accent: #0ea5e9; } .rs-dash-rose { --rs-dash-accent: #f43f5e; }
.rs-dash-violet { --rs-dash-accent: #8b5cf6; } .rs-dash-fuchsia { --rs-dash-accent: #d946ef; } .rs-dash-emerald { --rs-dash-accent: #10b981; }
.rs-dash-card-on .rs-dash-ico { animation: rs-pop .5s cubic-bezier(.2,.9,.3,1.3) both; }
@keyframes rs-dash-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.rs-dash-row { animation: rs-dash-in .4s ease both; }
.rs-dash-mine { background: linear-gradient(90deg, #fff1f2, #fff); box-shadow: inset 3px 0 0 #e11d48; }
.rs-dash-mine:hover { background: #ffe4e6; }
.rs-dash-locked { color: #6b7280; }
.rs-dash-view { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 800; color: #e11d48; background: #fff1f2; border: 1px solid #fecdd3; border-radius: 999px; padding: 2px 9px; }
.rs-dash-lock { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; color: #9ca3af; background: #f9fafb; border: 1px dashed #e5e7eb; border-radius: 999px; padding: 2px 9px; }
/* ===== มือถือ/แท็บเล็ต: ระบบวิจัย ===== */
@media (max-width: 640px) {
    .rs-congrats { padding: 20px 14px; border-radius: 18px; } .rs-congrats-title { font-size: 22px; }
    .rs-approved-banner { padding: 14px; } .rs-approved-title { font-size: 16px; }
    .rs-dash-card { padding: 12px 10px 10px; } .rs-dash-num { font-size: 24px; } .rs-dash-lbl { font-size: 12px; }
    .rs-dash-ring { width: 40px; height: 40px; } .rs-dash-ring > span { width: 31px; height: 31px; font-size: 12px; }
    .rs-score-grid { grid-template-columns: 1fr; }
    .rc-jump { top: 4px; padding: 6px 8px; gap: 4px; } .rc-jump button { font-size: 11px; padding: 3px 9px; }
    .rc-score-popup { width: 96vw !important; }
    /* หน้าอ่าน: ช่องคอมเมนต์วางใต้กระดาษแทนข้าง ๆ */
    .rs-doc-cm-panel { max-width: none; }
    /* ปุ่มยาวเกินจอ → ตัดบรรทัด */
    .rs-stage-card .flex, .rs-stage-actions { flex-wrap: wrap; }
}
/* ปก: โลโก้กลางหน้า */
.rs-doc-cover .rs-cover-logo { width: 3.6cm; height: 3.6cm; object-fit: contain; margin: 0 auto; display: block; }
.rs-doc-cover .rs-cover-logo + .rs-cover-title { margin-top: 1.4cm; }
/* หน้าอ่าน: พื้นเทาเข้มขึ้น + เงากระดาษ ให้เห็นเป็นแผ่น A4 ชัดเจน */
#rs-chapter-view-scroll { background: #d9dde3 !important; }
#rs-chapter-view-pages .rs-doc-page { box-shadow: 0 1px 3px rgba(0,0,0,.18), 0 8px 24px rgba(0,0,0,.16); border-radius: 0; }
/* ลายเซ็นออนไลน์บนหน้าการอนุมัติ */
.rs-sign-line { height: 2.2em; display: flex; align-items: flex-end; justify-content: center; border-bottom: 1px dotted #000; width: 62%; margin: 0 auto !important; }
.rs-sign-right .rs-sign-line { width: 82%; }
.rs-sign-img { max-height: 2.6em; max-width: 100%; margin-bottom: -.1em; }
.rs-sign-date { font-size: .95em; }
/* จุดยืดที่รอยต่อคำไทย (กระจายแบบไทย) — ความกว้าง 0 */
.rs-jsp { font-size: 0; }
/* ขั้นการอนุมัติผลสอบจบ (ที่ปรึกษารับรอง → ประธานอนุมัติ) */
.rs-approve-steps { display: grid; gap: 8px; }
.rs-approve-step { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; border: 1px solid #e5e7eb; background: #fff; font-size: 13px; color: #374151; }
.rs-approve-dot { width: 30px; height: 30px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; background: #9ca3af; }
.rs-approve-step.is-done { border-color: #a7f3d0; background: #ecfdf5; } .rs-approve-step.is-done .rs-approve-dot { background: #10b981; }
.rs-approve-step.is-wait { border-color: #fde68a; background: #fffbeb; } .rs-approve-step.is-wait .rs-approve-dot { background: #f59e0b; animation: rs-pulse 1.6s infinite; }
@keyframes rs-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(245,158,11,.45); } 50% { box-shadow: 0 0 0 8px rgba(245,158,11,0); } }
/* การ์ดลายเซ็นออนไลน์ (หน้าข้อมูลส่วนตัวอาจารย์) */
.rs-sig-preview { border: 1px solid #e5e7eb; border-radius: 16px; background: repeating-linear-gradient(0deg, #fff 0 28px, #f9fafb 28px 29px); padding: 22px 16px 14px; text-align: center; min-height: 170px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; font-family: 'TH Sarabun Web', 'TH Sarabun Gov', 'TH SarabunPSK', 'Sarabun', serif; color: #000; }
.rs-sig-preview img { max-height: 64px; max-width: 80%; margin-bottom: -6px; }
.rs-sig-preview-name { margin: 6px 0 0; font-size: 16pt; border-top: 1px dotted #000; padding-top: 4px; min-width: 60%; }
.rs-sig-preview-role { margin: 0; font-size: 15pt; }
.rs-sig-tabs { display: flex; gap: 6px; margin-bottom: 10px; }
.rs-sig-tabs button { flex: 1; padding: 7px 10px; border-radius: 10px; border: 1px solid #e5e7eb; background: #fff; font-size: 12px; font-weight: 700; color: #6b7280; }
.rs-sig-tabs button.is-on { background: #fff1f2; border-color: #fda4af; color: #be123c; }
.rs-sig-canvas { width: 100%; height: auto; border: 2px dashed #fda4af; border-radius: 14px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.rs-sig-drop { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 26px 16px; border: 2px dashed #e5e7eb; border-radius: 14px; cursor: pointer; background: #fafafa; }
.rs-sig-drop:hover { border-color: #fda4af; background: #fff1f2; }
.rs-chair-btn { color: #b45309; background: #fffbeb; } .rs-chair-btn.is-on { color: #fff; background: linear-gradient(135deg, #f59e0b, #d97706); box-shadow: 0 4px 12px rgba(217,119,6,.35); }
/* มือถือ (iOS Safari): ห้ามขยายตัวอักษรอัตโนมัติ — ไม่งั้นวัดแบ่งหน้าคลาดเคลื่อน เกิดที่ว่างท้ายหน้า */
#rs-chapter-view-pages, #rs-chapter-view-pages *, .rs-doc-page, #rs-chapter-page { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* ===== ฐานข้อมูลวิชาการ (ห้องสมุดวิจัย) ===== */
.rs-lib-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 26px; border-radius: 24px; color: #fff; background: linear-gradient(120deg, #9f1239, #e11d48 55%, #f472b6); box-shadow: 0 18px 40px -20px rgba(225,29,72,.7); position: relative; overflow: hidden; }
.rs-lib-hero::after { content: '\f02d'; font-family: 'Font Awesome 6 Free'; font-weight: 900; position: absolute; right: 130px; bottom: -30px; font-size: 150px; opacity: .08; }
.rs-lib-kicker { margin: 0; font-size: 11px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; opacity: .9; }
.rs-lib-title { margin: 2px 0 4px; font-size: 26px; font-weight: 900; }
.rs-lib-sub { margin: 0; font-size: 13px; opacity: .92; max-width: 640px; }
.rs-lib-stat { flex: none; text-align: center; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.4); border-radius: 18px; padding: 10px 18px; min-width: 84px; }
.rs-lib-stat span { display: block; font-size: 30px; font-weight: 900; line-height: 1; } .rs-lib-stat small { font-size: 11px; opacity: .9; }
.rs-lib-chip { padding: 5px 12px; border-radius: 999px; border: 1px solid #e5e7eb; background: #fff; font-size: 12px; font-weight: 700; color: #6b7280; }
.rs-lib-chip.is-on { background: #e11d48; border-color: #e11d48; color: #fff; }
.rs-lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.rs-lib-card { display: flex; gap: 0; background: #fff; border: 1px solid #f3f4f6; border-radius: 20px; overflow: hidden; box-shadow: 0 6px 18px rgba(17,24,39,.05); transition: .18s; animation: rs-dash-in .45s ease both; }
.rs-lib-card:hover { transform: translateY(-3px); box-shadow: 0 16px 30px rgba(225,29,72,.12); border-color: #fecdd3; }
.rs-lib-cover { flex: 0 0 96px; background: linear-gradient(160deg, #fff1f2, #fce7f3); display: flex; align-items: center; justify-content: center; position: relative; border-right: 1px solid #fee2e2; }
.rs-lib-cover > i { font-size: 30px; color: #f43f5e; opacity: .85; }
.rs-lib-year { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; color: #be123c; background: #fff; border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.rs-lib-info { flex: 1; min-width: 0; padding: 14px 16px; display: flex; flex-direction: column; }
.rs-lib-name { margin: 0; font-size: 15px; font-weight: 800; color: #111827; line-height: 1.3; }
.rs-lib-en { margin: 2px 0 0; font-size: 12px; font-style: italic; color: #6b7280; }
.rs-lib-meta { margin: 6px 0 0; font-size: 12px; color: #4b5563; display: flex; gap: 6px; align-items: flex-start; } .rs-lib-meta i { color: #f43f5e; margin-top: 3px; font-size: 10px; }
.rs-lib-abs { margin: 8px 0 0; font-size: 12px; color: #6b7280; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.rs-lib-actions { margin-top: auto; padding-top: 12px; display: flex; gap: 8px; }
.rs-lib-btn { padding: 7px 12px; border-radius: 10px; border: 1px solid #e5e7eb; background: #fff; font-size: 12px; font-weight: 800; color: #374151; }
.rs-lib-btn.primary { background: #e11d48; border-color: #e11d48; color: #fff; box-shadow: 0 6px 14px rgba(225,29,72,.25); }
@media (max-width: 640px) { .rs-lib-hero { padding: 18px; } .rs-lib-title { font-size: 21px; } .rs-lib-hero::after { display: none; } .rs-lib-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .rs-lib-card { flex-direction: column; } .rs-lib-cover { flex: none; height: 64px; border-right: 0; border-bottom: 1px solid #fee2e2; } .rs-lib-year { left: auto; right: 12px; transform: none; bottom: auto; top: 50%; margin-top: -10px; } }
/* ส่วนหน้าของเล่มใช้ฟอนต์เดียวกับเนื้อหาบท (ตามฟอนต์ที่ใช้มากที่สุดในบทที่ 1) */
.rs-doc-page.rs-pf-thsarabunpsk { font-family: 'TH Sarabun Web', 'TH Sarabun Gov', 'TH SarabunPSK', 'Sarabun Doc', sans-serif; }
.rs-doc-page.rs-pf-thsarabunnew { font-family: 'TH Sarabun New', 'TH Sarabun Web', 'TH Sarabun Gov', 'TH SarabunPSK', 'Sarabun Doc', sans-serif; }
.rs-doc-page.rs-pf-sarabun { font-family: 'Sarabun Doc', 'Sarabun', 'Noto Sans Thai', sans-serif; }
.rs-doc-page.rs-pf-angsana { font-family: 'Angsana New', 'AngsanaUPC', 'TH Sarabun Web', 'TH Sarabun Gov', serif; }
.rs-doc-page.rs-pf-tahoma { font-family: Tahoma, sans-serif; font-size: 13pt; }
.rs-doc-page.rs-pf-times { font-family: 'Times New Roman', Times, serif; }
.rs-doc-page.rs-pf-arial { font-family: Arial, Helvetica, sans-serif; font-size: 13pt; }
/* ส่งออก PDF: ซ่อนเส้นไกด์/เงา ให้ภาพหน้ากระดาษสะอาด */
body.rs-exporting #rs-chapter-view-pages .rs-doc-page { background-image: none !important; box-shadow: none !important; }
body.rs-exporting #rs-chapter-view-pages .rs-doc-cm-panel, body.rs-exporting .rs-sel-btn { display: none !important; }
.rs-pdf-bar { height: 8px; border-radius: 999px; background: #fee2e2; overflow: hidden; margin-top: 10px; }
.rs-pdf-bar > div { height: 100%; width: 0; background: linear-gradient(90deg, #e11d48, #db2777); transition: width .2s; }
.rs-pen-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid #e5e7eb; background: #fff; display: flex; align-items: center; justify-content: center; }
.rs-pen-btn span { display: block; border-radius: 50%; background: #0b1f5c; }
.rs-pen-btn.is-on { border-color: #e11d48; background: #fff1f2; box-shadow: 0 0 0 2px rgba(225,29,72,.15); }

/* ===== ฟอนต์เดียวทั้งระบบ: TH SarabunPSK =====
   ตามที่กำหนดให้รูปเล่มใช้ฟอนต์เดียว — เนื้อหาเก่าที่เคยเลือกฟอนต์อื่นไว้ (คลาส ql-font-* /
   หน้า rs-pf-*) ถูกบังคับกลับมาเป็นฟอนต์เอกสารทั้งหมด ทั้งหน้าเขียน หน้าอ่าน ปก และหน้าที่ระบบสร้าง
   (ประกาศไว้ท้ายไฟล์เพื่อให้ชนะกฎฟอนต์ของแต่ละคลาสด้านบน) */
:root { --rs-doc-font: 'TH Sarabun Web', 'TH Sarabun Gov', 'TH SarabunPSK', 'TH Sarabun New', 'Sarabun Doc', 'Sarabun', sans-serif; }
/* ต้องครอบ "ลูกทุกตัว" ด้วย เพราะ 01-base.css มีกฎระดับโลก
   `* { font-family: 'Sarabun', … !important }` ที่ทับทุก element โดยตรง
   (ตัวลูกจึงไม่ได้ฟอนต์ของหน้ากระดาษจากการสืบทอด) — ข้อความที่ไม่มีคลาส ql-font-*
   เช่น หน้าปก/สารบัญ/ย่อหน้าที่พิมพ์เอง จึงกลายเป็น Sarabun ทั้งที่หน้าบทเป็น TH SarabunPSK
   ยกเว้นไอคอน Font Awesome ไว้ ไม่งั้นไอคอนจะกลายเป็นตัวอักษร */
.rs-doc-page, .rs-doc-page .ql-editor,
.rs-doc-page *:not(i):not(.fas):not(.far):not(.fab):not(.fa):not(.rs-sel-btn),
.rs-doc-page.rs-pf-thsarabunpsk, .rs-doc-page.rs-pf-thsarabunnew, .rs-doc-page.rs-pf-sarabun,
.rs-doc-page.rs-pf-angsana, .rs-doc-page.rs-pf-tahoma, .rs-doc-page.rs-pf-times, .rs-doc-page.rs-pf-arial {
    font-family: var(--rs-doc-font) !important;
}
/* กฎเดียวกันนั้นยังตั้ง line-height: 1.55 ให้ลูกทุกตัว (ไม่ใช่ !important) ซึ่งชนะการสืบทอด
   ระยะบรรทัดของย่อหน้าจึงไม่ใช่ 1.31 (= "1 เท่า" ของ Word) ตามที่หน้ากระดาษตั้งไว้ */
.rs-doc-page *:not(i):not(.fas):not(.far):not(.fab):not(.fa) { line-height: inherit; }
/* คลาสฟอนต์เก่าบางตัวย่อขนาดไว้ (.ql-font-tahoma/-arial = .8em, rs-pf-tahoma = 13pt) — คืนเป็นขนาดเดียวกันทั้งเล่ม */
.rs-doc-page [class*="ql-font-"], .rs-doc-page .ql-editor [class*="ql-font-"] { font-size: inherit !important; }
.rs-doc-page.rs-pf-tahoma, .rs-doc-page.rs-pf-arial { font-size: 16pt !important; }

/* ป้ายตัวเลือก "ปกติ" ของเมนูระยะบรรทัด/ระยะห่างอักษร (ตัวเลือกว่าง = ล้างค่า เหมือนกด 1.0 / 0 pt ใน Word) */
#rs-chapter-toolbar .ql-picker.ql-lineheight .ql-picker-item:not([data-value])::before { content: 'ปกติ (1 เท่า)'; }
#rs-chapter-toolbar .ql-picker.ql-letterspacing .ql-picker-item:not([data-value])::before { content: 'ปกติ (0 pt)'; }

/* ---------- ตารางในหน้ากระดาษ vs กฎระดับโลกของเว็บ (02-components-2.css) ----------
   กฎเหล่านี้ทับตารางทุกตารางของทั้งเว็บด้วย !important ซึ่ง inline style ของช่องสู้ไม่ได้:
     table tbody td { border-bottom: 1px solid var(--line-soft) !important }  → เส้นล่างทุกช่องกลายเป็นสีเกือบขาว
     table tbody tr:last-child td { border-bottom: none !important }          → แถวสุดท้ายไม่มีเส้นล่าง
     table tbody tr:hover { background-color: var(--brand-50) !important }    → แถวที่เมาส์ชี้เป็นสีชมพู
     table thead th { font-size: .78rem; color: เทา; background: เทา !important }
   วิธีสู้: ช่องเก็บเส้นล่างของตัวเองไว้ในตัวแปร --rs-bb (research-table-border.js / research-paste-word.js เขียนให้)
   แล้วกฎที่เจาะจงกว่านี้วาดเส้นล่างจากตัวแปรนั้นด้วย !important — ช่องที่ไม่มีตัวแปร = เส้นครบตามค่าเริ่มต้น */
.rs-doc-page .ql-editor table tbody td, .rs-doc-page .ql-editor table tbody th,
.rs-doc-page .ql-editor table thead td, .rs-doc-page .ql-editor table thead th { border-bottom: var(--rs-bb, 1px solid #000) !important; }
.rs-doc-page .ql-editor table tbody tr:hover:not([style*="background"]) { background-color: transparent !important; }
.rs-doc-page .ql-editor table thead th { font-size: inherit !important; font-weight: inherit !important; color: inherit !important; letter-spacing: inherit; white-space: normal; }
.rs-doc-page .ql-editor table thead th:not([style*="background"]) { background-color: transparent !important; }
/* ตัว <table> ไม่วาดเส้นเอง (ตารางจาก Word มี border="1" → เบราว์เซอร์วาดกรอบนูนที่เมนูเส้นขอบลบไม่ได้) */
.rs-doc-page .ql-editor table, .rs-doc-page .ql-editor table[border] { border: 0 !important; }

/* ปุ่มแทรกตาราง (ตารางเลือกขนาดของ quill-table-better อยู่ "ข้างใน" <button>):
   กฎระดับโลก `button:active { transform: translateY(1px) }` (02-components-2.css) ทำให้ตอนกดเมาส์ค้าง
   ปุ่มกลายเป็น stacking context ใหม่ → ตารางเลือกขนาดถูกดันไปอยู่ใต้หน้ากระดาษชั่วขณะ
   mouseup จึงไปตกที่หน้ากระดาษแทนช่องที่เล็ง ไม่เกิด click → "กดแทรกตารางแล้วไม่มีอะไรเกิดขึ้น"
   (ทำซ้ำได้ทุกครั้งเมื่อตารางเลือกขนาดซ้อนอยู่บนหน้ากระดาษ) */
#rs-chapter-toolbar button:active, #rs-chapter-toolbar button.ql-table-better:active { transform: none !important; }
.ql-table-select-container { z-index: 10002 !important; }
/* ย่อหน้าที่จบด้วยตัวแบ่งบรรทัด (Shift+Enter) จากเนื้อหาเก่า: <br> ตัวท้ายไม่สร้างบรรทัดว่างบนจอ → เติมให้ด้วย ::after */
.rs-doc-page .ql-editor p:has(> br.ql-softbreak:last-child)::after, .rs-doc-page .ql-editor li:has(> br.ql-softbreak:last-child)::after,
.rs-doc-page .ql-editor h1:has(> br.ql-softbreak:last-child)::after, .rs-doc-page .ql-editor h2:has(> br.ql-softbreak:last-child)::after,
.rs-doc-page .ql-editor h3:has(> br.ql-softbreak:last-child)::after { content: '\200b'; }

/* ---------- ตัวแก้ไข/หน้าอ่านบท: เปิดเต็มหน้าจอเหมือนเปิดหน้าใหม่ ไม่ใช่หน้าต่างลอย (ผู้ใช้ขอ 21 ก.ย. 2569) ----------
   markup เดิมยังเป็นโมดัลอยู่ (ปุ่มปิด/ตรรกะเดิมทำงานเหมือนเดิม) แค่ให้กล่องกางเต็มจอ ไม่มีขอบมน ไม่มีพื้นหลังมืดรอบ ๆ */
#modal-research-chapter, #modal-research-chapter-view { padding: 0 !important; background: #f3f4f6 !important; backdrop-filter: none !important; }
#modal-research-chapter > div, #modal-research-chapter-view > div {
    max-width: none !important; width: 100% !important; height: 100vh !important; height: 100dvh !important;
    border-radius: 0 !important; box-shadow: none !important;
}

/* ---------- แถบเครื่องมือของตัวแก้ไข: จัดกลุ่มให้อ่านง่ายเมื่อกางเต็มจอ (ผู้ใช้ขอ 21 ก.ย. 2569) ----------
   กลุ่มคำสั่งคั่นด้วยเส้นบาง · ปุ่มพิเศษของระบบ (ตาราง/รูป/ผัง/ย้อนกลับ) เป็นไอคอนบนป้ายชื่อขนาดเท่ากัน
   แถบอยู่กึ่งกลางและติดขอบบนเวลาเลื่อนอ่าน */
#rs-chapter-toolbar.ql-toolbar.ql-snow {
    display: flex; flex-wrap: wrap; justify-content: center; align-items: stretch; gap: 4px 0;
    padding: 6px 10px; background: #fff; border-bottom: 1px solid #e5e7eb; position: sticky; top: 0; z-index: 30;
}
#rs-chapter-toolbar.ql-toolbar.ql-snow .ql-formats {
    display: inline-flex; align-items: center; gap: 2px; margin: 0; padding: 0 8px; border-right: 1px solid #e5e7eb;
}
#rs-chapter-toolbar.ql-toolbar.ql-snow .ql-formats:last-child { border-right: 0; }
#rs-chapter-toolbar.ql-toolbar.ql-snow button { width: 30px; height: 30px; padding: 4px; border-radius: 7px; transition: background .12s; }
#rs-chapter-toolbar.ql-toolbar.ql-snow button:hover, #rs-chapter-toolbar.ql-toolbar.ql-snow button.ql-active { background: #fff1f2; }
#rs-chapter-toolbar.ql-toolbar.ql-snow .ql-picker { height: 30px; line-height: 30px; }
#rs-chapter-toolbar.ql-toolbar.ql-snow .ql-picker-label { border-radius: 7px; border: 1px solid transparent; padding-left: 8px; }
#rs-chapter-toolbar.ql-toolbar.ql-snow .ql-picker-label:hover, #rs-chapter-toolbar.ql-toolbar.ql-snow .ql-picker.ql-expanded .ql-picker-label { border-color: #e5e7eb; background: #f9fafb; }
#rs-chapter-toolbar .rs-tbl-btn {
    display: inline-flex !important; width: auto !important; height: 40px !important; min-width: 40px; padding: 2px 6px !important; margin: 0;
    flex-direction: column; align-items: center; justify-content: center; gap: 1px; border: 0; background: transparent; color: #374151; font-size: 12px;
}
#rs-chapter-toolbar .rs-tbl-btn > i { font-size: 15px; line-height: 1; }
#rs-chapter-toolbar .rs-tbl-btn small { font-size: 10px; line-height: 1.1; font-weight: 700; white-space: nowrap; }
#rs-chapter-toolbar .rs-tbl-btn:hover { background: #fff1f2; color: #e11d48; }
#rs-chapter-toolbar.ql-toolbar.ql-snow button.ql-table-better { width: 40px; height: 40px; }

/* ---------- หัวตัวแก้ไขบท (ป้าย "บทที่ N" + ชื่อบท) ให้ดูเป็นหัวเรื่อง ไม่ใช่ช่องกรอกยาวเต็มจอ (ผู้ใช้ขอ 21 ก.ย. 2569) ---------- */
#modal-research-chapter > div > div:first-child {
    padding: 14px 28px !important; background: linear-gradient(180deg, #fff, #fff8fa) !important; border-bottom: 1px solid #fde2e8 !important;
}
#modal-research-chapter > div > div:first-child > .flex-1 { display: flex; flex-direction: column; gap: 2px; }
#rs-chapter-title {
    font-size: 1.55rem !important; font-weight: 800 !important; letter-spacing: -.01em; color: #111827 !important;
    background: transparent !important; border: 0 !important; border-bottom: 2px solid transparent !important; border-radius: 0 !important;
    padding: 2px 0 4px !important; box-shadow: none !important; max-width: 720px; transition: border-color .15s;
}
#rs-chapter-title:not([readonly]) { border-bottom-color: #fecdd3 !important; }
#rs-chapter-title:not([readonly]):hover { border-bottom-color: #fb7185 !important; }
#rs-chapter-title:focus { border-bottom-color: #e11d48 !important; outline: none !important; }
#rs-chapter-title::placeholder { color: #d1d5db; font-weight: 600; }
#rs-chapter-title.rs-title-locked { cursor: default; }
#rs-chapter-label { align-self: flex-start; margin-bottom: 2px; }
#rs-chapter-saved-at { font-size: 11px; color: #9ca3af; background: #f9fafb; border: 1px solid #f3f4f6; border-radius: 999px; padding: 3px 10px; }

/* ===== ขนาดตัวอักษรครบชุดแบบ Word (คลาส ql-size-Npt) — จากเมนูขนาด และจากการวางข้อความ/ตารางจาก Word =====
   !important + [class] (ความเจาะจง 0,3,0 ประกาศท้ายไฟล์): ชนะกฎ "ฟอนต์เดียวทั้งเล่ม" [class*="ql-font-"] { font-size: inherit !important }
   ซึ่งเดิมทำให้ข้อความที่มีทั้งคลาสฟอนต์และคลาสขนาด (วางจาก Word) กลับเป็น 16pt ทุกตัว */
.rs-doc-page .ql-size-8pt[class] { font-size: 8pt !important; }
.rs-doc-page .ql-size-9pt[class] { font-size: 9pt !important; }
.rs-doc-page .ql-size-10pt[class] { font-size: 10pt !important; }
.rs-doc-page .ql-size-11pt[class] { font-size: 11pt !important; }
.rs-doc-page .ql-size-12pt[class] { font-size: 12pt !important; }
.rs-doc-page .ql-size-13pt[class] { font-size: 13pt !important; }
.rs-doc-page .ql-size-14pt[class] { font-size: 14pt !important; }
.rs-doc-page .ql-size-15pt[class] { font-size: 15pt !important; }
.rs-doc-page .ql-size-16pt[class] { font-size: 16pt !important; }
.rs-doc-page .ql-size-17pt[class] { font-size: 17pt !important; }
.rs-doc-page .ql-size-18pt[class] { font-size: 18pt !important; }
.rs-doc-page .ql-size-20pt[class] { font-size: 20pt !important; }
.rs-doc-page .ql-size-22pt[class] { font-size: 22pt !important; }
.rs-doc-page .ql-size-24pt[class] { font-size: 24pt !important; }
.rs-doc-page .ql-size-26pt[class] { font-size: 26pt !important; }
.rs-doc-page .ql-size-28pt[class] { font-size: 28pt !important; }
.rs-doc-page .ql-size-32pt[class] { font-size: 32pt !important; }
.rs-doc-page .ql-size-36pt[class] { font-size: 36pt !important; }
.rs-doc-page .ql-size-40pt[class] { font-size: 40pt !important; }
.rs-doc-page .ql-size-48pt[class] { font-size: 48pt !important; }
.rs-doc-page .ql-size-72pt[class] { font-size: 72pt !important; }
/* ย่อหน้าที่หน้าอ่านรวมเล่มตัดข้ามหน้า: ส่วนต่อเป็นบรรทัดกลางย่อหน้า — ไม่เยื้องบรรทัดแรก/เยื้องแขวนซ้ำ */
.rs-doc-page .rs-split-cont { text-indent: 0 !important; }
