/* LINE LIFF — phone frame, same palette as backoffice (design-system/loan-system/pages/liff.md)
   LINE green appears ONLY on the login button (.btn-line-login). */
body { background: var(--ground); }
.liff-stage { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 14px; }
.liff-stage .stage-note { font-size: 12.5px; color: var(--muted); text-align: center; max-width: 420px; }
.phone { width: 375px; max-width: 100%; height: 812px; max-height: calc(100vh - 80px); background: var(--surface); border: 1px solid var(--silver-300); border-radius: 36px; box-shadow: var(--shadow-xl); overflow: hidden; display: flex; flex-direction: column; position: relative; }
.phone-top { height: 44px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--brand-900); }
.liff-head { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; padding: 6px 16px 10px; border-bottom: 1px solid var(--silver-300); }
.liff-head .logo { height: 28px; }
.liff-head .title { font-weight: 600; font-size: 15px; color: var(--brand-900); }
.liff-head .sub { font-size: 12px; color: var(--muted); } /* round7-audit U9: 12px is the floor (round 5 §3.1 rule 5) */
.liff-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; font-size: 16px; line-height: 1.55; }
.liff-body h1 { font-size: 20px; } .liff-body h2 { font-size: 17px; }
.liff-body .input, .liff-body .select, .liff-body .textarea { min-height: 46px; font-size: 16px; }
.liff-body .btn { min-height: 48px; font-size: 16px; }
.liff-body .btn-sm { min-height: 44px; font-size: 14px; } /* round5 §6: every tap target in LIFF is ≥44px, incl. list-row buttons */
.liff-steps { margin-bottom: 16px; }
.liff-body .check { padding: 10px 0; }
.liff-body .check input { width: 22px; height: 22px; }
.liff-nav { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--silver-300); background: var(--surface); padding-bottom: 10px; }
/* round7-audit W17: .liff-nav sets its own `display`, which beats the UA [hidden] rule — restate it
   here so nav(null) (an applicant with no contract of their own — #/apply/*, expired) truly hides the bar. */
.liff-nav[hidden] { display: none; }
.liff-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; font-size: 12px; color: var(--muted); text-decoration: none; transition: color var(--t-fast) var(--ease); }
.liff-nav a:hover { text-decoration: none; color: var(--text); }
.liff-nav a[aria-current="page"] { color: var(--brand-700); font-weight: 600; }
.liff-nav a .ic { width: 22px; height: 22px; }
.liff-nav a .badge { position: absolute; margin-left: 28px; margin-top: -30px; min-width: 18px; height: 18px; font-size: 12px; } /* round7-audit U9 */
.balance { border: 1px solid var(--silver-300); border-radius: var(--r-xl); overflow: hidden; }
.balance-head { background: var(--brand-100); padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--brand-900); }
.balance-body { padding: 16px; }
.balance .amount { font-family: var(--mono); font-size: 32px; font-weight: 600; color: var(--brand-900); line-height: 1.1; letter-spacing: -.02em; }
.balance .amount.gold { color: var(--gold-700); }
.liff-step { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.liff-step .bar { display: flex; gap: 4px; }
.liff-step .bar span { flex: 1; height: 5px; border-radius: 999px; background: var(--silver-100); }
.liff-step .bar span.on { background: var(--brand-700); }
.liff-step .txt { font-size: 12.5px; color: var(--muted); display: flex; justify-content: space-between; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px; border: 1px solid var(--silver-300); border-radius: var(--r-lg); background: var(--surface); }
.qr-box .qr { width: 168px; height: 168px; display: grid; grid-template-columns: repeat(9, 1fr); gap: 3px; padding: 8px; border: 1px solid var(--silver-300); border-radius: 8px; }
.qr-box .qr i { background: var(--brand-900); border-radius: 1px; }
.qr-box .qr i.o { background: transparent; }
.upload { border: 2px dashed var(--silver-400); border-radius: var(--r-lg); padding: 22px 12px; text-align: center; color: var(--muted); cursor: pointer; transition: border-color var(--t-fast) var(--ease), background-color var(--t-fast) var(--ease); }
.upload:hover { border-color: var(--brand-500); background: var(--brand-100); }
.upload .ic { width: 30px; height: 30px; margin: 0 auto 6px; color: var(--brand-500); }
.ocr-tag { font-size: 12px; color: var(--gold-700); background: var(--gold-100); border-radius: 999px; padding: 1px 7px; margin-left: 6px; font-weight: 500; } /* round7-audit U9: same 12px floor, caught alongside the header sub/badge/timestamp */
.list-row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; border-bottom: 1px solid var(--silver-300); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .t { font-weight: 500; } .list-row .s { font-size: 12.5px; color: var(--muted); }
/* round 7 / Part 1: the body is real HTML now (h1/h2/p/table), not a pre-wrapped plain-text blob —
   this box's typography mirrors the backoffice read view's .doc, just sized for a phone. */
.contract-doc { font-size: 13.5px; line-height: 1.7; padding: 14px; border: 1px solid var(--silver-300); border-radius: var(--r-md); background: var(--surface); max-height: 260px; overflow: auto; overflow-wrap: anywhere; transition: max-height var(--t-base) var(--ease); }
.contract-doc p { margin: 0 0 10px; }
.contract-doc h1 { font-size: 15px; font-weight: 600; text-align: center; color: var(--brand-900); margin: 0 0 14px; }
.contract-doc h2 { font-size: 13.5px; font-weight: 600; color: var(--brand-900); margin: 16px 0 6px; }
.contract-doc a { color: var(--brand-700); text-decoration: underline; }
.contract-doc table { border-collapse: collapse; width: 100%; margin: 10px 0; font-size: .96em; }
.contract-doc th, .contract-doc td { border: 1px solid var(--silver-300); padding: 6px 8px; text-align: left; vertical-align: top; }
.contract-doc th { background: var(--brand-100); color: var(--brand-900); font-weight: 600; }
.contract-doc td > *:last-child, .contract-doc th > *:last-child { margin-bottom: 0; }
/* round7-audit W1/U1 pattern fix: the client's draft text butts labels straight against merge values
   with no space ("จำนวนเงินทั้งสิน3,000บาท") — never rewrite their wording, just give every filled or
   empty merge token a visual gap on both sides so it never reads glued to the words around it. */
.contract-doc mark.mf { background: var(--gold-100); color: var(--gold-700); padding: 0 3px; margin: 0 2px; border-radius: 3px; }
.contract-doc mark.mf.mf-num { font-family: var(--mono); } /* figures only (round7-audit brand rule) — never Thai names/addresses */
.contract-doc .mf-empty { display: inline-block; color: var(--muted); background: var(--silver-100); padding: 0 5px; margin: 0 2px; border-radius: 3px; font-style: normal; }
.slide-in { animation: slide var(--t-base) var(--ease); }
@keyframes slide { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .slide-in { animation: none; } }
.chat-msg { border: 1px solid var(--silver-300); border-radius: var(--r-lg); padding: 12px 14px; background: var(--surface); }
.chat-msg .at { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-bottom: 4px; } /* round7-audit U9 */
.spin { animation: liff-spin 1s linear infinite; }
@keyframes liff-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
@media (max-width: 480px) {
  .liff-stage { padding: 0; }
  .liff-stage .stage-note { display: none; }
  .phone { width: 100%; height: 100vh; max-height: none; border-radius: 0; border: 0; box-shadow: none; }
  .phone-top { display: none; }
}
