/* ════════════════════════════════════════════════════════════════
   UNIT DETAIL MODAL (#fdModal) — modal CHI TIẾT CĂN DÙNG CHUNG.
   File CSS DUY NHẤT cho modal chi tiết căn, dùng ở MỌI trang:
   - Trang chi tiết dự án (bản tương tác: booking/lock).
   - Trang account (đơn hàng / booking / quan tâm — bản read-only).
   Nội dung tách nguyên khối từ project-detail.css để 1 nơi sửa = mọi nơi
   ăn theo. Bất kỳ trang nào include components/unit_detail_modal là tự nạp.
   ════════════════════════════════════════════════════════════════ */

/* Biến màu/spacing — khai báo tại #fdModal để không phụ thuộc page
   (trang account chưa định nghĩa --primary-light / --bg-light). */
#fdModal {
  --primary:       #b20707;
  --primary-light: #fdf2f2;
  --bg-light:      #f8f9fa;
  --t2:            #333333;
  --t3:            #666666;
  --t4:            #888888;
  --bdr:           #e8e8e8;
  --r:             4px;
  --rlg:           6px;
}

.fd-modal {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 9000;
  align-items: center; justify-content: center;
  padding: 16px; backdrop-filter: blur(2px);
}
.fd-modal.open { display: flex; }
/* Modal cấp 2 (lock / booking QR / trùng booking) chồng LÊN TRÊN modal chi tiết căn
   (#fdModal, z-index 9000) → modal 1 vẫn hiển thị & mờ đi phía sau (giống salepro). */
