/* =========================================================
   vzenrent — Design System & Global Styles
   Brand: vzenrent (V + zen + rent)
   ========================================================= */

:root {
  /* Palette — navy (logo) chu dao + gold noi bat (Sprint 8ET rebrand logo) */
  --primary: #1B3A63;
  --primary-600: #142C4D;
  --primary-700: #0E2038;
  --primary-50: #EEF2F8;
  --primary-100: #D4E0EF;

  --accent: #E4A52A;
  --accent-600: #C5871A;
  --accent-50: #FCF4E2;
  /* Sprint 8IQ: token v0 cho pill hoa hong (nen kem + chu nau) */
  --gold-soft: #FDF6E7;
  --gold-foreground: #5A3D07;

  --success: #10B981;
  --success-50: #ECFDF5;
  --warning: #F59E0B;
  --warning-50: #FFFBEB;
  --danger: #EF4444;
  --danger-50: #FEF2F2;
  --info: #3B82F6;
  --info-50: #EFF6FF;

  --ink: #0F172A;
  --ink-2: #1E293B;
  --ink-3: #334155;
  --muted: #64748B;
  --muted-2: #94A3B8;
  --line: #E2E8F0;
  --line-2: #CBD5E1;
  --bg: #F8FAFC;
  --bg-2: #F1F5F9;
  --surface: #FFFFFF;

  /* Layout */
  --sidebar-w: 248px;
  --header-h: 64px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Spacing scale (4px base) — Sprint 8IM design-system refresh */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px; --sp-8: 48px;

  /* Shadows — Sprint 8IM: nhe/tinh hon cho cam giac minimal SaaS */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 2px 8px rgba(15, 23, 42, .06);
  --shadow-lg: 0 6px 24px rgba(15, 23, 42, .10);

  --transition: 160ms ease;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; }
a { color: inherit; text-decoration: none; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; line-height: 1.25; color: var(--ink); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* ---------- Containers ---------- */
.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.container-fluid { width: 100%; padding: 0 20px; }

/* ---------- Typography Utility ---------- */
.text-muted { color: var(--muted); }
.text-sm { font-size: 13px; }
.text-xs { font-size: 12px; }
.text-lg { font-size: 17px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600; font-size: 14px;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}
/* Sprint 8IM: bo hover "nhay" (translateY) — cam giac calm/chuyen nghiep hon */
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-600); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-600); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-outline:hover { background: var(--bg-2); border-color: var(--line-2); }
.btn-ghost { background: transparent; color: var(--ink-3); }
.btn-ghost:hover { background: var(--bg-2); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #DC2626; }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 14px 24px; font-size: 15px; }
.btn-icon { padding: 8px; aspect-ratio: 1; justify-content: center; }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  overflow: auto;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.card-body { padding: 20px; }
.card-title { font-size: 16px; font-weight: 600; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px;
  font-size: 12px; font-weight: 600;
  border-radius: 999px;
  background: var(--bg-2); color: var(--ink-3);
}
.badge-primary { background: var(--primary-50); color: var(--primary-700); }
.badge-success { background: var(--success-50); color: #047857; }
.badge-warning { background: var(--warning-50); color: #B45309; }
.badge-danger { background: var(--danger-50); color: #B91C1C; }
.badge-info { background: var(--info-50); color: #1D4ED8; }
.badge-dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor;
}

/* ---------- Forms ---------- */
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-label { font-size: 13px; font-weight: 600; color: var(--ink-3); }
.form-label .req { color: var(--danger); }
.form-control,
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="date"],
select, textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
}
.form-control:focus,
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 58, 99, .15);
}
textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 12px; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-row { grid-template-columns: 1fr; } }

/* Custom select with icon */
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding-left: 40px; }

/* ---------- Header (public) ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 19px; color: var(--ink);
  letter-spacing: -0.02em;
}
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  background: url("../logo.png") center/contain no-repeat;
  border-radius: 0;
  font-size: 0;            /* an chu "vz" cu, hien anh logo */
  letter-spacing: -0.04em;
}
.brand-mark span { font-size: 0; }
.brand b { color: var(--primary); font-weight: 800; }
/* Footer nen toi -> sung navy bi chim: dat logo tren tile trang */
.site-footer .brand-mark {
  background-color: #fff;
  background-size: 78%;
  border-radius: 8px;
}

.site-nav { display: flex; gap: 4px; align-items: center; }
.site-nav a {
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  color: var(--ink-3);
}
.site-nav a:hover { background: var(--bg-2); color: var(--ink); }
.site-nav a.active { color: var(--primary-700); background: var(--primary-50); }

.site-actions { display: flex; gap: 10px; align-items: center; }

.hamburger {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--radius);
  align-items: center; justify-content: center;
}
.hamburger:hover { background: var(--bg-2); }
.hamburger svg { width: 22px; height: 22px; }

@media (max-width: 900px) {
  .site-nav { display: none; }
  .hamburger { display: inline-flex; }
  .site-nav.open {
    display: flex; flex-direction: column;
    position: absolute; top: var(--header-h); left: 0; right: 0;
    background: var(--surface); border-bottom: 1px solid var(--line);
    padding: 12px; gap: 2px;
  }
  .site-nav.open a { padding: 12px 14px; }
}
@media (max-width: 520px) {
  .site-actions .btn-outline { display: none; }
}

/* ---------- Landing Page ---------- */
.hero {
  position: relative;
  padding: 80px 0 100px;
  overflow: hidden;
  background:
    radial-gradient(ellipse 80% 60% at 80% 0%, rgba(27, 58, 99, .14), transparent 60%),
    radial-gradient(ellipse 60% 50% at 0% 30%, rgba(245, 158, 11, .10), transparent 60%),
    var(--surface);
}
.hero-grid {
  display: grid; grid-template-columns: 1.1fr 1fr;
  gap: 60px; align-items: center;
}
.hero h1 {
  font-size: clamp(32px, 5vw, 54px);
  line-height: 1.08;
  letter-spacing: -0.025em;
  margin-bottom: 18px;
}
.hero h1 .grad {
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead {
  font-size: 18px; color: var(--ink-3); margin-bottom: 28px;
  max-width: 560px;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 32px; }
.hero-stats { display: flex; gap: 36px; flex-wrap: wrap; }
.hero-stat .v { font-size: 26px; font-weight: 800; color: var(--ink); letter-spacing: -0.02em; }
.hero-stat .l { font-size: 13px; color: var(--muted); }

.hero-visual {
  position: relative;
  aspect-ratio: 1 / 1;
  max-width: 520px;
  min-height: 460px;
  margin-left: auto;
}
/* Sprint 8DV: mockup dashboard lam lop nen hero; cac card noi float len tren */
.hero-mockup {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  filter: drop-shadow(0 18px 40px rgba(15, 23, 42, 0.14));
}
.hero-card {
  position: absolute;
  z-index: 2;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  border: 1px solid var(--line);
}
.hero-card.c1 {
  top: 6%; left: 4%; width: 60%;
  animation: floaty 6s ease-in-out infinite;
}
.hero-card.c2 {
  top: 38%; right: 0; width: 62%;
  animation: floaty 6s ease-in-out infinite 2s;
}
.hero-card.c3 {
  bottom: 0; left: 14%; width: 64%;
  animation: floaty 6s ease-in-out infinite 4s;
}
@keyframes floaty {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}
.hero-card .row { display: flex; align-items: center; gap: 10px; }
.hero-card .img {
  width: 56px; height: 56px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
  display: grid; place-items: center; color: var(--primary-700); font-size: 22px;
}
.hero-card .t { font-weight: 700; font-size: 14px; }
.hero-card .s { font-size: 12px; color: var(--muted); }
.hero-card .price { color: var(--primary); font-weight: 700; font-size: 15px; margin-top: 4px; }
.hero-card .commission {
  margin-top: 10px; padding: 8px 10px; border-radius: 8px;
  background: var(--accent-50); color: var(--accent-600);
  font-size: 12px; font-weight: 600;
  display: flex; justify-content: space-between;
}

@media (max-width: 900px) {
  .hero { padding: 60px 0; }
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .hero-visual {
    max-width: 420px;
    margin: 0 auto;
    aspect-ratio: auto;
    height: 460px;
  }
}
/* Sprint 8T Phase 1: hide hero-visual hoàn toàn trên < 600px.
   3 floating card position:absolute overlap nhau gây vỡ layout iPhone < 480px.
   Cards là decorative — hero text + button + stats vẫn full-width readable. */
@media (max-width: 600px) {
  .hero-visual { display: none; }
  .hero-grid { grid-template-columns: 1fr; gap: 20px; }
  .hero { padding: 40px 0; }
}

/* ============================================================
   Sprint 8T Phase 2-3: Mobile bottom navigation bar
   Auto-injected qua client/js/pwa.js cho owner/CTV logged-in.
   Width >= 900px: hidden (sidebar đủ rộng).
   Width < 900px: sticky bottom 5 icon thay sidebar collapse.
   ============================================================ */
.mobile-bottom-nav { display: none; }
.mobile-bottom-nav-sheet { display: none; }

@media (max-width: 900px) {
  .mobile-bottom-nav {
    display: flex;
    position: fixed; bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top: 1px solid var(--line);
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    padding: 4px 0 calc(4px + env(safe-area-inset-bottom)) 0;
    z-index: 99;
    justify-content: space-around;
    align-items: stretch;
  }
  .mbn-item {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 6px 4px;
    text-decoration: none;
    color: var(--ink-3);
    font-size: 11px;
    font-weight: 500;
    gap: 2px;
    transition: color 0.15s;
    min-height: 50px;
  }
  .mbn-item svg { width: 22px; height: 22px; stroke-width: 2; }
  .mbn-item.active { color: var(--primary); }
  .mbn-item.active svg { stroke: var(--primary); }
  .mbn-item:active { background: var(--bg-2); }

  /* Đẩy body lên để bottom nav không che content */
  body.has-mobile-nav { padding-bottom: 64px; }

  /* Bottom sheet overlay cho "Khác" menu */
  .mobile-bottom-nav-sheet {
    display: none;
    position: fixed; inset: 0;
    z-index: 200;
    background: rgba(0,0,0,0.5);
  }
  .mobile-bottom-nav-sheet.open { display: block; }
  .mobile-bottom-nav-sheet-content {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: #fff;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    padding: 12px 0 calc(12px + env(safe-area-inset-bottom)) 0;
    max-height: 70vh;
    overflow-y: auto;
    animation: mbnSlideUp 0.2s ease-out;
  }
  @keyframes mbnSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .mobile-bottom-nav-sheet-content .mbn-sheet-header {
    text-align: center;
    padding: 0 16px 8px;
    border-bottom: 1px solid var(--bg-2);
    color: var(--ink-2);
    font-size: 13px;
    font-weight: 600;
  }
  .mobile-bottom-nav-sheet-content .mbn-sheet-handle {
    width: 36px; height: 4px;
    background: var(--line);
    border-radius: 2px;
    margin: 0 auto 10px;
  }
  .mobile-bottom-nav-sheet-content a {
    display: flex; align-items: center; gap: 12px;
    padding: 14px 20px;
    text-decoration: none;
    color: var(--ink);
    font-size: 15px;
    border-bottom: 1px solid var(--bg-2);
  }
  .mobile-bottom-nav-sheet-content a:active { background: var(--bg-2); }
  .mobile-bottom-nav-sheet-content a svg { width: 20px; height: 20px; stroke-width: 2; }

  /* Sidebar collapse — khi có bottom nav thì sidebar hamburger vẫn dùng được nhưng đỡ cần thiết */
  /* (giữ sidebar khả dụng cho user quen, KHÔNG ẩn hoàn toàn để fallback an toàn) */
}

/* Sprint 8T Phase 4: Touch target (Apple HIG 44px min) + iOS zoom prevention */
@media (max-width: 768px) {
  .btn { min-height: 44px; }
  .btn-sm { min-height: 44px; }  /* Sprint 8ID: 36->44 touch target chuan tren mobile */
  .form-control,
  input[type="text"], input[type="email"], input[type="tel"],
  input[type="password"], input[type="number"], input[type="search"],
  select, textarea {
    min-height: 44px;
    font-size: 16px;  /* >= 16px tránh iOS Safari auto-zoom khi focus input */
  }
  textarea { min-height: 88px; }
  .chip { min-height: 36px; padding: 8px 12px; }
}

/* Section */
.section { padding: 80px 0; }
.section-head { text-align: center; max-width: 720px; margin: 0 auto 48px; }
.eyebrow {
  display: inline-block; padding: 5px 12px;
  background: var(--primary-50); color: var(--primary-700);
  border-radius: 999px; font-size: 12px; font-weight: 700;
  margin-bottom: 14px; letter-spacing: 0.02em;
}
.section-head h2 {
  font-size: clamp(26px, 4vw, 40px);
  letter-spacing: -0.02em;
  margin-bottom: 14px;
}
.section-head p { color: var(--ink-3); font-size: 17px; }

/* Three audience cards */
.audience-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 22px;
}
.audience-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 32px 26px;
  transition: var(--transition);
}
.audience-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary-100); }
.audience-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  display: grid; place-items: center;
  font-size: 24px;
  margin-bottom: 18px;
}
.audience-icon.a { background: var(--primary-50); color: var(--primary-700); }
.audience-icon.b { background: var(--accent-50); color: var(--accent-600); }
.audience-icon.c { background: var(--info-50); color: #1D4ED8; }
.audience-card h3 { font-size: 19px; margin-bottom: 10px; }
.audience-card p { color: var(--ink-3); font-size: 14px; margin-bottom: 18px; }
.audience-card ul { display: flex; flex-direction: column; gap: 8px; }
.audience-card li { display: flex; gap: 8px; font-size: 14px; color: var(--ink-3); align-items: flex-start; }
.audience-card li::before {
  content: '✓'; color: var(--primary); font-weight: 700; flex-shrink: 0;
}

/* How it works steps */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; position: relative; }
.step {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  padding: 26px 22px;
  position: relative;
}
.step-num {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--primary), var(--primary-600));
  color: #fff; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 16px;
  margin-bottom: 14px;
}
.step h4 { font-size: 16px; margin-bottom: 8px; }
.step p { font-size: 14px; color: var(--ink-3); }

/* Features */
.features-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;
}
.feature {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
}
.feature .ico {
  width: 44px; height: 44px;
  background: var(--primary-50);
  color: var(--primary-700);
  border-radius: 12px;
  display: grid; place-items: center;
  margin-bottom: 14px;
  font-size: 20px;
}
.feature h4 { font-size: 16px; margin-bottom: 6px; }
.feature p { font-size: 14px; color: var(--ink-3); }

