
/* Styles */

/* ===== Giao diện "247 Khách hàng" (khung app Nhà đầu tư): điện thoại trước (máy tính dùng được), đỏ 247, chữ nội dung ≥ 17px (chỗ nhỏ hơn: danh sách
   cho phép có lý do trong tests/web.test.js), nút ≥ 48px.
   HĐ quá hạn: chữ đỏ "Quá hạn N ngày". Không CSS nội tuyến (CSP style-src 'self'). ===== */
:root {
  --do: #c8102e; --do-dam: #a00d25; --do-nhat: #fdecef; --vang-vien: #ffc61a;
  --chu: #1d1d1f; --chu-phu: #545a60; --chu-mo: #80868b; --vien: #e3e3e6; --nen: #f6f6f7; --the: #ffffff;
  --xanh: #1e7e34; --xanh-nen: #e6f4ea; --vang: #7a4f00; --vang-nen: #fff4d6; --lam: #1a56a6; --lam-nen: #e8f0fe; --xam: #545a60; --xam-nen: #eeeff1;
  --bo: 14px; --cao-nut: 48px; --day-duoi: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 17px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif; color: var(--chu); background: var(--nen); -webkit-text-size-adjust: 100%; }
h1 { font-size: 24px; margin: 0 0 12px; line-height: 1.3; }
h2 { font-size: 20px; margin: 20px 0 10px; }
a { color: var(--do); }
button, input, select, textarea { font: inherit; }
.boot, .dang-tai { padding: 40px 16px; text-align: center; color: var(--chu-phu); }
.o-loi { margin: 16px 0; padding: 12px 14px; border-radius: var(--bo); background: var(--do-nhat); color: var(--do-dam); }
.o-loi p { margin: 0 0 8px; }

