/* บันทึกการกู้ยืม nan.srn8.com — หน้าตาสำหรับมือถือล้วน */
:root {
  --blue: #2776bd; --blue-d: #1d5f9c; --blue-l: #e8f1fb;
  --green: #2e9d4f; --green-l: #e6f5ea;
  --red: #e0413a; --red-l: #fdecea;
  --orange: #f08c00; --orange-l: #fff3e0;
  --sky: #1e88e5; --sky-l: #e3f0fd;
  --ink: #1b2430; --ink2: #4b5768; --muted: #8a94a3; --line: #e3e8ef;
  --bg: #f1f4f8; --card: #fff;
  --top-h: 56px; --nav-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45;
       font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "Sarabun", system-ui, sans-serif;
       -webkit-text-size-adjust: 100%; overscroll-behavior-y: contain; }
body.lock { overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.r { text-align: right; } .c { text-align: center; }
.b { font-weight: 600; }
.blue { color: var(--blue); } .red { color: var(--red); } .green { color: var(--green); }
.orange { color: var(--orange); } .gray, .muted { color: var(--muted); }

/* ── แถบบน ── */
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: .5rem;
          padding: var(--safe-t) .5rem 0 1rem; min-height: calc(var(--top-h) + var(--safe-t));
          background: var(--blue); color: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); }
.topbar ._title { flex: 1 1 0%; min-width: 0; font-size: 1.125rem; font-weight: 600;
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar ._title small { display: block; font-size: .75rem; font-weight: 400; opacity: .8; }
.ibtn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px;
        border: 0; background: transparent; border-radius: 50%; font-size: 1.15rem; color: inherit; flex: 0 0 auto; }