/* CTA */
.cta-band {
  background: linear-gradient(135deg, var(--primary-700), var(--primary));
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 56px 40px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-band::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 50% 80% at 90% 10%, rgba(255,255,255,.18), transparent 60%);
}
.cta-band h2 { color: #fff; font-size: clamp(24px, 4vw, 36px); margin-bottom: 12px; position: relative; }
.cta-band p { font-size: 17px; opacity: 0.9; margin-bottom: 26px; position: relative; }
.cta-band .btn-primary { background: #fff; color: var(--primary-700); position: relative; }
.cta-band .btn-primary:hover { background: var(--bg); }
.cta-band .btn-outline { border-color: rgba(255,255,255,.4); color: #fff; position: relative; }
.cta-band .btn-outline:hover { background: rgba(255,255,255,.1); }

/* Footer */
.site-footer {
  background: var(--ink);
  color: #CBD5E1;
  padding: 60px 0 30px;
}
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.site-footer h5 { color: #fff; font-size: 14px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 16px; }
.site-footer ul { display: flex; flex-direction: column; gap: 8px; }
.site-footer a { color: #CBD5E1; font-size: 14px; }
.site-footer a:hover { color: #fff; }
.site-footer .brand { color: #fff; margin-bottom: 12px; }
.site-footer .about { font-size: 14px; color: #94A3B8; line-height: 1.6; max-width: 320px; }
.footer-bottom {
  border-top: 1px solid #1E293B;
  padding-top: 24px;
  display: flex; justify-content: space-between;
  font-size: 13px; color: #64748B;
  flex-wrap: wrap; gap: 10px;
}

@media (max-width: 900px) {
  .audience-grid { grid-template-columns: 1fr; }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .features-grid { grid-template-columns: repeat(2, 1fr); }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .section { padding: 60px 0; }
  .steps { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .cta-band { padding: 40px 24px; }
}

/* ===========================================================
   APP LAYOUT (Dashboard, CTV, Tenants, Commissions)
   =========================================================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar-brand { padding: 18px 20px; border-bottom: 1px solid var(--line); }
.sidebar-nav { padding: 16px 12px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.side-section-label {
  padding: 16px 14px 6px;
  font-size: 11px; font-weight: 700;
  color: var(--muted-2);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.side-link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  color: var(--ink-3);
  transition: var(--transition);
}
.side-link:hover { background: var(--bg-2); color: var(--ink); }
.side-link.active {
  background: var(--primary); color: #fff; font-weight: 600;
}
.side-link.active:hover { background: var(--primary-600); color: #fff; }
.side-link svg { width: 20px; height: 20px; flex-shrink: 0; }
.side-link .count {
  margin-left: auto; padding: 2px 8px;
  background: var(--bg-2); color: var(--ink-3);
  border-radius: 999px; font-size: 11px; font-weight: 700;
}
.side-link.active .count { background: var(--primary); color: #fff; }

/* Sprint 8GN: nut doi che do giao dien (cuoi sidebar) */
.side-mode-switch {
  margin: 14px 8px 4px;
  padding: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.side-mode-switch .sms-label { font-size: 12.5px; color: var(--ink-3); }
.side-mode-switch .sms-label b { color: var(--primary-700); }
.side-mode-switch .sms-hint {
  font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.4;
}
.side-mode-switch .sms-btn {
  margin-top: 10px; width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--primary); border-radius: var(--radius);
  background: #fff; color: var(--primary-700);
  font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: var(--transition);
}
.side-mode-switch .sms-btn:hover { background: var(--primary-50); }
.side-mode-switch .sms-btn:disabled { opacity: .6; cursor: default; }

.sidebar-footer {
  padding: 14px;
  border-top: 1px solid var(--line);
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius);
  cursor: pointer;
}
.user-chip:hover { background: var(--bg-2); }

/* Sprint 6.5: user-chip popup */
.user-popup {
  position: fixed;
  z-index: 1000;
  min-width: 300px; max-width: 360px;
  background: var(--card, #fff);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
  padding: 18px;
  display: none;
  animation: popIn .15s ease-out;
}
.user-popup.open { display: block; }
@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.user-popup-head {
  display: flex; gap: 14px; align-items: center;
  padding-bottom: 14px; border-bottom: 1px solid var(--border);
}
.user-popup-head .avatar-big {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-600));
  color: #fff; display: grid; place-items: center;
  font-weight: 700; font-size: 18px;
  background-position: center;
  flex-shrink: 0;
}
.user-popup-head .info { line-height: 1.3; min-width: 0; flex: 1; }
.user-popup-head .info .n { font-weight: 700; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.user-popup-head .info .e { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.user-popup-info { margin: 14px 0 4px; display: flex; flex-direction: column; gap: 6px; }
.user-popup-info .row { display: flex; justify-content: space-between; font-size: 13px; gap: 12px; }
.user-popup-info .label { color: var(--muted); }
.user-popup-info .value { font-weight: 600; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.user-popup-section-label {
  font-size: 11px; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin-top: 12px; margin-bottom: 6px; font-weight: 700;
}
.user-popup-divider { border-top: 1px solid var(--border); margin: 14px 0; }
.user-popup-actions { display: flex; flex-direction: column; gap: 8px; }
.user-popup-link {
  font-size: 13px; color: var(--primary);
  text-decoration: none; padding: 6px 0;
  display: inline-block;
}
.user-popup-link:hover { text-decoration: underline; }
.user-popup .btn { width: 100%; justify-content: center; }
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent-600));
  color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
}
.user-chip .info { line-height: 1.2; }
.user-chip .info .n { font-weight: 600; font-size: 14px; }
.user-chip .info .r { font-size: 12px; color: var(--muted); }

.site-actions-group { display: inline-flex; align-items: center; gap: 10px; }
.user-chip-landing {
  padding: 4px 10px 4px 4px;
  background: var(--bg);
  border-radius: 999px;
}
.user-chip-landing .user-avatar { width: 30px; height: 30px; font-size: 12px; }
.user-chip-landing .info .n { font-size: 13px; }
.user-chip-landing .info .r { font-size: 11px; }
@media (max-width: 720px) {
  .user-chip-landing .info { display: none; }
}

.app-main { display: flex; flex-direction: column; min-width: 0; }

.sidebar-overlay {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .4);
  z-index: 150;
  opacity: 0; pointer-events: none;
  transition: opacity 200ms ease;
  display: none;
}
.sidebar-overlay.show { opacity: 1; pointer-events: all; }

.app-header {
  /* Sprint 8JG (S2.0): nang shell CTV len global — header hoa nen xam + blur, cao theo noi dung */
  background: rgba(248, 250, 252, .85);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  height: auto; min-height: var(--header-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px;
  position: sticky; top: 0; z-index: 30;
}
.app-header .left { display: flex; align-items: center; gap: 14px; }
.app-header .title { font-size: 18px; font-weight: 700; }
.app-header .subtitle { font-size: 13px; color: var(--muted); margin-top: 2px; }
.app-header .right { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: var(--radius);
  color: var(--ink-3);
  position: relative;
}
.icon-btn:hover { background: var(--bg-2); color: var(--ink); }
.icon-btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px;
  background: var(--danger);
  border: 2px solid var(--surface);
  border-radius: 50%;
}

.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  border-radius: var(--radius);
}
.menu-toggle:hover { background: var(--bg-2); }

.app-content { padding: 24px; max-width: none; width: 100%; } /* Sprint 8JG: full-width + padding 24 (giong CTV) */

/* KPI cards */
.kpi-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px;
  margin-bottom: 24px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
}
a.kpi-actionable {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
a.kpi-actionable:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(27, 58, 99, .12);
}
.kpi-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px;
}
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-icon {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
}
.kpi-icon.t1 { background: var(--primary-50); color: var(--primary-700); }
.kpi-icon.t2 { background: var(--info-50); color: #1D4ED8; }
.kpi-icon.t3 { background: var(--accent-50); color: var(--accent-600); }
.kpi-icon.t4 { background: var(--danger-50); color: #B91C1C; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.kpi-delta { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi-delta.up { color: #047857; }
.kpi-delta.down { color: #B91C1C; }

/* Two-col app layout (main + side widgets) */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }

/* Tables */
.data-table {
  width: 100%; border-collapse: collapse;
  font-size: 14px;
}
.data-table thead th {
  text-align: left; font-weight: 600;
  font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted);
  padding: 14px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.data-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.data-table tbody tr:hover { background: var(--bg); }
.data-table tbody tr:last-child td { border-bottom: 0; }

.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-2); color: var(--ink-3);
  display: grid; place-items: center;
  font-weight: 600; font-size: 13px;
}
.cell-user .avatar.primary { background: var(--primary-100); color: var(--primary-700); }
.cell-user .avatar.accent { background: var(--accent-50); color: var(--accent-600); }
.cell-user .info { line-height: 1.3; }
.cell-user .info .n { font-weight: 600; }
.cell-user .info .s { font-size: 12px; color: var(--muted); }

.cell-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.cell-actions .icon-btn { width: 32px; height: 32px; }
.cell-actions .icon-btn svg { width: 16px; height: 16px; }

/* Sprint 8AT Buoc 3: collusion risk badge severe (flagged + repeat_conflict) — pulse animation */
.risk-badge-severe {
  animation: vz-risk-pulse 2s ease-in-out infinite;
}
@keyframes vz-risk-pulse {
  0%, 100% { box-shadow: 0 2px 6px rgba(220,38,38,0.25); transform: scale(1); }
  50% { box-shadow: 0 4px 14px rgba(220,38,38,0.55); transform: scale(1.02); }
}

.table-wrap { overflow-x: auto; }

/* Notification list */
.notif {
  display: flex; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  align-items: flex-start;
}
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--bg); }
.notif-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.notif-ico.warn { background: var(--warning-50); color: #B45309; }
.notif-ico.info { background: var(--info-50); color: #1D4ED8; }
.notif-ico.success { background: var(--success-50); color: #047857; }
.notif-ico.danger { background: var(--danger-50); color: #B91C1C; }
.notif .body { flex: 1; min-width: 0; }
.notif .body .t { font-size: 14px; font-weight: 600; margin-bottom: 2px; }
.notif .body .d { font-size: 12px; color: var(--muted); }

/* Empty rooms list */
.empty-room {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
}
.empty-room:last-child { border-bottom: 0; }
.empty-room .img {
  width: 48px; height: 48px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary-50), var(--primary-100));
  display: grid; place-items: center;
  color: var(--primary-700); font-weight: 700;
}
.empty-room .info { flex: 1; }
.empty-room .info .t { font-weight: 600; font-size: 14px; }
.empty-room .info .d { font-size: 12px; color: var(--muted); }

/* Page header (within app content) */
.page-head {
  display: flex; justify-content: space-between;
  align-items: flex-start; margin-bottom: 22px;
  gap: 16px; flex-wrap: wrap;
}
.page-head h1 { font-size: 24px; letter-spacing: -0.02em; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: 14px; }

/* Toolbar (search + filters) */
.toolbar {
  display: flex; gap: 12px; flex-wrap: wrap;
  align-items: center;
  background: var(--surface);
  padding: 14px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  margin-bottom: 18px;
}
.toolbar .search { flex: 1; min-width: 220px; max-width: 420px; }
.toolbar select { width: auto; min-width: 150px; padding: 8px 12px; font-size: 13px; }
.toolbar .group { display: flex; gap: 8px; flex-wrap: wrap; }

/* Chip filters */
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 6px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px; font-weight: 500;
  color: var(--ink-3); cursor: pointer;
  transition: var(--transition);
}
.chip:hover { border-color: var(--primary); color: var(--primary-700); }
.chip.active { background: var(--primary); color: #fff; border-color: var(--primary); }
/* Sprint 7O: count badge nho ben trong chip */
.chip .count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  margin-left: 4px;
  background: var(--bg-2);
  color: var(--ink-3);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  line-height: 16px;
}
.chip.active .count {
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
}

/* Room cards (CTV page) */
.room-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.room-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  display: flex; flex-direction: column;
}
.room-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.room-image {
  aspect-ratio: 16 / 10;
  background-size: cover; background-position: center;
  position: relative;
}
.room-image .room-type {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px);
  font-size: 12px; font-weight: 600; color: var(--ink);
}
.room-image .room-fav {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255, 255, 255, .95); backdrop-filter: blur(8px);
  display: grid; place-items: center;
  color: var(--ink-3);
}
.room-body { padding: 16px; display: flex; flex-direction: column; flex: 1; }
.room-title { font-size: 15px; font-weight: 700; margin-bottom: 6px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 2.6em; }
.room-loc { font-size: 13px; color: var(--muted); display: flex; gap: 5px; align-items: center; margin-bottom: 6px; }
.room-loc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-meta { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
.room-meta .sep { color: var(--line-2); }
.room-price { font-size: 18px; font-weight: 800; color: var(--ink); letter-spacing: -0.01em; }
.room-price small { font-size: 12px; color: var(--muted); font-weight: 500; }
/* Sprint 8IQ: pill hoa hong (bo tron + cham vang, nen kem, chu nau) — khop v0 */
.room-commission {
  margin-top: 10px; align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--gold-soft); border: 1px solid rgba(228, 165, 42, .3);
  color: var(--gold-foreground); font-size: 12px; font-weight: 600;
}
.room-commission .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.room-commission .rate { color: var(--accent-600); font-weight: 500; }
.room-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.room-actions .btn { flex: 1 1 auto; min-width: 0; justify-content: center; }