#bookingLockModal, #fdBookingQRModal, #fdDuplicateBookingModal { z-index: 9100; }
.fd-modal-box {
  background: #fff; border-radius: var(--rlg);
  width: 800px; max-width: 96vw; height: 82vh;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 64px rgba(0,0,0,.25);
  animation: fdPop .18s ease; overflow: hidden;
}
@keyframes fdPop {
  from { opacity: 0; transform: scale(.97); }
  to   { opacity: 1; transform: scale(1); }
}
.fd-modal-head {
  padding: 6px 12px; border-bottom: 1px solid #f0f0f0;
  display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  flex-shrink: 0; background: var(--primary);
  color: #fff;
}
.fd-head-code { font-size: 14px; font-weight: 900; color: #fff; }
.fd-head-price { text-align: right; flex-shrink: 0; }
.fd-head-price .price-big { font-size: 14px; font-weight: 900; color: #fff; }
.fd-head-price .price-note { font-size: 9px; color: rgba(255,255,255,.75); margin-top: 1px; }
.fd-close {
  background: rgba(255,255,255,.15); border: none; cursor: pointer;
  font-size: 14px; color: #fff; width: 24px; height: 24px;
  border-radius: 4px; display: flex; align-items: center;
  justify-content: center; transition: background .15s; flex-shrink: 0;
}
.fd-close:hover { background: rgba(255,255,255,.3); }
.fd-modal-body {
  display: grid; grid-template-columns: 240px 1fr;
  flex: 1; min-height: 0; overflow: hidden;
}
@media(max-width:680px){
  .fd-modal-body { grid-template-columns: 1fr; overflow-y: auto; }
}
.fd-left  { padding: 8px; border-right: 1px solid #f0f0f0; overflow-y: auto; }
.fd-right { padding: 8px 12px; overflow-y: auto; }

.fd-img-wrap {
  border-radius: var(--r); overflow: hidden;
  background: #f0f0f0; height:auto; cursor: pointer;
  position: relative; display: flex;
  align-items: center; justify-content: center; margin-bottom: 5px;
}
.fd-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .28s; display: none;
}
.fd-no-img {
  display: flex; flex-direction: column;
  align-items: center; gap: 5px; color: #bbb; font-size: 11px;
}
.fd-zoom-hint {
  position: absolute; bottom: 5px; right: 5px;
  background: rgba(0,0,0,.45); color: #fff;
  font-size: 10px; padding: 2px 6px; border-radius: 3px; display: none;
}
.fd-thumbs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 5px; }
.fd-thumb {
  width: 48px; height: 36px; border-radius: 4px;
  overflow: hidden; border: 2px solid transparent;
  cursor: pointer; transition: all .13s;
}
.fd-thumb:hover,.fd-thumb.active { border-color: var(--primary); }
.fd-thumb img { width: 100%; height: 100%; object-fit: cover; }

.fd-spec-row { display: flex; gap: 4px; margin-top: 5px; }
.fd-spec-pill {
  flex: 1; text-align: center; padding: 4px 2px;
  background: var(--bg-light); border-radius: 4px; border: 1px solid #eee;
}
.fd-spec-pill .sp-icon { font-size: 9px; color: var(--primary); margin-bottom: 1px; }
.fd-spec-pill .sp-val  { font-size: 11px; font-weight: 800; color: #1a1a1a; }
.fd-spec-pill .sp-lbl  { font-size: 9px; color: var(--t3); }

.fd-price-box {
  background: var(--primary-light);
  border: 1.5px solid rgba(192,57,43,.2);
  border-radius: var(--r); padding: 6px 10px; margin-bottom: 6px;
}
.fd-price-box .pb-main { font-size: 15px; font-weight: 900; color: var(--primary); margin-bottom: 1px; }
.fd-price-box .pb-note { font-size: 10px; color: var(--t3); }
.fd-price-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 4px; }
.fd-price-item {
  background: #fafafa; border-radius: 4px;
  padding: 4px 6px; border: 1px solid #f0f0f0;
}
.fd-price-item .pi-lbl { font-size: 9px; color: var(--t3); margin-bottom: 1px; }
.fd-price-item .pi-val { font-size: 12px; font-weight: 700; color: var(--primary); }
.fd-price-item .pi-val.dark { color: #1a1a1a; }

.fd-sec {
  font-size: 10px; font-weight: 800; color: var(--primary);
  text-transform: uppercase; letter-spacing: .5px;
  padding: 3px 0 2px;
  border-bottom: 1.5px solid rgba(192,57,43,.15);
  margin-bottom: 4px;
  display: flex; align-items: center; justify-content: space-between;
}
.fd-sec.fd-agent-sec-head {
  margin-top: 8px;
}
.fd-sec-left { display: flex; align-items: center; gap: 4px; }
.fd-row {
  display: flex; justify-content: space-between;
  align-items: flex-start; padding: 3px 0;
  border-bottom: 1px solid #f8f8f8; gap: 6px;
}
.fd-row:last-child { border-bottom: none; padding-bottom: 0; }
.fd-lbl { font-size: 12px; color: var(--t3); font-weight: 500; flex-shrink: 0; }
.fd-row .fd-val { font-size: 12px; color: #1a1a1a; font-weight: 600; text-align: right; }

.fd-csbh-box {
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 5px; padding: 5px 8px; margin-bottom: 6px;
}
.fd-csbh-row {
  display: flex; align-items: flex-start;
  gap: 6px; margin-bottom: 3px;
}
.fd-gift-text {
  font-size: 11px; color: #166534;
  background: #dcfce7; border-radius: 4px;
  padding: 4px 6px; margin-top: 2px;
  font-weight: 500; line-height: 1.5;
}

.fd-status-row { display: flex; align-items: center; gap: 6px; padding: 3px 0; }
.fd-status-row span { font-size: 12px !important; }
.fd-sbadge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 3px; font-size: 11px; font-weight: 700;
}
.fd-sbadge.s-available { color: #166534; }
.fd-sbadge.s-held      { color: #854d0e; }
.fd-sbadge.s-deposited { color: #1e40af; }
.fd-sbadge.s-sold      { color: #991b1b; }
.fd-sbadge.s-locked    { color: #7e22ce; }

.fd-agents { display: flex; flex-direction: column; gap: 4px; margin-top: 2px; }
.fd-agent {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; background: var(--bg-light);
  border-radius: 5px; border: 1px solid #eaecf0;
}
.fd-agent-av {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}
.fd-agent-name  { font-size: 12px; font-weight: 700; color: #1a1a1a; }
.fd-agent-role  { font-size: 11px; color: var(--t3); }
.fd-agent-phone {
  font-size: 11px; color: var(--primary); font-weight: 600;
  display: flex; align-items: center; gap: 3px;
  margin-top: 1px; text-decoration: none;
}
.fd-call-btn {
  padding: 4px 8px; background: var(--primary); color: #fff;
  border-radius: 4px; font-size: 11px; font-weight: 700;
  white-space: nowrap; display: inline-flex; align-items: center;
  gap: 3px; border: none; cursor: pointer;
  font-family: inherit; transition: opacity .14s;
}
.fd-call-btn:hover { opacity: .84; }

.fd-modal-foot {
  flex-shrink: 0; background: #fafafa;
  border-top: 1px solid #f0f0f0;
  border-radius: 0 0 var(--rlg) var(--rlg);
}
.fd-foot-actions {
  padding: 6px 12px; display: flex; gap: 6px;
  align-items: center; justify-content: center; flex-wrap: wrap;
}
.fd-booking-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px; background: var(--primary); color: #fff;
  border-radius: var(--r); font-size: 13px; font-weight: 700;
  border: 1px solid transparent; cursor: pointer; font-family: inherit;
  box-sizing: border-box; height: 36px;
}
.fd-booking-btn:disabled {
  opacity: 0.6 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
}
.fd-outline-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 0 12px; background: #fff; color: var(--t2);
  border: 1px solid var(--bdr); border-radius: var(--r);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .14s;
  box-sizing: border-box; height: 36px;
}
.fd-outline-btn:hover { border-color: var(--primary); color: var(--primary); }
.fd-outline-btn.fd-wishlisted { border-color: var(--primary); color: var(--primary); }

.fd-ptg-wrap {
  border: 1px solid #ddd6fe; border-radius: 6px;
  padding: 6px 8px; background: #faf5ff; margin-top: 5px;
}

.fd-area-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 8px;
}
.fd-area-box {
  background: var(--bg-light);
  border-radius: var(--r);
  padding: 6px 10px;
  border: 1px solid #eee;
}
.fd-area-lbl {
  font-size: 9px;
  color: var(--t3);
  margin-bottom: 1px;
}
.fd-area-val {
  font-size: 14px;
  font-weight: 800;
}
.fd-handover-wrap {
  margin-bottom: 8px;
}

.fd-lb {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.93); z-index: 9999;
  align-items: center; justify-content: center;
}
.fd-lb.open { display: flex; }
.fd-lb-close {
  position: absolute; top: 14px; right: 18px;
  color: #fff; font-size: 20px; cursor: pointer; background: none; border: none;
}
.fd-lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.13); border: none; color: #fff;
  font-size: 17px; width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.fd-lb-prev { left: 14px; }
.fd-lb-next { right: 14px; }
/* Giới hạn ảnh lightbox trong khung nhìn: ảnh dài/cao cũng hiện trọn vẹn,
   không bị phóng to tràn màn hình. object-fit:contain giữ đúng tỉ lệ. */
#fdLbImg {
  max-width: 90vw; max-height: 90vh;
  width: auto; height: auto;
  object-fit: contain; display: block;
}

/* ── BOOKING LOCK MODAL extras ─────────────────────────────────── */
#bookingLockModal .fd-modal-box,
#fdBookingQRModal .fd-modal-box {
  height: auto; max-height: 92vh;
}

/* ════════════════════════════════════════════════════════════════
   #fdModal — REDESIGN modal chi tiết căn (theo thiết kế mới).
   TẤT CẢ scope vào #fdModal để KHÔNG ảnh hưởng modal lock/booking/QR
   đang dùng chung các class .fd-* (đã test, không được phá).
   ════════════════════════════════════════════════════════════════ */
#fdModal .fd-modal-box {
  width: 1080px; max-width: 96vw; height: 88vh; border-radius: 16px;
}

