/* ====== CARD HEADER ====== */
.card-header {
  background: var(--bg-white);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  margin-bottom: 0;
}
.card-header-left {
  flex: 1; min-width: 0;
  padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}

/* Project Info */
.project-info { display: flex; flex-direction: column; gap: 8px; }
.status-row { display: flex; align-items: center; gap: 6px; }
.status-label { font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; }
.status-dot { width: 4px; height: 4px; border-radius: 50%; background: #D4D4D4; flex-shrink: 0; }
.status-date { font-size: 12px; font-weight: 600; color: var(--text-muted); line-height: 18px; }
.status-chua_nhan .status-label { color: #737373; }
.status-sap_nhan .status-label { color: var(--brand); }
.status-sap_nhan .status-dot { background: var(--brand); }
.status-dang_nhan .status-label { color: var(--green); }
.status-dang_nhan .status-dot { background: var(--green); }
.status-dung_nhan .status-label { color: var(--red); }
.status-dung_nhan .status-dot { background: var(--red); }
.status-da_ban_het .status-label { color: var(--red); }
.status-da_ban_het .status-dot { background: var(--red); }

.project-name {
  font-size: 30px; font-weight: 700; line-height: 38px;
  color: var(--text-primary);
}
.info-row {
  display: flex; align-items: center; gap: 8px;
}
.info-row img { width: 20px; height: 20px; flex-shrink: 0; }
.info-row-text { font-size: 16px; font-weight: 500; color: var(--text-secondary); }

/* Prices box */
.prices-box {
  background: var(--bg-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-card);
  display: flex; gap: 12px;
}
/* Desktop: hiển thị ngang 3 cột, dùng price-row-main + price-cards-row */
.price-row-main {
  flex: 1; display: flex; flex-direction: column; gap: 4px;
  background: none; border-radius: 0; padding: 0;
}
.price-row-main-left { display: flex; align-items: center; gap: 6px; }
.price-row-main-left svg { display: none; } /* ẩn icon trên desktop */
.price-row-main-label { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.price-row-main-value { font-size: 18px; font-weight: 700; color: var(--green); }
.price-cards-row { display: contents; } /* desktop: các card hòa vào flex row */
.price-card {
  flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0;
  background: none; border-radius: 0; padding: 0;
}
.price-card-icon-wrap { display: none; } /* ẩn icon trên desktop */
.price-card-details { display: flex; flex-direction: column; gap: 4px; }
.price-card-label { font-size: 14px; font-weight: 400; color: var(--text-muted); }
.price-card-label-row { display: flex; align-items: center; gap: 4px; font-size: 14px; font-weight: 400; color: var(--text-muted); }
.price-card-value { font-size: 18px; font-weight: 700; color: var(--text-secondary); }

/* Buttons */
.header-btns { display: flex; gap: 8px; }


/* Image layout — matches Figma: aspect-video main + 5 square thumbs */
.card-header-right {
  flex: 1; min-width: 0;
  padding: 4px 4px 4px 0;
  display: flex; flex-direction: column; gap: 4px;
}
/* Main image: 16:9 */
.main-image-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.main-image-wrap img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}
.main-image-wrap img:hover { opacity: 0.92; }
/* Thumbnails: 5 square images */
.thumbnails {
  display: flex; gap: 4px;
  flex-shrink: 0;
}
.thumb-wrap {
  flex: 0 0 calc((100% - 4px * 4) / 5); /* luôn bằng 1/5 width, gap 4px × 4 khoảng */
  min-width: 0;
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.08);
  cursor: pointer;
}
.thumb-wrap img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  border-radius: 6px;
  transition: opacity 0.15s;
}
.thumb-wrap:hover img { opacity: 0.85; }
.thumb-wrap.active { border: 1px solid rgba(0,0,0,0.08); }
/* Overlay "N+" trên thumbnail cuối */
.thumb-overlay {
  position: absolute; inset: 0;
  border-radius: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: linear-gradient(0deg, rgba(0,0,0,0.50) 0%, rgba(0,0,0,0.50) 100%);
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.thumb-overlay-text {
  font-size: 16px; font-weight: 600;
  color: white; font-family: 'Inter', sans-serif; line-height: 24px;
}

/* ====== PROJECT CARDS LAYOUT ====== */
.project-cards-layout {
  display: flex; gap: 12px; align-items: flex-start;
  padding-top: 12px;
}
.left-col { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.right-col { width: 320px; flex-shrink: 0; position: sticky; top: 68px; }

/* ====== CARD CONTENT ====== */
.card-content {
  background: var(--bg-white); border-radius: var(--radius-lg);
  padding: 20px; display: flex; flex-direction: column; gap: 16px;
}
.card-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }

/* Sub-blocks */
.sub-block { display: flex; flex-direction: column; gap: 8px; }
.sub-label {
  font-size: 16px; font-weight: 500; color: #525252;
  display: flex; align-items: center; gap: 8px;
}
.sub-label::after {
  content: '';
  flex: 1;
  height: 1px;
  border-top: 1px dashed #D4D4D4;
}
.inner-box {
  background: var(--bg-secondary); border-radius: var(--radius-lg); padding: 20px;
}
.inner-box-gap { gap: 12px; display: flex; flex-direction: column; }

/* Owner row */
.owner-row { display: flex; align-items: center; gap: 12px; }
.owner-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.08); object-fit: cover; flex-shrink: 0;
}
.owner-info { display: flex; flex-direction: column; gap: 4px; }
.owner-name { font-size: 16px; font-weight: 500; color: var(--text-primary); }
.owner-meta { display: flex; align-items: center; gap: 6px; }
.owner-type { font-size: 14px; color: var(--text-tertiary); }
.dot-sep { width: 4px; height: 4px; border-radius: 50%; background: #D4D4D4; }
.owner-link { font-size: 14px; font-weight: 500; color: #DC6803; text-decoration: underline; }

/* Info rows */
.info-table-row {
  display: flex; align-items: flex-start; gap: 16px;
}
.info-table-label {
  width: 192px; flex-shrink: 0;
  display: flex; align-items: center; gap: 8px;
}
.info-table-label img, .info-table-label svg { width: 18px; height: 18px; flex-shrink: 0; }
.info-table-label-text { font-size: 14px; color: var(--text-tertiary); }
.info-table-value { flex: 1; font-size: 14px; font-weight: 500; color: var(--text-primary); }
.info-link { color: #DC6803; text-decoration: underline; font-weight: 500; font-size: 14px; }

/* ====== SALE BATCH ====== */
.section-header {
  display: flex; align-items: flex-start; gap: 4px; cursor: pointer;
  user-select: none;
}
.section-header img { width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.section-header-text { font-size: 16px; font-weight: 600; color: #525252; }

.step-wrap { display: flex; gap: 12px; align-items: flex-start; padding-left: 24px; }
.connector-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; flex-shrink: 0; padding-bottom: 4px;
  align-self: stretch;
}
.step-icon {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--border); background: white;
  flex-shrink: 0; z-index: 2; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.step-icon-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #D4D4D4;
}
.connector-line {
  flex: 1; width: 2px; min-height: 8px;
  background: repeating-linear-gradient(to bottom, #E5E5E5 0, #E5E5E5 4px, transparent 4px, transparent 8px);
  z-index: 1;
}
.step-content {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 16px;
  padding-bottom: 24px; padding-top: 2px;
}
.step-header { display: flex; align-items: center; gap: 8px; }
.step-batch-name { font-size: 16px; font-weight: 600; color: var(--text-primary); }

.step-types {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.step-type-text { font-size: 14px; font-weight: 500; color: var(--text-tertiary); }
.step-type-dot { width: 4px; height: 4px; border-radius: 50%; background: #A3A3A3; }

/* Step batch card layout (Figma — mobile only) */
.step-batch-card { display: none; }
.step-batch-card {
  border: 1px solid var(--border, #E5E5E5);
  border-radius: var(--radius-xl, 12px);
  overflow: hidden;
  box-shadow: 0px 12px 40px -12px rgba(0,0,0,0.06);
}
.step-batch-card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 12px 16px;
  background: #FAFAFA;
}
.step-batch-card-header-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.step-unit-block {
  border-top: 1px solid var(--border, #E5E5E5);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
}
.step-unit-block + .step-unit-block { border-top: 1px solid var(--border, #E5E5E5); }
.step-unit-name { font-size: 14px; font-weight: 600; color: var(--text-primary, #171717); }
.step-unit-stats {
  display: flex; gap: 12px;
  background: #FAFAFA; border-radius: 6px;
  padding: 12px 16px;
}
.step-unit-stat {
  display: flex; flex-direction: column; gap: 2px; flex: 1;
}
.step-unit-stat-value { font-size: 14px; font-weight: 600; color: var(--text-primary, #171717); line-height: 20px; }
.step-unit-stat-label { font-size: 12px; font-weight: 500; color: #525252; line-height: 18px; }

/* Nộp hồ sơ — submission info box (desktop + mobile) */
.submission-box {
  background: #F5F5F5;
  border-radius: 10px;
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-top: 12px;
}
.submission-title {
  font-size: 14px;
  font-weight: 600;
  color: #171717;
  padding: 6px;
  line-height: 20px;
}
.submission-card {
  background: #fff;
  border-radius: 6px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0px 1px 2px 0px rgba(10,13,18,0.05);
}
.submission-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.submission-label-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 192px;
  flex-shrink: 0;
}
.submission-label {
  font-size: 14px;
  font-weight: 400;
  color: #525252;
  line-height: 20px;
  flex: 1;
  min-width: 0;
}
.submission-value {
  font-size: 14px;
  font-weight: 500;
  color: #171717;
  line-height: 20px;
  flex: 1;
  min-width: 0;
}

/* Table */
.data-table {
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  overflow: hidden; display: flex;
}
.data-table-col { display: flex; flex-direction: column; }
.data-table-col.label-col { width: 180px; flex-shrink: 0; }
.data-table-col.value-col { flex: 1; min-width: 0; }
.table-cell {
  min-height: 44px; padding: 12px;
  display: flex; align-items: center;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  font-size: 14px;
}
.table-cell:last-child { border-bottom: none; }
.table-header-cell {
  background: var(--bg-secondary);
  font-size: 14px; font-weight: 600; color: var(--text-tertiary);
}
.table-value-cell {
  font-weight: 500; color: #181D27;
}
.table-value-col-last .table-cell { border-right: none; }

/* Apartment list (Căn hộ & Giá) — Figma vertical card layout (mobile only) */
.apt-list { display: none; flex-direction: column; gap: 12px; }
/* Desktop table shown by default, mobile card hidden */
#apartmentTable .data-table { display: flex; }
#apartmentTable .apt-list { display: none; }
.apt-item { display: flex; flex-direction: column; gap: 12px; }
.apt-item-title-row {
  display: flex; align-items: center; gap: 12px;
}
.apt-item-title {
  font-size: 14px; font-weight: 500; color: #525252; white-space: nowrap; flex-shrink: 0;
}
.apt-item-spacer {
  flex: 1; height: 1px; border-bottom: 1px dashed #E5E5E5;
}
.apt-item-card {
  background: #fff; border: 1px solid #E5E5E5;
  border-radius: 12px; padding: 16px;
  box-shadow: 0px 12px 40px -12px rgba(0,0,0,0.06);
  display: flex; flex-direction: column; gap: 12px;
}
.apt-detail-row {
  display: flex; gap: 12px; align-items: flex-start;
  font-size: 14px; font-weight: 500; line-height: 20px;
}
.apt-detail-label {
  width: 100px; flex-shrink: 0; color: #525252; font-weight: 400;
}
.apt-detail-value {
  flex: 1; min-width: 0; color: #171717;
}

/* Collapsible */
.collapsible-body { overflow: hidden; }
.collapsible-body.collapsed { display: none; }

/* Previous batches */
.prev-batch-header {
  display: flex; align-items: center; gap: 4px;
  cursor: pointer; user-select: none; padding: 4px 0;
}
.prev-batch-header img { width: 20px; height: 20px; flex-shrink: 0; }
.prev-batch-header-text { font-size: 16px; font-weight: 600; color: #525252; }

/* ====== SUBJECTS & CONDITIONS ====== */
.tags-wrap {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.subject-tag {
  background: white; border: 1px solid var(--border-input);
  border-radius: var(--radius); padding: 4px 10px;
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  box-shadow: var(--shadow-xs);
}
.condition-text {
  font-size: 14px; font-weight: 400; color: var(--text-primary); line-height: 20px;
}
.btn-check-condition {
  display: inline-flex; align-items: center; gap: 4px;
  width: fit-content;
  padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid #DC6803; background: #FFFAEB;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  color: #B54708; cursor: pointer; transition: background 0.15s;
}
.btn-check-condition:hover { background: #FEF0C7; }
.btn-check-condition img { width: 20px; height: 20px; }
.btn-explain {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: none; padding: 0;
  font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600;
  color: #DC6803; cursor: pointer;
}
.btn-explain img { width: 20px; height: 20px; }
.subjects-row { display: flex; align-items: center; gap: 8px; }
.subjects-row .sub-label { flex: 1; }

/* ====== TIMELINE ====== */
.timeline-wrap { display: flex; flex-direction: column; }
.timeline-step { display: flex; gap: 12px; align-items: flex-start; }
.timeline-connector-wrap {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; flex-shrink: 0; padding-bottom: 4px; align-self: stretch;
}
.timeline-icon {
  width: 24px; height: 24px; border-radius: 50%;
  flex-shrink: 0; z-index: 2; position: relative;
  display: flex; align-items: center; justify-content: center;
}
.timeline-icon.complete {
  background: #DC6803; border: none;
}
.timeline-icon.complete svg { color: white; }
.timeline-icon.current {
  background: #DC6803;
  box-shadow: 0 0 0 2px white, 0 0 0 4px #F79009;
}
.timeline-icon.incomplete {
  background: white; border: 1.5px solid var(--border);
}
.timeline-icon.incomplete .step-icon-dot { background: #D4D4D4; }
.timeline-line {
  flex: 1; width: 2px; min-height: 8px;
  background: repeating-linear-gradient(to bottom, #E5E5E5 0, #E5E5E5 4px, transparent 4px, transparent 8px);
}
.timeline-text { flex: 1; min-width: 0; padding-bottom: 24px; padding-top: 2px; }
.timeline-label { font-size: 14px; font-weight: 600; line-height: 20px; }
.timeline-label.complete { color: var(--text-secondary); font-size: 14px; }
.timeline-label.current { color: #B54708; }
.timeline-label.incomplete { color: var(--text-secondary); }
.timeline-date { font-size: 14px; line-height: 20px; }
.timeline-date.complete { color: var(--text-tertiary); }
.timeline-date.current { color: #DC6803; font-weight: 400; }
.timeline-date.incomplete { color: var(--text-tertiary); }

/* ====== LOAN CARD ====== */
.loan-card {
  background: var(--bg-white); border-radius: var(--radius-xl);
  padding: 20px; box-shadow: var(--shadow-soft);
  display: flex; gap: 12px;
}
.loan-logo { width: 40px; height: 40px; flex-shrink: 0; object-fit: cover; }
.loan-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.loan-title { font-size: 14px; font-weight: 500; color: var(--text-primary); }
.loan-sub { font-size: 12px; color: var(--text-secondary); }
.loan-btns { display: flex; gap: 8px; }


/* ====== MODAL ====== */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.3);
  z-index: 200;
  display: none; align-items: flex-start; justify-content: flex-end;
  padding: 12px;
}
.modal-overlay.open { display: flex; }
.modal-container {
  width: 384px; max-height: calc(100vh - 24px);
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--border-input);
  box-shadow: 0px 12px 40px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-header {
  padding: 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}
.modal-title { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.modal-close {
  width: 28px; height: 28px; border-radius: 6px;
  border: none; background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: #F5F5F5; }
.modal-close img { width: 20px; height: 20px; }
.modal-body {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.modal-intro { font-size: 14px; color: var(--text-tertiary); line-height: 20px; }
.modal-section-header {
  display: flex; align-items: flex-start; gap: 4px;
  cursor: pointer; user-select: none;
}
.modal-section-header img { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }
.modal-section-title { font-size: 16px; font-weight: 600; color: var(--text-primary); }
.modal-steps { display: flex; flex-direction: column; }
.modal-step { display: flex; gap: 12px; align-items: flex-start; }
.modal-step-connector {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; flex-shrink: 0; align-self: stretch; padding-bottom: 6px;
}
.modal-step-icon {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1.5px solid var(--border); background: white;
  flex-shrink: 0; z-index: 2;
}
.modal-step-line {
  flex: 1; width: 2px; min-height: 8px;
  background: repeating-linear-gradient(to bottom, #E5E5E5 0, #E5E5E5 4px, transparent 4px, transparent 8px);
}
.modal-step-content {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column; gap: 6px;
  padding-bottom: 24px; padding-top: 2px;
}
.modal-step-name { font-size: 14px; font-weight: 600; color: var(--text-secondary); line-height: 20px; }
.modal-step-desc { font-size: 14px; color: var(--text-tertiary); line-height: 20px; }

/* ====== IMAGE LIGHTBOX (mobile only) ====== */
.img-lightbox {
  display: none;
  position: fixed; inset: 0;
  background: #0a0a0a;
  z-index: 300;
  flex-direction: column;
  overscroll-behavior: contain;
}
.img-lightbox.open { display: flex; }

.img-lightbox-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 0;
  flex-shrink: 0;
}
.img-lightbox-close {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: white; padding: 0;
}
.img-lightbox-indicator {
  background: #262626;
  border-radius: 9999px;
  padding: 2px 10px;
  display: flex; align-items: center; gap: 2px;
  font-family: 'Inter', sans-serif; font-size: 14px; line-height: 20px;
}
.img-lightbox-indicator-cur { font-weight: 600; color: white; }
.img-lightbox-indicator-sep { font-weight: 500; color: #737373; }
.img-lightbox-indicator-total { font-weight: 500; color: #737373; }

.img-lightbox-stage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  position: relative;
}
/* Touch-swipe strip */
.img-lightbox-strip {
  display: flex;
  width: 100%; height: 100%;
  transition: transform 0.3s ease;
  will-change: transform;
}
.img-lightbox-slide {
  flex-shrink: 0;
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
}
.img-lightbox-slide img {
  width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
  user-select: none; -webkit-user-drag: none;
}

.lb-arrow {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.12);
  border: none; border-radius: 50%;
  cursor: pointer; z-index: 10;
  transition: background 0.15s, opacity 0.15s;
}
.lb-arrow:hover { background: rgba(255,255,255,0.24); }
.lb-arrow.hidden { opacity: 0; pointer-events: none; }
.lb-arrow-left  { left: 16px; }
.lb-arrow-right { right: 16px; }

.img-lightbox-bottom { height: 40px; flex-shrink: 0; }

/* ====== MOBILE RESPONSIVE (≤ 768px) ====== */
@media (max-width: 768px) {
/* ---- Body wrap ---- */
  .body-wrap { padding: 0; }
  .center-container { gap: 0; }

  /* ---- Image gallery mobile ---- */
  .card-header {
    flex-direction: column;
    border-radius: 0;
  }
  .card-header-left { padding: 16px; gap: 12px; }

  /* ---- Gallery wrapper: ảnh lên trên thông tin ---- */
  .card-header-right {
    order: -1;
    padding: 0;
    gap: 0;
  }

  /* ============================================================
     1 ẢNH: full width, max-height 400px
  ============================================================ */
  /* ---- Images: bỏ border-radius trên mobile ---- */
  .main-image-wrap { border-radius: 0; }
  .main-image-wrap img { border-radius: 0; }
  .thumb-wrap { border-radius: 0; }
  .thumb-wrap img { border-radius: 0; }

  .card-header-right[data-img-count="1"],
  .card-header-right[data-img-count="0"] {
    display: block;
  }
  .card-header-right[data-img-count="1"] .main-image-wrap,
  .card-header-right[data-img-count="0"] .main-image-wrap {
    width: 100%;
    aspect-ratio: unset;
    min-height: 200px;
    max-height: 400px;
    height: 300px;   /* fallback height */
    border-radius: 0;
    flex: unset;
  }
  .card-header-right[data-img-count="1"] .thumbnails,
  .card-header-right[data-img-count="0"] .thumbnails {
    display: none;
  }

  /* ============================================================
     2 ẢNH: 2 ảnh cạnh nhau, max-height 204px
  ============================================================ */
  .card-header-right[data-img-count="2"] {
    display: flex;
    flex-direction: row;
    gap: 2px;
  }
  .card-header-right[data-img-count="2"] .main-image-wrap {
    display: none;
  }
  .card-header-right[data-img-count="2"] .thumbnails {
    display: flex;
    flex-direction: row;
    width: 100%;
    gap: 2px;
  }
  .card-header-right[data-img-count="2"] .two-img-item {
    flex: 1;
    aspect-ratio: unset;
    height: 204px;
    border-radius: 0;
    min-width: 0;
  }
  .card-header-right[data-img-count="2"] .two-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* ============================================================
     3+ ẢNH: ảnh lớn trái + cột thumbnail 100px phải
  ============================================================ */
  .card-header-right[data-img-count="3"],
  .card-header-right[data-img-count="4"],
  .card-header-right[data-img-count="5"],
  .card-header-right[data-img-count="many"] {
    display: flex;
    flex-direction: row;
    gap: 2px;
  }
  .card-header-right[data-img-count="3"] .main-image-wrap,
  .card-header-right[data-img-count="4"] .main-image-wrap,
  .card-header-right[data-img-count="5"] .main-image-wrap,
  .card-header-right[data-img-count="many"] .main-image-wrap {
    flex: 1;
    min-width: 0;
    aspect-ratio: unset;
    border-radius: 0;
    height: 202px;
    max-height: 202px;
  }
  .card-header-right[data-img-count="3"] .thumbnails,
  .card-header-right[data-img-count="4"] .thumbnails,
  .card-header-right[data-img-count="5"] .thumbnails,
  .card-header-right[data-img-count="many"] .thumbnails {
    display: flex;
    flex-direction: column;
    width: 100px;
    flex-shrink: 0;
    gap: 2px;
    height: 202px;
    max-height: 202px;
    overflow: hidden;
  }
  /* Thumbnail: fixed 100px height, 2 ảnh × 100px + 2px gap = 202px */
  .card-header-right[data-img-count="3"] .thumb-wrap,
  .card-header-right[data-img-count="4"] .thumb-wrap,
  .card-header-right[data-img-count="5"] .thumb-wrap,
  .card-header-right[data-img-count="many"] .thumb-wrap {
    flex: none;
    width: 100px;
    height: 100px;
    aspect-ratio: unset;
    border-radius: 0;
  }
  /* Overlay "8+" trên thumbnail cuối */
  .thumb-overlay {
    position: absolute;
    inset: 0;
    border-radius: 0;
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.50) 0%, rgba(0, 0, 0, 0.50) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
  }
  .thumb-overlay-text {
    font-size: 16px;
    font-weight: 600;
    color: white;
    font-family: 'Inter', sans-serif;
    line-height: 24px;
  }

  /* ---- Project info mobile ---- */
  .project-info { gap: 6px; }
  .project-name { font-size: 20px; font-weight: 700; line-height: 28px; }
  .info-row { gap: 6px; }
  .info-row-text { font-size: 14px; font-weight: 500; color: var(--text-secondary); }
  .info-row img { width: 18px; height: 18px; }
  .status-label { font-size: 12px; font-weight: 600; }
  .status-date { font-size: 12px; }

  /* ---- Prices box mobile: dọc — hàng giá bán full-width + 2 card ngang ---- */
  .prices-box {
    flex-direction: column;
    padding: 0;
    gap: 8px;
    background: transparent;
    border: none;
    box-shadow: none;
  }
  /* Hiện icon Giá bán trên mobile */
  .price-row-main-left svg { display: block; }

  /* Hàng Giá bán: full width, icon + label trái, value phải */
  .price-row-main {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-main, #F5F5F5);
    border-radius: 8px;
    padding: 8px 12px;
    gap: 8px;
  }
  .price-row-main-left {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .price-row-main-label {
    font-size: 12px;
    font-weight: 500;
    color: #525252;
  }
  .price-row-main-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--green, #079455);
  }
  /* 2 mini-cards ngang: Đơn giá/m² và Đợt bán */
  .price-cards-row {
    display: flex;
    gap: 8px;
  }
  .price-card {
    flex: 1;
    background: var(--bg-main, #F5F5F5);
    border-radius: 10px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
  }
  /* price-card: icon trái + column (label/value) phải, gap 8px */
  .price-card {
    flex-direction: row;
    align-items: flex-start;
    gap: 8px;
  }
  .price-card-icon-wrap {
    display: flex;
    align-items: center;
    padding-top: 1px;
    flex-shrink: 0;
  }
  .price-card-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
  }
  .price-card-label-row {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary, #525252);
  }
  .price-card-value {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #171717);
  }

  /* ---- Header buttons: ẩn trên mobile (dùng header-mobile-cta) ---- */
  .header-btns { display: none; }

  /* ---- Layout: 1 cột ---- */
  .project-cards-layout {
    flex-direction: column;
    padding-top: 0;
    gap: 0;
  }
  .left-col { gap: 0; }
  .right-col {
    display: none;
  }

  /* ---- Card content ---- */
  .card-content { border-radius: 0; padding: 16px; gap: 16px; }
  .card-title { font-size: 16px; }

  /* ---- Sub-label ---- */
  .sub-label { font-size: 14px; display: flex; flex-direction: row; align-items: center; gap: 8px; height: auto; flex: unset; }

  /* ---- Divider giữa các section: handled by .section-divider elements ---- */

  /* ---- Info table: vertical (label trên, value dưới) ---- */
  .inner-box-gap { gap: 16px; }
  .info-table-row {
    flex-direction: column;
    gap: 2px;
  }
  .info-table-label {
    width: auto;
    align-items: center;
    gap: 6px;
  }
  .info-table-label img { width: 16px; height: 16px; }
  .info-table-label-text { font-size: 12px; color: var(--text-tertiary); }
  .info-table-value { font-size: 14px; font-weight: 500; color: var(--text-primary); padding-left: 22px; }
  .info-link { font-size: 14px; padding-left: 22px; }

  /* ---- Sub-block ---- */
  .sub-block { gap: 8px; }
  .inner-box { padding: 12px; }

  /* ---- Owner ---- */
  .owner-row { gap: 10px; }
  .owner-avatar { width: 40px; height: 40px; }
  .owner-name { font-size: 14px; font-weight: 500; }
  .owner-type { font-size: 12px; }
  .owner-link { font-size: 12px; }

  /* ---- Sale batch ---- */
  .section-header-text { color: #525252; font-size: 14px; font-weight: 500; line-height: 20px; }
  .prev-batch-header-text { color: #525252; font-size: 14px; font-weight: 500; line-height: 20px; }
  .step-batch-name { font-size: 14px; font-weight: 600; }
  .step-type-text { font-size: 12px; }
  .step-content { padding-bottom: 16px; }
  /* Mobile: show card layout, hide desktop timeline layout */
  .step-batch-card { display: block; }
  .step-wrap { display: none; }
  /* Submission box mobile: ngang cấp với card, row tách 2 dòng */
  .submission-box { margin-top: 8px; }
  .submission-row {
    flex-direction: column;
    gap: 2px;
  }
  .submission-label-wrap {
    width: auto;
    flex-shrink: 1;
  }
  .submission-value {
    padding-left: 28px; /* indent bằng icon 20px + gap 8px */
  }

  /* ---- Apartment list (mobile) ---- */
  #apartmentTable .data-table { display: none; }
  #apartmentTable .apt-list { display: flex; }
  .apt-item-card { padding: 12px; }
  .apt-detail-row { font-size: 13px; }

  /* ---- Subjects tags ---- */
  .subject-tag { font-size: 13px; padding: 4px 10px; }
  .condition-text { font-size: 13px; line-height: 20px; }

  /* ---- Timeline ---- */
  .timeline-label { font-size: 13px; }
  .timeline-date { font-size: 13px; }
  .timeline-text { padding-bottom: 16px; }

  /* ---- Loan/right-col card ---- */
  .loan-card { border-radius: 0; padding: 16px; }
  .loan-title { font-size: 14px; }
  .loan-sub { font-size: 12px; }
  .btn-loan-primary, .btn-loan-secondary { font-size: 12px; }

  /* ---- Đường kẻ section (dùng margin thay border) ---- */
  .section-divider {
    height: 4px;
    background: var(--bg-main);
    margin: 0;
    border: none;
  }

} /* end @media (max-width: 768px) */

/* Desktop (> 768px): ẩn mobile header */
@media (min-width: 769px) {
  .header-mobile { display: none; }
}