/* Stepper */
.stepper {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 28px;
}
.step-item {
  display: flex; align-items: center; gap: 10px; flex: 1;
}
.step-item .dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--bg-2); color: var(--muted);
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  flex-shrink: 0;
}
.step-item.active .dot { background: var(--primary); color: #fff; }
.step-item.done .dot { background: var(--success); color: #fff; }
.step-item .lbl { font-size: 13px; font-weight: 600; color: var(--muted); }
.step-item.active .lbl, .step-item.done .lbl { color: var(--ink); }
.step-line { flex: 1; height: 2px; background: var(--line); border-radius: 1px; }
.step-line.done { background: var(--success); }

@media (max-width: 640px) {
  .step-item .lbl { display: none; }
}

/* Steps content panels */
.step-panel { display: none; }
.step-panel.active { display: block; }

/* Room select grid (in stepper) */
.room-select-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
/* Sprint 8EO: chọn phòng dạng accordion theo toà (chọn toà trước) + thu gọn */
.room-select-grid.bldg-accordion { display: block; }
.bldg-acc { border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; overflow: hidden; }
.bldg-acc-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; background: var(--bg-2); border: 0; cursor: pointer;
  font: inherit; text-align: left;
}
.bldg-acc-head:hover { background: var(--line); }
.bldg-acc-title { font-weight: 700; font-size: 14px; color: var(--ink); }
.bldg-acc-meta { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.bldg-acc-chevron { transition: transform .15s ease; color: var(--muted); }
.bldg-acc.open .bldg-acc-chevron { transform: rotate(90deg); }
.bldg-acc-body { padding: 12px 14px; }
/* Card phòng thu gọn */
.room-select-grid.compact { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.room-select.compact { padding: 10px 12px; }
.room-select.compact .name { font-size: 14px; margin-bottom: 2px; }
.room-select.compact .addr { font-size: 11px; margin-bottom: 6px; }
.room-select.compact .price { font-size: 14px; }
/* Sprint 8EP: card compact — badge chạy theo dòng (không absolute) để KHÔNG đè lên số phòng */
.room-select.compact .status { position: static; display: inline-block; margin-bottom: 6px; font-size: 11px; }
.room-select {
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.room-select:hover { border-color: var(--primary); }
.room-select.selected { border-color: var(--primary); background: var(--primary-50); }
.room-select.disabled { opacity: 0.5; cursor: not-allowed; background: var(--bg); }
.room-select .name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.room-select .addr { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.room-select .price { font-size: 16px; font-weight: 700; color: var(--primary); }
.room-select .status {
  position: absolute; top: 10px; right: 10px;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700;
}

/* CTV select list */
.ctv-select-list { display: flex; flex-direction: column; gap: 10px; }
.ctv-option {
  display: flex; align-items: center; gap: 12px;
  padding: 14px; border: 2px solid var(--line);
  border-radius: var(--radius); cursor: pointer;
  transition: var(--transition);
}
.ctv-option:hover { border-color: var(--primary); }
.ctv-option.selected { border-color: var(--primary); background: var(--primary-50); }
.ctv-option .commission { margin-left: auto; color: var(--accent-600); font-weight: 700; font-size: 14px; }

/* Expandable row */
.expand-row {
  background: var(--bg);
  padding: 20px;
  border-bottom: 1px solid var(--line);
  display: none;
}
.expand-row.open { display: block; }
.expand-row .expand-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px;
}
.expand-col h5 {
  font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 10px;
}
.expand-col .row {
  display: flex; justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.expand-col .row:last-child { border-bottom: 0; }
.expand-col .row .l { color: var(--muted); }
.expand-col .row .v { font-weight: 600; color: var(--ink); }
.timeline { display: flex; flex-direction: column; gap: 14px; }
.timeline-item { display: flex; gap: 10px; }
.timeline-item .marker {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--success); margin-top: 4px; flex-shrink: 0;
  position: relative;
}
.timeline-item.pending .marker { background: var(--bg-2); border: 2px solid var(--line); }
.timeline-item:not(:last-child) .marker::after {
  content: ''; position: absolute;
  left: 50%; top: 12px; bottom: -18px;
  width: 2px; background: var(--line);
  transform: translateX(-50%);
}
.timeline-item .t { font-size: 13px; font-weight: 600; }
.timeline-item .d { font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  .expand-row .expand-grid { grid-template-columns: 1fr; }
}

/* Modal — brute force hardcoded values + !important to override any conflict */
.modal-backdrop {
  position: fixed !important;
  top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  z-index: 9999 !important;
  background: rgba(15, 23, 42, .5) !important;
  display: none !important;
}
.modal-backdrop.open {
  display: block !important;
}

/* Sprint 8Y: Skeleton loader (replace "Đang tải..." text) */
.skeleton {
  background: linear-gradient(90deg, #E2E8F0 0%, #F1F5F9 50%, #E2E8F0 100%);
  background-size: 200% 100%;
  animation: vz-skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes vz-skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.skeleton-row { display: flex; gap: 12px; padding: 12px 0; align-items: center; border-bottom: 1px solid var(--line); }
.skeleton-row .skeleton { height: 14px; }
.skeleton-row .skeleton.short { width: 80px; }
.skeleton-row .skeleton.medium { width: 160px; }
.skeleton-row .skeleton.long { flex: 1; max-width: 280px; }
.skeleton-row .skeleton.circle { width: 36px; height: 36px; border-radius: 50%; }

/* Sprint 8BM: skeleton inline-block helper (cho KPI value + table cell) */
.sk-block {
  background: linear-gradient(90deg, #E2E8F0 0%, #F1F5F9 50%, #E2E8F0 100%);
  background-size: 200% 100%;
  animation: vz-skeleton-shimmer 1.5s ease-in-out infinite;
  border-radius: 4px;
  vertical-align: middle;
}

/* Sprint 8BM: 6 KPI grid 2×3 cho pnl-report */
.kpi-grid-6 {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
@media (max-width: 1100px) {
  .kpi-grid-6 { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 600px) {
  .kpi-grid-6 { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .kpi-grid-6 .kpi { padding: 10px 12px; }
  .kpi-grid-6 .kpi-value { font-size: 18px; }
  .kpi-grid-6 .kpi-label { font-size: 11px; }
}

/* Sprint 8BM + 8BP: ẩn cột Địa chỉ + Margin + Delta trên mobile cho bảng pnl */
@media (max-width: 600px) {
  .pnl-property-table .col-address,
  .pnl-property-table .col-margin,
  .pnl-property-table .col-delta { display: none; }
}

/* Sprint 8BS #5: Pagination control bên dưới bảng pnl */
.pnl-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding: 10px 14px;
  background: #F9FAFB;
  border-radius: 8px;
  flex-wrap: wrap;
  gap: 10px;
}
.pnl-pg-left,
.pnl-pg-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pnl-pagination .btn-sm[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
@media (max-width: 600px) {
  .pnl-pagination { font-size: 12px; }
}

/* Sprint 8BR #6: Modal drilldown grid responsive */
@media (max-width: 600px) {
  .pnl-modal-grid { grid-template-columns: 1fr !important; }
}

/* Sprint 8BQ #11: Export CSV dropdown menu */
.pnl-export-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  z-index: 100;
  padding: 6px;
}
.pnl-export-opt {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: #1F2937;
  line-height: 1.4;
}
.pnl-export-opt:hover {
  background: #F3F4F6;
}
.pnl-export-opt b {
  font-weight: 600;
}
@media (max-width: 600px) {
  .pnl-export-menu {
    min-width: 280px;
    right: -8px;
  }
}

/* Sprint 8BN: sticky filter bar pnl-report */
.pnl-filter-sticky {
  position: sticky;
  /* Sprint 8DD: dính dưới header (không chồng header) + z-index<header(30) để menu Tải CSV không bị che */
  top: var(--header-h);
  z-index: 20;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}
/* Sprint 8DD: nút preset kỳ đang chọn — nổi rõ so với btn-ghost */
.btn.preset-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn.preset-active:hover { background: var(--primary); color: #fff; }
@media (max-width: 600px) {
  .pnl-filter-sticky { top: 0; }
}

/* Sprint 8BN: chart container responsive height (thay cố định 320/280px) */
.pnl-chart-wrap {
  height: clamp(240px, 36vw, 380px);
}
.pnl-chart-wrap.pnl-chart-sm {
  height: clamp(220px, 30vw, 320px);
}
@media (max-width: 600px) {
  .pnl-chart-wrap { height: 260px; }
  .pnl-chart-wrap.pnl-chart-sm { height: 240px; }
}

/* Sprint 8Y: Table row hover */
.data-table tbody tr { transition: background .12s ease; }
.data-table tbody tr:hover { background: var(--bg-2); }

/* Sprint 8AF: vzConfirm / vzPrompt modal */
.vz-modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  opacity: 0; pointer-events: none;
  transition: opacity .15s ease;
  padding: 16px;
}
.vz-modal-backdrop.open { opacity: 1; pointer-events: auto; }
.vz-modal {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  max-width: 440px; width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  transform: scale(.96);
  transition: transform .15s ease;
}
.vz-modal-backdrop.open .vz-modal { transform: scale(1); }
.vz-modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.vz-modal-title {
  margin: 0;
  font-size: 16px; font-weight: 600;
  color: var(--text, #0f172a);
}
.vz-modal-body {
  padding: 16px 20px;
  overflow-y: auto;
  color: var(--text-2, #334155);
  font-size: 14px;
  line-height: 1.5;
}
.vz-modal-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  display: flex; gap: 8px; justify-content: flex-end;
}
.vz-modal-footer .btn { min-width: 90px; }
.vz-modal-input { width: 100%; }
.btn-danger {
  background: #dc2626; color: #fff; border: 1px solid #dc2626;
}
.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }
@media (max-width: 480px) {
  .vz-modal { max-width: 100%; }
  .vz-modal-footer { flex-direction: column-reverse; }
  .vz-modal-footer .btn { width: 100%; }
}

/* Sprint 8AF Phase 2: field error highlight */
.input-error,
.input-error:focus {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15) !important;
}
.input-error::placeholder { color: rgba(220, 38, 38, 0.5); }

/* Sprint 8AN: AI Chatbox-style search */
.ai-search-wrap {
  margin-bottom: 14px;
}
.ai-search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
  transition: all 0.2s ease;
}
.ai-search-box:focus-within {
  border-color: var(--primary, #1B3A63);
  box-shadow: 0 0 0 3px rgba(27, 58, 99, 0.12);
}
.ai-search-icon {
  color: var(--muted-2);
  display: flex; align-items: center;
  flex-shrink: 0;
  user-select: none;
}
.ai-search-icon .ic { width: 20px; height: 20px; }
.ai-search-icon.thinking {
  animation: ai-pulse 1s ease-in-out infinite;
}
@keyframes ai-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
}
.ai-search-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text, #0F172A);
  padding: 2px 0;
  min-height: 24px;
  max-height: 96px; /* ~4 rows */
  overflow-y: auto;
}
.ai-search-input::placeholder {
  color: #6B7280;
  font-style: italic;
}
.ai-search-clear {
  background: rgba(0,0,0,0.06);
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  color: #6B7280;
  flex-shrink: 0;
  align-self: center;
}
.ai-search-clear:hover {
  background: rgba(0,0,0,0.12);
  color: #111;
}
.ai-search-status {
  font-size: 12px;
  color: var(--muted, #64748B);
  margin-top: 6px;
  min-height: 16px;
  padding-left: 4px;
}
.ai-search-status.thinking { color: #1B3A63; font-weight: 500; }
.ai-search-status.success { color: #059669; }
.ai-search-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.suggest-chip {
  display: inline-block;
  padding: 6px 12px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 999px;
  font-size: 12px;
  color: #475569;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}
.suggest-chip:hover {
  background: #EEF2F8;
  border-color: #D4E0EF;
  color: var(--primary, #1B3A63);
  transform: translateY(-1px);
}
@media (max-width: 600px) {
  .ai-search-box { padding: 10px 12px; }
  .ai-search-icon { font-size: 20px; }
  .ai-search-input { font-size: 14px; }
  .suggest-chip { font-size: 11px; padding: 5px 10px; }
}

/* Sprint 8AO: Inline status dropdown trong bang phong */
.status-select {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 24px 5px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'><path d='M1 1L5 5L9 1' stroke='currentColor' stroke-width='1.5' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 10px 6px;
  outline: none;
  transition: all 0.15s ease;
  min-width: 110px;
}
.status-select:hover { filter: brightness(0.95); }
.status-select:focus { box-shadow: 0 0 0 2px rgba(27, 58, 99, 0.25); }
.status-select:disabled { opacity: 0.5; cursor: wait; }

/* Mau theo status */
.status-available    { background-color: #D1FAE5; color: #065F46; }
.status-occupied     { background-color: #DBEAFE; color: #1E40AF; }
.status-maintenance  { background-color: #FEF3C7; color: #92400E; }
.status-hidden       { background-color: #E5E7EB; color: #374151; }
.modal {
  display: block !important;
  position: absolute !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) !important;
  background: #FFFFFF !important;
  border-radius: 16px !important;
  width: calc(100% - 40px) !important;
  max-width: 560px !important;
  min-height: 100px !important;
  max-height: 90vh !important;
  height: auto !important;
  overflow: auto !important;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3) !important;
  color: #0f172a !important;
}
.modal-head {
  padding: 18px 22px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head h3 { font-size: 17px; }
.modal-body { padding: 22px; }
.modal-foot {
  padding: 16px 22px; border-top: 1px solid var(--line);
  display: flex; gap: 10px; justify-content: flex-end;
}
.invoice-line {
  display: flex; justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.invoice-line:last-of-type { border-bottom: 0; }
.invoice-line.total {
  font-size: 16px; font-weight: 700;
  border-top: 2px solid var(--ink);
  margin-top: 8px; padding-top: 14px;
  border-bottom: 0;
}
.invoice-line .v { font-weight: 600; }

/* Toast (Sprint 8EZ: nang len 96px de khong de nut ho tro FAB goc phai duoi) */
.toast {
  position: fixed; bottom: 96px; right: 24px;
  background: var(--ink); color: #fff;
  padding: 12px 18px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 10px;
  transform: translateY(100px); opacity: 0;
  transition: all 250ms ease;
  z-index: 200;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--success); }
.toast.danger { background: var(--danger); }

/* ===== Sprint 8EZ: nut tron ho tro (FAB) goc phai duoi ===== */
.vz-fab-wrap { position: fixed; bottom: 24px; right: 24px; z-index: 150; }
.vz-fab {
  width: 56px; height: 56px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--primary); color: #fff; font-size: 24px; line-height: 1;
  box-shadow: 0 6px 18px rgba(27, 58, 99, .35);
  display: grid; place-items: center; transition: transform .15s, box-shadow .15s;
}
.vz-fab:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(27, 58, 99, .45); }
.vz-fab .vz-fab-close { display: none; }
.vz-fab-wrap.open .vz-fab { background: var(--primary-700, #0E2038); }
.vz-fab-wrap.open .vz-fab .vz-fab-open { display: none; }
.vz-fab-wrap.open .vz-fab .vz-fab-close { display: block; font-size: 20px; }
.vz-fab-menu {
  position: absolute; right: 0; bottom: 68px; width: 240px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18); padding: 8px;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .15s, transform .15s, visibility .15s;
}
.vz-fab-wrap.open .vz-fab-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.vz-fab-item {
  display: block; padding: 10px 12px; border-radius: 10px;
  text-decoration: none; color: var(--ink); font-size: 13px; line-height: 1.45;
}
.vz-fab-item:hover { background: var(--primary-50, #EEF2F8); }
.vz-fab-item b { color: var(--primary); font-size: 13.5px; }
.vz-fab-item .vz-fab-ic { font-size: 16px; margin-right: 4px; }
@media (max-width: 900px) {
  .vz-fab-wrap { bottom: 76px; right: 16px; } /* tren mobile-bottom-nav */
  .toast { bottom: 148px; } /* tren FAB mobile */
}

/* ===================
   RESPONSIVE - APP
   =================== */
@media (max-width: 1100px) {
  /* Sprint 8U Phase 12 v4: minmax(0, 1fr) thay vi 1fr de chong grid column
     overflow khi child co table nowrap wider than container. Bug khi 1fr cho
     phep min-content expansion - card lòi ra ngoai .two-col container. */
  .two-col { grid-template-columns: minmax(0, 1fr); }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 250ms ease;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { display: block; }
  .menu-toggle { display: inline-flex; align-items: center; justify-content: center; }
  .app-header { padding: 10px 16px; }
  .app-content { padding: 16px; }
}
@media (max-width: 600px) {
  /* Sprint 8T Phase 5: KPI compact 2x2 grid thay vì 1fr.
     KPI single column ~140-170px/card x 4 = 600-700px scroll lãng phí.
     2x2 grid: ~110-130px/card x 2 row = ~240-280px total. */
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .kpi { padding: 12px 14px; }
  .kpi-head { margin-bottom: 8px; }
  .kpi-label { font-size: 12px; }
  .kpi-icon { width: 30px; height: 30px; border-radius: 8px; }
  .kpi-icon svg { width: 16px; height: 16px; }
  .kpi-value { font-size: 20px; }
  .kpi-delta { font-size: 11px; margin-top: 2px; }

  /* Sprint 8T Phase 6: align edge giữa header/content và bottom nav.
     Bottom nav full-width edge-to-edge (mobile standard) → giảm app-content
     horizontal padding 16px → 8px để KPI cards gần edge hơn, đỡ lệch.
     Header cùng 8px → toàn bộ 3 zone edge cùng inset ~8px (perceived flush). */
  .app-header { padding: 0 8px; gap: 8px; }
  .app-content { padding: 14px 8px; }

  .page-head { flex-direction: column; align-items: flex-start; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar .search { max-width: none; }
  .app-header .subtitle { display: none; }
  .app-header .title { font-size: 16px; }
  /* Sprint 8CM: pnl-filter-sticky mobile compact — auto-collapse details + bo summary marker */
  .pnl-filter-details summary::-webkit-details-marker { display: none; }
  .pnl-filter-details summary::marker { display: none; content: ''; }
  /* Sprint 8CN: inv-hint-details bo marker (collapse on mobile via JS) */
  .inv-hint-details summary::-webkit-details-marker { display: none; }
  .inv-hint-details summary::marker { display: none; content: ''; }
  /* Sprint 8CP: bo marker cho dashboard secondary KPI + commissions advanced filters */
  .dashboard-secondary-kpis summary::-webkit-details-marker,
  .cm-advanced-filters summary::-webkit-details-marker { display: none; }
  .dashboard-secondary-kpis summary::marker,
  .cm-advanced-filters summary::marker { display: none; content: ''; }
  /* Sprint 8CP: tenants chip-row overflow safeguard mobile */
  .chip-row { flex-wrap: nowrap !important; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .chip-row .chip { flex-shrink: 0; }
  /* Sprint 8CP: properties sidebar building-list compact (hide count badge mobile) */
  .property-list .count { display: none; }
  /* Sprint 8CL: fix mobile overflow — header buttons cuộn ngang khi nhiều, height auto khi wrap */
  .app-header { height: auto; min-height: var(--header-h); flex-wrap: wrap; padding: 8px; gap: 8px; }
  .app-header .left { flex: 1 1 auto; min-width: 0; }
  .app-header .left .title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app-header .right {
    flex: 1 1 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 4px;
  }
  .app-header .right .btn { padding: 8px 10px; font-size: 12px; white-space: nowrap; flex-shrink: 0; }
  .app-header .right .btn svg { width: 14px; height: 14px; }
  .modal { max-width: calc(100vw - 24px) !important; }
  .modal-backdrop { padding: 12px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 16px; padding-right: 16px; }
  .modal-foot { flex-wrap: wrap; }
  .modal-foot .btn { flex: 1; min-width: 0; }
  /* form-row inline 2-col fallback for mobile */
  .form-row[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 8px 10px; }

  /* Sprint 8U Phase 8: card-header gọn + table mobile no-wrap + ellipsis.
     User screenshot: "Khách thuê gần đây" widget wrap text dọc mọi cell —
     "số 30a ngõ 124/4 Hòe Thị Xuân Phương Hà Nội" 8 dòng, "Đã kết thúc" 3 dòng. */
  .card-header { flex-wrap: wrap; gap: 8px; }
  .card-header .side-link { display: none; }  /* duplicate với bottom nav */

  .data-table th { white-space: nowrap; }
  .data-table td { white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
  .data-table td:first-child { max-width: 150px; }  /* Khách column rộng hơn cho name + phone */
  .data-table td .text-xs,
  .data-table td .text-muted.text-xs { display: none; }  /* hide subtitle (address dài) */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* Sprint 8U Phase 12: canh thẳng KPI grid và .two-col mép trái/phải.
     User screenshot: KPI 2x2 trông HẸP hơn card "Khách thuê gần đây" bên dưới.
     Outer edge math đã align (cả 2 inset 8px), nhưng inner padding khác nhau
     (KPI 12x14, card-header/body 18-20) gây visual illusion.
     Fix: defensive normalize outer + đồng bộ inner padding = 14x16. */
  .app-content > .kpi-grid,
  .app-content > .two-col,
  .app-content > .properties-layout {
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  .kpi { padding: 14px 16px; }  /* was 12px 14px */
  .card-header { padding: 14px 16px; }  /* was 18px 20px */
  .card-body { padding: 14px 16px; }  /* was 20px */
}

/* ============================================================
   Sprint 8U Phase 11 v2: custom scrollbar 5px primary teal — scope .card only.
   - .card overflow: auto → scrollbar xuất hiện khi content tràn (ngang/dọc).
   - Track: bg nhạt + border 1px line color → "khung" scrollbar luôn nhìn thấy.
   - Thumb: solid teal + border đậm hơn → nổi bật, hover sáng hơn.
   - Firefox: dùng scrollbar-width/scrollbar-color (không có border, chỉ màu).
   ============================================================ */
.card,
.card * {
  scrollbar-width: thin;
  scrollbar-color: var(--primary) var(--bg-2);
}
.card::-webkit-scrollbar,
.card *::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
.card::-webkit-scrollbar-track,
.card *::-webkit-scrollbar-track {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.card::-webkit-scrollbar-thumb,
.card *::-webkit-scrollbar-thumb {
  background: var(--primary);
  border: 1px solid var(--primary-700);
  border-radius: 999px;
}
.card::-webkit-scrollbar-thumb:hover,
.card *::-webkit-scrollbar-thumb:hover {
  background: var(--primary-600);
}
.card::-webkit-scrollbar-corner,
.card *::-webkit-scrollbar-corner {
  background: var(--bg-2);
}

/* Helpers */
.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ===================================================
   Giai doan 3.5: Listing modal (switch, tags, photos preview)
   =================================================== */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--line-2);
  border-radius: 24px;
  transition: background 200ms;
}
.switch .slider::before {
  position: absolute;
  content: '';
  height: 18px; width: 18px;
  left: 3px; bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 200ms;
}
.switch input:checked + .slider { background: var(--primary); }
.switch input:checked + .slider::before { transform: translateX(20px); }

.tags-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  min-height: 4px;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: var(--primary-50);
  color: var(--primary-700);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
}
.tag-chip button {
  background: transparent;
  border: none;
  color: var(--primary-700);
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}
.tag-chip button:hover { color: var(--danger); }

.photos-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.photos-preview img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-2);
}

/* Videos preview */
.videos-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.videos-preview .video-cell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #000;
  overflow: hidden;
}
.videos-preview video,
.videos-preview iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}
.videos-preview .video-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  text-align: center;
  padding: 8px;
  background: linear-gradient(135deg, #1f2937, #0f172a);
}

.badge-muted { background: var(--bg-2); color: var(--muted); }

.form-fieldset {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
}
.form-fieldset > legend {
  padding: 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
}
/* Sprint 8CT: gập field nâng cao trong modal toà nhà (Tạo nhanh) */
.prop-advanced { margin-top: 14px; }
.prop-advanced > summary {
  cursor: pointer;
  padding: 11px 14px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg-2, #F3F4F6);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.prop-advanced > summary::-webkit-details-marker { display: none; }
.prop-advanced > summary::before { content: '▸'; color: var(--muted); transition: transform .15s; }
.prop-advanced[open] > summary::before { transform: rotate(90deg); }
.prop-advanced[open] > summary { margin-bottom: 14px; }
.prop-advanced > summary:hover { border-color: var(--primary); }
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.checkbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  user-select: none;
  background: var(--surface);
  transition: background 120ms, border-color 120ms;
}
.checkbox-pill:hover { background: var(--bg-2); }
.checkbox-pill input { margin: 0; accent-color: var(--primary); }
.checkbox-pill:has(input:checked) {
  background: var(--primary-50);
  border-color: var(--primary);
  color: var(--primary-700);
  font-weight: 600;
}
.policy-row {
  display: grid;
  grid-template-columns: auto 1fr 200px;
  gap: 12px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.policy-row:last-child { border-bottom: 0; }

/* Fee row: label | amount | mode (theo phong / theo nguoi) */
.fee-row {
  display: grid;
  grid-template-columns: 1fr 160px 140px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.fee-row:last-child { border-bottom: 0; }
.fee-row .fee-label { font-size: 14px; color: var(--ink); }
@media (max-width: 600px) {
  .fee-row { grid-template-columns: 1fr; gap: 6px; padding: 10px 0; }
}

/* POIs + giay to phap ly */
.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.poi-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.poi-item {
  display: grid;
  grid-template-columns: 1fr 80px auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--bg-2);
  border-radius: var(--radius);
  font-size: 13px;
}
.poi-item .poi-name { font-weight: 500; color: var(--ink); }
.poi-item .poi-dist { color: var(--ink-3); text-align: right; }
.poi-item button {
  background: transparent;
  border: none;
  color: var(--danger);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}
.docs-preview {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.docs-preview img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--bg-2);
}

/* Room types list (Sprint 3.7.2-B) */
.room-types-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 14px;
}
.room-type-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 120ms, box-shadow 120ms, border-color 120ms;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.room-type-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-100);
}
.room-type-card .rt-photo {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-2) center / cover no-repeat;
  border-bottom: 1px solid var(--line);
}
.room-type-card .rt-photo.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(150deg, var(--primary-50, #EEF2F8), var(--bg-2, #F1F5F9));
  color: var(--primary, #1B3A63);
}
.room-type-card .rt-photo.empty svg { width: 40px; height: 40px; opacity: .45; }
.room-type-card .rt-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.room-type-card .rt-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
}
.room-type-card .rt-meta {
  font-size: 12px;
  color: var(--ink-3);
}
.room-type-card .rt-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  margin-top: 2px;
}
.room-type-card .rt-count {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
}
.room-type-card .rt-count .v { font-weight: 600; color: var(--ink); }
.room-type-card .rt-actions {
  display: flex;
  gap: 6px;
  padding: 0 14px 12px;
}
.room-type-card .rt-actions .btn { flex: 1; padding: 6px 8px; font-size: 12px; }
/* Sprint 8GT: mobile an anh kieu phong (chiem nhieu dien tich) — giu phan chu gon */
@media (max-width: 600px) {
  .room-type-card .rt-photo { display: none; }
}
.policy-label { font-size: 14px; color: var(--ink); }
.policy-surcharge { max-width: 200px; }
@media (max-width: 600px) {
  .policy-row { grid-template-columns: auto 1fr; }
  .policy-row .policy-surcharge { grid-column: 1 / -1; max-width: none; }
}

/* ===================================================
   Giai doan 3: Properties page layout
   =================================================== */
.properties-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 20px;
  align-items: start;
}
.property-list { display: flex; flex-direction: column; padding: 8px; gap: 4px; }
.property-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 120ms ease, border-color 120ms ease;
}
.property-item:hover { background: var(--bg-2); }
.property-item.active { background: var(--primary-50); border-color: var(--primary-100); }
.p-info { flex: 1; min-width: 0; }
.p-name { font-weight: 600; font-size: 14px; color: var(--ink); margin-bottom: 2px; }
.p-addr { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-counts { font-size: 13px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.dot-sep { color: var(--muted); margin: 0 4px; }

.empty {
  padding: 32px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.empty b { color: var(--ink-3); }

@media (max-width: 900px) {
  /* Sprint 8U Phase 12 v4: minmax(0, 1fr) chong overflow. */
  .properties-layout { grid-template-columns: minmax(0, 1fr); }
}

/* ===================================================
   Giai doan 1: Testimonials, FAQ, Lead form
   =================================================== */

/* Testimonials */
.testimonials-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.testimonial {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.testimonial:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.testimonial blockquote {
  font-size: 15px;
  line-height: 1.65;
  color: var(--ink);
  margin: 0;
  position: relative;
  padding-left: 14px;
  border-left: 3px solid var(--primary-100);
}
.testimonial figcaption {
  display: flex;
  align-items: center;
  gap: 12px;
}
.t-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}
.t-name { font-weight: 600; font-size: 14px; color: var(--ink); }
.t-role { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* FAQ */
.faq-list {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px 20px;
  transition: border-color 150ms ease;
}
.faq-item[open] {
  border-color: var(--primary-100);
  box-shadow: var(--shadow-sm);
}
.faq-item summary {
  cursor: pointer;
  padding: 16px 0;
  font-weight: 600;
  font-size: 15px;
  color: var(--ink);
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 22px;
  color: var(--primary);
  font-weight: 400;
  transition: transform 200ms ease;
  flex-shrink: 0;
}
.faq-item[open] summary::after {
  content: '−';
}
.faq-item p {
  padding: 0 0 16px;
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: var(--ink-3);
}
.faq-item p a { color: var(--primary); }

/* Lead form (in CTA band) */
.lead-form {
  margin-top: 24px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
}
.lead-form-grid {
  display: grid;
  grid-template-columns: 1.4fr 1.2fr 1fr auto;
  gap: 10px;
  align-items: stretch;
}
.lead-form input,
.lead-form select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: #fff;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.lead-form input:focus,
.lead-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 58, 99, .15);
}
.lead-form input::placeholder { color: var(--muted); }
.lead-form button[type="submit"] {
  white-space: nowrap;
}
.lead-form-hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink-3);
  text-align: center;
}
.lead-form-hint a { color: var(--primary); font-weight: 500; }
.lead-form .form-field.has-error input,
.lead-form .form-field.has-error select {
  border-color: var(--danger);
  background: #FEF2F2;
}

/* Coming soon / Auth placeholder pages */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 40px 20px;
  background: linear-gradient(135deg, var(--bg) 0%, var(--primary-50) 100%);
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-lg);
}
.auth-card h1 {
  font-size: 24px;
  margin-bottom: 8px;
  letter-spacing: -0.02em;
}
.auth-card .lead {
  color: var(--ink-3);
  margin-bottom: 28px;
  font-size: 14px;
}
.auth-card .form-field { margin-bottom: 14px; }
.auth-card .form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
}
.auth-card .form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(27, 58, 99, .15);
}
.auth-card .role-tabs {
  display: flex;
  gap: 8px;
  padding: 4px;
  background: var(--bg-2);
  border-radius: var(--radius);
  margin-bottom: 20px;
}
.auth-card .role-tab {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius) - 4px);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
  font-family: inherit;
}
.auth-card .role-tab.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Sprint 8I: Role button group - 2 button to với màu primary khi active */
.auth-card .role-button-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 22px;
}
.auth-card .role-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s ease;
  text-align: center;
}
.auth-card .role-btn:hover {
  border-color: var(--primary-300, #D4E0EF);
  background: var(--primary-50, #EEF2F8);
}
.auth-card .role-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.auth-card .role-btn-icon {
  font-size: 28px;
  line-height: 1;
}
.auth-card .role-btn-label {
  font-size: 14px;
  font-weight: 700;
}
.auth-card .role-btn-desc {
  font-size: 11px;
  opacity: 0.85;
  line-height: 1.3;
}
.auth-card .role-btn.active .role-btn-desc {
  color: rgba(255, 255, 255, 0.9);
}
@media (max-width: 480px) {
  .auth-card .role-button-group {
    grid-template-columns: 1fr;
  }
}
.auth-card .auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--muted);
  font-size: 12px;
}
.auth-card .auth-divider::before,
.auth-card .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.auth-card .auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--ink-3);
}
.auth-card .auth-footer a { color: var(--primary); font-weight: 600; }
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-3);
  text-decoration: none;
  font-size: 13px;
  margin-bottom: 20px;
}
.auth-back:hover { color: var(--primary); }