/* ── Header: mã căn (trái) · giá (giữa) · trạng thái + đóng (phải) ── */
#fdModal .fd-modal-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 16px; padding: 16px 24px; border-bottom: none;
  background: var(--primary); color: #fff;
}
#fdModal .fd-head-left { min-width: 0; }
#fdModal .fd-head-code { font-size: 22px; font-weight: 900; color: #fff; line-height: 1.1; }
#fdModal .fd-head-sub  { font-size: 13px; color: rgba(255,255,255,.82); margin-top: 3px; }
#fdModal .fd-head-price { text-align: center; }
#fdModal .fd-head-price .price-big  { font-size: 24px; font-weight: 900; color: #fff; line-height: 1.15; }
#fdModal .fd-head-price .price-note { font-size: 11px; color: rgba(255,255,255,.82); margin-top: 2px; }
#fdModal .fd-head-right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
#fdModal .fd-modal-head .fd-sbadge {
  background: #fff; color: var(--primary);
  padding: 6px 14px; border-radius: 20px; font-size: 13px; font-weight: 700;
}
#fdModal .fd-modal-head .fd-sbadge.s-available { color: #15803d; }
#fdModal .fd-modal-head .fd-sbadge.s-held      { color: #b45309; }
#fdModal .fd-modal-head .fd-sbadge.s-deposited { color: #1d4ed8; }
#fdModal .fd-modal-head .fd-sbadge.s-sold      { color: #b91c1c; }
#fdModal .fd-modal-head .fd-sbadge.s-locked    { color: #7e22ce; }
#fdModal .fd-close {
  width: 34px; height: 34px; font-size: 16px; border-radius: 8px;
  background: rgba(255,255,255,.18);
}