.ibtn:active { background: rgba(0,0,0,.08); }
.topbar .ibtn:active { background: rgba(255,255,255,.18); }
.topbar .ibtn.-spin i { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── เนื้อหา ── */
#page { padding: .75rem .75rem calc(var(--nav-h) + var(--safe-b) + 5.5rem); max-width: 720px; margin: 0 auto; }
.searchbar { position: sticky; top: calc(var(--top-h) + var(--safe-t)); z-index: 20; margin: -.75rem -.75rem .75rem;
             padding: .625rem .75rem; background: var(--bg); }
.search { display: flex; align-items: center; background: #fff; border: 1px solid var(--line);
          border-radius: 12px; padding: 0 .25rem 0 .875rem; height: 46px; }
.search i { color: var(--muted); }
.search input { flex: 1 1 0%; min-width: 0; border: 0; outline: 0; background: transparent;
                font-size: 16px; padding: 0 .625rem; height: 100%; }
.search .ibtn { width: 38px; height: 38px; color: var(--muted); }
.hint { color: var(--muted); font-size: .8125rem; margin: 0 .25rem .625rem; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.empty i { display: block; font-size: 2.25rem; margin-bottom: .75rem; color: #c3ccd8; }
.loading { text-align: center; padding: 3rem 0; color: var(--blue); font-size: 1.5rem; }

/* ── การ์ด ── */
.card { background: var(--card); border-radius: 14px; margin-bottom: .75rem; overflow: hidden;
        box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.06); border-left: 4px solid transparent; }
.card.-late { border-left-color: var(--red); }
.card.-due { border-left-color: var(--orange); }
.card.-soon { border-left-color: var(--sky); }
.card.-done { border-left-color: var(--green); }
.card ._main { padding: .875rem .875rem .625rem; }
.card ._main:active { background: #f7f9fc; }
.c-top { display: flex; align-items: center; gap: .5rem; margin-bottom: .25rem; }
.c-name { flex: 1 1 0%; min-width: 0; font-weight: 600; color: var(--ink2); font-size: .9375rem;
          white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pill { display: inline-flex; align-items: center; gap: .25rem; border-radius: 999px; padding: .125rem .625rem;
        font-size: .75rem; font-weight: 600; white-space: nowrap; flex: 0 0 auto; }
.pill.-late { background: var(--red-l); color: var(--red); }
.pill.-due { background: var(--orange-l); color: #c26f00; }
.pill.-soon { background: var(--sky-l); color: var(--sky); }
.pill.-wait { background: #eef1f5; color: var(--ink2); }
.pill.-done { background: var(--green-l); color: var(--green); }
.pill.-line { background: var(--blue-l); color: var(--blue); }
.pill.-off { background: #eef1f5; color: var(--muted); }
.c-money { font-size: 1.5rem; font-weight: 700; letter-spacing: -.01em; }
.c-money small { font-size: .8125rem; font-weight: 400; color: var(--muted); margin-left: .25rem; }
.c-money ._rate { font-size: .8125rem; font-weight: 600; color: var(--blue); background: var(--blue-l);
                  border-radius: 6px; padding: .0625rem .375rem; margin-left: .375rem; vertical-align: middle; }
.c-dates { color: var(--ink2); font-size: .875rem; margin-top: .125rem; }
.c-dates i { color: var(--muted); margin-right: .25rem; }
.c-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .625rem;
          background: #f6f8fb; border-radius: 10px; padding: .5rem .625rem; }
.c-grid > div { min-width: 0; }
.c-grid ._l { display: block; font-size: .6875rem; color: var(--muted); }
.c-grid ._v { display: block; font-weight: 600; font-size: .9375rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-meta { display: flex; flex-wrap: wrap; gap: .25rem .75rem; color: var(--muted); font-size: .8125rem; margin-top: .5rem; }
.c-meta i { margin-right: .25rem; }
.c-note { margin-top: .5rem; font-size: .8125rem; color: var(--ink2); background: #fffbea; border-radius: 8px;
          padding: .375rem .5rem; white-space: pre-wrap; word-break: break-word; }
.c-note i { color: #c99a00; margin-right: .25rem; }
.c-actions { display: flex; align-items: center; gap: .25rem; padding: .375rem .5rem .5rem .875rem;
             border-top: 1px solid #f0f2f6; }
.c-actions ._sp { flex: 1 1 0%; }
.c-actions .ibtn { color: var(--muted); position: relative; }
.c-actions .ibtn.-has { color: var(--blue); }
.c-actions .ibtn.-file { color: var(--orange); }
.badge { position: absolute; top: 4px; right: 2px; min-width: 17px; height: 17px; border-radius: 9px; padding: 0 4px;
         background: var(--orange); color: #fff; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; }

/* ── ปุ่ม ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; height: 44px;
       padding: 0 1.125rem; border-radius: 11px; border: 1px solid transparent; font-weight: 600;
       font-size: .9375rem; background: #eef1f5; color: var(--ink); white-space: nowrap; }
.btn:active { filter: brightness(.94); }
.btn.-blue { background: var(--blue); color: #fff; }
.btn.-green { background: var(--green); color: #fff; }
.btn.-green-o { background: #fff; color: var(--green); border-color: var(--green); }
.btn.-red-o { background: #fff; color: var(--red); border-color: #f3b7b3; }
.btn.-ghost { background: #fff; border-color: var(--line); color: var(--ink2); }
.btn.-sm { height: 38px; padding: 0 .875rem; font-size: .875rem; border-radius: 10px; }
.btn.-block { width: 100%; }
.btn[disabled] { opacity: .55; }

/* ── ปุ่มลอยเพิ่มข้อมูล ── */
.fab { position: fixed; right: 1rem; bottom: calc(var(--nav-h) + var(--safe-b) + 1rem); z-index: 25;
       height: 56px; padding: 0 1.25rem 0 1.125rem; border: 0; border-radius: 28px; background: var(--green); color: #fff;
       font-weight: 600; font-size: 1rem; display: inline-flex; align-items: center; gap: .5rem;
       box-shadow: 0 6px 16px rgba(46,157,79,.35), 0 2px 4px rgba(0,0,0,.12); }
.fab i { font-size: 1.25rem; }
.fab:active { transform: scale(.97); }

/* ── แถบเมนูล่าง ── */
.bnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; background: #fff;
        border-top: 1px solid var(--line); padding-bottom: var(--safe-b); box-shadow: 0 -2px 8px rgba(0,0,0,.04); }
.bnav ._it { flex: 1 1 0%; display: flex; flex-direction: column; align-items: center; justify-content: center;
             gap: .125rem; height: var(--nav-h); border: 0; background: transparent; color: var(--muted);
             font-size: .6875rem; font-weight: 500; padding: 0; }
.bnav ._it i { font-size: 1.25rem; }
.bnav ._it.-on { color: var(--blue); font-weight: 700; }
.bnav ._it.-on i { font-weight: 900; }

/* ── เลขหน้า ── */
.pager { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 1rem 0 0; }
.pager ._n { color: var(--ink2); font-size: .875rem; }

/* ── สรุปดอกเบี้ย ── */
.sum-total { background: linear-gradient(135deg, #2776bd, #1d5f9c); color: #fff; border-radius: 16px;
             padding: 1rem 1.125rem; margin-bottom: .875rem; box-shadow: 0 6px 16px rgba(39,118,189,.25); }
.sum-total ._l { font-size: .8125rem; opacity: .85; }
.sum-total ._big { font-size: 1.875rem; font-weight: 700; letter-spacing: -.01em; }
.sum-total ._row { display: flex; gap: 1rem; margin-top: .5rem; font-size: .875rem; }
.sum-total ._row > div { flex: 1 1 0%; background: rgba(255,255,255,.14); border-radius: 10px; padding: .375rem .625rem; }
.sum-total ._row b { display: block; font-size: 1rem; }
.sum-card ._main { display: flex; align-items: center; gap: .75rem; }
.sum-card ._caret { color: var(--muted); width: 1rem; text-align: center; }
.sum-card ._info { flex: 1 1 0%; min-width: 0; }
.sum-card ._sub { color: var(--muted); font-size: .8125rem; }
.sum-card ._amt { text-align: right; }
.sum-card ._amt b { display: block; color: var(--blue); font-size: 1.0625rem; }
.sum-card ._amt span { font-size: .6875rem; color: var(--muted); }
.sum-card.-stale { opacity: .7; }
.sum-detail { border-top: 1px solid #f0f2f6; background: #f8fafd; padding: .25rem .875rem .5rem; }
.sd-row { display: flex; align-items: center; gap: .5rem; padding: .5rem 0; border-bottom: 1px dashed #e3e8ef; }
.sd-row:last-child { border-bottom: 0; }
.sd-row ._i { flex: 1 1 0%; min-width: 0; font-size: .8125rem; color: var(--ink2); }
.sd-row ._i b { color: var(--ink); font-size: .875rem; }
.sd-row ._v { text-align: right; font-size: .8125rem; color: var(--muted); }
.sd-row ._v b { display: block; color: var(--blue); font-size: .9375rem; }
.sd-row .ibtn { width: 38px; height: 38px; color: var(--muted); }

/* ── เลขที่สัญญา ── */
.ct-card ._main { display: flex; align-items: center; gap: .5rem; padding: .625rem .625rem .625rem .375rem; }
.ct-card ._bulb { color: #c3ccd8; }
.ct-card ._bulb.-on { color: var(--orange); }
.ct-card ._info { flex: 1 1 0%; min-width: 0; }
.ct-card ._name { font-weight: 600; font-size: 1rem; }
.ct-card ._note { color: var(--muted); font-size: .8125rem; white-space: pre-wrap; word-break: break-word; }
.ct-card ._amt { text-align: right; color: var(--red); font-weight: 600; white-space: nowrap; }
.ct-card ._amt span { display: block; font-size: .6875rem; color: var(--muted); font-weight: 400; }
.ct-card.-off ._name { color: var(--muted); }

/* ── ข้อความไลน์ ── */
.box { background: #fff; border-radius: 14px; padding: .875rem; margin-bottom: .75rem;
       box-shadow: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.06); }
.rate-row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.rate-row ._l { flex: 1 1 auto; font-weight: 600; }
.rate-row input { width: 5.5rem; height: 42px; border: 1px solid var(--line); border-radius: 10px; text-align: right;
                  padding: 0 .625rem; font-size: 16px; }
.rate-row input:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,118,189,.18); }
.line-tools { display: flex; align-items: center; gap: .5rem; margin: 0 0 .625rem; }
.line-tools ._count { margin-left: auto; color: var(--ink2); font-size: .875rem; }
.pick { display: flex; align-items: center; gap: .75rem; padding: .75rem .875rem; }
.pick ._chk { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #c3ccd8; display: flex;
              align-items: center; justify-content: center; color: #fff; font-size: .875rem; flex: 0 0 auto; }
.card.-picked .pick ._chk { background: var(--blue); border-color: var(--blue); }
.card.-picked { box-shadow: 0 0 0 2px var(--blue) inset, 0 1px 3px rgba(16,24,40,.06); }
.pick ._info { flex: 1 1 0%; min-width: 0; }
.pick ._name { font-weight: 600; font-size: .9375rem; }
.pick ._sub { color: var(--ink2); font-size: .8125rem; }
.pick ._amt { text-align: right; white-space: nowrap; }
.pick ._amt b { display: block; color: var(--blue); }
.pick ._amt span { font-size: .75rem; color: var(--muted); }
.newchip { border: 1px dashed #b9c2cf; background: #fff; color: var(--muted); border-radius: 999px;
           font-size: .75rem; font-weight: 600; padding: .25rem .625rem; margin-top: .375rem; }
.newchip.-on { border-style: solid; border-color: var(--green); background: var(--green-l); color: var(--green); }
.line-text { display: block; width: 100%; min-height: 22rem; border: 1px solid var(--line); border-radius: 12px;
             padding: .75rem; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 14px; line-height: 1.6;
             background: #fff; resize: vertical; }
.line-text:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,118,189,.18); }
.line-actions { display: flex; gap: .5rem; margin-top: .625rem; }
.line-actions .btn.-green { flex: 1 1 0%; }
.sec-title { font-weight: 700; font-size: .875rem; color: var(--ink2); margin: 1rem .25rem .5rem; }

/* ── แผ่นฟอร์มเต็มจอ ── */
.sheet-ov { position: fixed; inset: 0; z-index: 50; background: rgba(15,23,42,.45);
            display: flex; flex-direction: column; justify-content: flex-end; animation: fade .15s ease-out; }
.sheet { background: #fff; width: 100%; max-width: 720px; margin: 0 auto; height: 100%; height: 100dvh;
         display: flex; flex-direction: column; animation: up .2s ease-out; }
.sheet.-half { height: auto; max-height: 92%; max-height: 92dvh; border-radius: 18px 18px 0 0; }
@keyframes up { from { transform: translateY(24px); opacity: .6; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-h { display: flex; align-items: center; gap: .25rem; padding: var(--safe-t) .25rem 0 .25rem;
           min-height: calc(54px + var(--safe-t)); border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.sheet.-half .sheet-h { padding-top: 0; min-height: 54px; }
.sheet-h ._t { flex: 1 1 0%; min-width: 0; font-weight: 700; font-size: 1.0625rem;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-h ._t small { display: block; font-size: .75rem; font-weight: 400; color: var(--muted); }
.sheet-b { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 1rem; overscroll-behavior: contain; }
.sheet-f { flex: 0 0 auto; display: flex; align-items: center; gap: .5rem; padding: .625rem 1rem calc(.625rem + var(--safe-b));
           border-top: 1px solid var(--line); background: #fff; }
.sheet-f .btn.-blue { flex: 1 1 0%; }
.sheet-f .ibtn.-del { color: var(--red); border: 1px solid #f3b7b3; border-radius: 11px; width: 44px; }

/* ── ช่องกรอก ── */
.fld { margin-bottom: 1rem; }
.fld > label, .fld > ._l { display: block; font-size: .8125rem; font-weight: 600; color: var(--ink2); margin-bottom: .375rem; }
.inp { display: flex; align-items: center; border: 1px solid #cfd6e0; border-radius: 11px; background: #fff;
       min-height: 48px; overflow: hidden; }
.inp:focus-within { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(39,118,189,.18); }
.inp input, .inp select, .inp textarea { flex: 1 1 0%; min-width: 0; border: 0; outline: 0; background: transparent;
       font-size: 16px; padding: .625rem .875rem; height: 48px; }
.inp select { appearance: none; -webkit-appearance: none; padding-right: 2.25rem;
              background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238a94a3' stroke-width='2' fill='none'/%3E%3C/svg%3E") no-repeat right .875rem center; }
.inp textarea { height: auto; min-height: 6rem; resize: vertical; line-height: 1.5; }
.inp ._u { padding: 0 .875rem; color: var(--muted); font-size: .875rem; }
.inp input.r { text-align: right; }
.inp input { width: 100%; }
.row2 { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: .75rem; }
.row2 > * { min-width: 0; }
.calc { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; background: var(--blue-l); border-radius: 12px;
        padding: .75rem; margin-bottom: 1rem; }
.calc > div { background: #fff; border-radius: 9px; padding: .375rem .625rem; }
.calc ._l { display: block; font-size: .6875rem; color: var(--muted); }
.calc ._v { display: block; font-weight: 700; font-size: 1.0625rem; }
.calc ._v.-big { color: var(--blue); }
.calc ._v.red { color: var(--red); }
.calc ._warn { grid-column: 1 / -1; color: var(--red); font-size: .8125rem; padding: 0 .25rem; background: transparent; }
.drow { display: flex; align-items: center; gap: .5rem; }
.drow .btn { width: 48px; height: 48px; padding: 0; flex: 0 0 auto; background: #fff; border-color: #cfd6e0; color: var(--ink2); }
.dpick { position: relative; flex: 1 1 0%; display: flex; align-items: center; justify-content: center; gap: .5rem;
         height: 48px; border: 1px solid #cfd6e0; border-radius: 11px; background: #fff; font-weight: 600; overflow: hidden; }
.dpick i { color: var(--blue); }
.dpick input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; border: 0; font-size: 16px; }
.seg { display: flex; flex-wrap: wrap; gap: .5rem; }
.seg button { flex: 1 1 5.5rem; min-width: 0; padding: 0 .5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; height: 46px; border-radius: 11px; border: 1px solid #cfd6e0; background: #fff;
              color: var(--ink2); font-weight: 600; }
.seg button.-on { background: var(--blue); border-color: var(--blue); color: #fff; }
.chips { display: flex; flex-wrap: wrap; gap: .375rem; margin-top: .5rem; }
.chip { border: 1px dashed #b9c2cf; background: #f7f9fc; color: #44526a; border-radius: 999px;
        padding: .375rem .75rem; font-size: .8125rem; }
.chip:active { background: var(--blue-l); }
.switch { display: flex; align-items: center; gap: .75rem; min-height: 48px; }
.switch input { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: #cfd6e0;
                position: relative; transition: background .15s; flex: 0 0 auto; margin: 0; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
                       background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.switch input:checked { background: var(--blue); }
.switch input:checked::after { left: 23px; }

/* ── ไฟล์แนบ ── */
.file-list { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.file-list ._row { display: flex; align-items: center; gap: .625rem; padding: .375rem .25rem .375rem .875rem; min-height: 56px; }
.file-list ._row + ._row { border-top: 1px solid #f0f2f6; }
.file-list ._row > i { font-size: 1.375rem; width: 1.5rem; text-align: center; }
.file-list ._name { flex: 1 1 0%; min-width: 0; color: var(--blue-d); word-break: break-all; font-size: .9375rem; }
.file-list ._name small { display: block; color: var(--muted); font-size: .75rem; }
.file-list .ibtn { color: var(--red); }
.upl { margin-top: 1rem; }
.upl ._hint { display: block; text-align: center; color: var(--muted); font-size: .8125rem; margin-top: .5rem; }

/* ── ตัวเปิดไฟล์ ── */
.viewer { position: fixed; inset: 0; z-index: 70; background: #2b2b2b; display: flex; flex-direction: column; }
.viewer .sheet-h { background: #fff; }
.viewer ._body { flex: 1 1 0%; display: flex; overflow: auto; }
.viewer iframe { width: 100%; height: 100%; border: 0; }
.viewer img { max-width: 100%; margin: auto; display: block; }
.viewer ._none { flex: 1 1 0%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .75rem; color: #fff; }

/* ── ยืนยัน ── */
.cf-ov { position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,.5); display: flex; align-items: center;
         justify-content: center; padding: 1.5rem; animation: fade .12s ease-out; }
.cf { background: #fff; border-radius: 16px; width: 100%; max-width: 340px; padding: 1.25rem 1.125rem 1rem; text-align: center; }
.cf ._m { font-size: 1rem; margin: .25rem 0 1.25rem; }
.cf ._b { display: flex; gap: .5rem; }
.cf ._b .btn { flex: 1 1 0%; }

/* ── toast ── */
.toast-root { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b) + 5rem); z-index: 90;
              display: flex; flex-direction: column; align-items: center; pointer-events: none; padding: 0 1rem; }
.toast-root > ._t { margin-top: .5rem; border-radius: 12px; padding: .75rem 1.125rem; color: #fff; font-size: .9375rem;
                    box-shadow: 0 8px 20px rgba(0,0,0,.2); max-width: 100%; animation: up .18s ease-out; }
.toast-root > ._t.-success { background: #23303f; }
.toast-root > ._t.-error { background: var(--red); }

/* ── เข้าสู่ระบบ ── */
.login { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: center;
         padding: 2rem 1.25rem calc(2rem + var(--safe-b)); background: linear-gradient(180deg, #2776bd 0, #2776bd 38%, var(--bg) 38%); }
.login ._logo { text-align: center; color: #fff; margin-bottom: 1.5rem; }
.login ._logo i { font-size: 2.75rem; }
.login ._logo h1 { margin: .5rem 0 0; font-size: 1.5rem; }
.login ._box { background: #fff; border-radius: 18px; padding: 1.5rem 1.25rem; max-width: 420px; width: 100%; margin: 0 auto;
               box-shadow: 0 10px 30px rgba(16,24,40,.12); }
.login .btn { margin-top: .5rem; height: 50px; font-size: 1rem; }

/* ── ตั้งค่าตัวเลือก ── */
.set-box ._head { display: flex; gap: .75rem; align-items: flex-start; margin-bottom: .75rem; }
.set-box ._head > i { color: var(--blue); font-size: 1.125rem; margin-top: .2rem; width: 1.25rem; text-align: center; }
.set-box ._head b { display: block; font-size: 1rem; }
.set-box ._head small { display: block; color: var(--muted); font-size: .8125rem; }
.set-row { display: flex; align-items: center; gap: .125rem; margin-bottom: .5rem; }
.set-row ._no { width: 1.5rem; flex: 0 0 auto; color: var(--muted); font-size: .8125rem; text-align: center; }
.set-row .inp { flex: 1 1 0%; min-width: 0; min-height: 44px; }
.set-row .inp input { height: 44px; }
.set-row .ibtn { width: 38px; height: 38px; color: var(--ink2); font-size: 1rem; }
.set-row .ibtn[disabled] { opacity: .25; }
.ibtn.-del { color: var(--red); }
.set-add { display: flex; gap: .5rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px dashed var(--line); }
.set-add .inp { flex: 1 1 0%; min-width: 0; }
.set-add .btn { height: 48px; }
.savebar { position: fixed; left: 0; right: 0; bottom: calc(var(--nav-h) + var(--safe-b)); z-index: 26; display: none;
           gap: .5rem; padding: .625rem .75rem; background: #fff; border-top: 1px solid var(--line);
           box-shadow: 0 -4px 12px rgba(0,0,0,.06); }
.savebar.-show { display: flex; }
.savebar .btn.-blue { flex: 1 1 0%; }

/* ── แถวรายการกู้แบบย่อ (แตะเพื่อกาง) ── */
.card.lc { margin-bottom: .5rem; border-radius: 12px; }
.lc-row { display: flex; align-items: center; gap: .5rem; padding: .5rem .5rem .5rem .75rem; min-height: 56px; }
.lc-row:active { background: #f7f9fc; }
.lc-row ._l { flex: 1 1 0%; min-width: 0; }
.lc-row ._amt { font-size: 1.0625rem; font-weight: 700; line-height: 1.3; white-space: nowrap; }
.lc-row ._int { font-size: .8125rem; font-weight: 600; color: var(--blue); margin-left: .375rem; }
.lc-row ._sub { font-size: .75rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lc-row ._sub b { color: var(--ink2); font-weight: 600; }
.lc-row ._f { margin-left: .375rem; font-size: .6875rem; }
.lc-row ._f.-note { color: #c99a00; }
.lc-row ._f.-file { color: var(--orange); }
.lc-row ._r { display: flex; align-items: center; gap: .375rem; flex: 0 0 auto; }
.lc-row ._cv { color: #b5bfcc; font-size: .75rem; width: .875rem; text-align: center; }
.lc.-open .lc-row { border-bottom: 1px solid #f0f2f6; }
.lc-more { padding: .25rem .75rem .5rem; }
.lc-more .c-grid { margin-top: .375rem; }
.lc .c-actions { gap: .375rem; padding: .375rem .375rem .375rem .75rem; }
.lc-row ._amt { display: flex; align-items: center; min-width: 0; }
.lc-row ._amt > span { flex: 0 0 auto; }
.lc-row ._amt > ._note { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
                         margin-left: .5rem; font-size: .75rem; font-weight: 600; color: #8a6500; background: #fff4c2;
                         border-radius: 6px; padding: .0625rem .4375rem; }
/* กรอบวันที่ยืม / วันที่คืน */
.lc-row ._sub { display: flex; align-items: center; gap: .3125rem; margin-top: .1875rem; }
.lc-row ._sub > b { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; margin-right: .125rem; }
.dchip { display: inline-flex; align-items: baseline; gap: .25rem; flex: 0 0 auto; border: 1px solid #dbe2ec; background: #f6f8fb;
         color: var(--ink2); border-radius: 7px; padding: .0625rem .4375rem; font-size: .75rem; font-weight: 600; line-height: 1.5; }
.dchip small { font-size: .625rem; font-weight: 500; color: var(--muted); }
.dchip.-e { border-color: #c9dcf2; background: var(--blue-l); color: var(--blue-d); }
.dchip.-e.-late { border-color: #f5c2bf; background: var(--red-l); color: var(--red); }
.dchip.-e.-due { border-color: #ffd699; background: var(--orange-l); color: #b06400; }
.dchip.-e.-soon { border-color: #b9d9f7; background: var(--sky-l); color: var(--sky); }
.dchip.-e.-done { border-color: #bfe3c9; background: var(--green-l); color: var(--green); }
.dchip.-e small { color: inherit; opacity: .75; }
.lc-row ._arr { color: #b5bfcc; font-size: .6875rem; flex: 0 0 auto; }
.lc-row ._days { font-size: .75rem; color: var(--muted); flex: 0 0 auto; margin-left: .125rem; }
.lc-row ._f { flex: 0 0 auto; }
/* กรอบจำนวนวัน */
.dchip.-d { margin-left: .125rem; border-color: #ddd6fe; background: #f3f0ff; color: #6d28d9; gap: .1875rem; }
.dchip.-d b { font-weight: 700; }
.dchip.-d small { color: inherit; opacity: .75; }
/* ปุ่มในแถวที่กาง + หน้าต่างยืมต่อ */
.btn.-blue-o { background: #fff; color: var(--blue); border-color: #9cc3e8; }
.lc .c-actions { flex-wrap: wrap; gap: .3125rem; padding: .375rem .25rem .375rem .625rem; }
.lc .c-actions .btn.-sm { padding: 0 .625rem; gap: .3125rem; }
.lc .c-actions .ibtn { width: 36px; height: 38px; }
.lc .c-actions ._sp { min-width: 0; }
.renew-info { display: flex; gap: .625rem; align-items: flex-start; background: #f6f8fb; border-radius: 12px;
              padding: .625rem .75rem; margin-bottom: 1rem; font-size: .8125rem; color: var(--muted); }
.renew-info > i { color: var(--blue); margin-top: .2rem; }
.renew-info b { color: var(--ink); font-size: .9375rem; }
.rdays { flex: 1 1 0%; }
.rdays input { text-align: center; font-weight: 700; font-size: 1.125rem; }
.chip.-on { background: var(--blue); border-color: var(--blue); border-style: solid; color: #fff; }
.renew-end { display: flex; align-items: center; gap: .5rem; margin: -.25rem 0 .875rem; color: var(--ink2); font-size: .9375rem; }
.renew-end i { color: var(--green); }
/* ปุ่มในแถวที่กาง: แถวเดียวเสมอ */
.lc .c-actions { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 1fr) repeat(3, 34px);
                 gap: .3125rem; align-items: center; padding: .375rem .375rem .375rem .625rem; }
.lc .c-actions ._sp { display: none; }
.lc .c-actions .btn.-sm { padding: 0 .25rem; min-width: 0; width: 100%; }
.lc .c-actions .ibtn { width: 34px; height: 38px; }
@media (max-width: 400px) { .lc .c-actions .btn.-sm i { display: none; } }
/* สายยืมต่อ */
.rnd { flex: 0 0 auto; display: inline-flex; align-items: center; gap: .1875rem; margin-left: .375rem; font-size: .6875rem;
       font-weight: 700; color: #0f766e; background: #ccfbf1; border-radius: 6px; padding: .0625rem .375rem; }
.rnd i { font-size: .5625rem; }
.pill.-off i { font-size: .625rem; margin-right: .1875rem; }
.dchip.-e.-renewed { border-color: #dbe2ec; background: #f1f4f8; color: var(--muted); }
.lc.-renewed { background: #fbfcfd; }
.lc.-renewed .lc-row ._amt { color: var(--ink2); }
.rlink { display: flex; align-items: center; gap: .5rem; width: 100%; margin-top: .5rem; padding: .5rem .625rem;
         border: 1px solid #cdeee8; background: #f0fdfa; border-radius: 10px; color: #0f766e; font-size: .8125rem; text-align: left; }
.rlink b { flex: 1 1 0%; min-width: 0; color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rlink ._go { color: #94a3b8; font-size: .75rem; }
.rlink:active { background: #ccfbf1; }
.lc.-flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px #14b8a6; } 100% { box-shadow: 0 1px 2px rgba(16,24,40,.06); } }
.rnd.-done { color: #64748b; background: #eef1f5; }
.lc.-done.-renewed, .lc.-done { }
/* รหัสรายการ */
.lcode { flex: 0 0 auto; margin-right: .4375rem; font-size: .75rem; font-weight: 700; letter-spacing: .02em; color: #fff;
         background: #475569; border-radius: 6px; padding: .0625rem .375rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
.lcode.-r { background: #0f766e; }
/* แถบจำนวนรายการ + สลับการเรียง */
.listbar { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin: 0 .125rem .5rem .25rem;
           color: var(--muted); font-size: .8125rem; }
.sortsw { display: inline-flex; background: #e6ebf2; border-radius: 10px; padding: 3px; }
.sortsw button { border: 0; background: transparent; color: var(--ink2); font-size: .8125rem; font-weight: 600; height: 32px;
                 padding: 0 .75rem; border-radius: 8px; display: inline-flex; align-items: center; gap: .375rem; }
.sortsw button i { font-size: .75rem; opacity: .7; }
.sortsw button.-on { background: #fff; color: var(--blue); box-shadow: 0 1px 3px rgba(16,24,40,.12); }
/* กล่องข้อมูลแยกสี ในแถวที่กาง */
.c-grid.-tiles { background: transparent; padding: 0; gap: .375rem; }
.c-grid.-tiles > div { border-radius: 10px; padding: .4375rem .5625rem; border: 1px solid transparent; }
.c-grid.-tiles ._l i { margin-right: .25rem; font-size: .625rem; }
.c-grid.-tiles ._v { font-size: 1rem; }
.c-grid.-tiles > .-rate { background: #f3f0ff; border-color: #e4dcfd; }
.c-grid.-tiles > .-rate ._l, .c-grid.-tiles > .-rate ._v { color: #6d28d9; }
.c-grid.-tiles > .-day { background: #fff6e8; border-color: #fde5bd; }
.c-grid.-tiles > .-day ._l, .c-grid.-tiles > .-day ._v { color: #b45309; }
.c-grid.-tiles > .-refund { background: #ecfdf3; border-color: #c9f0d8; }
.c-grid.-tiles > .-refund ._l, .c-grid.-tiles > .-refund ._v { color: #15803d; }
.c-grid.-tiles ._l { opacity: .85; }
/* ไอคอนท้ายแถว */
.lc .c-actions .ibtn.-c-note { color: #d4a106; }
.lc .c-actions .ibtn.-c-note.-has { color: #b45309; }
.lc .c-actions .ibtn.-c-file { color: #94a3b8; }
.lc .c-actions .ibtn.-c-file.-file { color: var(--orange); }
.lc .c-actions .ibtn.-c-print { color: #2776bd; }
/* เวลาสร้างรายการ ตัวเล็กใต้ป้ายสถานะ */
.lc-row ._st { display: flex; flex-direction: column; align-items: flex-end; gap: .125rem; }
.lc-row ._cr { font-size: .625rem; color: #a3adbb; white-space: nowrap; line-height: 1.2; }
.lc-row ._cr i { font-size: .5625rem; margin-right: .1875rem; }
/* แท็บไลน์: ป้ายยืมต่อ + หมายเหตุ */
.newchip.-renew { display: inline-block; border-style: solid; border-color: #99e2d6; background: #f0fdfa; color: #0f766e; }
.pick ._lnote { font-size: .75rem; color: #8a6500; margin-top: .125rem; }
.pick ._lnote i { color: #d4a106; margin-right: .25rem; }
/* ผู้ใช้ดูอย่างเดียว */
.lc .c-actions.-ro { display: flex; align-items: center; gap: .25rem; }
.lc .c-actions.-ro ._rotag { flex: 1 1 0%; color: var(--muted); font-size: .75rem; }
.lc .c-actions.-ro ._rotag i { margin-right: .3125rem; }
/* ปุ่มเรียง 3 แบบ */
.sortsw button { padding: 0 .5625rem; gap: .25rem; }
.sortsw button ._dir { font-size: .6875rem; opacity: 1; }