/* Responsive */
@media (max-width: 900px) {
  .testimonials-grid { grid-template-columns: 1fr; }
  .lead-form-grid { grid-template-columns: 1fr; }
  .lead-form button[type="submit"] { margin-top: 4px; }
}
@media (max-width: 600px) {
  .auth-card { padding: 28px 22px; }
  .auth-card h1 { font-size: 21px; }
  .faq-item { padding: 2px 16px; }
  .faq-item summary { font-size: 14px; }
}

/* ============================================================
   Sprint 4.8 — Map view (Leaflet) cho CTV
   ============================================================ */
.view-toggle {
  display: inline-flex;
  background: var(--bg-2);
  border-radius: 999px;
  padding: 4px;
  margin: 0 0 18px;
  gap: 2px;
}
.view-toggle .vt-btn {
  border: 0;
  background: transparent;
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  transition: all 150ms;
}
.view-toggle .vt-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 4px rgba(27, 58, 99, 0.3);
}

.map-topbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  margin-bottom: 12px;
}
.map-addr-input {
  flex: 1;
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--bg-2);
  border-radius: var(--radius);
}
.map-addr-input .addr-icon { font-size: 16px; }
.map-addr-input input {
  flex: 1;
  border: 0;
  background: transparent;
  font-size: 14px;
  outline: none;
  color: var(--ink);
  font-family: inherit;
}
.map-addr-input .addr-clear {
  background: var(--muted);
  color: #fff;
  border: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-section {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
#mapEl {
  height: 580px;
  width: 100%;
  z-index: 1;
}
@media (max-width: 700px) {
  #mapEl { height: 70vh; min-height: 420px; }
}

/* Sprint 8FZ: nut "Tim khu vuc nay" noi giua-tren ban do */
.map-search-here {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  z-index: 600; background: var(--primary); color: #fff; border: none;
  padding: 9px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
  cursor: pointer; box-shadow: 0 4px 14px rgba(27,58,99,.35);
}
.map-search-here:hover { background: var(--primary-700, #0E2038); }

/* Sprint 8GB: bo loc nang cao CTV */
.adv-filter-bar { margin: 8px 0 0; }
.adv-count { background: var(--primary); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.adv-filter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px; margin: 10px 0 14px; }
.adv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.adv-field > label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: var(--ink-2); }
.adv-row2 { display: flex; gap: 8px; }
.adv-amenities { display: flex; flex-wrap: wrap; gap: 8px; }
.adv-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* Sprint 8GD: gop Danh sach + Ban do thanh 1 man (split) */
.ctv-split { display: flex; gap: 16px; align-items: flex-start; margin-top: 6px; }
.ctv-list-col { flex: 1.35; min-width: 0; }
.ctv-map-col { flex: 1; position: sticky; top: 16px; }
.ctv-list-col .room-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
.ctv-map-col #mapEl { height: calc(100vh - 170px); min-height: 460px; }
/* Sprint 8IB: toggle list/map chi mobile — desktop an toggle, hien ca 2 cot */
.ctv-mobile-toggle { display: none; }
/* Sprint 8IH: nut "Luot phong" chi cho mobile (desktop da co split list+map) */
#swipeModeBtn { display: none; }
@media (max-width: 900px) {
  #swipeModeBtn { display: inline-flex; }
  .ctv-split { flex-direction: column; }
  .ctv-map-col { position: static; width: 100%; }
  .ctv-map-col #mapEl { height: calc(100vh - 230px); min-height: 420px; }
  /* mac dinh hien DANH SACH (san pham truoc), an ban do; toggle .show-map dao lai */
  .ctv-mobile-toggle { display: flex; gap: 6px; margin: 4px 0 12px; background: var(--bg-2); padding: 4px; border-radius: 10px; position: sticky; top: 8px; z-index: 12; }
  .ctv-mobile-toggle .ctv-vt { flex: 1; border: 0; background: none; padding: 10px 12px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--ink-3); cursor: pointer; min-height: 44px; }
  .ctv-mobile-toggle .ctv-vt.active { background: var(--surface, #fff); color: var(--ink); box-shadow: var(--shadow-sm); }
  .ctv-list-col { display: block; }
  .ctv-map-col { display: none; }
  .ctv-split.show-map .ctv-list-col { display: none; }
  .ctv-split.show-map .ctv-map-col { display: block; }
}

/* Price pin marker (Leaflet divIcon) */
.map-price-pin {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 14px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(0, 0, 0, 0.08);
  position: relative;
  transform: translate(-50%, -100%);
  cursor: pointer;
  transition: all 120ms;
}
.map-price-pin::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.15));
}
.map-price-pin.active {
  background: var(--accent, #F59E0B);
  color: #fff;
  z-index: 1000 !important;
  transform: translate(-50%, -100%) scale(1.1);
}
.map-price-pin.active::after { border-top-color: var(--accent, #F59E0B); }
/* Sprint 8GE: hover marker (khi re card tuong ung) + sang card khi chon marker */
.map-price-pin.hover { background: var(--primary); color: #fff; z-index: 999 !important; transform: translate(-50%, -100%) scale(1.08); }
.map-price-pin.hover::after { border-top-color: var(--primary); }
.room-card.hl { outline: 2px solid var(--primary); outline-offset: 2px; }
.leaflet-marker-icon.leaflet-div-icon {
  background: transparent !important;
  border: 0 !important;
}

/* Bottom preview card — slide up from bottom */
.map-preview-card {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
  padding: 0;
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0;
  overflow: hidden;
  z-index: 1000;
  transform: translateY(calc(100% + 24px));
  transition: transform 220ms ease-out;
  cursor: pointer;
}
.map-preview-card.show { transform: translateY(0); }
.map-preview-card .mpc-img {
  width: 100%;
  height: 100%;
  min-height: 130px;
  background-color: var(--bg-2);
  background-size: cover;
  background-position: center;
}
.map-preview-card .mpc-info {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  font-size: 13px;
}
.map-preview-card .mpc-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-right: 30px;
}
.map-preview-card .mpc-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}
.map-preview-card .mpc-addr {
  color: var(--ink-3);
  font-size: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.map-preview-card .mpc-meta {
  font-size: 12px;
  color: var(--muted);
}
.map-preview-card .mpc-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.map-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.95);
  padding: 24px 32px;
  border-radius: var(--radius-lg);
  text-align: center;
  z-index: 999;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Center marker (search location) — red pin */
.map-center-pin {
  width: 32px;
  height: 32px;
  transform: translate(-50%, -100%);
}
.map-center-pin svg { width: 100%; height: 100%; filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }

/* Sprint 7B.2: VzUploader component */
.vz-upload-wrap { display: flex; flex-direction: column; gap: 12px; }
.vz-upload-drop {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 24px 16px;
  text-align: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
  background: var(--bg);
}
.vz-upload-drop:hover, .vz-upload-drop.drag-over {
  border-color: var(--primary);
  background: var(--bg-2);
}
.vz-upload-hint { color: var(--muted); font-size: 14px; }
.vz-upload-hint > div:first-child { font-size: 32px; line-height: 1; margin-bottom: 8px; }
.vz-upload-progress {
  background: var(--bg-2);
  padding: 10px 14px;
  border-radius: 8px;
}
.vz-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}
.vz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width .2s;
  width: 0;
}
.vz-upload-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
}
.vz-upload-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--border);
}
.vz-upload-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.vz-upload-badge {
  position: absolute;
  top: 4px; left: 4px;
  background: rgba(0,0,0,.7);
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}
.vz-upload-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 24px; height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(220, 38, 38, .9);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.vz-upload-remove:hover { background: rgba(185, 28, 28, 1); }