/* ── Body ── */
#fdModal .fd-modal-body {
  grid-template-columns: 280px 1fr; gap: 18px; padding: 18px; background: #fff;
}
#fdModal .fd-left  { padding: 0; border-right: none; }
#fdModal .fd-right { padding: 0; display: flex; flex-direction: column; gap: 14px; }

/* ── Cột trái ── */
#fdModal .fd-img-wrap { border-radius: 12px; height:auto; background: #f1f2f4; margin-bottom: 12px; }
#fdModal .fd-no-img { font-size: 13px; gap: 8px; }
#fdModal .fd-no-img svg { width: 40px; height: 40px; }
#fdModal .fd-thumbs { gap: 6px; margin-bottom: 12px; }
#fdModal .fd-spec-row { gap: 8px; margin: 0; }
#fdModal .fd-spec-pill {
  background: var(--bg-light); border: 1px solid #eef0f2; border-radius: 10px; padding: 10px 6px;
}
#fdModal .fd-spec-pill .sp-icon { font-size: 14px; color: var(--primary); margin-bottom: 4px; }
#fdModal .fd-spec-pill .sp-val  { font-size: var(--fs-xs); font-weight: 500; color: var(--t3); }
#fdModal .fd-spec-pill .sp-lbl  { font-size: 14px; color: var(--text); font-weight: 500; margin-top: 2px; }

#fdModal .fd-ptg-card {
  display: flex; align-items: center; gap: 12px;
  background: #f1ad8c; border: 1px solid #eef0f2; border-radius: 12px;
  padding: 12px 14px; transition: border-color .15s;
}
#fdModal .fd-ptg-card:hover { border-color: var(--primary); }
#fdModal .fd-ptg-card-ic {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
#fdModal .fd-ptg-card-info { flex: 1; min-width: 0; }
#fdModal .fd-ptg-card-title { font-size: 14px; font-weight: 700; color: #1a1a1a; }
#fdModal .fd-ptg-card-sub { font-size: 12px; color: var(--t3); margin-top: 2px; }
#fdModal .fd-ptg-card-chev { color: #bbb; font-size: 13px; flex-shrink: 0; }
#fdModal .fd-ptg-btn { color: var(--primary); font-weight: 700; text-decoration: none; }
.fd-ptg-btn {
    padding: 2px 0;
    font-size: 12px;
}

/* ── Card chung (cột phải) ── */
#fdModal .fd-card {
  background: var(--bg-light); border: 1px solid #eef0f2; border-radius: 12px; padding: 14px 16px;
}
#fdModal .fd-card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 800; color: var(--primary);
  text-transform: uppercase; letter-spacing: .4px; margin-bottom: 12px;
}
#fdModal .fd-card-title i { font-size: 14px; }

