/* ส่วนเสริมเล็กน้อยของ b.srn8.com (ที่ต้นฉบับใช้ simplebar / react-select ทำให้) */
html, body { height: 100%; }
body { margin: 0; font-size: 14px; color: #000;
       font-family: ui-sans-serif, system-ui, sans-serif, "Segoe UI Emoji"; }
#root { height: 100%; }
#root > .layout { height: 100%; }
#page { display: flex; flex-direction: column; flex: 1 1 0%; min-height: 0; }

/* รายการเลื่อนได้ (แทน simplebar ของต้นฉบับ) */
.un-list-body > ._scroll { position: absolute; top: 0; right: 0; bottom: 0; left: 0;
                           overflow-y: auto; overflow-x: hidden; }
.layout-menu { overflow-y: auto; }

/* select (แทน react-select) */
.un-input-select .s__control { display: flex; align-items: center; min-height: 2rem; }
.un-input-select .s__value-container { display: flex; align-items: center; flex: 1 1 0%;
                                       padding-left: .75rem; padding-right: .25rem; min-height: 2rem; }
.un-input-select .s__indicators { display: flex; align-items: center; }
.un-input-select .s__indicator { display: flex; align-items: center; justify-content: center;
                                 width: 2rem; color: #ccc; cursor: pointer; }
.un-input-select .s__indicator:hover { color: #999; }
.un-input-select .s__indicator-separator { align-self: stretch; width: 1px; background: #e0e1e4;
                                           margin-top: .5rem; margin-bottom: .5rem; }
.un-input-select .s__placeholder { color: #9ca3af; }
.un-input-select .s__menu { position: absolute; top: 100%; left: 0; right: 0; z-index: 60;
                            margin-top: 2px; background: #fff; border-radius: .25rem;
                            border: 1px solid #e0e1e4; box-shadow: 0 10px 15px -3px rgba(0,0,0,.1);
                            max-height: 260px; overflow-y: auto; }
.un-input-select .s__option { padding: .5rem .75rem; cursor: pointer; }
.un-input-select .s__option:hover { background: #eff0f2; }
.un-input-select .s__option.-selected { background: #2776bd; color: #fff; }

/* ปฏิทิน (โครงเดียวกับ react-datepicker ที่ธีมรองรับอยู่แล้ว) */
.un-popup-date .react-datepicker { background: #fff; border: 1px solid #e0e1e4;
                                   border-radius: .25rem; }
.un-popup-date .react-datepicker__header { background: #f7f8f9; padding-bottom: .25rem; }
.un-popup-date .react-datepicker__month { margin: .25rem 0; }
.un-popup-date .react-datepicker__week,
.un-popup-date .react-datepicker__day-names { display: flex; justify-content: center; }
.un-popup-date .react-datepicker__day,
.un-popup-date .react-datepicker__day-name { display: block; width: 2.25rem; margin: .125rem; flex: 0 0 auto; }

/* toast */
.toast-root { position: fixed; top: 1rem; right: 1rem; z-index: 90; display: flex;
              flex-direction: column; align-items: flex-end; }
.toast-root > ._t { margin-bottom: .5rem; border-radius: .375rem; padding: .625rem 1rem;
                    color: #fff; box-shadow: 0 10px 15px -3px rgba(0,0,0,.2); min-width: 15rem; }
.toast-root > ._t.-success { background: #4caf50; }
.toast-root > ._t.-error { background: #f44336; }

/* หน้า login */
.login-page { display: flex; height: 100%; align-items: center; justify-content: center;
              background: #dee9fd; }
.login-box { width: 22rem; background: #fff; border-radius: .5rem; padding: 1.5rem;
             box-shadow: 0 10px 15px -3px rgba(0,0,0,.15); }
.login-box > ._title { font-size: 1.25rem; text-align: center; margin-bottom: 1.25rem; }

/* แถบเลื่อนบาง ให้ใกล้เคียง simplebar ของต้นฉบับ */
.un-list-body > ._scroll::-webkit-scrollbar { width: 11px; height: 11px; }
.un-list-body > ._scroll::-webkit-scrollbar-track { background: transparent; }
.un-list-body > ._scroll::-webkit-scrollbar-thumb { background: rgba(0,0,0,.25); border-radius: 7px;
                                                   border: 3px solid transparent; background-clip: content-box; }
.un-list-body > ._scroll::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.4);
                                                          border: 3px solid transparent; background-clip: content-box; }

/* หน้าสรุปดอกเบี้ย */
.un-page-title ._note { color: #9ca3af; font-size: .875rem; }
.un-list-foot { border-top: 1px dashed #c1c4ca; padding-top: .5rem; padding-bottom: .5rem;
                background: #f4f8ff; }
.un-list-foot > div { min-height: 2rem; padding-top: .25rem; }

/* รายละเอียดที่กางใต้แถวสรุปดอกเบี้ย */
.sum-detail { background: #f4f8ff; border-left: 3px solid #2776bd; border-radius: .25rem;
              margin: 0 .5rem .5rem 2.5rem; padding: 0 .25rem .25rem; }
.sum-detail .un-list-head { border-bottom-style: solid; border-color: #dee9fd; }
.sum-detail .un-list { border-bottom: 1px solid #e8f0fe; }
.sum-detail .un-list:last-child { border-bottom: 0; }
.summary-caret, .un-list-button ._caret { margin-right: .5rem; width: .75rem; }

/* ไฟล์สัญญาที่แนบกับรายการ */
.file-list { border: 1px solid #e0e1e4; border-radius: .375rem; overflow: hidden; }
.file-list > ._row { display: flex; align-items: center; padding: .375rem .625rem; }
.file-list > ._row + ._row { border-top: 1px solid #eff0f2; }
.file-list > ._row:hover { background: #f4f8ff; }
.file-list > ._row > .un-icon { margin-right: .625rem; font-size: 1.125rem; }
.file-list > ._row > ._name { flex: 1 1 0%; color: #26588a; word-break: break-all; }
.file-list > ._row > ._name:hover { text-decoration: underline; }
.file-list > ._row > ._size { color: #9ca3af; font-size: .875rem; margin: 0 .75rem; white-space: nowrap; }
.file-upload { display: flex; align-items: center; margin-top: 1rem; }
.file-upload ._hint { color: #9ca3af; font-size: .875rem; margin-left: .75rem; }

/* ตัวอ่านไฟล์ในระบบ (pdf.js ชุดเดียวกับ srn8) */
.viewer-overlay { z-index: 70; }
.viewer-overlay .un-modal { width: 100%; max-width: 1200px; height: 100%; }
.viewer-body { display: flex; flex: 1 1 0%; padding: 0; overflow: hidden; background: #404040; }
.viewer-frame { width: 100%; height: 100%; border: 0; }
.viewer-img-wrap { display: flex; flex: 1 1 0%; overflow: auto; padding: 1rem; }
.viewer-img { max-width: 100%; max-height: 100%; margin: auto; }
.viewer-none { display: flex; flex: 1 1 0%; flex-direction: column; align-items: center;
               justify-content: center; gap: .75rem; color: #fff; background: #404040; }
.viewer-none .un-icon { font-size: 2.5rem; }

/* แถวที่ถึงวันครบกำหนดแล้วยังไม่ได้รับเงิน */
.un-list.-due { box-shadow: inset 0 0 0 2px #ff9800; border-radius: .375rem; background: #fff6ec; }
.un-list.-due .un-list-button:hover { background: #ffe6cc; }

/* แถวที่ครบกำหนดพรุ่งนี้ */
.un-list.-soon { box-shadow: inset 0 0 0 2px #2196f3; border-radius: .375rem; background: #eff4fe; }
.un-list.-soon .un-list-button:hover { background: #dee9fd; }

/* หน้าข้อความไลน์ */
.line-page { display: flex; flex: 1 1 0%; min-height: 0; gap: 1rem; }
.line-page > ._left { display: flex; flex-direction: column; flex: 1 1 0%; min-width: 0; }
.line-page > ._right { display: flex; flex-direction: column; width: 26rem; }
.line-page ._tools { display: flex; align-items: center; margin-top: .75rem; }
.line-page ._tools ._count { color: #607d8b; margin-left: auto; }
.line-text { flex: 1 1 0%; width: 100%; border: 1px solid #c1c4ca; border-radius: .375rem;
             padding: .75rem; font-family: ui-monospace, Menlo, Consolas, monospace;
             font-size: .875rem; line-height: 1.6; resize: none; background: #fff; }
.line-text:focus { outline: none; border-color: #6baaf6; box-shadow: 0 0 0 2px rgba(107,170,246,.5); }
.un-list.-picked { background: #eff4fe; }
.line-page input[type=checkbox] { width: 1.125rem; height: 1.125rem; accent-color: #2776bd; cursor: pointer; }

.cbox { display: inline-flex; align-items: center; cursor: pointer; }
.cbox input[type=checkbox] { width: 1.125rem; height: 1.125rem; accent-color: #2776bd; margin-right: .5rem; }
.tag-line { display: inline-block; border-radius: .25rem; background: #dee9fd; color: #26588a;
            font-size: .75rem; padding: .0625rem .5rem; }

.un-page-title ._rate { display: inline-flex; align-items: center; color: #607d8b;
                        margin-left: 1rem; white-space: nowrap; }
.un-page-title ._rate ._input { width: 4.5rem; border: 1px solid #c1c4ca; border-radius: .25rem;
                                padding: .25rem .5rem; margin: 0 .375rem 0 .5rem; text-align: right; }
.un-page-title ._rate ._input:focus { outline: none; border-color: #6baaf6; }

/* สัญญาที่ไม่เคลื่อนไหวแล้ว ในตารางสรุป */
.un-list.-stale { color: #9ca3af; }
.un-list.-stale .blue { color: #9aa8b5 !important; }
.tag-stale { display: inline-block; border-radius: .25rem; background: #eff0f2; color: #878c98;
             font-size: .75rem; padding: .0625rem .5rem; margin-left: .5rem; }

/* แถวที่เลยวันครบกำหนดแล้ว */
.un-list.-late { box-shadow: inset 0 0 0 2px #f44336; border-radius: .375rem; background: #fff1ee; }
.un-list.-late .un-list-button:hover { background: #ffdcd4; }

/* เตือนจำนวนวันเป็น 0 */
.un-form-item ._warn { color: #f44336; font-size: .875rem; margin-left: .75rem; }
.un-inputbox-text.red { color: #f44336; }

/* หมายเหตุแบบพิมพ์เอง */
.note-wrap { width: 100%; }
.note-wrap .un-inputbox { height: auto; }
.note-ta { min-height: 5.5rem; resize: vertical; line-height: 1.45; padding-top: .4rem; padding-bottom: .4rem; }
.note-chips { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .35rem; }
.note-chip { border: 1px dashed #b9c2cf; background: #f7f9fc; color: #44526a; border-radius: 999px;
             padding: .15rem .65rem; font-size: 12.5px; cursor: pointer; font-family: inherit; }
.note-chip:hover { background: #e8f0fb; border-color: #2776bd; color: #2776bd; }
.row-note { color: #d1d5db; }
.row-note:hover { color: #2776bd; }
.row-note.-has { color: #2776bd; }

/* คอลัมน์หมายเหตุในตาราง (ยืดตามที่ว่าง ข้อความยาวตัดด้วย … ชี้ดูเต็มได้) */
.note-col { min-width: 0; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.un-list .note-col { color: #8a6500; }
.un-list .note-col.-empty { color: #c1c4ca; }
.un-list > [data-receive] { flex-shrink: 0; }
.un-list .note-col { width: 0; }
/* คอลัมน์เดิมไม่หด (หน้าตาเดิม) · หมายเหตุกว้างขั้นต่ำ 7rem เฉพาะจอ ≥1500 (รวมมือถือที่ล็อก 1520) */
.un-list-head > div:not(.note-col), .un-list > .un-list-button > div:not(.note-col) { flex-shrink: 0; }
@media (min-width: 1500px) { .note-col { min-width: 7rem; padding-left: .75rem; padding-right: .5rem; } }
/* จอแคบกว่า 1500 (คอมเล็ก) ไม่มีที่ให้หมายเหตุ → ซ่อนคอลัมน์ ตารางเหมือนเดิมทุกอย่าง (ชี้ไอคอนโน้ตดูหมายเหตุได้เหมือนเดิม) */
@media (max-width: 1499.98px) { .note-col { display: none !important; } }