/* Khung: thanh trên (chuông) + nội dung + thanh dưới 4 mục */
.thanh-tren { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px; padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  background: var(--do); color: #fff; }
.thanh-tren img { width: 32px; height: 32px; }
.nut-ve { display: inline-flex; align-items: center; justify-content: center; min-width: var(--cao-nut); min-height: var(--cao-nut); margin-left: -8px;
  border-radius: 50%; color: #fff; font-size: 26px; font-weight: 700; text-decoration: none; }
.nut-ve[hidden] { display: none; }
.thanh-tren .tieu-de { flex: 1; font-weight: 700; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nut-chuong { position: relative; min-width: var(--cao-nut); min-height: var(--cao-nut); border: 0; border-radius: 50%; background: transparent; color: #fff; font-size: 22px; cursor: pointer; }
.nut-chuong .so { position: absolute; top: 4px; right: 2px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--vang-vien); color: var(--chu); font-size: 12px; font-weight: 700; line-height: 20px; }
.noi-dung { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(100px + var(--day-duoi)); }
.thanh-duoi { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; background: var(--the); border-top: 1px solid var(--vien); padding-bottom: var(--day-duoi); }
.thanh-duoi a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 60px; color: var(--chu-phu); text-decoration: none; font-size: 14px; }
.thanh-duoi a .bt { font-size: 21px; line-height: 1.2; }
.thanh-duoi a.dang { color: var(--do); font-weight: 700; }

/* Thẻ, dòng thông tin */
.the-trang { background: var(--the); border: 1px solid var(--vien); border-radius: var(--bo); padding: 14px 16px; margin-bottom: 12px; }
.the-hd .dau { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.xe { font-weight: 700; font-size: 18px; }
.the-hd .ma { color: var(--chu-phu); font-size: 15px; }
.so-lon { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--chu); margin: 4px 0 0; }
.dong-tt { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--vien); }
.dong-tt:last-child { border-bottom: 0; }
.dong-tt .nhan { color: var(--chu-phu); }
.dong-tt .gt { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dong-tt.dai .gt { white-space: normal; word-break: break-word; }
.phu { color: var(--chu-phu); font-size: 17px; }
.mo-ta { color: var(--chu-phu); margin: 0 0 12px; }
.the { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 15px; font-weight: 600; white-space: nowrap; }
.the.xanh { background: var(--xanh-nen); color: var(--xanh); }
.the.vang { background: var(--vang-nen); color: var(--vang); }
.the.lam { background: var(--lam-nen); color: var(--lam); }
.the.xam { background: var(--xam-nen); color: var(--xam); }
.hang { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Quá hạn (đỏ) — chỉ chữ "Quá hạn N ngày"; dải tiền chờ PGD xác nhận; số tất toán tham khảo */
.qua-han { color: var(--do); font-weight: 700; margin: 6px 0 0; }
.dai-cho { margin: 10px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--vang-nen); color: var(--vang); font-weight: 600; }
.tat-toan .so-lon { color: var(--chu); }
.tham-khao { margin: 4px 0 0; color: var(--chu-phu); font-size: 17px; font-style: italic; }
.ls { padding: 10px 0; border-bottom: 1px solid var(--vien); }
.ls:last-child { border-bottom: 0; }
.ls .tien { font-weight: 700; font-variant-numeric: tabular-nums; }

/* Thanh toán QR */
.qr-khung { display: flex; justify-content: center; padding: 12px; background: #fff; border: 1px solid var(--vien); border-radius: var(--bo); margin: 12px 0; }
.qr-khung svg { width: 260px; height: 260px; max-width: 100%; }
.nhac { padding: 10px 12px; border-radius: 12px; background: var(--lam-nen); color: var(--lam); font-weight: 600; margin: 12px 0; }
.dong-chep { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--vien); }
.dong-chep .nhan { color: var(--chu-phu); min-width: 110px; }
.dong-chep .gt { flex: 1; font-weight: 700; word-break: break-word; }

/* Nút + ô nhập */
.nut { min-height: var(--cao-nut); padding: 10px 18px; border: 1px solid var(--vien); border-radius: 12px; background: var(--the); color: var(--chu); font-weight: 600; text-align: center; cursor: pointer; }
.nut.chinh { background: var(--do); border-color: var(--do); color: #fff; }
.nut.vien-do { border-color: var(--do); color: var(--do); }
.nut.nho { padding: 8px 14px; font-size: 17px; }
.nut.rong { width: 100%; }
.nut:disabled { opacity: .55; cursor: default; }
a.nut { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.nhom-nut { display: flex; gap: 10px; flex-wrap: wrap; margin: 12px 0; }
.nhom-nut .nut { flex: 1; }
.nhom-nut.doc { flex-direction: column; }   /* nút chữ dài (Liên hệ): mỗi nút 1 hàng rộng hết — 375px không gãy chữ */
.nhom-nut.doc .nut { flex: none; width: 100%; }
.o-nhap { margin-bottom: 14px; }
.o-nhap label { display: block; font-weight: 600; margin-bottom: 6px; }
.o-nhap input, .o-nhap textarea { width: 100%; min-height: var(--cao-nut); padding: 10px 12px; border: 1px solid var(--vien); border-radius: 12px; background: #fff; font-size: 18px; }
.o-nhap textarea { min-height: 110px; resize: vertical; }
.o-nhap .goi-y { color: var(--chu-phu); font-size: 17px; margin-top: 4px; }

/* Màn chào / đăng nhập / kích hoạt */
.man-chao { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; text-align: center; background: var(--the); }
.man-chao img.logo { width: 88px; height: 88px; margin-bottom: 16px; }
.man-chao p { max-width: 440px; color: var(--chu-phu); }
.man-chao .nut { min-width: 260px; margin-top: 12px; }
.man-chao form, .man-chao .cot { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: center; }
.buoc { text-align: left; max-width: 440px; margin: 8px auto; padding-left: 24px; }
.buoc li { margin: 6px 0; }
.o-pin, .o-sdt, .o-ma { width: 100%; max-width: 300px; min-height: 54px; margin: 6px 0; padding: 10px 14px; border: 1px solid var(--vien); border-radius: 12px;
  background: #fff; font-size: 22px; text-align: center; }
.o-pin, .o-ma { letter-spacing: .4em; font-variant-numeric: tabular-nums; }
.modal .o-pin { max-width: none; }
.nhan-o { align-self: stretch; max-width: 300px; margin: 8px auto 0; font-weight: 600; text-align: left; width: 100%; }
.chu-loi, .man-chao .chu-loi { color: var(--do-dam); min-height: 24px; margin: 8px 0 0; }   /* lỗi ô nhập: thắng .man-chao p (chữ xám) */
.nut-chu { min-height: var(--cao-nut); margin-top: 6px; padding: 8px 6px; border: 0; background: none; color: var(--do); font-weight: 600; text-decoration: underline; cursor: pointer; }
.hop-vang { max-width: 400px; margin: 10px 0; padding: 12px 14px; border-radius: 12px; background: var(--vang-nen); color: var(--vang); text-align: left; }
.hop-vang p { color: var(--vang); margin: 0 0 6px; }
.dieu-khoan { width: 100%; max-width: 520px; max-height: 46vh; overflow: auto; margin: 8px 0; padding: 12px 14px; border: 1px solid var(--vien); border-radius: 12px;
  background: var(--nen); text-align: left; font-size: 17px; }
.dieu-khoan h3 { font-size: 18px; margin: 12px 0 4px; }
.dieu-khoan h3:first-child { margin-top: 0; }
.dieu-khoan p, .dieu-khoan li { margin: 4px 0; color: var(--chu); }
.dong-y { display: flex; align-items: flex-start; gap: 12px; width: 100%; max-width: 520px; min-height: var(--cao-nut); margin: 8px 0; text-align: left; font-weight: 600; cursor: pointer; }
.dong-y input { width: 26px; height: 26px; margin-top: 2px; flex: 0 0 auto; }

/* Thông báo, hộp, toast */
.tb { display: block; width: 100%; text-align: left; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--vien); background: var(--the); color: inherit; cursor: pointer; font-size: 17px; }
.tb.moi { background: var(--do-nhat); }
.tb .tieu { font-weight: 700; }
.modal-bg { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, .4); }
.modal { width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; padding: 18px 16px calc(16px + var(--day-duoi)); border-radius: 18px 18px 0 0; background: var(--the); }
.modal h2 { margin-top: 0; }
.modal-nut { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal-nut .nut { flex: 1; }
#toasts { position: fixed; left: 16px; right: 16px; bottom: calc(80px + var(--day-duoi)); z-index: 30; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { max-width: 480px; padding: 12px 16px; border-radius: 12px; background: #323232; color: #fff; }
.toast.loi { background: var(--do-dam); }
.toast.ok { background: var(--xanh); }
@media (min-width: 760px) { .modal-bg { align-items: center; } .modal { border-radius: 18px; } }