/* ── GIÁ BÁN ── */
#fdModal .fd-price-head { display: flex; align-items: stretch; gap: 16px; flex-wrap: wrap; }
#fdModal .fd-price-main {
  flex: 0 0 auto; min-width: 150px;
  display: flex; flex-direction: column; justify-content: center;
}
#fdModal .fd-price-main .pb-main { font-size: 30px; font-weight: 900; color: var(--primary); line-height: 1.1; }
#fdModal .fd-price-main .pb-note { font-size: 12px; color: var(--t3); margin-top: 4px; }
#fdModal .fd-price-grid { display: flex; gap: 10px; flex: 1; min-width: 0; margin: 0; }
#fdModal .fd-price-item {
  flex: 1; background: #fff; border: 1px solid #eef0f2; border-radius: 10px; padding: 10px 12px; min-width: 0;
}
#fdModal .fd-price-item .pi-lbl { font-size: var(--fs-sm); color: var(--text); font-weight: 500; margin-bottom: 4px; }
#fdModal .fd-price-item .pi-val {
  font-size: var(--fs-xs); font-weight: 400; color: var(--t3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#fdModal .fd-price-item .pi-val.dark { color: #1a1a1a; }

/* ── Lưới 2 cột: Diện tích · CSBH · Bàn giao · Trạng thái ── */
/* align-items:stretch → 2 khối cùng hàng (Diện tích + Bàn giao) bằng chiều cao */
#fdModal .fd-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: stretch; }
/* Khối full width (CSBH & Quà tặng) chiếm trọn 1 hàng riêng (row 2) */
#fdModal .fd-card-full { grid-column: 1 / -1; }

/* ── Thông tin căn (lưới gọn, 3 ô/hàng, ô rỗng bị JS ẩn) ── */
#fdModal .fd-info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 680px) { #fdModal .fd-info-grid { grid-template-columns: 1fr 1fr; } }
#fdModal .fd-info-box { background: var(--bg-light); border: 1px solid #eef0f2; border-radius: 8px; padding: 7px 10px; min-width: 0;display: flex;align-items: center;justify-content: space-between;}
#fdModal .fd-info-lbl { font-size: var(--fs-sm); color: var(--text); font-weight: 500; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fdModal .fd-info-val { font-size: var(--fs-xs); font-weight: 400; color: var(--t3); word-break: break-word; }

/* Link "Xem chi tiết" hình thức bàn giao (cạnh Tiêu chuẩn) — như .ov-handover-link tab tổng quan. */
#fdModal .fd-handover-detail {
  margin-left: 8px; color: var(--primary); font-weight: 600; font-size: 12px;
  text-decoration: none; display: inline-flex; align-items: center; gap: 4px; cursor: pointer;
}
#fdModal .fd-handover-detail i { font-size: 11px; }

/* ══ MODAL HÌNH THỨC BÀN GIAO (#handoverModal) — đặt tại đây (thay vì project-detail.css)
   để dùng chung cho MỌI trang có modal chi tiết căn, gồm cả account (không nạp project-detail.css). ══ */