/* ============ Sprint 7D: Gallery thumbnails + Lightbox ============ */
.vz-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.vz-gallery-thumb {
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  background: var(--bg-2) center/cover no-repeat;
  cursor: zoom-in;
  border: 1px solid var(--line);
  transition: transform .12s ease;
  position: relative;
}
.vz-gallery-thumb:hover { transform: scale(1.02); }
.vz-gallery-thumb.is-video::after {
  content: '▶';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  color: #fff;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* Hero cursor zoom-in */
.room-hero .hero-main,
.room-hero .hero-side > div { cursor: zoom-in; }

/* Lightbox overlay */
.vz-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
}
.vz-lightbox.open { display: flex; }
.vz-lightbox-content {
  max-width: 92vw;
  max-height: 86vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.vz-lightbox-content img,
.vz-lightbox-content video {
  max-width: 100%;
  max-height: 86vh;
  object-fit: contain;
  border-radius: 6px;
  background: #000;
}
.vz-lightbox-btn {
  position: absolute;
  background: rgba(255, 255, 255, 0.15);
  border: 0;
  color: #fff;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  font-size: 22px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s;
  text-decoration: none;
  z-index: 1;
}
.vz-lightbox-btn:hover { background: rgba(255, 255, 255, 0.3); }
.vz-lightbox-close { top: 20px; right: 20px; }
.vz-lightbox-prev  { left: 20px; top: 50%; transform: translateY(-50%); }
.vz-lightbox-next  { right: 20px; top: 50%; transform: translateY(-50%); }
.vz-lightbox-download {
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  padding: 10px 22px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  background: var(--primary, #1B3A63);
  color: #fff;
}
.vz-lightbox-download:hover { background: var(--primary-700, #142C4D); }
.vz-lightbox-counter {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  color: #fff;
  font-size: 14px;
  opacity: 0.85;
}
@media (max-width: 600px) {
  .vz-lightbox-prev,
  .vz-lightbox-next {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
}

/* Video cell improvement */
.video-cell {
  position: relative;
  margin-bottom: 12px;
}
.video-cell video,
.video-cell iframe {
  width: 100%;
  max-height: 480px;
  border-radius: var(--radius);
  background: #000;
  display: block;
}
.video-cell-download {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  padding: 6px 12px;
  border-radius: 16px;
  font-size: 12px;
  text-decoration: none;
  font-weight: 600;
  z-index: 2;
}
.video-cell-download:hover { background: rgba(0, 0, 0, 0.85); }

/* Sprint 7O: subtle blink animation cho badge danger <=7d */
@keyframes vzBlink {
  0%, 70%, 100% { opacity: 1; }
  85% { opacity: 0.55; }
}

/* Sprint 7O Vùng 2: Tenant detail modal — tabs + groups + timeline */
.tenant-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.tt-btn {
  padding: 10px 16px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tt-btn:hover { color: var(--primary-700); }
.tt-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tt-btn .count {
  background: var(--bg-2);
  color: var(--ink-3);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.tt-btn.active .count { background: var(--primary-50); color: var(--primary-700); }

.tenant-info-group {
  margin-bottom: 18px;
}
.tenant-info-group h6 {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 8px;
}
.tenant-info-group .row,
.tenant-contract-card .row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
}
.tenant-info-group .row:last-child,
.tenant-contract-card .row:last-child { border-bottom: 0; }
.tenant-info-group .l,
.tenant-contract-card .l { color: var(--muted); font-size: 13px; flex-shrink: 0; }
.tenant-info-group .v,
.tenant-contract-card .v { color: var(--ink); text-align: right; }

.tenant-banner {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}
.tenant-banner.warning {
  background: #FEF3C7;
  border: 1px solid #FCD34D;
  color: #92400E;
}
.tenant-banner.danger {
  background: #FEE2E2;
  border: 1px solid #FCA5A5;
  color: #991B1B;
}

.tenant-contract-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
}
.tenant-contract-card .contract-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding-bottom: 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.tenant-timeline {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 2px solid var(--line);
}
.tenant-timeline li {
  position: relative;
  padding: 10px 0 10px 28px;
  margin-left: 8px;
}
.tenant-timeline .ti {
  position: absolute;
  left: -16px;
  top: 8px;
  width: 26px;
  height: 26px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}

@media (max-width: 600px) {
  .tenant-tabs { gap: 0; }
  .tt-btn { padding: 10px 12px; font-size: 13px; flex: 1; justify-content: center; }
  .tenant-contract-card .contract-head { flex-direction: column; }
}

/* Sprint 7Q: Building grid (Level 1) + tenant list header (Level 2) */
.building-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.building-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-decoration: none;
  color: inherit;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.building-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(27, 58, 99, 0.12);
  border-color: var(--primary);
}
.building-card.has-expired { border-left: 4px solid #DC2626; }
.building-card.has-expiring { border-left: 4px solid #F59E0B; }
.building-card.has-orphan { border-left: 4px solid var(--muted); border-style: dashed; }
.bc-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.bc-icon {
  font-size: 28px;
  line-height: 1;
}
.bc-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 2px;
}
.bc-addr {
  font-size: 13px;
  color: var(--ink-3);
}
.bc-stats {
  padding: 10px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  font-size: 14px;
  color: var(--ink-2);
}
.bc-stats b { color: var(--ink); font-weight: 700; }
.bc-foot {
  margin-top: 12px;
}
.building-alert {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
}
.building-alert.ok { color: #047857; background: var(--success-50, #D1FAE5); }
.building-alert.warning { color: #92400E; background: #FEF3C7; }
.building-alert.danger { color: #991B1B; background: #FEE2E2; }
.building-alert.muted { color: var(--ink-3); background: var(--bg-2); }

.tenant-list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.tenant-list-header .back-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}
.tenant-list-header .back-link:hover { text-decoration: underline; }
.tenant-list-header .sep { color: var(--ink-3); }

/* Sprint 7Q: highlight row khi nhiều khách cùng phòng */
.row-shared-room td {
  background: var(--primary-50, #ecfeff);
}
.row-shared-room:hover td {
  background: var(--primary-100, #cffafe);
}
.share-tag {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  background: #FEF3C7;
  color: #92400E;
  border-radius: 6px;
  font-weight: 600;
  margin-left: 4px;
  cursor: help;
}

/* Sprint 7T: Period selector */
.period-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 100px;
  width: max-content;
}
.period-selector .period-label {
  font-weight: 700;
  color: var(--ink);
  padding: 0 8px;
  min-width: 120px;
  text-align: center;
}

/* Sprint 7T: P&L card stats inside building card */
.bc-pnl {
  padding: 10px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  margin: 0 0 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.bc-pnl .pnl-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  color: var(--ink-2);
}
.bc-pnl .pnl-row b { color: var(--ink); font-weight: 700; }
.bc-pnl .pnl-row .text-muted { font-size: 12px; }
.bc-pnl .pnl-total {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--line);
  font-size: 14px;
}
.bc-pnl .pnl-total b { font-size: 16px; }
.bc-pnl .pnl-total.pos b { color: var(--primary); }
.bc-pnl .pnl-total.neg b { color: #DC2626; }

/* Sprint 7T: Level 2 tab nav (Hoá đơn / Chi phí / P&L) */
.invoice-l2-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.invoice-l2-tabs .l2-btn {
  padding: 10px 18px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-3);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.invoice-l2-tabs .l2-btn:hover { color: var(--primary-700); }
.invoice-l2-tabs .l2-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.invoice-l2-tabs .l2-btn .count {
  background: var(--bg-2);
  color: var(--ink-3);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.invoice-l2-tabs .l2-btn.active .count { background: var(--primary-50); color: var(--primary-700); }

/* Sprint 7Y: section header trong Tab Hoá đơn */
.invoice-section-head td {
  background: var(--bg-2);
  font-weight: 700;
  color: var(--ink);
  padding: 12px 16px;
  font-size: 14px;
  border-top: 2px solid var(--line);
}
.invoice-section-head.debt td {
  background: #FEE2E2;
  color: #991B1B;
  border-top-color: #FCA5A5;
}
.invoice-section-head.current td {
  background: var(--primary-50, #ecfeff);
  color: var(--primary-700);
}
.invoice-section-head.next td {
  background: #FEF3C7;
  color: #92400E;
}
.invoice-section-empty td {
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  background: var(--surface);
  font-size: 13px;
  font-style: italic;
}
.invoice-section-empty a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: underline;
}

/* Sprint 7Y: partial info trong row */
.partial-info {
  color: #92400E;
  margin-top: 2px;
}
.partial-info b { color: #DC2626; }

/* Sprint 7Y: read-only banner */
.readonly-banner {
  display: inline-block;
  background: var(--bg-2);
  color: var(--ink-3);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
}

/* Sprint 7X: inline expandable edit row */
.invoice-row.invoice-row-editing td {
  background: var(--primary-50, #ecfeff);
  border-bottom-color: transparent;
}
.invoice-row-expand .invoice-expand-cell {
  padding: 0 !important;
  background: var(--bg-2);
  border-top: 0;
}
.invoice-inline-form {
  padding: 16px 20px 18px;
  border-bottom: 2px solid var(--primary);
}
.invoice-inline-header {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 14px;
  font-size: 13px;
  color: var(--ink-2);
}
.invoice-inline-header b { color: var(--primary-700); }
.invoice-inline-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
}
.invoice-inline-grid .form-field { margin: 0; }
.invoice-inline-grid .form-field .form-label {
  font-size: 12px;
  color: var(--ink-3);
  margin-bottom: 2px;
}
.invoice-inline-grid .form-control {
  padding: 6px 10px;
  font-size: 14px;
}
.invoice-inline-grid .form-hint {
  font-size: 11px;
  color: var(--primary-700);
  margin-top: 2px;
}
.invoice-inline-total {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--surface);
  border-radius: var(--radius);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.invoice-inline-total .total-label {
  font-size: 15px;
  color: var(--ink-2);
}
.invoice-inline-total .total-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  margin-left: 6px;
}
.invoice-inline-total .total-actions {
  display: flex;
  gap: 8px;
}

@media (max-width: 700px) {
  /* Sprint 7X mobile: grid 1 cột nhưng form vẫn inline (không fall back modal — đơn giản hơn) */
  .invoice-inline-grid { grid-template-columns: 1fr; }
  .invoice-inline-form { padding: 12px 14px; }
}

/* Sprint 7T.2: mobile responsive helpers — ẩn cột trên mobile */
.col-show-mobile { display: none; }
@media (max-width: 600px) {
  .col-hide-mobile { display: none; }
  .col-show-mobile { display: block; }
  .invoice-table .cell-actions { gap: 2px; }
  .invoice-table .cell-actions .btn-sm { padding: 4px 8px; }
}

/* ====================================================
   Sprint 8K: Invoice Grid (Demo C — Bảng + Bulk Apply)
   ==================================================== */

.grid-toolbar {
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.grid-selected-count {
  color: var(--ink-3);
  font-weight: 500;
  margin-left: 2px;
}

/* Sprint 8BC: auto-save status indicator (Google Sheets style) */
.auto-save-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  transition: all .2s ease;
  user-select: none;
}
.auto-save-status.auto-save-idle {
  background: #F0FDF4;
  color: #15803D;
  border: 1px solid #BBF7D0;
}
.auto-save-status.auto-save-pending {
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
}
.auto-save-status.auto-save-saving {
  background: #DBEAFE;
  color: #1E40AF;
  border: 1px solid #93C5FD;
}
.auto-save-status.auto-save-saved {
  background: #D1FAE5;
  color: #065F46;
  border: 1px solid #6EE7B7;
  animation: vzPulseGreen .4s ease;
}
.auto-save-status.auto-save-error {
  background: #FEE2E2;
  color: #B91C1C;
  border: 1px solid #FCA5A5;
}
@keyframes vzPulseGreen {
  0% { transform: scale(1); }
  50% { transform: scale(1.06); }
  100% { transform: scale(1); }
}

/* Bulk apply bar */
.bulk-apply-bar {
  background: #FFFBEB;
  border: 1px solid #F59E0B;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(245, 158, 11, 0.15);
}
.bulk-apply-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.bulk-apply-title { font-weight: 600; color: #78350F; font-size: 14px; }
.bulk-apply-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}
.bulk-field label {
  display: block;
  font-size: 12px;
  color: #78350F;
  font-weight: 600;
  margin-bottom: 4px;
}
.bulk-field input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid #FCD34D;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
}
.bulk-field input:focus { outline: none; border-color: #F59E0B; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15); }
.bulk-apply-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.bulk-apply-only {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #78350F;
  flex: 1;
}
.bulk-apply-only input { margin: 0; }

/* Grid card + wrap */
.invoice-grid-card { padding: 0; overflow: hidden; }
.invoice-grid-wrap {
  overflow-x: auto;
  max-height: calc(100vh - 380px);
  overflow-y: auto;
  /* Sticky header support */
  position: relative;
}

/* Grid table */
.invoice-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  min-width: 1820px; /* đủ cho 23 cột (Sprint 8HX thêm cột Số người) */
  background: #fff;
}
/* Sprint 8HU: ẩn cột phí toà không cấu hình (hệ số = 0) — bớt cột rườm rà.
   Sprint 8HV: ẩn kèm cột tiền (-amt) tương ứng. */
.invoice-grid.hide-col-ev .col-ev,
.invoice-grid.hide-col-ev .col-ev-amt,
.invoice-grid.hide-col-foreigner .col-foreigner,
.invoice-grid.hide-col-foreigner .col-foreigner-amt,
.invoice-grid.hide-col-pets .col-pets,
.invoice-grid.hide-col-pets .col-pets-amt,
.invoice-grid.hide-col-service .col-service,
.invoice-grid.hide-col-wifi .col-wifi,
.invoice-grid.hide-col-garbage .col-garbage,
.invoice-grid.hide-col-occ .col-occ { display: none; }
.invoice-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg-2);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12px;
  color: var(--ink-2);
  padding: 10px 8px;
  border-bottom: 2px solid var(--line);
  text-align: center;
  white-space: nowrap;
}
.invoice-grid tbody td,
.invoice-grid tfoot td {
  padding: 0;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #fff;
  text-align: right;
  vertical-align: middle;
  white-space: nowrap;
}
.invoice-grid tbody td.col-tick,
.invoice-grid tbody td.col-room,
.invoice-grid tbody td.col-tenant,
.invoice-grid tbody td.col-actions {
  text-align: left;
}
.invoice-grid tbody td.col-tick { text-align: center; }

/* Sticky cols left (Tick + Phòng + Khách) */
.invoice-grid th.col-tick,
.invoice-grid td.col-tick {
  position: sticky;
  left: 0;
  z-index: 4;
  background: #fff;
  width: 36px;
  padding: 0 8px;
  border-right: 1px solid var(--line);
}
.invoice-grid thead th.col-tick { z-index: 5; background: var(--bg-2); }
.invoice-grid th.col-room,
.invoice-grid td.col-room {
  position: sticky;
  left: 36px;
  z-index: 4;
  background: #fff;
  min-width: 64px;
  padding: 6px 10px;
  font-weight: 600;
}
.invoice-grid thead th.col-room { z-index: 5; background: var(--bg-2); }
.invoice-grid th.col-tenant,
.invoice-grid td.col-tenant {
  position: sticky;
  left: 100px;
  z-index: 4;
  background: #fff;
  min-width: 140px;
  padding: 6px 10px;
  box-shadow: 2px 0 3px -2px rgba(0,0,0,0.05);
}
.invoice-grid thead th.col-tenant { z-index: 5; background: var(--bg-2); }

/* Sprint 8BD: rebalance column width — cột count nhỏ, cột tiền/đo rộng */
.invoice-grid th.col-ev, .invoice-grid td.col-ev,
.invoice-grid th.col-foreigner, .invoice-grid td.col-foreigner,
.invoice-grid th.col-pets, .invoice-grid td.col-pets,
.invoice-grid th.col-occ, .invoice-grid td.col-occ {
  width: 56px;
  min-width: 56px;
  max-width: 56px;
  text-align: center;
}
.invoice-grid td.col-ev input.grid-cell,
.invoice-grid td.col-foreigner input.grid-cell,
.invoice-grid td.col-pets input.grid-cell,
.invoice-grid td.col-occ input.grid-cell {
  padding: 8px 4px;
  text-align: center;
  font-weight: 600;
}
.invoice-grid th.col-rent, .invoice-grid td.col-rent,
.invoice-grid th.col-service, .invoice-grid td.col-service,
.invoice-grid th.col-wifi, .invoice-grid td.col-wifi,
.invoice-grid th.col-garbage, .invoice-grid td.col-garbage,
.invoice-grid th.col-ev-amt, .invoice-grid td.col-ev-amt,
.invoice-grid th.col-foreigner-amt, .invoice-grid td.col-foreigner-amt,
.invoice-grid th.col-pets-amt, .invoice-grid td.col-pets-amt,
.invoice-grid th.col-elec-amt, .invoice-grid td.col-elec-amt,
.invoice-grid th.col-water-amt, .invoice-grid td.col-water-amt,
.invoice-grid th.col-debt, .invoice-grid td.col-debt {
  min-width: 100px;
}
.invoice-grid th.col-total, .invoice-grid td.col-total {
  min-width: 110px;
  font-weight: 600;
}
.invoice-grid th.col-elec-prev, .invoice-grid td.col-elec-prev,
.invoice-grid th.col-elec-cur, .invoice-grid td.col-elec-cur,
.invoice-grid th.col-water-prev, .invoice-grid td.col-water-prev,
.invoice-grid th.col-water-cur, .invoice-grid td.col-water-cur {
  min-width: 88px;
}

/* Sprint 8HW: ô tiền in đậm (ô nhập tiền + ô tính sẵn + hàng TỔNG) cho dễ đọc */
.invoice-grid td input.money-cell,
.invoice-grid td.cell-computed,
.invoice-grid tfoot td { font-weight: 700; }

/* Cell inputs */
.invoice-grid td input.grid-cell {
  width: 100%;
  border: none;
  background: transparent;
  padding: 8px 10px;
  font-size: 13px;
  text-align: right;
  font-family: inherit;
  color: var(--ink);
  -moz-appearance: textfield; /* hide number spinner */
}
.invoice-grid td input.grid-cell::-webkit-outer-spin-button,
.invoice-grid td input.grid-cell::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.invoice-grid td input.grid-cell:focus {
  outline: 2px solid var(--primary);
  outline-offset: -2px;
  background: #EEF2F8;
}

/* Cell states */
.invoice-grid td.cell-autofilled input.grid-cell { color: #9CA3AF; }
.invoice-grid td.cell-dirty {
  background: #D4E0EF;
  position: relative;
}
.invoice-grid td.cell-dirty input.grid-cell { color: var(--ink); font-weight: 500; }
.invoice-grid td.cell-dirty::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  border-bottom: 2px solid var(--primary);
}
.invoice-grid td.cell-saved::after {
  content: '';
  position: absolute; bottom: 0; left: 0; right: 0;
  border-bottom: 2px solid #10B981;
}
.invoice-grid td.cell-saved { position: relative; }
.invoice-grid td.cell-error { background: #FEE2E2; }
/* Sprint 8CQ: cảnh báo số mới < số cũ (viền + nền đỏ nhạt, không chặn lưu) */
.invoice-grid td.cell-warn-negative {
  background: #FEF2F2;
  box-shadow: inset 0 0 0 2px #DC2626;
  position: relative;
}
.invoice-grid td.cell-warn-negative input.grid-cell { color: #B91C1C; font-weight: 600; }
.invoice-grid td.cell-error input.grid-cell { color: #DC2626; }
/* Sprint 8CU: badge cảnh báo tiêu thụ điện/nước bất thường so TB 3 kỳ */
.consume-badge {
  display: inline-block; margin-left: 4px; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 6px; vertical-align: middle; white-space: nowrap;
}
.consume-yellow { background: #FEF3C7; color: #92400E; }
.consume-red { background: #FEE2E2; color: #B91C1C; }
/* Sprint 8CV: ô "số cũ" làm mờ (Tab bỏ qua, chỉ click sửa khi cần) */
.invoice-grid td.cell-prev-dim input.grid-cell { color: var(--muted); background: #FAFAFA; }
.invoice-grid td.cell-prev-dim input.grid-cell:focus { color: var(--ink); background: #fff; }
/* Sprint 8CW: sáng cả hàng đang sửa (gồm cột ghim trái) — chống nhầm hàng khi cuộn ngang */
.invoice-grid tbody tr.row-active td { background: #FFFBEB; }
.invoice-grid td.cell-computed {
  background: #F9FAFB;
  font-weight: 600;
  padding: 8px 10px;
  color: var(--ink);
}
.invoice-grid td.cell-computed.cell-total {
  background: #EFF6FF;
  color: var(--primary);
  font-size: 14px;
}

/* Row states */
.invoice-grid tbody tr.row-paid { background: #F0FDF4; }
.invoice-grid tbody tr.row-paid td { background: #F0FDF4; }
.invoice-grid tbody tr.row-paid td.col-room,
.invoice-grid tbody tr.row-paid td.col-tenant,
.invoice-grid tbody tr.row-paid td.col-tick { background: #F0FDF4; }
.invoice-grid tbody tr.row-debt { background: #FEF2F2; }
.invoice-grid tbody tr.row-debt td { background: #FEF2F2; }
.invoice-grid tbody tr.row-debt td.col-room,
.invoice-grid tbody tr.row-debt td.col-tenant,
.invoice-grid tbody tr.row-debt td.col-tick { background: #FEF2F2; }
/* Sprint 8EL: hàng được tick → tô xanh (đặt sau row-debt/paid/active để thắng) */
.invoice-grid tbody tr.row-selected td { background: #BBF7D0; }
.invoice-grid tbody tr.row-selected td.col-room,
.invoice-grid tbody tr.row-selected td.col-tenant,
.invoice-grid tbody tr.row-selected td.col-tick { background: #BBF7D0; }

/* Section header row */
.invoice-grid tr.grid-section td {
  background: var(--bg-2);
  font-weight: 600;
  font-size: 13px;
  text-align: left;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  border-right: none;
  position: sticky;
  left: 0;
  color: var(--ink);
}
.invoice-grid tr.grid-section.debt td { background: #FEF2F2; color: #991B1B; }
.invoice-grid tr.grid-section.current td { background: #ECFDF5; color: #065F46; }
.invoice-grid tr.grid-section.next td { background: #EFF6FF; color: #1E40AF; }
/* Sprint 8JA: ghim nhan section (ngay thang) sang trai khi keo bang ngang (cell colspan rong nen phai sticky o span ben trong) */
.invoice-grid tr.grid-section td .gsec-label { position: sticky; left: 14px; display: inline-block; z-index: 1; }

/* Footer total */
.invoice-grid tfoot td {
  background: var(--bg-2);
  font-weight: 700;
  font-size: 13px;
  padding: 10px 10px;
  border-top: 2px solid var(--line);
  position: sticky;
  bottom: 0;
  z-index: 5; /* Sprint 8EI: > cot dong cung thbody (z4) de footer khong bi ten khach de len */
}
.invoice-grid tfoot td.cell-total { background: #DBEAFE; color: var(--primary); }
.invoice-grid tfoot td.col-tick,
.invoice-grid tfoot td.col-room,
.invoice-grid tfoot td.col-tenant {
  position: sticky;
  bottom: 0;
  z-index: 6; /* Sprint 8EI: goc sticky (bottom + left) phai cao nhat */
}

/* Action mini buttons in last col */
.invoice-grid td.col-actions {
  padding: 4px 6px;
  white-space: nowrap;
  min-width: 100px;
}
.invoice-grid td.col-actions .btn {
  padding: 4px 6px;
  font-size: 11px;
  min-width: 0;
}
.grid-cell-tooltip { /* hover tooltip */
  position: relative;
}
.grid-cell-tooltip[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 4px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

/* Mobile fallback — card stack */
@media (max-width: 900px) {
  .invoice-grid-wrap { max-height: none; }
  .invoice-grid { min-width: 0; display: block; }
  .invoice-grid thead { display: none; }
  .invoice-grid tbody { display: block; }
  .invoice-grid tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 10px;
    padding: 10px;
    background: #fff;
  }
  .invoice-grid tbody tr.grid-section { display: block; padding: 6px 10px; }
  .invoice-grid tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 4px;
    border: none;
    border-bottom: 1px solid var(--bg-2);
    position: static !important;
  }
  .invoice-grid tbody td.col-tick { display: none; }
  .invoice-grid tbody td::before {
    content: attr(data-mobile-label);
    font-weight: 600;
    color: var(--ink-2);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }
  .invoice-grid tbody td.col-room,
  .invoice-grid tbody td.col-tenant {
    background: var(--bg-2) !important;
    font-weight: 700;
  }
  .invoice-grid td input.grid-cell { width: 50%; text-align: right; }
  .invoice-grid tfoot { display: none; } /* tổng đã có trong header */
}

/* Sprint 7T: P&L summary table */
.pl-table {
  width: 100%;
  border-collapse: collapse;
}
.pl-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  font-size: 14px;
}
.pl-table tr.pl-section td {
  background: var(--bg-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  padding: 8px 16px;
}
.pl-table tr.pl-sub td {
  background: var(--bg);
  font-weight: 700;
}
.pl-table .text-right { text-align: right; }

/* Sprint 7W: end-contract modal radio options */
.end-reason-group, .end-deposit-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.end-reason-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
  transition: all .15s;
}
.end-reason-opt:hover {
  border-color: var(--primary);
  background: var(--primary-50, #ecfeff);
}
.end-reason-opt input[type="radio"]:checked + span {
  font-weight: 700;
  color: var(--primary-700);
}
.end-reason-opt input[type="radio"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Sprint 7R Vùng 4: invoice modal context chip 1 dòng compact */
.invoice-context-chip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  padding: 10px 14px;
  background: var(--primary-50, #ecfeff);
  border: 1px solid var(--primary-200, #99f6e4);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--ink);
}
.invoice-context-chip span {
  white-space: nowrap;
}
.invoice-context-chip b {
  color: var(--primary-700);
}

/* Sprint 7P Phần A: tenant info edit mode */
.tenant-info-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}
.input-with-clear {
  position: relative;
}
.input-with-clear .form-control {
  padding-right: 32px;
}
.input-with-clear .clear-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 0;
  background: var(--bg-2);
  color: var(--ink-3);
  border-radius: 50%;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
}
.input-with-clear .clear-btn:hover {
  background: var(--danger-50, #FEE2E2);
  color: #B91C1C;
}

/* Sprint 7O Vùng 4: empty state lớn khi chưa có khách */
.tenants-empty-card {
  text-align: center;
  padding: 60px 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.tenants-empty-card .ic {
  width: 80px;
  height: 80px;
  background: var(--primary-50);
  color: var(--primary);
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 40px;
  margin-bottom: 12px;
}
.tenants-empty-card h3 {
  font-size: 20px;
  margin: 0;
}
.tenants-empty-card p {
  color: var(--ink-3);
  max-width: 440px;
  margin: 0 0 14px;
  font-size: 14.5px;
  line-height: 1.6;
}

/* Sprint 7O Vùng 3: accordion form ẩn trường optional */
.advanced-accordion {
  border: 1px dashed var(--line-2);
  border-radius: var(--radius);
  background: var(--bg-2);
}
.advanced-accordion > summary {
  cursor: pointer;
  padding: 12px 16px;
  font-weight: 600;
  font-size: 14px;
  color: var(--ink);
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.advanced-accordion > summary::-webkit-details-marker { display: none; }
.advanced-accordion > summary::before {
  content: '▸';
  font-size: 12px;
  color: var(--ink-3);
  transition: transform .2s;
  display: inline-block;
}
.advanced-accordion[open] > summary::before { transform: rotate(90deg); }
.advanced-accordion > summary:hover { color: var(--primary-700); }
.advanced-accordion[open] {
  background: var(--surface);
  border-style: solid;
  border-color: var(--line);
}
.advanced-accordion > *:not(summary) {
  padding-left: 16px;
  padding-right: 16px;
}
.advanced-accordion > *:last-child {
  padding-bottom: 14px;
}

/* ============ Mobile sticky bottom CTA bar ============
   For public room/listing pages — keeps booking button always reachable on mobile */
.mobile-cta-bar {
  display: none;
}
@media (max-width: 900px) {
  .mobile-cta-bar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
    padding: 10px 14px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0));
    gap: 10px;
    align-items: center;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
  }
  .mobile-cta-bar .price {
    font-size: 16px;
    font-weight: 800;
    color: var(--primary);
    flex-shrink: 0;
    line-height: 1.2;
  }
  .mobile-cta-bar .price small {
    display: block;
    font-size: 11px;
    color: var(--ink-3);
    font-weight: 500;
  }
  .mobile-cta-bar .btn {
    flex: 1;
    padding: 12px 14px;
    font-size: 15px;
    font-weight: 700;
  }
  /* Extra bottom padding on main so content not hidden behind sticky bar */
  body.has-mobile-cta main {
    padding-bottom: 90px !important;
  }
  /* Sprint 8IC (audit B1): bo nut "Dat lich xem" TRUNG o sidebar tren mobile —
     da co .mobile-cta-bar fixed day; giu lai gia/phi/hoa hong/uy tin + ghi chu trust. */
  .contact-card #openBookingBtn { display: none; }
  .contact-card .owner-block { margin-top: 12px; padding-top: 12px; }
}

/* ============ Sprint 8HZ: Che do "luot phong" kieu TikTok cho CTV ============
   Overlay full-screen, vuot doc (scroll-snap), moi phong = 1 trang 100dvh.
   Tai dung helper/format/action cua ctv.js — khong them thu vien. */
body.swipe-open { overflow: hidden; }
.ctv-swipe { position: fixed; inset: 0; z-index: 2000; background: #000; }
.ctv-swipe[hidden] { display: none; }
.swipe-track {
  height: 100%; width: 100%;
  overflow-y: scroll; overflow-x: hidden;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
}
.swipe-track::-webkit-scrollbar { display: none; }
.swipe-page {
  position: relative;
  height: 100vh; height: 100dvh; width: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  background-color: #111;
  display: flex; flex-direction: column; justify-content: flex-end;
  overflow: hidden;
}
/* Carousel media ngang trong 1 phong: vuot trai/phai xem them anh/video */
.swipe-media {
  position: absolute; inset: 0; z-index: 0;
  display: flex; overflow-x: scroll; overflow-y: hidden;
  scroll-snap-type: x mandatory; overscroll-behavior: contain;
  scrollbar-width: none;
}
.swipe-media::-webkit-scrollbar { display: none; }
.swipe-slide {
  position: relative; flex: 0 0 100%; width: 100%; height: 100%;
  scroll-snap-align: center; scroll-snap-stop: always;
  background-color: #111; overflow: hidden;
}
.swipe-slide.swipe-noimg {
  display: grid; place-items: center;
  color: rgba(255, 255, 255, .35); background: linear-gradient(150deg, #1B3A63, #0E2038);
}
/* Nen blur cua chinh media (lap khoang trong khi anh/video lech ti le) */
.swipe-blur {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center; background-repeat: no-repeat;
  filter: blur(28px) brightness(.5); transform: scale(1.18);
}
/* Anh/video hien DAY DU (contain), khong cat — nam tren nen blur */
.swipe-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; z-index: 1; }
/* Sprint 8IL: chan long-press callout (menu "Tai video/Mo Chrome") tren media */
.swipe-media, .swipe-slide, .swipe-video, .swipe-img, .swipe-blur {
  -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; -webkit-user-drag: none;
}
.swipe-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: transparent; z-index: 1; }
.swipe-slide-embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }
.swipe-slide .swipe-play {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 60px; height: 60px; border-radius: 50%; z-index: 1;
  background: rgba(0, 0, 0, .5); color: #fff; display: grid; place-items: center;
  font-size: 24px; pointer-events: none;
}
.swipe-slide.playing .swipe-play { display: none; }
.swipe-count {
  position: absolute; top: calc(16px + env(safe-area-inset-top, 0)); left: 50%; transform: translateX(-50%); z-index: 3;
  background: rgba(0, 0, 0, .5); color: #fff; font-size: 12px; font-weight: 700;
  padding: 4px 10px; border-radius: 999px;
}
/* scrim de chu duoi de doc (tren media, duoi info) */
.swipe-page::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 64%; z-index: 1;
  background: linear-gradient(to top, rgba(0,0,0,.88) 0%, rgba(0,0,0,.55) 38%, rgba(0,0,0,0) 100%);
  pointer-events: none;
}
.swipe-kind {
  position: absolute; top: calc(14px + env(safe-area-inset-top, 0)); left: 14px; z-index: 2;
  background: rgba(255, 255, 255, .92); color: var(--ink);
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
/* khoi day: dots + (info trai | rail phai) + CTA "Ghi danh" full-width */
.swipe-foot { position: relative; z-index: 2; padding: 0 14px calc(14px + env(safe-area-inset-bottom, 0)); }
.swipe-foot-main { display: flex; align-items: flex-end; gap: 12px; }
.swipe-info { flex: 1; min-width: 0; color: #fff; }
.swipe-mediatag {
  display: inline-block; margin-bottom: 8px;
  background: rgba(0, 0, 0, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
}
.swipe-info .s-title {
  font-size: 20px; font-weight: 800; line-height: 1.25; margin-bottom: 6px; text-shadow: 0 1px 4px rgba(0,0,0,.45);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.swipe-info .s-loc { font-size: 14px; opacity: .92; margin-bottom: 10px; }
.s-desc-wrap { margin-bottom: 10px; }
.s-desc {
  font-size: 13px; opacity: .9; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.s-desc-wrap.open .s-desc { -webkit-line-clamp: unset; }
.s-more { font-size: 13px; font-weight: 700; color: #fff; opacity: .8; cursor: pointer; }
.swipe-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.swipe-badges span {
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
}
.swipe-price { font-size: 22px; font-weight: 800; margin-bottom: 10px; text-shadow: 0 1px 4px rgba(0,0,0,.45); }
.swipe-price small { font-size: 13px; font-weight: 500; opacity: .85; }
.swipe-commission {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #3A2A05;
  padding: 8px 14px; border-radius: 12px; font-size: 14px; font-weight: 800;
}
/* Rail hanh dong doc ben phai (kieu TikTok) — chi chua hanh dong CHUC NANG, khong vanity metric */
.swipe-rail { display: flex; flex-direction: column; gap: 16px; align-items: center; margin-bottom: 10px; flex-shrink: 0; }
.swipe-rail-btn {
  background: none; border: 0; padding: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.swipe-rail-btn b {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255, 255, 255, .18); border: 1px solid rgba(255, 255, 255, .25);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  display: grid; place-items: center; font-size: 22px;
}
.swipe-rail-btn span { font-size: 11px; font-weight: 600; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.55); }
/* CTA "Ghi danh" full-width noi bat (kieu Shopee) */
.swipe-cta { width: 100%; margin-top: 12px; min-height: 48px; display: flex; align-items: center; justify-content: center; }
.btn-introduce { background: #fff; color: var(--primary); border: 0; font-weight: 800; }
/* Cham dot chi vi tri media (TikTok) */
/* Cham dot chi vi tri media — GOC TREN giua (khong noi giua khung hinh) */
.swipe-dots {
  position: absolute; top: calc(16px + env(safe-area-inset-top, 0)); left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; justify-content: center; gap: 6px;
  background: rgba(0, 0, 0, .35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  padding: 6px 10px; border-radius: 999px;
}
.swipe-dots i { width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, .45); transition: all .15s; }
.swipe-dots i.on { background: #fff; width: 7px; height: 7px; }
.swipe-close {
  position: absolute; top: calc(12px + env(safe-area-inset-top, 0)); right: 14px; z-index: 5;
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(0, 0, 0, .45); color: #fff; border: 1px solid rgba(255, 255, 255, .3);
  font-size: 20px; line-height: 1; cursor: pointer; display: grid; place-items: center;
}
.swipe-hint {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  padding: 8px 16px; border-radius: 999px;
  color: #fff; font-size: 13px; font-weight: 600; z-index: 4;
  pointer-events: none; transition: opacity .3s;
  animation: swipeHintBounce 1.6s ease-in-out infinite;
}
.swipe-hint.hide { opacity: 0; }
/* dung margin (khong dung transform) de khong de len canh giua translate */
@keyframes swipeHintBounce { 0%, 100% { margin-top: 0; } 50% { margin-top: -6px; } }
/* Desktop: gioi han be rong kieu Reels, canh giua tren nen den */
@media (min-width: 768px) {
  .swipe-page { max-width: 460px; margin: 0 auto; box-shadow: 0 0 60px rgba(0,0,0,.6); }
}

/* Sprint 8DZ: bang -> the (card) tren mobile (opt-in qua .data-table--cards).
   Moi <td> can data-label="..." de hien nhan cot. Override rule truncate/scroll cu. */
@media (max-width: 600px) {
  .data-table--cards thead { display: none; }
  .data-table--cards,
  .data-table--cards tbody { display: block; width: 100%; }
  .data-table--cards tr {
    display: block; border: 1px solid var(--line); border-radius: 12px;
    margin-bottom: 12px; padding: 4px 2px; background: var(--surface, #fff);
  }
  .data-table--cards tbody tr:hover { background: var(--surface, #fff); }
  .data-table--cards td {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
    padding: 9px 14px; max-width: none; white-space: normal; overflow: visible;
    text-overflow: clip; border: none; text-align: right;
  }
  .data-table--cards td:first-child { max-width: none; }
  .data-table--cards td::before {
    content: attr(data-label); font-weight: 600; color: var(--muted);
    text-align: left; flex: 0 0 auto; white-space: nowrap;
  }
  /* hien lai subtitle bi an boi rule .data-table td .text-xs o tren */
  .data-table--cards td .text-xs,
  .data-table--cards td .text-muted.text-xs { display: block; }
  /* cot action (khong co data-label) canh phai, bo nhan */
  .data-table--cards td:last-child { justify-content: flex-end; }
  .data-table--cards td:last-child::before { content: none; }
}

/* Sprint 8EB: show/hide password + thanh do do manh */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer; color: var(--muted);
  padding: 6px; display: flex; line-height: 0; border-radius: 6px;
}
.pw-toggle:hover { color: var(--ink); background: var(--bg-2); }
.pw-strength { display: flex; align-items: center; gap: 8px; margin-top: 8px; height: 14px; }
.pw-strength .track { flex: 1; height: 5px; background: var(--bg-2); border-radius: 999px; overflow: hidden; }
.pw-strength .track i { display: block; height: 100%; width: 0; background: var(--danger, #DC2626); transition: width .2s ease, background .2s ease; }
.pw-strength b { font-size: 12px; font-weight: 600; min-width: 70px; text-align: right; }

/* Sprint 8EC: hang sub-tab admin — desktop wrap, mobile cuon ngang 1 hang (thay vi wrap ~5 dong) */
.admin-tabs { margin-bottom: 20px; flex-wrap: wrap; }
@media (max-width: 720px) {
  .admin-tabs {
    /* Sprint 8GZ.1 fix: .view-toggle base la inline-flex -> co theo noi dung (13 tab) =>
       overflow-x:auto KHONG co tac dung, tran ngang ca trang. Ep display:flex (block-level)
       + max-width:100% de gioi han be rong = khung cha -> cuon ngang noi bo dung cach. */
    display: flex;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    padding-bottom: 6px;
    -ms-overflow-style: none;
  }
  .admin-tabs .vt-btn { flex: 0 0 auto; white-space: nowrap; }
}

/* Sprint 8EH: thanh goi y phim tat grid hoa don (desktop) */
.kbd-hint {
  display: flex; align-items: center; gap: 10px; justify-content: space-between;
  margin: 6px 0 12px; padding: 8px 14px;
  background: var(--primary-50, #EEF2F8); border: 1px solid var(--primary-100, #D4E0EF); border-radius: 8px;
  font-size: 12.5px; color: #142C4D; line-height: 1.5;
}
.kbd-hint b { color: #1B3A63; }
.kbd-hint button {
  background: none; border: none; cursor: pointer; color: #142C4D;
  font-size: 18px; line-height: 1; padding: 2px 6px; border-radius: 6px; flex-shrink: 0;
}
.kbd-hint button:hover { background: #D4E0EF; }
@media (max-width: 720px) { .kbd-hint { display: none !important; } }

/* Sprint 8EK: thanh thao tac hang loat (phong da tick) */
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 0 0 12px; padding: 10px 14px;
  background: var(--primary-50, #EEF2F8); border: 1px solid var(--primary-100, #D4E0EF); border-radius: 10px;
  font-size: 13px; color: #142C4D;
}
.bulk-bar b { color: #1B3A63; font-size: 15px; }
.bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn.bulk-danger { color: #DC2626; background: #fff; border: 1px solid #FCA5A5; }
.btn.bulk-danger:hover { background: #FEF2F2; }

/* ============ Sprint 8ID (audit mobile C3): touch target >=44px tren mobile ============
   Dat o CUOI file de thang thu tu nguon (ghi de .cell-actions .icon-btn 32px o tren). */
@media (max-width: 768px) {
  .icon-btn { width: 44px; height: 44px; }
  .cell-actions .icon-btn { width: 44px; height: 44px; }
}

/* ============ Sprint 8IG: CTV listing 2 cot "compact" kieu Shopee mobile ============
   1 dong = 2 phong. Card gon: chu nho 2 dong, GIU pill hoa hong, AN nut + badge phu
   (tap anh card -> mo che do Luot phong da co day du hanh dong). Chi scope .ctv-list-col. */
@media (max-width: 600px) {
  .ctv-list-col .room-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .ctv-list-col .room-card .room-body { padding: 10px; }
  .ctv-list-col .room-card .room-title {
    font-size: 13.5px; margin-bottom: 4px; line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  }
  .ctv-list-col .room-card .room-loc { font-size: 11px; margin-bottom: 6px; }
  .ctv-list-col .room-card .room-meta { gap: 8px; font-size: 11px; margin-bottom: 8px; }
  .ctv-list-col .room-card .room-price { font-size: 15px; }
  .ctv-list-col .room-card .room-price small { font-size: 10px; }
  /* Sprint 8IQ: giu pill hoa hong (row + tron), chi thu nho tren mobile */
  .ctv-list-col .room-card .room-commission { margin-top: 8px; padding: 4px 9px; font-size: 11px; }
  /* gon kieu Shopee: an phu + nut (hanh dong nam trong che do Luot phong / chi tiet) */
  .ctv-list-col .room-card .room-guide-badge,
  .ctv-list-col .room-card .room-minterm,
  .ctv-list-col .room-card .room-actions { display: none; }
}

/* ============ Sprint 8IJ: fix toolbar trang Hoa hong (CTV) tran/cat tren mobile ============
   Global mobile ep .chip-row { flex-wrap:nowrap !important } (cuon ngang) -> 9 chip trang thai
   bi cat cut. Hang loc nay nen XUONG DONG hien het. Selector co [attr] -> specificity cao hon
   .chip-row -> thang. */
@media (max-width: 600px) {
  .chip-row[data-filter-group="ctv-cm-status"] { flex-wrap: wrap !important; overflow-x: visible; }
}

/* ============ Sprint 8IN (Redesign S1 khu CTV): icon line + tinh KPI/search/card ============ */
.ic { width: 16px; height: 16px; flex-shrink: 0; display: inline-block; vertical-align: middle; }
/* KPI icon: line icon trong vong tron nhat */
.kpi-icon .ic { width: 18px; height: 18px; }
/* Search: pill "Tim thong minh" + icon line */
.ai-search-go {
  display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; margin-right: 4px;
  padding: 6px 12px; border-radius: 999px; background: var(--accent-50); color: var(--accent-600);
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.ai-search-go .ic { width: 14px; height: 14px; }
@media (max-width: 600px) { .ai-search-go { display: none; } }
/* Card: loc/meta icon line */
.room-loc .ic { color: var(--muted-2); }
.room-meta span { display: inline-flex; align-items: center; gap: 5px; }
.room-meta .ic { width: 15px; height: 15px; color: var(--muted-2); }
/* Card commission pill (nen kem nhat + icon) */
.room-commission span { display: inline-flex; align-items: center; gap: 5px; }
.room-commission .ic { width: 14px; height: 14px; }
/* Badge tren anh card -> dung class (thay inline emoji) */
.room-image .room-badge {
  position: absolute; display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); z-index: 1;
}
.room-badge .ic { width: 13px; height: 13px; }
.room-badge-video { top: 10px; right: 10px; background: rgba(15, 23, 42, .8); color: #fff; }
.room-badge-count { top: 10px; left: 10px; background: rgba(255, 255, 255, .95); color: var(--ink); }
.room-badge-dist { top: 10px; right: 10px; background: rgba(15, 23, 42, .72); color: #fff; }
.room-badge-upcoming { top: 10px; right: 10px; background: var(--accent-50); color: var(--accent-600); }
/* guide/min-term (bo inline style, dung icon line) */
.room-guide-badge { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #0F766E; background: #CCFBF1; border: 1px solid #5EEAD4; border-radius: 8px; padding: 5px 9px; margin-top: 8px; }
.room-minterm { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.room-guide-badge .ic, .room-minterm .ic { width: 14px; height: 14px; }

/* ============ Sprint 8IP (Redesign S1.2 — sat mockup hon) ============ */
/* Nut hanh dong tren header (Bo loc / Luot phong) */
.app-header .header-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
/* Gop 2 nhom chip (type + price) thanh 1 hang (giong mockup) */
.ctv-toolbar .chip-row { display: contents; }
/* Mobile: override rule cu (.toolbar flex-direction:column) de chip wrap NGANG, khong stack full-width */
@media (max-width: 600px) {
  .ctv-toolbar { flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 8px; }
}

/* ============ Sprint 8IK: cu chi gi-giu trong Luot phong ============
   .chrome-hidden = an chu/nut + lop toi (xem ro media); .speeding = bao x2 toc do video. */
.ctv-swipe .swipe-kind, .ctv-swipe .swipe-count, .ctv-swipe .swipe-dots,
.ctv-swipe .swipe-foot, .ctv-swipe .swipe-hint, .ctv-swipe .swipe-close,
.swipe-page::after { transition: opacity .15s ease; }
.ctv-swipe.chrome-hidden .swipe-kind,
.ctv-swipe.chrome-hidden .swipe-count,
.ctv-swipe.chrome-hidden .swipe-dots,
.ctv-swipe.chrome-hidden .swipe-foot,
.ctv-swipe.chrome-hidden .swipe-hint,
.ctv-swipe.chrome-hidden .swipe-close { opacity: 0; pointer-events: none; }
.ctv-swipe.chrome-hidden .swipe-page::after { opacity: 0; }
.swipe-speed-ind {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 6;
  background: rgba(0, 0, 0, .6); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  color: #fff; font-size: 18px; font-weight: 800; padding: 10px 18px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .15s ease;
}
.ctv-swipe.speeding .swipe-speed-ind { opacity: 1; }

/* ============ Sprint 8IQ (Redesign S1.3 — khop chinh xac code v0) ============ */
/* KPI icon: o vuong xam + icon navy (thuong); rieng "cho nhan" nen kem + icon vang */
.kpi-icon--neutral { background: var(--bg-2); color: var(--primary); }
.kpi-icon--gold { background: var(--gold-soft); color: var(--accent); }
/* Pill "Tim thong minh": nen xam + chu muted + sparkle vang (giong v0) */
.ai-search-go { background: var(--bg-2); color: var(--muted); }
.ai-search-go .ic { color: var(--accent); }
/* Card hover: nhac nhe + vien primary mo (giong v0) */
.room-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); border-color: rgba(27, 58, 99, .3); }

/* ============ Sprint 8IR (Redesign S1.4 — app-content + room-card khop v0) ============
   Scope rieng khu CTV (.ctv-header / .ctv-content) -> KHONG dung 20 trang app-shell khac. */
/* 1. Header hoa nen content (xam --bg ~85%) + blur, cao theo noi dung (giong v0 bg-background/80) */
.ctv-header {
  background: rgba(248, 250, 252, .85);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  height: auto; min-height: var(--header-h);
  padding: 14px 24px;
}
/* 2. Content tran full (bo max-width 1400) + padding 24px (giong v0 main flex-1 lg:px-6) */
.ctv-content { max-width: none; padding: 24px; }
/* 3. Nhip khoang cach KPI -> search -> chip -> toggle (giong v0 mt-5/mt-4/mt-3) */
.ctv-content > .kpi-grid { margin-bottom: 20px; }
.ctv-content .ai-search-wrap { margin-bottom: 16px; }
.ctv-content .ctv-toolbar { margin-bottom: 16px; }
.ctv-content .ctv-mobile-toggle { margin-bottom: 12px; }
/* 4. Dong dem ket qua "N phong phu hop" (thay hang goi y) */
.ctv-result-count { font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.ctv-result-count:empty { display: none; }
.ctv-result-count strong { color: var(--ink); font-weight: 700; }
/* 5. Room-card gon + khop v0: badge bo nho (rounded-md, KHONG pill) */
.ctv-list-col .room-image .room-type { border-radius: 8px; font-size: 11px; padding: 3px 8px; }
.ctv-list-col .room-image .room-badge { border-radius: 8px; }
/* Nut hanh dong gon lai (giu 3 nut vi CTV can thao tac nhanh) */
.ctv-list-col .room-actions { margin-top: 12px; gap: 6px; }
.ctv-list-col .room-actions .btn { font-size: 12.5px; }

@media (max-width: 600px) {
  .ctv-header { padding: 10px 16px; }
  .ctv-content { padding: 16px; padding-bottom: 88px; }
}

/* ============ Sprint 8IS (S1.5) ============ */
/* --- A. Nut thu gon sidebar (toan web) --- */
/* Sprint 8JG-fix: khop chieu cao + vien voi .app-header (het lech nut thu gon) */
.sidebar-header, .sidebar-brand {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: var(--header-h); padding: 14px 20px;
  border-bottom: 1px solid var(--line); box-sizing: border-box;
}
/* Desktop: ep .app-header + .sidebar-header/.sidebar-brand CUNG chieu cao -> vien duoi thang hang, het lech nut thu gon */
@media (min-width: 901px) {
  .app-header, .sidebar-header, .sidebar-brand { height: 72px; min-height: 72px; }
}
.sidebar-collapse-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  color: var(--ink-3); flex-shrink: 0; cursor: pointer;
  background: transparent; border: 0;
}
.sidebar-collapse-btn:hover { background: var(--bg-2); color: var(--ink); }
.sidebar-collapse-btn .ic { width: 18px; height: 18px; }
.sb-ic-open { display: none; }
.vz-sidebar-collapsed .sb-ic-close { display: none; }
.vz-sidebar-collapsed .sb-ic-open { display: inline; }

@media (min-width: 901px) {
  .app-shell { transition: grid-template-columns .18s ease; }
  html.vz-sidebar-collapsed .app-shell { grid-template-columns: 76px 1fr; }
  /* thu gon: an logo + chu, chi chua nut toggle canh giua */
  /* Sprint 8JS.1: cac trang dung .sidebar-brand (invoices/commissions/platform-fees/admin*) thay vi
     .sidebar-header -> phai target CA HAI, neu khong logo van hien + header khong canh giua khi thu gon */
  .vz-sidebar-collapsed .sidebar-header,
  .vz-sidebar-collapsed .sidebar-brand { justify-content: center; }
  .vz-sidebar-collapsed .sidebar .brand { display: none; }
  .vz-sidebar-collapsed .side-section-label { display: none; }
  /* font-size:0 an ca label la text-node tran (sidebar hardcode HTML) LAN span (buildSidebar JS); svg giu 20px co dinh */
  .vz-sidebar-collapsed .side-link { justify-content: center; padding-left: 0; padding-right: 0; gap: 0; font-size: 0; }
  .vz-sidebar-collapsed .side-link > span,
  .vz-sidebar-collapsed .side-link .count { display: none; }
  .vz-sidebar-collapsed .user-chip { justify-content: center; }
  .vz-sidebar-collapsed .user-chip .info { display: none; }
  .vz-sidebar-collapsed .side-mode-switch { display: none; }
}

/* --- B. Mobile header GLOBAL (Sprint 8JH) — chi trang co bottom nav (owner/ctv). --- */
/* Admin khong co body.has-mobile-nav -> GIU hamburger + header thuong. */
.app-mobile-brand, .app-mobile-avatar, .app-mobile-title { display: none; }
@media (max-width: 900px) {
  body.has-mobile-nav .app-header { flex-wrap: wrap; align-items: center; }
  body.has-mobile-nav .app-header .left { display: none; }
  body.has-mobile-nav .app-header .menu-toggle { display: none !important; }
  body.has-mobile-nav .app-mobile-brand {
    display: inline-flex; align-items: center; gap: 8px; order: 1;
    font-weight: 800; font-size: 18px; color: var(--ink); letter-spacing: -0.02em;
  }
  body.has-mobile-nav .app-mobile-brand .brand-mark { width: 30px; height: 30px; }
  body.has-mobile-nav .app-mobile-brand b { color: var(--primary); }
  body.has-mobile-nav .app-mobile-avatar { display: inline-flex; order: 2; margin-left: auto; }
  body.has-mobile-nav .app-mobile-avatar .user-avatar { width: 32px; height: 32px; font-size: 12px; }
  body.has-mobile-nav .app-header .right,
  body.has-mobile-nav .app-header .header-actions { order: 3; flex-basis: 100%; }
  body.has-mobile-nav .app-mobile-title { display: block; margin-bottom: 14px; }
  body.has-mobile-nav .app-mobile-title h1 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
  body.has-mobile-nav .app-mobile-title p { font-size: 13px; color: var(--muted); margin-top: 2px; }
}