.handover-modal {
  position: fixed; inset: 0; width: 100%; height: 100%;
  background-color: rgba(15, 23, 42, 0.6); display: none;
  align-items: center; justify-content: center; z-index: 9999; padding: 16px;
  backdrop-filter: blur(6px);
}
.handover-modal-card {
  background: #ffffff; width: 100%; max-width: 100%; max-height: 88vh;
  border-radius: 16px; box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex; flex-direction: column; overflow: hidden;
  border: 1px solid #f1f5f9; animation: fdPop .3s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (min-width: 738px) { .handover-modal-card { max-width: 75%; } }
.handover-modal-header {
  background: linear-gradient(135deg, var(--red, #b20707), var(--red-dark, #b71c1c));
  padding: 18px 20px; color: #ffffff;
  /* flex-start: header cao thay đổi theo tiêu đề nhiều dòng → canh trên cho icon + nút đóng. */
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
}
.handover-modal-head-left { display: flex; align-items: flex-start; gap: 12px; min-width: 0; flex: 1; }
/* Khối text 3 dòng — min-width:0 để dòng tiêu đề dài tự xuống dòng trong bề rộng còn lại. */
.handover-modal-head-text { min-width: 0; flex: 1; }
.handover-modal-icon {
  width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.16);
  display: flex; align-items: center; justify-content: center; color: #ffffff; font-size: 16px; flex-shrink: 0;
}
.handover-modal-title { font-size: 17px; font-weight: 700; color: #ffffff; margin: 0; }
/* Nhãn cấp (Dự án:/Phân khu:/Tòa nhà:) ở dòng 2. */
.handover-modal-head-text .hm-name-lbl { font-weight: 500; color: #fff; }
/* Dòng 2 — "Tòa nhà: X - {tiêu đề}" (nhãn + nội dung; tiêu đề gộp vào, dài → xuống dòng). */
.handover-modal-subtitle {
  font-size: 13px; color: rgba(255, 255, 255, 0.85); margin: 2px 0 0; font-weight: 600; line-height: 1.4;
  white-space: normal; word-break: break-word; overflow-wrap: anywhere;
}
.handover-modal-body { padding: 20px 24px; overflow-y: auto; }
.handover-modal-content { font-size: 14px; line-height: 1.65; color: #334155; word-break: break-word; }
.handover-modal-content img { max-width: 100%; height: auto; border-radius: 8px; }
/* Style bảng tối thiểu — để không phụ thuộc ckeditor.css (account không nạp). */
.handover-modal-content table { width: 100%; max-width: 100%; border-collapse: collapse; }
.handover-modal-content th, .handover-modal-content td { border: 1px solid #e5e7eb; padding: 7px 11px; }
.handover-modal-content a { color: var(--primary, #b20707); }
.handover-modal-footer { padding: 14px 24px; border-top: 1px solid #f1f5f9; display: flex; justify-content: flex-end; background: #fff; }

/* ── CSBH & Quà tặng ── */
#fdModal .fd-csbh-box { background: transparent; border: none; padding: 0; margin: 0; }
#fdModal .fd-csbh-row-inline {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; font-size: 13px;
}
#fdModal .fd-csbh-row-inline .text-t3 { color: var(--t3); }
#fdModal .fd-csbh-row-inline .text-weight-600 { font-weight: 700; color: #1a1a1a; }
#fdModal .fd-gifts-lbl { font-size: 12px; color: var(--t3); margin-bottom: 4px; }
#fdModal .fd-gift-text {
  font-size: 13px; color: #166534; background: #ecfdf3;
  border: 1px solid #bbf7d0; border-radius: 8px; padding: 8px 10px; line-height: 1.5;
}

/* ── Bàn giao (rows) ── */
#fdModal .fd-handover-wrap { margin: 0; }
#fdModal .fd-row { padding: 6px 0; border-bottom: 1px solid #eef0f2; }
#fdModal .fd-row:last-child { border-bottom: none; }
#fdModal .fd-lbl { font-size: var(--fs-sm); color: var(--text); font-weight: 500 }
#fdModal .fd-row .fd-val { font-size: var(--fs-xs); font-weight: 400; color: var(--t3); }

/* ── Trạng thái ── */
#fdModal .fd-status-row { padding: 5px 0; }
#fdModal .fd-status-row span { font-size: 13px !important; }
#fdModal .fd-countdown-text { font-weight: 800; color: var(--primary); }
#fdModal .fd-hold-until-val { font-weight: 700; color: #1a1a1a; }

/* ── Nhân viên phụ trách: lưới ngang, tự xuống dòng → không phải kéo dọc khi nhiều người ── */
#fdModal .fd-agents { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
#fdModal .fd-agent { background: #fff; border: 1px solid #eef0f2; border-radius: 10px; padding: 8px 10px; gap: 8px; }
#fdModal .fd-agent-av { width: 34px; height: 34px; font-size: 13px; }
#fdModal .fd-agent-av-wrap { flex: 1; min-width: 0; }
#fdModal .fd-agent-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#fdModal .fd-agent-role { font-size: 11.5px; }
#fdModal .fd-agent-phone { font-size: 12px; }
#fdModal .fd-call-btn {
  background: #fff; color: var(--primary); border: 1px solid var(--primary);
  padding: 6px 12px; border-radius: 8px; font-size: 13px; transition: all .14s; flex-shrink: 0;
}
/* Màn hẹp: rớt về 1 cột cho dễ đọc */
@media (max-width: 680px) { #fdModal .fd-agents { grid-template-columns: 1fr; } }
#fdModal .fd-call-btn:hover { background: var(--primary); color: #fff; opacity: 1; }
#fdModal .fd-agent-empty { font-size: 13px; color: var(--t3); padding: 10px; text-align: center; }

/* ── Footer ── */
#fdModal .fd-modal-foot { background: #fff; border-top: 1px solid #eef0f2; }
#fdModal .fd-foot-actions { padding: 12px 18px; gap: 8px; }
#fdModal .fd-booking-btn { height: 38px; font-size: var(--fs-sm); padding: 0 18px; border-radius: 9px; }
#fdModal .fd-outline-btn { height: 38px; font-size: var(--fs-sm); padding: 0 14px; border-radius: 9px; }
/* Nút Quan tâm: màu theo TRẠNG THÁI (class .fd-wishlisted), không ép đỏ cố định
   để giữ được hiệu ứng :hover. */
#fdModal .fd-outline-btn.fd-wishlisted { border-color: var(--primary); color: var(--primary); }
/* Icon tim đổi màu rõ theo trạng thái: chưa quan tâm = xám, đã quan tâm = đỏ. */
#fdModal .fd-outline-btn--wish i { color: #bbb; }
#fdModal .fd-outline-btn--wish.fd-wishlisted i { color: var(--primary); }

/* ── Responsive #fdModal ── */
@media (max-width: 860px) {
  #fdModal .fd-modal-body { grid-template-columns: 1fr; overflow-y: auto; }
  #fdModal .fd-left, #fdModal .fd-right { overflow: visible; }
  #fdModal .fd-grid2 { grid-template-columns: 1fr; }
  #fdModal .fd-price-head { flex-direction: column; }
  #fdModal .fd-price-grid { flex-wrap: wrap; }
  #fdModal .fd-price-item { flex: 1 1 calc(50% - 5px); }
}
@media (max-width: 768px) {
  /* Bung full màn hình như các modal khác (ghi đè rule #fdModal id-specificity) */
  #fdModal .fd-modal-box {
    width: 100%; max-width: 100%; height: 96vh;
    border-radius: 12px 12px 0 0; position: fixed; bottom: 0; top: auto;
  }
  #fdModal .fd-modal-head { grid-template-columns: 1fr auto; padding: 12px 16px; }
  #fdModal .fd-head-price { display: none; }
  #fdModal .fd-head-code { font-size: 18px; }
}

/* ── Nút "Xem trang dự án" (footer bản read-only ở trang account) ── */
.fd-btn-proj {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 16px; background: var(--primary); color: #fff;
  border: 1px solid var(--primary); border-radius: var(--r);
  font-size: 13px; font-weight: 700; cursor: pointer;
  font-family: inherit; box-sizing: border-box; height: 36px; text-decoration: none;
}
.fd-btn-proj:hover { opacity: .9; }
#fdModal .fd-btn-proj { height: 38px; font-size: 13.5px; padding: 0 18px; border-radius: 9px; }
#fdModal .fd-agent-empty { grid-column: 1 / -1; }

/* ════════════════════════════════════════════════════════════════
   NÚT "TÍNH LÃI VAY" (cạnh tiêu đề "Giá bán")
   ════════════════════════════════════════════════════════════════ */
#fdModal .fd-card-title--flex { justify-content: space-between; }
#fdModal .fd-laiway-card { cursor: pointer; }
/* Card tính lãi vay dùng tông xanh để phân biệt với phiếu tính giá */
#fdModal .fd-laiway-card .fd-ptg-card-ic { color: #2563eb; background: rgba(37, 99, 235, .1); }
#fdModal .fd-laiway-card .fd-ptg-btn { color: #2563eb; }

/* ════════════════════════════════════════════════════════════════
   MODAL "TÍNH LÃI VAY" (#lcModal / #lcDetailModal)
   ════════════════════════════════════════════════════════════════ */
.lc-modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 10050; align-items: center; justify-content: center; padding: 16px;
}
.lc-modal.open { display: flex; }
.lc-box {
  background: #fff; border-radius: 14px; width: 820px; max-width: 98vw; max-height: 92vh;
  overflow: hidden; display: flex; flex-direction: column;
  box-shadow: 0 28px 80px rgba(0,0,0,.3);
}
.lc-box--detail { width: 760px; }
.lc-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 22px; border-bottom: 1px solid #f0f0f0; flex-shrink: 0;
}
.lc-head-title { font-size: 17px; font-weight: 800; color: #1a1a1a; display: flex; align-items: center; gap: 8px; }
.lc-head-title--sm { font-size: 15px; }
.lc-back {
  background: none; border: none; cursor: pointer; font-size: 14px; color: #555;
  display: flex; align-items: center; gap: 6px; font-family: inherit; padding: 6px 8px; border-radius: 6px;
}
.lc-back:hover { background: #f5f5f5; }
.lc-close {
  width: 30px; height: 30px; border-radius: 50%; background: #f3f4f6; border: none;
  cursor: pointer; font-size: 16px; color: #888; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0;
}
.lc-close:hover { background: #fee2e2; color: #e74c3c; }
.lc-body { flex: 1; overflow-y: auto; padding: 20px 22px; }
.lc-body--table { padding: 0 22px 20px; }
.lc-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
@media (max-width: 680px) { .lc-cols { grid-template-columns: 1fr; gap: 20px; } }
.lc-col-title { font-size: 14px; font-weight: 700; color: #1a1a1a; margin-bottom: 14px; }
.lc-field { margin-bottom: 16px; }
.lc-label { font-size: 13px; color: #555; font-weight: 600; margin-bottom: 6px; display: block; }
.lc-required { color: #e74c3c; }
.lc-input {
  width: 100%; height: 42px; padding: 0 48px 0 12px; border: 1.5px solid #ddd; border-radius: 8px;
  font-size: 14px; font-family: inherit; color: #1a1a1a; box-sizing: border-box; outline: none;
  transition: border-color .15s;
}
.lc-input:focus { border-color: #2563eb; }
.lc-input-wrap { position: relative; }
.lc-input-suffix {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 13px; color: #888; pointer-events: none;
}
.lc-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.lc-range-wrap { display: flex; align-items: center; gap: 10px; }
.lc-range-wrap input[type=range] { flex: 1; accent-color: #2563eb; }
.lc-range-badge {
  flex-shrink: 0; min-width: 52px; text-align: center; background: #eff6ff; color: #2563eb;
  font-weight: 700; font-size: 13px; padding: 5px 10px; border-radius: 6px;
}
.lc-hint { font-size: 12px; color: #aaa; margin-top: 5px; }
.lc-computed {
  background: #f8f9fb; border: 1px solid #eaecf0; border-radius: 8px; padding: 10px 14px;
  font-size: 16px; font-weight: 800; color: #1a1a1a;
}
.lc-stat { border-radius: 10px; padding: 14px 16px; margin-bottom: 14px; }
.lc-stat-interest { background: #fffbeb; border: 1px solid #fde68a; }
.lc-stat-principal { background: #f5f3ff; border: 1px solid #ddd6fe; }
.lc-stat-total { background: #f0fdf4; border: 1px solid #bbf7d0; }
.lc-stat-label { font-size: 13px; color: #666; margin-bottom: 4px; }
.lc-stat-val { font-size: 19px; font-weight: 800; color: #1a1a1a; margin-bottom: 8px; }
.lc-stat-bar-bg { height: 6px; border-radius: 3px; background: rgba(0,0,0,.06); overflow: hidden; }
.lc-stat-bar { height: 100%; border-radius: 3px; transition: width .3s ease; }
.lc-stat-interest .lc-stat-bar { background: #f59e0b; }
.lc-stat-principal .lc-stat-bar { background: #7c3aed; }
.lc-stat-total .lc-stat-bar { background: #22c55e; }
.lc-note { font-size: 12px; color: #999; line-height: 1.6; margin-top: 6px; }
.lc-foot { padding: 16px 22px; border-top: 1px solid #f0f0f0; flex-shrink: 0; }
.lc-btn-detail {
  width: 100%; padding: 13px 20px; background: #111827; color: #fff; border: none;
  border-radius: 9px; font-size: 15px; font-weight: 700; cursor: pointer; font-family: inherit;
  transition: opacity .15s;
}
.lc-btn-detail:hover { opacity: .88; }
.lc-table-wrap { overflow-x: auto; max-height: 60vh; overflow-y: auto; }
.lc-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.lc-table thead th {
  position: sticky; top: 0; background: #fff; text-align: right; padding: 10px 12px;
  border-bottom: 2px solid #eee; font-weight: 700; color: #555; white-space: nowrap; z-index: 1;
}
.lc-table thead th:first-child { text-align: left; }
.lc-table td {
  padding: 8px 12px; text-align: right; border-bottom: 1px solid #f5f5f5;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.lc-table td:first-child { text-align: left; color: #888; }
.lc-phase-row td {
  background: #fff7ed; font-weight: 700; color: #92400e; padding: 9px 12px; border-bottom: 1px solid #fde68a;
}
.lc-phase-row .lc-phase-icon { margin-right: 5px; }
.lc-total-row td {
  background: #f8f9fb; font-weight: 800; color: #1a1a1a; border-top: 2px solid #eee;
  border-bottom: none; position: sticky; bottom: 0;
}
.lc-interest-col { color: #d97706; }
