/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-light: #dbeafe;
  --primary-50: #eff6ff;
  --secondary: #0f172a;
  --accent: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;

  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-full: 9999px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);

  --font: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --nav-height: 64px;
}

html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  color: var(--gray-800);
  background: var(--gray-50);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }
button { cursor: pointer; font-family: var(--font); }
img { max-width: 100%; display: block; }
input, select, textarea { font-family: var(--font); }

/* ===== Navbar ===== */
.navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  height: var(--nav-height);
}
.nav-container {
  max-width: 1280px; margin: 0 auto;
  padding: 0 24px; height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 22px; font-weight: 800; color: var(--primary);
}
.nav-logo i { font-size: 28px; }
.nav-links { display: flex; align-items: center; gap: 8px; }
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 500; color: var(--gray-600);
  transition: all 0.2s;
}
.nav-link:hover { color: var(--primary); background: var(--primary-50); }
.nav-link.active { color: var(--primary); background: var(--primary-light); font-weight: 600; }
.nav-mobile-toggle {
  display: none; background: none; border: none;
  font-size: 24px; color: var(--gray-700);
}
.nav-mobile-menu {
  display: none; position: absolute; top: var(--nav-height); left: 0; right: 0;
  background: white; border-bottom: 1px solid var(--gray-200);
  padding: 12px 24px; flex-direction: column; gap: 4px;
  box-shadow: var(--shadow-lg);
}
.nav-mobile-menu.open { display: flex; }
.nav-mobile-link {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 15px; color: var(--gray-700);
}
.nav-mobile-link:hover { background: var(--gray-100); }
.nav-auth-btn {
  padding: 8px 20px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 600; border: none; transition: all 0.2s;
}
.nav-auth-btn.login { background: none; color: var(--gray-700); }
.nav-auth-btn.login:hover { color: var(--primary); }
.nav-auth-btn.register { background: var(--primary); color: white; }
.nav-auth-btn.register:hover { background: var(--primary-dark); }
.nav-auth-btn.mypage { background: var(--primary-light); color: var(--primary); }
.nav-user-menu {
  position: relative; display: flex; align-items: center; gap: 8px;
}
.nav-user-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; cursor: pointer;
}
.nav-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: white; border-radius: var(--radius);
  box-shadow: var(--shadow-xl); border: 1px solid var(--gray-200);
  min-width: 200px; padding: 8px; display: none; z-index: 200;
}
.nav-dropdown.open { display: block; }
.nav-dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 14px; color: var(--gray-700); cursor: pointer;
  transition: background 0.15s;
}
.nav-dropdown-item:hover { background: var(--gray-100); }
.nav-dropdown-item.danger { color: var(--danger); }
.nav-dropdown-divider { height: 1px; background: var(--gray-200); margin: 6px 0; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-mobile-toggle { display: block; }
}

/* ===== Main Content ===== */
.main-content {
  min-height: calc(100vh - var(--nav-height));
  padding-top: var(--nav-height);
}

/* ===== Hero Section ===== */
.hero {
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #3b82f6 100%);
  color: white; padding: 80px 24px 60px; text-align: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  opacity: 0.6;
}
.hero-content { position: relative; max-width: 680px; margin: 0 auto; }
.hero h1 { font-size: 40px; font-weight: 800; margin-bottom: 12px; letter-spacing: -0.5px; }
.hero p { font-size: 18px; opacity: 0.9; margin-bottom: 36px; }

/* ===== Search Box ===== */
.search-box {
  background: white; border-radius: var(--radius-lg); padding: 6px;
  display: flex; align-items: center;
  box-shadow: var(--shadow-xl); max-width: 600px; margin: 0 auto;
}
.search-box input {
  flex: 1; border: none; outline: none; padding: 14px 20px;
  font-size: 16px; color: var(--gray-800); background: transparent;
}
.search-box input::placeholder { color: var(--gray-400); }
.search-box button {
  background: var(--primary); color: white; border: none;
  padding: 14px 28px; border-radius: var(--radius);
  font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 6px;
  transition: background 0.2s;
}
.search-box button:hover { background: var(--primary-dark); }

/* ===== Quick Filters ===== */
.quick-filters {
  display: flex; gap: 8px; justify-content: center;
  margin-top: 24px; flex-wrap: wrap; position: relative;
}
.filter-chip {
  padding: 8px 18px; border-radius: var(--radius-full);
  font-size: 14px; font-weight: 500; cursor: pointer;
  background: rgba(255,255,255,0.2); color: white;
  border: 1px solid rgba(255,255,255,0.3);
  transition: all 0.2s;
}
.filter-chip:hover, .filter-chip.active {
  background: white; color: var(--primary);
}

/* ===== Section ===== */
.section {
  max-width: 1280px; margin: 0 auto; padding: 48px 24px;
}
.section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.section-title { font-size: 24px; font-weight: 700; color: var(--gray-900); }
.section-subtitle { font-size: 14px; color: var(--gray-500); margin-top: 4px; }

/* ===== Filter Bar ===== */
.filter-bar {
  background: white; border-radius: var(--radius-lg);
  padding: 20px 24px; margin-bottom: 24px;
  box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
}
.filter-row {
  display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 12px; font-weight: 600; color: var(--gray-500); text-transform: uppercase; }
.filter-select {
  padding: 10px 36px 10px 14px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); font-size: 14px; color: var(--gray-700);
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E") no-repeat right 12px center;
  appearance: none; cursor: pointer; min-width: 130px;
  transition: border-color 0.2s;
}
.filter-select:focus { border-color: var(--primary); outline: none; }
.filter-input {
  padding: 10px 14px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); font-size: 14px; color: var(--gray-700);
  width: 120px; transition: border-color 0.2s;
}
.filter-input:focus { border-color: var(--primary); outline: none; }

/* ===== Property Grid ===== */
.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 24px;
}

/* ===== Property Card ===== */
.property-card {
  background: white; border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
  transition: all 0.3s ease; cursor: pointer;
}
.property-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card-image {
  position: relative; width: 100%; height: 200px; overflow: hidden;
  background: var(--gray-200);
}
.card-image img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 0.5s ease;
}
.property-card:hover .card-image img { transform: scale(1.05); }
.card-badge {
  position: absolute; top: 12px; left: 12px;
  display: flex; gap: 6px;
}
.badge {
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; line-height: 1.4;
}
.badge-monthly { background: #dbeafe; color: #1d4ed8; }
.badge-jeonse { background: #dcfce7; color: #166534; }
.badge-sale { background: #fef3c7; color: #92400e; }
.badge-type { background: rgba(0,0,0,0.6); color: white; }
.card-favorite {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.9); border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--gray-400);
  transition: all 0.2s; backdrop-filter: blur(4px);
}
.card-favorite:hover { transform: scale(1.1); }
.card-favorite.active { color: var(--danger); }
.card-no-image {
  width: 100%; height: 100%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--gray-400); gap: 8px;
}
.card-no-image i { font-size: 40px; }
.card-body { padding: 18px; }
.card-price {
  font-size: 20px; font-weight: 800; color: var(--gray-900);
  margin-bottom: 4px;
}
.card-price .deal-label {
  font-size: 13px; font-weight: 600; margin-right: 6px;
}
.card-price .deal-label.monthly { color: var(--primary); }
.card-price .deal-label.jeonse { color: var(--success); }
.card-price .deal-label.sale { color: var(--warning); }
.card-title {
  font-size: 15px; font-weight: 500; color: var(--gray-700);
  margin-bottom: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.card-info {
  display: flex; gap: 12px; font-size: 13px; color: var(--gray-500);
}
.card-info span { display: flex; align-items: center; gap: 4px; }
.card-address {
  font-size: 13px; color: var(--gray-500); margin-bottom: 6px;
  display: flex; align-items: center; gap: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center; padding: 80px 24px; color: var(--gray-400);
}
.empty-state i { font-size: 64px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--gray-600); }
.empty-state p { font-size: 14px; }

/* ===== Loading ===== */
.loading-spinner {
  display: flex; align-items: center; justify-content: center;
  padding: 60px; color: var(--gray-400);
}
.spinner {
  width: 40px; height: 40px; border: 3px solid var(--gray-200);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ===== Auth Pages ===== */
.auth-page {
  min-height: calc(100vh - var(--nav-height));
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  background: linear-gradient(135deg, var(--gray-50), var(--primary-50));
}
.auth-card {
  background: white; border-radius: var(--radius-xl);
  padding: 48px; max-width: 440px; width: 100%;
  box-shadow: var(--shadow-lg); border: 1px solid var(--gray-200);
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-header h2 { font-size: 26px; font-weight: 800; color: var(--gray-900); margin-bottom: 8px; }
.auth-header p { font-size: 14px; color: var(--gray-500); }
.auth-logo {
  font-size: 40px; color: var(--primary); margin-bottom: 16px;
}

/* Social Login */
.social-divider {
  display: flex; align-items: center; gap: 16px;
  margin: 24px 0; color: var(--gray-400); font-size: 13px;
}
.social-divider::before, .social-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--gray-200);
}
.social-login-buttons {
  display: flex; flex-direction: column; gap: 10px;
}
.social-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 600; text-decoration: none;
  transition: all 0.2s; border: 1.5px solid var(--gray-200);
  cursor: pointer;
}
.social-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.social-btn.kakao {
  background: #FEE500; color: #191919; border-color: #FEE500;
}
.social-btn.kakao:hover { background: #F5DC00; }
.social-btn.naver {
  background: #03C75A; color: #fff; border-color: #03C75A;
}
.social-btn.naver:hover { background: #02b351; }
.social-btn.google {
  background: #fff; color: var(--gray-700); border-color: var(--gray-300);
}
.social-btn.google:hover { background: var(--gray-50); }

/* Role Toggle */
.role-toggle {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.role-option {
  flex: 1; padding: 10px; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius); background: white; color: var(--gray-600);
  font-size: 14px; font-weight: 600; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.2s;
}
.role-option:hover { border-color: var(--primary); color: var(--primary); }
.role-option.active {
  background: var(--primary-50); border-color: var(--primary);
  color: var(--primary);
}

/* ===== Form Elements ===== */
.form-group { margin-bottom: 20px; }
.form-label {
  display: block; font-size: 14px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 6px;
}
.form-input {
  width: 100%; padding: 12px 16px; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius); font-size: 15px; color: var(--gray-800);
  transition: all 0.2s; background: white;
}
.form-input:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-input::placeholder { color: var(--gray-400); }
.form-input.error { border-color: var(--danger); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; }
.form-select {
  width: 100%; padding: 12px 16px; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius); font-size: 15px; color: var(--gray-800);
  appearance: none; background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E") no-repeat right 14px center;
  transition: all 0.2s; cursor: pointer;
}
.form-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-textarea {
  width: 100%; padding: 12px 16px; border: 1.5px solid var(--gray-300);
  border-radius: var(--radius); font-size: 15px; color: var(--gray-800);
  resize: vertical; min-height: 100px; transition: all 0.2s;
}
.form-textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

/* Role Toggle */
.role-toggle {
  display: flex; border-radius: var(--radius); overflow: hidden;
  border: 1.5px solid var(--gray-300); margin-bottom: 20px;
}
.role-option {
  flex: 1; padding: 12px; text-align: center;
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.2s; background: white; color: var(--gray-600);
  border: none;
}
.role-option.active {
  background: var(--primary); color: white;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius); font-size: 15px;
  font-weight: 600; border: none; transition: all 0.2s;
  cursor: pointer; line-height: 1.4;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { background: var(--gray-300); cursor: not-allowed; }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-outline {
  background: white; color: var(--primary);
  border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: var(--primary-50); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-lg { padding: 14px 32px; font-size: 16px; }
.btn-icon {
  width: 40px; height: 40px; padding: 0;
  border-radius: var(--radius); display: flex;
  align-items: center; justify-content: center;
}

/* ===== Detail Page ===== */
.detail-page { max-width: 960px; margin: 0 auto; padding: 24px; }
.detail-gallery {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  height: 480px; background: var(--gray-200); margin-bottom: 28px;
}
.detail-gallery img {
  width: 100%; height: 100%; object-fit: cover;
}
.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.9); border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: var(--gray-700); cursor: pointer;
  transition: all 0.2s; box-shadow: var(--shadow-md);
}
.gallery-nav:hover { background: white; }
.gallery-nav.prev { left: 16px; }
.gallery-nav.next { right: 16px; }
.gallery-counter {
  position: absolute; bottom: 16px; right: 16px;
  background: rgba(0,0,0,0.6); color: white;
  padding: 6px 14px; border-radius: var(--radius-full);
  font-size: 13px; font-weight: 500;
}

.detail-content { display: grid; grid-template-columns: 1fr 340px; gap: 28px; }

.detail-main {}
.detail-price-section {
  background: white; border-radius: var(--radius-lg); padding: 28px;
  border: 1px solid var(--gray-200); margin-bottom: 20px;
}
.detail-deal-type {
  font-size: 14px; font-weight: 600; margin-bottom: 8px;
  display: inline-block; padding: 4px 12px; border-radius: var(--radius-full);
}
.detail-deal-type.monthly { background: var(--primary-light); color: var(--primary-dark); }
.detail-deal-type.jeonse { background: #dcfce7; color: #166534; }
.detail-deal-type.sale { background: #fef3c7; color: #92400e; }
.detail-price { font-size: 32px; font-weight: 800; color: var(--gray-900); margin-bottom: 4px; }
.detail-address { font-size: 15px; color: var(--gray-500); display: flex; align-items: center; gap: 6px; }

.detail-info-grid {
  background: white; border-radius: var(--radius-lg); padding: 28px;
  border: 1px solid var(--gray-200); margin-bottom: 20px;
}
.detail-info-grid h3 { font-size: 18px; font-weight: 700; margin-bottom: 20px; color: var(--gray-900); }
.info-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px;
}
.info-item { display: flex; flex-direction: column; gap: 4px; }
.info-item .label { font-size: 13px; color: var(--gray-500); }
.info-item .value { font-size: 15px; font-weight: 600; color: var(--gray-800); }

.detail-desc {
  background: white; border-radius: var(--radius-lg); padding: 28px;
  border: 1px solid var(--gray-200);
}
.detail-desc h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; color: var(--gray-900); }
.detail-desc p { font-size: 15px; color: var(--gray-600); line-height: 1.8; white-space: pre-line; }

/* Detail Sidebar */
.detail-sidebar {}
.agent-card {
  background: white; border-radius: var(--radius-lg); padding: 24px;
  border: 1px solid var(--gray-200); margin-bottom: 16px;
  position: sticky; top: calc(var(--nav-height) + 24px);
}
.agent-card h4 { font-size: 16px; font-weight: 700; margin-bottom: 16px; color: var(--gray-900); }
.agent-profile {
  display: flex; align-items: center; gap: 14px; margin-bottom: 20px;
}
.agent-avatar {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
}
.agent-name { font-size: 16px; font-weight: 600; color: var(--gray-800); }
.agent-agency { font-size: 13px; color: var(--gray-500); }
.agent-actions { display: flex; flex-direction: column; gap: 10px; }

/* ===== My Page ===== */
.mypage { max-width: 960px; margin: 0 auto; padding: 32px 24px; }
.mypage-header {
  background: white; border-radius: var(--radius-lg); padding: 32px;
  border: 1px solid var(--gray-200); margin-bottom: 24px;
  display: flex; align-items: center; gap: 20px;
}
.mypage-avatar {
  width: 72px; height: 72px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
}
.mypage-info h2 { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.mypage-info p { font-size: 14px; color: var(--gray-500); }
.mypage-role-badge {
  padding: 4px 12px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; display: inline-block; margin-top: 6px;
}
.mypage-role-badge.agent { background: #fef3c7; color: #92400e; }
.mypage-role-badge.user { background: var(--primary-light); color: var(--primary-dark); }

.mypage-tabs {
  display: flex; gap: 4px; margin-bottom: 24px;
  background: white; padding: 6px; border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}
.mypage-tab {
  flex: 1; padding: 12px; text-align: center;
  border-radius: var(--radius); font-size: 14px; font-weight: 600;
  color: var(--gray-500); cursor: pointer; transition: all 0.2s;
  border: none; background: none;
}
.mypage-tab.active { background: var(--primary); color: white; }
.mypage-tab:hover:not(.active) { background: var(--gray-100); }

/* ===== Inquiry Card ===== */
.inquiry-card {
  background: white; border-radius: var(--radius-lg); padding: 20px;
  border: 1px solid var(--gray-200); margin-bottom: 12px;
  transition: box-shadow 0.2s;
}
.inquiry-card:hover { box-shadow: var(--shadow-md); }
.inquiry-header {
  display: flex; justify-content: space-between; align-items: start;
  margin-bottom: 12px;
}
.inquiry-property { font-size: 15px; font-weight: 600; color: var(--gray-800); }
.inquiry-status {
  padding: 4px 10px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600;
}
.inquiry-status.pending { background: #fef3c7; color: #92400e; }
.inquiry-status.replied { background: #dcfce7; color: #166534; }
.inquiry-message { font-size: 14px; color: var(--gray-600); margin-bottom: 8px; }
.inquiry-meta { font-size: 12px; color: var(--gray-400); }
.inquiry-reply {
  background: var(--gray-50); border-radius: var(--radius);
  padding: 14px; margin-top: 12px;
}
.inquiry-reply-label { font-size: 12px; font-weight: 600; color: var(--primary); margin-bottom: 4px; }
.inquiry-reply-text { font-size: 14px; color: var(--gray-700); }

/* ===== Agent Property Form ===== */
.property-form {
  max-width: 780px; margin: 0 auto; padding: 32px 24px;
}
.property-form h2 {
  font-size: 24px; font-weight: 800; margin-bottom: 8px; color: var(--gray-900);
}
.property-form .subtitle {
  font-size: 14px; color: var(--gray-500); margin-bottom: 32px;
}
.form-card {
  background: white; border-radius: var(--radius-lg);
  padding: 28px; border: 1px solid var(--gray-200);
  margin-bottom: 20px;
}
.form-card h3 {
  font-size: 17px; font-weight: 700; color: var(--gray-900);
  margin-bottom: 20px; display: flex; align-items: center; gap: 8px;
}
.form-row {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}
.image-upload-area {
  border: 2px dashed var(--gray-300); border-radius: var(--radius-lg);
  padding: 40px; text-align: center; cursor: pointer;
  transition: all 0.2s; color: var(--gray-400);
}
.image-upload-area:hover {
  border-color: var(--primary); color: var(--primary); background: var(--primary-50);
}
.image-upload-area i { font-size: 36px; margin-bottom: 8px; }
.image-preview-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px; margin-top: 16px;
}
.image-preview {
  position: relative; width: 100%; aspect-ratio: 1;
  border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--gray-200);
}
.image-preview img { width: 100%; height: 100%; object-fit: cover; }
.image-preview-remove {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px; border-radius: 50%;
  background: rgba(0,0,0,0.6); color: white; border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; cursor: pointer;
}

/* ===== Toast ===== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 1000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 14px 20px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; color: white;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s;
  display: flex; align-items: center; gap: 10px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }

/* ===== Modal ===== */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; backdrop-filter: blur(4px);
}
.modal-backdrop.hidden { display: none; }
.modal-content {
  background: white; border-radius: var(--radius-xl);
  max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto;
  padding: 32px; box-shadow: var(--shadow-xl);
  animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { transform: scale(0.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.modal-header h3 { font-size: 20px; font-weight: 700; }
.modal-close {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gray-100); border: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--gray-600); cursor: pointer;
}

/* ===== Pagination ===== */
.pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; margin-top: 40px;
}
.page-btn {
  width: 40px; height: 40px; border-radius: var(--radius);
  border: 1px solid var(--gray-300); background: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 500; color: var(--gray-700);
  cursor: pointer; transition: all 0.2s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== Stats Cards ===== */
.stat-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px; margin-bottom: 32px;
}
.stat-card {
  background: white; border-radius: var(--radius-lg); padding: 20px;
  border: 1px solid var(--gray-200);
}
.stat-card .stat-icon {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; margin-bottom: 12px;
}
.stat-card .stat-value { font-size: 28px; font-weight: 800; color: var(--gray-900); }
.stat-card .stat-label { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* ===== Footer ===== */
.footer {
  background: var(--gray-900); color: var(--gray-400);
  padding: 60px 24px 32px;
}
.footer-container { max-width: 1280px; margin: 0 auto; }
.footer-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr;
  gap: 40px; margin-bottom: 40px;
}
.footer-logo {
  font-size: 22px; font-weight: 800; color: white;
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.footer-desc { font-size: 14px; line-height: 1.6; }
.footer h4 {
  font-size: 14px; font-weight: 600; color: white;
  margin-bottom: 16px; text-transform: uppercase; letter-spacing: 0.5px;
}
.footer a {
  display: block; font-size: 14px; color: var(--gray-400);
  padding: 4px 0; transition: color 0.2s;
}
.footer a:hover { color: white; }
.footer-bottom {
  border-top: 1px solid var(--gray-800); padding-top: 24px;
  font-size: 13px;
}

/* ===== Map page ===== */
.map-page-wrap {
  height: calc(100vh - var(--nav-height));
  display: flex; flex-direction: column;
}
.map-controls {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: white;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0; z-index: 10;
}
.map-search-bar {
  position: relative; display: flex; align-items: center;
  background: var(--gray-100); border-radius: var(--radius);
  padding: 0 12px; flex: 1; max-width: 400px;
}
.map-search-bar i { color: var(--gray-400); font-size: 18px; }
.map-search-bar input {
  border: none; background: none; padding: 10px 8px;
  font-size: 14px; flex: 1; outline: none;
}
.map-search-results {
  position: absolute; top: 100%; left: 0; right: 0;
  background: white; border: 1px solid var(--gray-200);
  border-radius: var(--radius); box-shadow: var(--shadow-lg);
  max-height: 300px; overflow-y: auto; z-index: 100;
}
.map-search-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; cursor: pointer; font-size: 14px;
}
.map-search-item:hover { background: var(--gray-50); }
.map-filters { display: flex; gap: 8px; }
.map-filters select {
  padding: 8px 12px; border: 1px solid var(--gray-200);
  border-radius: var(--radius); font-size: 13px;
  background: white; cursor: pointer;
}
.map-body {
  flex: 1; display: flex; min-height: 0;
}
.map-area {
  flex: 1; background: var(--gray-200);
  position: relative;
}
.map-sidebar {
  width: 380px; overflow-y: auto; background: white;
  border-left: 1px solid var(--gray-200);
}
.map-sidebar-header {
  padding: 16px 20px; border-bottom: 1px solid var(--gray-200);
  font-size: 14px; font-weight: 700; color: var(--gray-600);
}
.map-property-list { padding: 8px; }
.map-property-item {
  display: flex; gap: 12px; padding: 12px;
  border-radius: var(--radius); cursor: pointer;
  transition: background 0.2s;
}
.map-property-item:hover { background: var(--gray-50); }
.map-property-thumb {
  width: 80px; height: 80px; border-radius: var(--radius);
  overflow: hidden; flex-shrink: 0; background: var(--gray-200);
}
.map-property-thumb img { width: 100%; height: 100%; object-fit: cover; }
.map-property-info { flex: 1; min-width: 0; }
.map-property-price { font-size: 15px; font-weight: 700; color: var(--gray-900); display: flex; align-items: center; gap: 6px; }
.map-property-title {
  font-size: 13px; color: var(--gray-600); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.map-property-meta { font-size: 12px; color: var(--gray-400); margin-top: 4px; }

/* Map markers */
.map-marker {
  padding: 4px 10px; border-radius: 20px;
  color: white; font-size: 12px; font-weight: 700;
  white-space: nowrap; box-shadow: 0 2px 6px rgba(0,0,0,.3);
  cursor: pointer; transform: translate(-50%, -100%);
}
.map-marker::after {
  content: ''; position: absolute; bottom: -6px; left: 50%;
  transform: translateX(-50%);
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  border-top: 6px solid inherit;
}

/* Map info window */
.map-info-window {
  padding: 12px 16px; cursor: pointer; min-width: 180px;
}
.map-info-title {
  font-size: 14px; font-weight: 700; color: var(--gray-900);
  margin-bottom: 4px;
}
.map-info-price {
  font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 6px;
}
.map-info-meta {
  font-size: 12px; color: var(--gray-500); margin-top: 4px;
}

/* Deal type badges */
.deal-badge {
  display: inline-block; padding: 2px 8px; border-radius: 4px;
  font-size: 11px; font-weight: 700; color: white;
}
.deal-badge.monthly { background: #7c3aed; }
.deal-badge.jeonse { background: #2563eb; }
.deal-badge.sale { background: #dc2626; }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .detail-content { grid-template-columns: 1fr; }
  .agent-card { position: static; }
  .map-sidebar { width: 300px; }
}

@media (max-width: 768px) {
  .hero { padding: 60px 20px 40px; }
  .hero h1 { font-size: 28px; }
  .hero p { font-size: 15px; }
  .search-box { flex-direction: column; padding: 12px; }
  .search-box input { padding: 12px 16px; }
  .search-box button { width: 100%; justify-content: center; }
  .property-grid { grid-template-columns: 1fr; }
  .detail-gallery { height: 300px; }
  .info-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .auth-card { padding: 32px 24px; }
  .mypage-header { flex-direction: column; text-align: center; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); }
  .map-body { flex-direction: column; }
  .map-sidebar { width: 100%; max-height: 40vh; border-left: none; border-top: 1px solid var(--gray-200); }
  .map-controls { flex-wrap: wrap; }
  .map-search-bar { max-width: 100%; }
}

@media (max-width: 480px) {
  .mypage-tabs { flex-direction: column; }
  .stat-cards { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ===== Admin Layout ===== */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 260px; background: var(--gray-900); color: white;
  display: flex; flex-direction: column; flex-shrink: 0;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 200;
}
.admin-sidebar-header {
  padding: 24px; font-size: 22px; font-weight: 800;
  display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1); color: var(--primary);
}
.admin-sidebar-header i { font-size: 28px; }
.admin-nav { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.admin-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; border-radius: var(--radius);
  font-size: 14px; font-weight: 500; color: var(--gray-400);
  transition: all 0.2s; cursor: pointer;
  background: none; border: none; width: 100%; text-align: left;
}
.admin-nav-item:hover { color: white; background: rgba(255,255,255,0.08); }
.admin-nav-item.active { color: white; background: var(--primary); font-weight: 600; }
.admin-nav-item i { font-size: 18px; width: 20px; }
.admin-sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.admin-main { flex: 1; margin-left: 260px; background: var(--gray-50); display: flex; flex-direction: column; }
.admin-topbar {
  background: white; padding: 16px 28px;
  display: flex; align-items: center; gap: 16px;
  border-bottom: 1px solid var(--gray-200); position: sticky; top: 0; z-index: 100;
}
.admin-topbar h1 { font-size: 20px; font-weight: 700; flex: 1; }
.admin-topbar-right { display: flex; align-items: center; gap: 12px; }
.admin-user-name { font-size: 14px; font-weight: 600; color: var(--gray-600); }
.admin-menu-toggle { display: none; background: none; border: none; font-size: 24px; color: var(--gray-700); cursor: pointer; }
.admin-content { padding: 28px; flex: 1; }

/* Admin Stats */
.admin-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.admin-stat-card {
  background: white; border-radius: var(--radius-lg); padding: 20px;
  display: flex; align-items: center; gap: 16px;
  border: 1px solid var(--gray-200); transition: box-shadow 0.2s;
}
.admin-stat-card:hover { box-shadow: var(--shadow-md); }
.admin-stat-icon { width: 52px; height: 52px; border-radius: var(--radius); display: flex; align-items: center; justify-content: center; font-size: 24px; }
.admin-stat-card.blue .admin-stat-icon { background: var(--primary-light); color: var(--primary); }
.admin-stat-card.green .admin-stat-icon { background: #dcfce7; color: #16a34a; }
.admin-stat-card.orange .admin-stat-icon { background: #fef3c7; color: #d97706; }
.admin-stat-card.red .admin-stat-icon { background: #fef2f2; color: #dc2626; }
.admin-stat-card.purple .admin-stat-icon { background: #f3e8ff; color: #9333ea; }
.admin-stat-card.teal .admin-stat-icon { background: #ccfbf1; color: #0d9488; }
.admin-stat-value { font-size: 28px; font-weight: 800; color: var(--gray-900); }
.admin-stat-label { font-size: 13px; color: var(--gray-500); margin-top: 2px; }

/* Admin Cards */
.admin-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr)); gap: 20px; }
.admin-card { background: white; border-radius: var(--radius-lg); border: 1px solid var(--gray-200); overflow: hidden; }
.admin-card-header {
  padding: 20px 24px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
}
.admin-card-header h3 { font-size: 16px; font-weight: 700; color: var(--gray-900); display: flex; align-items: center; gap: 8px; }
.admin-card-body { padding: 20px 24px; }

/* Admin Table */
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th {
  padding: 12px 16px; text-align: left; font-size: 12px; font-weight: 600;
  color: var(--gray-500); text-transform: uppercase; background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
.admin-table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
.admin-table tr:hover { background: var(--gray-50); }
.admin-cell-truncate { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Admin Badge */
.admin-badge { display: inline-block; padding: 3px 10px; border-radius: var(--radius-full); font-size: 12px; font-weight: 600; }
.admin-badge.blue { background: var(--primary-light); color: var(--primary-dark); }
.admin-badge.green { background: #dcfce7; color: #166534; }
.admin-badge.orange { background: #fef3c7; color: #92400e; }
.admin-badge.red { background: #fef2f2; color: #dc2626; }
.admin-badge.gray { background: var(--gray-100); color: var(--gray-600); }

/* Admin Actions & Links */
.admin-actions { display: flex; gap: 6px; }
.admin-link { color: var(--primary); font-weight: 500; }
.admin-link:hover { text-decoration: underline; }

/* Admin Empty & Error */
.admin-empty { text-align: center; padding: 60px 24px; color: var(--gray-400); }
.admin-empty i { font-size: 48px; display: block; margin-bottom: 12px; }
.admin-error { text-align: center; padding: 60px 24px; color: var(--gray-500); }
.admin-error i { font-size: 48px; color: var(--danger); display: block; margin-bottom: 12px; }
.admin-error-detail { font-size: 13px; color: var(--gray-400); margin: 8px 0 16px; }

/* Admin Chart */
.admin-chart-bars { display: flex; flex-direction: column; gap: 16px; }
.admin-chart-bar-row { display: flex; align-items: center; gap: 12px; }
.admin-chart-label { width: 60px; font-size: 13px; font-weight: 600; color: var(--gray-600); text-align: right; display: flex; align-items: center; justify-content: flex-end; gap: 4px; }
.admin-chart-bar-track { flex: 1; height: 28px; background: var(--gray-100); border-radius: var(--radius-full); overflow: hidden; }
.admin-chart-bar-fill { height: 100%; border-radius: var(--radius-full); transition: width 0.6s ease; min-width: 4px; }
.admin-chart-value { width: 90px; font-size: 13px; color: var(--gray-500); font-weight: 500; }
.admin-chart-total { text-align: right; font-size: 12px; color: var(--gray-400); margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--gray-100); }

/* Admin Type Chart */
.admin-type-list { display: flex; flex-direction: column; gap: 12px; }
.admin-type-item { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.admin-type-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.admin-type-name { flex: 1; font-weight: 500; color: var(--gray-700); }
.admin-type-count { font-weight: 700; color: var(--gray-800); }
.admin-type-pct { font-size: 12px; color: var(--gray-400); width: 36px; text-align: right; }

/* Admin Stat Change */
.admin-stat-change { font-size: 11px; font-weight: 600; margin-top: 4px; padding: 2px 8px; border-radius: var(--radius-full); display: inline-block; }
.admin-stat-change.up { background: #dcfce7; color: #166534; }
.admin-stat-change.warn { background: #fef3c7; color: #92400e; }

/* Admin Compact List */
.admin-compact-list { }
.admin-compact-item {
  display: flex; align-items: center; gap: 12px; padding: 12px 20px;
  border-bottom: 1px solid var(--gray-100); transition: background 0.15s;
}
.admin-compact-item:last-child { border-bottom: none; }
.admin-compact-item:hover { background: var(--gray-50); }
.admin-compact-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; flex-shrink: 0;
}
.admin-compact-icon {
  width: 36px; height: 36px; border-radius: var(--radius);
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.admin-compact-info { flex: 1; min-width: 0; }
.admin-compact-name { font-size: 14px; font-weight: 600; color: var(--gray-800); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-compact-sub { font-size: 12px; color: var(--gray-400); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-compact-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.admin-compact-date { font-size: 11px; color: var(--gray-400); }

/* Admin Quick Actions */
.admin-quick-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.admin-quick-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 24px; border-radius: var(--radius-lg);
  background: var(--gray-50); border: 1px solid var(--gray-200);
  font-size: 14px; font-weight: 600; color: var(--gray-700);
  cursor: pointer; transition: all 0.2s; position: relative;
}
.admin-quick-btn:hover { background: var(--primary-50); color: var(--primary); border-color: var(--primary-light); }
.admin-quick-btn i { font-size: 20px; }
.admin-quick-badge {
  background: var(--primary); color: white;
  font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 6px;
}
.admin-quick-badge.red { background: var(--danger); }

/* Admin Filter Row */
.admin-filter-row { display: flex; gap: 8px; align-items: center; }
.admin-filter-select {
  padding: 6px 30px 6px 10px; border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm); font-size: 13px; color: var(--gray-700);
  background: white url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none; cursor: pointer;
}

/* Admin Pagination */
.admin-pagination {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; padding: 20px;
}
.admin-page-btn {
  min-width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--gray-200); background: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 500; color: var(--gray-600);
  cursor: pointer; transition: all 0.15s; padding: 0 8px;
}
.admin-page-btn:hover { border-color: var(--primary); color: var(--primary); }
.admin-page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }
.admin-page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.admin-page-dots { font-size: 13px; color: var(--gray-400); padding: 0 4px; }

/* Admin Agent Cards */
.admin-agent-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 16px; padding: 20px; }
.admin-agent-card {
  background: white; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 20px; transition: box-shadow 0.2s;
}
.admin-agent-card:hover { box-shadow: var(--shadow-md); }
.admin-agent-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--gray-100); }
.admin-agent-avatar {
  width: 48px; height: 48px; border-radius: 50%;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white; display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; flex-shrink: 0;
}
.admin-agent-info { flex: 1; }
.admin-agent-name { font-size: 16px; font-weight: 700; color: var(--gray-900); }
.admin-agent-email { font-size: 13px; color: var(--gray-500); }
.admin-agent-details { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.admin-agent-detail { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gray-600); }
.admin-agent-detail i { font-size: 16px; color: var(--gray-400); width: 18px; }
.admin-agent-actions { display: flex; gap: 8px; }
.admin-agent-actions .btn { flex: 1; }

/* Admin Banner Grid */
.admin-banner-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; padding: 20px; }
.admin-banner-card { border: 1px solid var(--gray-200); border-radius: var(--radius-lg); overflow: hidden; transition: box-shadow 0.2s; }
.admin-banner-card:hover { box-shadow: var(--shadow-md); }
.admin-banner-preview { height: 160px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--gray-100); }
.admin-banner-preview img { width: 100%; height: 100%; object-fit: cover; }
.admin-banner-info { padding: 16px; }
.admin-banner-info h4 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--gray-800); }
.admin-banner-info p { font-size: 12px; color: var(--gray-500); display: flex; align-items: center; gap: 4px; margin-bottom: 2px; }

/* Admin Responsive */
@media (max-width: 1024px) { .admin-grid-2 { grid-template-columns: 1fr; } }
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); transition: transform 0.3s ease; }
  .admin-sidebar.open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .admin-menu-toggle { display: block; }
  .admin-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .admin-content { padding: 16px; }
  .admin-quick-actions { flex-direction: column; }
  .admin-quick-btn { flex: 1; }
  .admin-agent-cards { grid-template-columns: 1fr; }
  .admin-filter-row { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .admin-stats-grid { grid-template-columns: 1fr; }
  .admin-compact-item { padding: 10px 14px; }
}

/* ===== Call UI ===== */
.call-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.3s ease;
}
.call-overlay.hidden { display: none; }

.call-container {
  width: 100%; max-width: 420px; padding: 60px 32px 40px;
  display: flex; flex-direction: column; align-items: center;
  text-align: center; color: #fff; position: relative;
}
.call-container.call-video-mode {
  max-width: 100%; height: 100%; padding: 0;
}

.call-remote-video {
  width: 100%; height: 100%; object-fit: cover;
  position: absolute; inset: 0;
}
.call-local-video {
  position: absolute; bottom: 120px; right: 24px;
  width: 140px; height: 190px; object-fit: cover;
  border-radius: 12px; border: 2px solid rgba(255,255,255,0.3);
  z-index: 2;
}

.call-info {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
}
.call-video-mode .call-info {
  position: absolute; top: 40px; left: 50%; transform: translateX(-50%);
}

.call-avatar {
  width: 96px; height: 96px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  display: flex; align-items: center; justify-content: center;
  font-size: 40px; font-weight: 700; color: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,0.15);
}
.call-name { font-size: 24px; font-weight: 700; }
.call-status { font-size: 15px; color: rgba(255,255,255,0.7); }

.call-pulse {
  width: 120px; height: 120px; border-radius: 50%;
  position: absolute; top: -12px;
  border: 2px solid rgba(255,255,255,0.3);
  animation: callPulse 1.5s ease-out infinite;
}
@keyframes callPulse {
  0% { transform: scale(1); opacity: 0.5; }
  100% { transform: scale(1.8); opacity: 0; }
}

.call-actions {
  position: relative; z-index: 2;
  display: flex; gap: 20px; margin-top: 60px;
}
.call-video-mode .call-actions {
  position: absolute; bottom: 40px; left: 50%; transform: translateX(-50%);
}

.call-btn {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: rgba(255,255,255,0.15); border: none; color: #fff;
  width: 64px; height: 64px; border-radius: 50%; cursor: pointer;
  font-size: 24px; transition: background 0.2s;
  justify-content: center;
}
.call-btn span { font-size: 11px; position: absolute; bottom: -20px; white-space: nowrap; }
.call-btn { position: relative; }
.call-btn:hover { background: rgba(255,255,255,0.25); }

.call-btn-accept { background: #22c55e; }
.call-btn-accept:hover { background: #16a34a; }
.call-btn-reject { background: #ef4444; }
.call-btn-reject:hover { background: #dc2626; }
.call-btn-active { background: rgba(255,255,255,0.35); }

/* Agent call buttons in detail page */
.agent-call-btns {
  display: flex; gap: 8px;
}
.agent-call-btns .btn-call {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 0; font-size: 14px; font-weight: 600; border-radius: 8px;
  border: none; cursor: pointer; color: #fff; transition: opacity 0.2s;
}
.agent-call-btns .btn-call:hover { opacity: 0.85; }
.btn-success { background: #22c55e; color: #fff; }
.btn-info { background: var(--primary); color: #fff; }

/* ===== Nav Badge (Chat Unread) ===== */
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: var(--radius-full);
  background: var(--danger); color: white;
  font-size: 11px; font-weight: 700;
  margin-left: 4px; line-height: 1;
}
.nav-badge.hidden { display: none; }

/* ===== Contract Page ===== */
.contract-page {
  max-width: 960px; margin: 0 auto; padding: 32px 24px;
}
.contract-page > h2 {
  font-size: 24px; font-weight: 800; color: var(--gray-900);
  display: flex; align-items: center; gap: 10px; margin-bottom: 24px;
}
.contract-page > h2 i { color: var(--primary); font-size: 28px; }

.contract-tabs {
  display: flex; gap: 8px; margin-bottom: 24px; flex-wrap: wrap;
}

.contract-filter {
  margin-bottom: 16px;
}
.contract-filter select {
  padding: 8px 14px; border: 1px solid var(--gray-300);
  border-radius: var(--radius); font-size: 14px; color: var(--gray-700);
  background: white; min-width: 160px;
}

.contract-list {
  display: flex; flex-direction: column; gap: 16px;
}

.contract-card {
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200); overflow: hidden;
  transition: box-shadow 0.2s;
}
.contract-card:hover { box-shadow: var(--shadow-md); }

.contract-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--gray-100);
  background: var(--gray-50);
}
.contract-card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; color: var(--gray-900);
}
.contract-card-title i { color: var(--primary); }

.contract-status-badge {
  display: inline-block; padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.contract-status-badge.gray { background: var(--gray-100); color: var(--gray-600); }
.contract-status-badge.orange { background: #fef3c7; color: #92400e; }
.contract-status-badge.blue { background: var(--primary-light); color: var(--primary-dark); }
.contract-status-badge.green { background: #dcfce7; color: #166534; }
.contract-status-badge.red { background: #fef2f2; color: #dc2626; }

.contract-card-body {
  padding: 16px 20px; display: flex; flex-direction: column; gap: 8px;
}
.contract-info-row {
  display: flex; align-items: center; gap: 12px; font-size: 14px;
}
.contract-info-label {
  min-width: 72px; color: var(--gray-500); font-weight: 500; flex-shrink: 0;
}
.contract-info-value {
  color: var(--gray-800); font-weight: 500;
}
.contract-info-value.contract-price {
  font-weight: 700; color: var(--primary);
}

.contract-card-actions {
  display: flex; gap: 8px; padding: 12px 20px;
  border-top: 1px solid var(--gray-100); flex-wrap: wrap;
}

.btn-danger-outline {
  background: white; color: var(--danger);
  border: 1px solid var(--danger); border-radius: var(--radius);
  padding: 6px 14px; font-size: 13px; font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
  transition: all 0.2s; cursor: pointer;
}
.btn-danger-outline:hover {
  background: #fef2f2;
}

/* Contract Create Form */
.contract-form-wrap {
  background: white; border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200); padding: 32px;
}
.contract-form-title {
  font-size: 18px; font-weight: 700; color: var(--gray-900);
  display: flex; align-items: center; gap: 8px; margin-bottom: 24px;
}
.contract-form-title i { color: var(--primary); }

.contract-form .form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
.contract-form .form-group {
  margin-bottom: 16px;
}
.contract-form .required {
  color: var(--danger); font-weight: 600;
}

/* Contract Detail Modal */
.contract-detail-modal {
  padding: 0 24px 24px;
}
.contract-detail-status {
  text-align: center; padding: 16px 0 20px;
}
.contract-detail-section {
  margin-bottom: 20px;
}
.contract-detail-section h4 {
  font-size: 15px; font-weight: 700; color: var(--gray-800);
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--gray-100);
}
.contract-detail-section h4 i { color: var(--primary); }
.contract-detail-grid {
  display: flex; flex-direction: column; gap: 8px;
}
.contract-detail-item {
  display: flex; gap: 12px; font-size: 14px;
}
.contract-detail-item .label {
  min-width: 80px; color: var(--gray-500); font-weight: 500; flex-shrink: 0;
}
.contract-detail-item .value {
  color: var(--gray-800); font-weight: 500;
}
.contract-special-terms {
  font-size: 14px; color: var(--gray-700); line-height: 1.8;
  background: var(--gray-50); padding: 16px;
  border-radius: var(--radius); white-space: pre-wrap;
}
.contract-detail-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  padding-top: 16px; border-top: 1px solid var(--gray-100);
}

/* Contract Responsive */
@media (max-width: 768px) {
  .contract-page { padding: 24px 16px; }
  .contract-form-wrap { padding: 24px 16px; }
  .contract-form .form-row { grid-template-columns: 1fr; }
  .contract-card-actions { flex-direction: column; }
  .contract-card-actions .btn { width: 100%; justify-content: center; }
}

/* ===== Chat Page ===== */
.chat-page {
  display: flex;
  height: calc(100vh - var(--nav-height) - 40px);
  background: white;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  margin: 20px auto;
  max-width: 1200px;
}

.chat-sidebar {
  width: 340px;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.chat-sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--gray-200);
}
.chat-sidebar-header h3 { font-size: 18px; font-weight: 700; }

.chat-room-list {
  flex: 1;
  overflow-y: auto;
}

.chat-room-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--gray-100);
}
.chat-room-item:hover { background: var(--gray-50); }
.chat-room-item.active { background: var(--primary-light); }

.chat-room-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  flex-shrink: 0;
}

.chat-room-info { flex: 1; min-width: 0; }
.chat-room-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-room-last-msg {
  font-size: 13px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.chat-room-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
}
.chat-room-time { font-size: 11px; color: var(--gray-400); }
.chat-room-badge {
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  min-width: 20px;
  text-align: center;
}

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

.chat-main-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.chat-main-header h4 { font-size: 16px; font-weight: 600; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-date-separator {
  text-align: center;
  color: var(--gray-400);
  font-size: 12px;
  padding: 12px 0;
}

.chat-bubble-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.chat-bubble-wrap.mine { flex-direction: row-reverse; }

.chat-bubble {
  max-width: 70%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
}
.chat-bubble.mine {
  background: var(--primary);
  color: white;
  border-bottom-right-radius: 4px;
}
.chat-bubble.theirs {
  background: var(--gray-100);
  color: var(--gray-800);
  border-bottom-left-radius: 4px;
}

.chat-bubble-time {
  font-size: 11px;
  color: var(--gray-400);
  white-space: nowrap;
  flex-shrink: 0;
}

.chat-input-area {
  padding: 16px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input-area textarea {
  flex: 1;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
  outline: none;
}
.chat-input-area textarea:focus { border-color: var(--primary); }
.chat-input-area button {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.chat-input-area button:hover { background: var(--primary-dark); }

.chat-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--gray-400);
}

.chat-typing { font-size: 12px; color: var(--primary); padding: 4px 20px; }

/* ===== Tools Page ===== */
.tools-page {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}
.tools-page h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
}

.tools-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--gray-200);
  padding-bottom: 0;
}
.tools-tab {
  padding: 10px 20px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-500);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
}
.tools-tab:hover { color: var(--gray-800); }
.tools-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.calc-result {
  background: var(--primary-50);
  border: 1px solid var(--primary-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 20px;
}
.calc-result h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 16px;
}
.calc-result-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--primary-light);
  font-size: 14px;
}
.calc-result-item:last-child { border: none; }
.calc-result-item .label { color: var(--gray-600); }
.calc-result-item .value { font-weight: 700; color: var(--gray-800); }

.loan-schedule {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
.loan-schedule table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.loan-schedule th {
  background: var(--gray-100);
  padding: 10px;
  text-align: right;
  font-weight: 600;
  position: sticky;
  top: 0;
}
.loan-schedule td {
  padding: 8px 10px;
  text-align: right;
  border-bottom: 1px solid var(--gray-100);
}

/* ===== Agent Profile Page ===== */
.agent-profile-page {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

.agent-profile-header {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  background: white;
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
}

.agent-profile-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  flex-shrink: 0;
}

.agent-profile-info h2 {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.agent-profile-stars {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 8px 0;
}
.agent-profile-stars i { color: var(--accent); font-size: 18px; }
.agent-profile-stars span { font-size: 14px; color: var(--gray-500); margin-left: 8px; }

.agent-profile-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
}
.agent-profile-section h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.agent-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.agent-tag {
  background: var(--primary-50);
  color: var(--primary);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 500;
}
.agent-area-tag {
  background: var(--gray-100);
  color: var(--gray-700);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 13px;
}

.review-item {
  padding: 16px 0;
  border-bottom: 1px solid var(--gray-100);
}
.review-item:last-child { border: none; }
.review-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.review-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  color: var(--gray-600);
}
.review-name { font-weight: 600; font-size: 14px; }
.review-stars i { color: var(--accent); font-size: 14px; }
.review-time { font-size: 12px; color: var(--gray-400); margin-left: auto; }
.review-content { font-size: 14px; color: var(--gray-700); line-height: 1.6; }

.star-picker {
  display: flex;
  gap: 6px;
  margin: 12px 0;
}
.star-picker i {
  font-size: 28px;
  color: var(--gray-300);
  cursor: pointer;
  transition: color 0.15s;
}
.star-picker i.active { color: var(--accent); }
.star-picker i:hover { color: var(--accent); }

/* ===== Facilities ===== */
.detail-facilities, .detail-streetview {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-top: 20px;
}
.detail-facilities h3, .detail-streetview h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 16px;
}

.facility-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.facility-tab {
  padding: 6px 14px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-full);
  background: white;
  font-size: 13px;
  color: var(--gray-600);
  transition: all 0.15s;
}
.facility-tab:hover { border-color: var(--primary); color: var(--primary); }
.facility-tab.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.facility-list { max-height: 300px; overflow-y: auto; }
.facility-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.facility-item i {
  font-size: 18px;
  color: var(--primary);
  width: 28px;
  text-align: center;
}
.facility-info {
  flex: 1;
  display: flex;
  justify-content: space-between;
}
.facility-name { font-size: 14px; color: var(--gray-700); }
.facility-distance { font-size: 13px; color: var(--gray-500); }

.streetview-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.share-section {
  margin-bottom: 16px;
}

/* ===== Nav Badge ===== */
.nav-badge {
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: var(--radius-full);
  min-width: 18px;
  text-align: center;
  display: inline-block;
  vertical-align: top;
  margin-left: 4px;
}
.nav-badge.hidden { display: none; }

/* ===== Responsive: Chat ===== */
@media (max-width: 768px) {
  .chat-page { flex-direction: column; height: calc(100vh - var(--nav-height)); margin: 0; border-radius: 0; }
  .chat-sidebar { width: 100%; max-height: 50%; }
  .chat-sidebar.hidden { display: none; }
  .chat-main.full-height { height: 100%; }
  .agent-profile-header { flex-direction: column; align-items: center; text-align: center; }
  .tools-tabs { overflow-x: auto; }
  .facility-tabs { overflow-x: auto; flex-wrap: nowrap; }
}

/* ===== Blog Styles ===== */

/* Hero - 컴팩트하게 */
.blog-hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius-xl);
  padding: 32px 28px;
  margin-bottom: 20px;
  text-align: center;
  color: #fff;
}
.blog-hero h1 { font-size: 26px; font-weight: 800; margin-bottom: 6px; }
.blog-hero h1 i { margin-right: 6px; }
.blog-hero p { font-size: 14px; opacity: 0.9; margin-bottom: 16px; }
.blog-search {
  max-width: 460px; margin: 0 auto; position: relative;
}
.blog-search i {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 17px; color: var(--gray-400);
}
.blog-search input {
  width: 100%; padding: 11px 14px 11px 40px;
  border: none; border-radius: var(--radius-full);
  font-size: 14px; font-family: var(--font);
  box-shadow: var(--shadow-lg); outline: none;
}
.blog-search input:focus { box-shadow: var(--shadow-xl), 0 0 0 3px rgba(255,255,255,0.3); }

/* Categories */
.blog-categories {
  display: flex; gap: 6px; margin-bottom: 16px;
  overflow-x: auto; padding-bottom: 4px;
  scrollbar-width: none;
}
.blog-categories::-webkit-scrollbar { display: none; }
.blog-cat-tab {
  padding: 6px 14px; border: 1px solid var(--gray-200);
  border-radius: var(--radius-full); background: #fff;
  font-size: 13px; font-family: var(--font); cursor: pointer;
  white-space: nowrap; transition: all 0.2s;
  color: var(--gray-600);
}
.blog-cat-tab:hover { border-color: var(--primary); color: var(--primary); }
.blog-cat-tab.active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* Tag Cloud */
.blog-tag-cloud { margin-bottom: 16px; }
.tag-cloud-inner { display: flex; gap: 6px; flex-wrap: wrap; }
.blog-tag {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 4px 10px; background: var(--primary-50);
  color: var(--primary); border: none; border-radius: var(--radius-full);
  font-size: 12px; cursor: pointer; font-family: var(--font);
  transition: all 0.2s;
}
.blog-tag span { font-size: 10px; opacity: 0.7; }
.blog-tag:hover { background: var(--primary-light); }

/* Featured Section - 균일한 3열 카드 */
.blog-featured-section { margin-bottom: 24px; }
.blog-section-title {
  font-size: 17px; font-weight: 700; margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px; color: var(--gray-800);
}
.blog-featured-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}
.blog-featured-card {
  background: #fff; border-radius: var(--radius-lg);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: all 0.3s;
}
.blog-featured-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.blog-featured-card.large { grid-row: auto; position: static; }
.blog-featured-card.large .blog-featured-thumb { height: 140px; min-height: auto; }
.blog-featured-card.large .blog-featured-info {
  position: static; background: none; padding: 12px; color: inherit;
}
.blog-featured-card.large .blog-featured-info h3 { font-size: 14px; color: var(--gray-900); }
.blog-featured-card.large .blog-featured-info p { color: var(--gray-500); }
.blog-featured-thumb {
  height: 140px; overflow: hidden; position: relative;
}
.blog-featured-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.blog-featured-card:hover .blog-featured-thumb img { transform: scale(1.05); }
.blog-featured-cat {
  position: absolute; top: 8px; left: 8px;
  background: var(--primary); color: #fff;
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
}
.blog-featured-info { padding: 12px; }
.blog-featured-info h3 {
  font-size: 14px; font-weight: 700; margin-bottom: 4px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.blog-featured-info p {
  font-size: 12px; color: var(--gray-500); margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.blog-meta { display: flex; gap: 10px; font-size: 11px; color: var(--gray-400); }
.blog-meta i { margin-right: 2px; }

/* Posts Grid - 균일한 3열 */
.blog-posts-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
  margin-bottom: 28px;
}
.blog-card {
  background: #fff; border-radius: var(--radius-lg);
  overflow: hidden; cursor: pointer; box-shadow: var(--shadow-sm);
  transition: all 0.3s;
}
.blog-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.blog-card-thumb {
  height: 160px; overflow: hidden; position: relative;
}
.blog-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s; }
.blog-card:hover .blog-card-thumb img { transform: scale(1.05); }
.blog-thumb-placeholder {
  width: 100%; height: 100%; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  background: var(--gray-100); color: var(--gray-400);
}
.blog-thumb-placeholder i { font-size: 28px; }
.blog-card-cat {
  position: absolute; top: 8px; left: 8px;
  background: var(--primary); color: #fff;
  padding: 2px 8px; border-radius: var(--radius-full);
  font-size: 11px; font-weight: 600;
}
.blog-card-body { padding: 12px; }
.blog-card-title {
  font-size: 14px; font-weight: 700; margin-bottom: 5px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.4;
}
.blog-card-excerpt {
  font-size: 12px; color: var(--gray-500); margin-bottom: 8px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  line-height: 1.5;
}
.blog-card-footer {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--gray-400); margin-bottom: 4px;
}
.blog-card-author i { margin-right: 3px; }
.blog-card-stats {
  display: flex; gap: 8px; font-size: 11px; color: var(--gray-400);
}
.blog-card-stats i { margin-right: 2px; }
.blog-card.small .blog-card-thumb { height: 120px; }
.blog-card.small .blog-card-title { font-size: 13px; }

/* Pagination */
.blog-pagination { display: flex; justify-content: center; margin-bottom: 28px; }
.blog-pagination-inner { display: flex; gap: 4px; align-items: center; }
.blog-page-btn {
  width: 34px; height: 34px; border: 1px solid var(--gray-200);
  border-radius: var(--radius); background: #fff; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 500;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; color: var(--gray-600);
}
.blog-page-btn:hover { border-color: var(--primary); color: var(--primary); }
.blog-page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.blog-page-dots { padding: 0 6px; color: var(--gray-400); }

/* Write FAB */
.blog-write-fab {
  position: fixed; bottom: 24px; right: 24px;
  width: 48px; height: 48px; border: none;
  background: var(--primary); color: #fff;
  border-radius: 50%; font-size: 20px;
  cursor: pointer; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s; z-index: 90;
}
.blog-write-fab:hover { background: var(--primary-dark); transform: scale(1.1); }

/* Blog Detail */
.blog-detail-page { max-width: 760px; margin: 0 auto; }
.blog-detail-hero {
  border-radius: var(--radius-xl); overflow: hidden; margin-bottom: 24px;
  max-height: 360px;
}
.blog-detail-hero img { width: 100%; height: 100%; object-fit: cover; }
.blog-detail-article {
  background: #fff; border-radius: var(--radius-lg);
  padding: 32px; margin-bottom: 24px; box-shadow: var(--shadow-sm);
}
.blog-detail-title {
  font-size: 26px; font-weight: 800; line-height: 1.35;
  margin-bottom: 16px; color: var(--gray-900);
}
.blog-detail-meta {
  display: flex; justify-content: space-between; align-items: center;
  padding-bottom: 16px; border-bottom: 1px solid var(--gray-200);
  margin-bottom: 24px;
}
.blog-detail-author {
  display: flex; align-items: center; gap: 10px;
}
.blog-author-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--primary-light); color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700;
}
.blog-detail-author strong { display: block; font-size: 14px; }
.blog-detail-author span { font-size: 12px; color: var(--gray-400); }
.blog-detail-stats {
  display: flex; gap: 14px; font-size: 13px; color: var(--gray-400);
}
.blog-detail-stats i { margin-right: 3px; }
.blog-detail-body {
  font-size: 15px; line-height: 1.8; color: var(--gray-700);
  word-break: break-word;
}
.blog-detail-body h2 { font-size: 21px; font-weight: 700; margin: 28px 0 12px; color: var(--gray-900); }
.blog-detail-body h3 { font-size: 18px; font-weight: 700; margin: 22px 0 10px; color: var(--gray-800); }
.blog-detail-body p { margin-bottom: 14px; }
.blog-detail-body img { max-width: 100%; border-radius: var(--radius); margin: 14px 0; }
.blog-detail-body blockquote {
  border-left: 4px solid var(--primary); padding: 14px 18px;
  background: var(--gray-50); border-radius: 0 var(--radius) var(--radius) 0;
  margin: 14px 0; color: var(--gray-600); font-style: italic;
}
.blog-detail-body ul, .blog-detail-body ol { margin: 14px 0; padding-left: 24px; }
.blog-detail-body li { margin-bottom: 6px; }
.blog-detail-tags {
  display: flex; gap: 6px; flex-wrap: wrap; margin-top: 24px;
  padding-top: 16px; border-top: 1px solid var(--gray-200);
}
.blog-detail-actions {
  display: flex; gap: 8px; margin-top: 18px;
  padding-top: 16px; border-top: 1px solid var(--gray-200);
}
.blog-detail-actions .btn.danger { color: var(--danger); border-color: var(--danger); }
.blog-detail-actions .btn.danger:hover { background: var(--danger); color: #fff; }

/* Comments */
.blog-comments-section {
  background: #fff; border-radius: var(--radius-lg);
  padding: 24px; margin-bottom: 24px; box-shadow: var(--shadow-sm);
}
.blog-comments-section h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 16px;
  display: flex; align-items: center; gap: 6px;
}
.blog-comment-form {
  display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px;
}
.blog-comment-form .btn { align-self: flex-end; }
.blog-comment {
  display: flex; gap: 10px; padding: 12px 0;
  border-bottom: 1px solid var(--gray-100);
}
.blog-comment:last-child { border-bottom: none; }
.blog-comment-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--gray-200); color: var(--gray-600);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}
.blog-comment-body { flex: 1; }
.blog-comment-header {
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
}
.blog-comment-header strong { font-size: 13px; }
.blog-comment-header span { font-size: 11px; color: var(--gray-400); }
.blog-comment-del {
  background: none; border: none; color: var(--gray-400);
  cursor: pointer; margin-left: auto; font-size: 13px;
}
.blog-comment-del:hover { color: var(--danger); }
.blog-comment-body p { font-size: 13px; line-height: 1.6; color: var(--gray-700); }

/* Related */
.blog-related-section { margin-bottom: 32px; }
.blog-related-section h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 12px;
  display: flex; align-items: center; gap: 6px;
}
.blog-related-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
}

/* Editor Form */
.blog-editor-form .form-row { display: flex; gap: 12px; }
.blog-thumbnail-preview {
  width: 100%; height: 180px; border: 2px dashed var(--gray-300);
  border-radius: var(--radius-lg); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
  cursor: pointer; color: var(--gray-400); transition: all 0.2s;
  overflow: hidden;
}
.blog-thumbnail-preview:hover { border-color: var(--primary); color: var(--primary); }
.blog-thumbnail-preview i { font-size: 32px; }
.blog-thumbnail-preview img { width: 100%; height: 100%; object-fit: cover; }

/* Responsive */
@media (max-width: 1024px) {
  .blog-posts-grid { grid-template-columns: repeat(2, 1fr); }
  .blog-featured-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .blog-hero { padding: 24px 16px; }
  .blog-hero h1 { font-size: 20px; }
  .blog-hero p { font-size: 13px; }
  .blog-posts-grid { grid-template-columns: 1fr; gap: 12px; }
  .blog-featured-grid { grid-template-columns: 1fr; }
  .blog-card-thumb { height: 150px; }
  .blog-detail-article { padding: 20px; }
  .blog-detail-title { font-size: 22px; }
  .blog-detail-meta { flex-direction: column; gap: 10px; align-items: flex-start; }
  .blog-related-grid { grid-template-columns: 1fr; }
  .blog-editor-form .form-row { flex-direction: column; gap: 0; }
  .blog-write-fab { bottom: 16px; right: 16px; width: 42px; height: 42px; font-size: 18px; }
  .blog-comments-section { padding: 18px; }
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
  --primary: #3b82f6;
  --primary-dark: #2563eb;
  --primary-light: #1e3a5f;
  --primary-50: #0f1729;
  --secondary: #e2e8f0;

  --gray-50: #0f172a;
  --gray-100: #1e293b;
  --gray-200: #334155;
  --gray-300: #475569;
  --gray-400: #64748b;
  --gray-500: #94a3b8;
  --gray-600: #cbd5e1;
  --gray-700: #e2e8f0;
  --gray-800: #f1f5f9;
  --gray-900: #f8fafc;

  color-scheme: dark;
}
[data-theme="dark"] body { background: #0f172a; color: #e2e8f0; }
[data-theme="dark"] .navbar { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .nav-logo span { color: #e2e8f0; }
[data-theme="dark"] .nav-link { color: #94a3b8; }
[data-theme="dark"] .nav-link:hover, [data-theme="dark"] .nav-link.active { color: #3b82f6; }
[data-theme="dark"] .card, [data-theme="dark"] .property-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .property-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,0.4); }
[data-theme="dark"] .property-title { color: #f1f5f9; }
[data-theme="dark"] .property-address { color: #94a3b8; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #1e293b; color: #e2e8f0; border-color: #334155; }
[data-theme="dark"] input:focus, [data-theme="dark"] select:focus { border-color: #3b82f6; }
[data-theme="dark"] .modal-content { background: #1e293b; }
[data-theme="dark"] .modal-overlay { background: rgba(0,0,0,0.7); }
[data-theme="dark"] .filter-bar, [data-theme="dark"] .search-bar { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .tab-btn { color: #94a3b8; border-color: #334155; }
[data-theme="dark"] .tab-btn.active { color: #3b82f6; border-color: #3b82f6; }
[data-theme="dark"] .badge { background: #334155; color: #e2e8f0; }
[data-theme="dark"] .stat-card { background: #1e293b; }
[data-theme="dark"] .sidebar, [data-theme="dark"] .map-sidebar { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .empty-state { color: #64748b; }
[data-theme="dark"] .toast { background: #334155; color: #e2e8f0; }
[data-theme="dark"] .header-section { background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%); }
[data-theme="dark"] .nav-mobile-menu { background: #1e293b; }
[data-theme="dark"] .map-controls { background: #1e293b; }
[data-theme="dark"] .map-search-bar { background: #0f172a; border-color: #334155; }
[data-theme="dark"] .detail-info-table td { border-color: #334155; }
[data-theme="dark"] .admin-sidebar { background: #1e293b; }
[data-theme="dark"] .tool-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] .blog-card { background: #1e293b; border-color: #334155; }
[data-theme="dark"] hr { border-color: #334155; }
[data-theme="dark"] .price-tag { background: #1e3a5f; }

.dark-toggle { background: none; border: none; color: var(--gray-500); cursor: pointer; font-size: 20px; padding: 6px; border-radius: 50%; transition: all 0.2s; }
.dark-toggle:hover { color: var(--primary); background: var(--gray-100); }
[data-theme="dark"] .dark-toggle { color: #f59e0b; }
[data-theme="dark"] .dark-toggle:hover { background: #334155; }

/* ===== Moving Checklist ===== */
.checklist-phase { margin-bottom: 20px; }
.checklist-phase-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--primary-50); border-radius: var(--radius); cursor: pointer; margin-bottom: 8px; font-weight: 600; }
.checklist-phase-header .phase-count { font-size: 13px; color: var(--gray-500); font-weight: 400; }
.checklist-item { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--gray-100); }
.checklist-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.checklist-item.checked label { text-decoration: line-through; color: var(--gray-400); }
.checklist-progress { height: 8px; background: var(--gray-200); border-radius: var(--radius-full); overflow: hidden; margin-bottom: 20px; }
.checklist-progress-bar { height: 100%; background: var(--success); border-radius: var(--radius-full); transition: width 0.3s; }
.checklist-stats { display: flex; justify-content: space-between; margin-bottom: 12px; font-size: 14px; color: var(--gray-600); }

/* ===== QR Modal ===== */
.qr-modal-content { text-align: center; padding: 30px; }
.qr-modal-content canvas { margin: 20px auto; display: block; }
.qr-download-btn { margin-top: 12px; }

/* ============================================
   Enhanced Responsive Design
   PC (1200+) → Tablet (768-1199) → Mobile (480-767) → Small (≤479)
   ============================================ */

/* === PC / Large Desktop (1200px+) === */
@media (min-width: 1200px) {
  .hero h1 { font-size: 44px; }
  .hero p { font-size: 20px; }
  .property-grid { grid-template-columns: repeat(4, 1fr); }
  .search-box { max-width: 680px; }
  .tools-page, .blog-page { max-width: 900px; }
  .map-body { height: calc(100vh - var(--nav-height) - 60px); }
  .map-sidebar { width: 380px; }
}

/* === Tablet (769px ~ 1199px) === */
@media (max-width: 1199px) and (min-width: 769px) {
  .hero h1 { font-size: 34px; }
  .hero p { font-size: 16px; }
  .property-grid { grid-template-columns: repeat(3, 1fr); }
  .nav-container { padding: 0 16px; }

  /* 지도 페이지 - 태블릿 최적화 */
  .map-body { flex-direction: column; }
  .map-area { height: 50vh; }
  .map-sidebar { width: 100%; height: auto; max-height: 45vh; overflow-y: auto; }
  .map-property-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; padding: 12px; }

  /* 매물 상세 - 태블릿 */
  .detail-content { padding: 20px; }
  .detail-grid { grid-template-columns: 1fr 320px; gap: 20px; }
  .detail-gallery { height: 350px; }

  /* 관리자 */
  .admin-layout { flex-direction: row; }
  .admin-sidebar { width: 220px; }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* 채팅 */
  .chat-layout { flex-direction: row; }
  .chat-sidebar { width: 280px; }

  /* 도구 페이지 */
  .tools-page { padding: 30px 20px; }
  .tools-tabs { flex-wrap: nowrap; overflow-x: auto; }

  /* 블로그 */
  .blog-grid { grid-template-columns: repeat(2, 1fr); }
}

/* === Mobile (481px ~ 768px) === */
@media (max-width: 768px) {
  /* 기본 레이아웃 */
  body { font-size: 14px; }
  .main-content { padding-top: 56px; }

  /* 네비게이션 */
  .navbar { height: 56px; }
  .nav-logo span { font-size: 18px; }
  .dark-toggle { font-size: 18px; padding: 4px; }

  /* 히어로 섹션 */
  .hero { padding: 40px 16px 32px; }
  .hero h1 { font-size: 26px; letter-spacing: -0.3px; }
  .hero p { font-size: 14px; margin-bottom: 24px; }

  /* 검색 */
  .search-box { flex-direction: column; border-radius: var(--radius); }
  .search-box input { padding: 12px 16px; font-size: 15px; }
  .search-box button { width: 100%; padding: 12px; border-radius: var(--radius-sm); }

  /* 매물 그리드 */
  .property-grid { grid-template-columns: 1fr; gap: 16px; padding: 0 16px; }
  .property-card { border-radius: var(--radius); }
  .property-card-image { height: 180px; }
  .property-card-body { padding: 14px; }
  .property-title { font-size: 15px; }
  .property-price { font-size: 17px; }
  .property-meta { font-size: 12px; }

  /* 필터 바 */
  .filter-bar { padding: 12px 16px; gap: 8px; flex-wrap: wrap; }
  .filter-bar select, .filter-bar input { font-size: 13px; padding: 8px 10px; }

  /* 탭 */
  .deal-tabs, .tools-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; gap: 2px; }
  .deal-tab, .tools-tab { flex: none; padding: 8px 16px; font-size: 13px; white-space: nowrap; }

  /* 지도 페이지 */
  .map-page-wrap { height: calc(100vh - 56px); }
  .map-controls { padding: 8px 12px; }
  .map-search-bar input { font-size: 14px; }
  .map-filters { gap: 6px; }
  .map-filters select { font-size: 12px; padding: 6px 8px; }
  .map-body { flex-direction: column; }
  .map-area { height: 55vh; min-height: 300px; }
  .map-sidebar { width: 100%; height: auto; max-height: 40vh; border-top: 1px solid var(--gray-200); border-left: none; }
  .map-sidebar-header { padding: 10px 14px; font-size: 13px; }
  .map-property-list { padding: 8px; }

  /* 매물 상세 */
  .detail-page { padding: 0; }
  .detail-grid { grid-template-columns: 1fr; gap: 16px; }
  .detail-gallery { height: 250px; border-radius: 0; }
  .detail-content { padding: 16px; }
  .detail-title { font-size: 20px; }
  .detail-price { font-size: 22px; }
  .detail-info-table { font-size: 13px; }
  .detail-info-table td { padding: 10px 12px; }
  .detail-agent-card { position: static; margin: 16px; }

  /* 채팅 */
  .chat-layout { flex-direction: column; height: calc(100vh - 56px); }
  .chat-sidebar { width: 100%; height: auto; max-height: 35vh; border-right: none; border-bottom: 1px solid var(--gray-200); }
  .chat-messages { height: auto; flex: 1; }
  .chat-input-area { padding: 10px 12px; }
  .chat-input-area input { font-size: 14px; }

  /* 관리자 */
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; }
  .admin-sidebar-nav { display: flex; overflow-x: auto; padding: 8px; gap: 4px; }
  .admin-sidebar-nav a { white-space: nowrap; padding: 8px 14px; font-size: 13px; }
  .admin-content { padding: 16px; }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .admin-stat-card { padding: 14px; }
  .admin-stat-card .stat-value { font-size: 22px; }

  /* 마이페이지 */
  .mypage-section { padding: 16px; margin: 16px; }
  .mypage-header { flex-direction: column; text-align: center; gap: 12px; }

  /* 도구 페이지 */
  .tools-page { padding: 20px 16px; }
  .tools-page h2 { font-size: 20px; }
  .tool-card { padding: 16px; }

  /* 블로그 */
  .blog-grid { grid-template-columns: 1fr; }
  .blog-card-image { height: 160px; }

  /* 계약 */
  .contract-form { padding: 16px; }
  .form-row { flex-direction: column; gap: 0; }

  /* 버튼 */
  .btn { padding: 10px 16px; font-size: 14px; }
  .btn-block { width: 100%; }
  .btn-sm { padding: 6px 12px; font-size: 12px; }

  /* 모달 */
  .modal-content { width: 95%; max-width: none; margin: 16px; max-height: 90vh; overflow-y: auto; }

  /* 체크리스트 */
  .checklist-item { padding: 8px 12px; }
  .checklist-phase-header { padding: 10px 12px; font-size: 14px; }

  /* 에이전트 프로필 */
  .agent-profile-header { flex-direction: column; text-align: center; }
  .agent-profile-stats { grid-template-columns: repeat(2, 1fr); }
}

/* === Small Phone (≤480px) === */
@media (max-width: 480px) {
  .hero h1 { font-size: 22px; }
  .hero p { font-size: 13px; }
  .hero { padding: 32px 12px 24px; }

  /* 매물 카드 */
  .property-grid { padding: 0 12px; gap: 12px; }
  .property-card-image { height: 160px; }
  .property-card-body { padding: 12px; }
  .property-title { font-size: 14px; }
  .property-price { font-size: 16px; }
  .property-address { font-size: 11px; }
  .property-tags { gap: 4px; }
  .property-tags span { font-size: 10px; padding: 2px 6px; }

  /* 필터 */
  .filter-bar { padding: 10px 12px; }
  .filter-bar select { font-size: 12px; padding: 6px 8px; min-width: 0; }
  .deal-tabs { padding: 8px 12px; }
  .deal-tab { padding: 6px 12px; font-size: 12px; }

  /* 상세 */
  .detail-gallery { height: 200px; }
  .detail-title { font-size: 18px; }
  .detail-price { font-size: 20px; }
  .detail-info-table td { padding: 8px 10px; font-size: 12px; }
  .detail-agent-card { margin: 12px; padding: 14px; }

  /* 도구 */
  .tools-page { padding: 16px 12px; }
  .tools-page h2 { font-size: 18px; }
  .tools-tabs { gap: 2px; }
  .tools-tab { padding: 8px 10px; font-size: 12px; }

  /* 관리자 */
  .admin-stat-grid { grid-template-columns: 1fr; }
  .admin-table { font-size: 12px; }
  .admin-table th, .admin-table td { padding: 8px 6px; }

  /* 지도 */
  .map-area { height: 50vh; min-height: 250px; }
  .map-sidebar { max-height: 45vh; }
  .map-search-bar { padding: 6px 10px; }
  .map-search-bar input { font-size: 13px; }

  /* 채팅 */
  .chat-sidebar { max-height: 30vh; }
  .chat-bubble { max-width: 85%; font-size: 13px; }
  .chat-input-area { padding: 8px 10px; }

  /* 모달 */
  .modal-content { margin: 8px; border-radius: var(--radius); }
  .modal-header { padding: 14px; font-size: 16px; }
  .modal-body { padding: 14px; }

  /* 블로그 */
  .blog-card-body { padding: 12px; }
  .blog-card-title { font-size: 15px; }
  .blog-detail-article { padding: 14px; }
  .blog-detail-title { font-size: 20px; }

  /* 기타 */
  .section-title { font-size: 18px; }
  .nav-logo i { font-size: 22px; }
  .nav-logo span { font-size: 16px; }
  .toast { font-size: 13px; padding: 10px 14px; margin: 8px; }
}

/* === Touch & Interaction for Mobile === */
@media (hover: none) and (pointer: coarse) {
  .property-card:hover { transform: none; }
  .btn:hover { filter: none; }
  .nav-link:hover { color: inherit; }
  .property-card { -webkit-tap-highlight-color: transparent; }
  input, select, textarea { font-size: 16px !important; }
}

/* === Landscape Phone === */
@media (max-width: 768px) and (orientation: landscape) {
  .hero { padding: 24px 16px 20px; }
  .hero h1 { font-size: 24px; }
  .map-area { height: 60vh; }
  .map-sidebar { max-height: 35vh; }
  .detail-gallery { height: 200px; }
}

/* ============================================
   Samsung Galaxy Foldable Device Reference
   ============================================
   [Galaxy Z Flip Series - CSS Viewport]
   Flip 3: 360x800  DPR 3.0  (접힘 커버: 260x512)
   Flip 4: 360x800  DPR 3.0  (접힘 커버: 260x512)
   Flip 5: 360x800  DPR 3.0  (접힘 커버: 306x340)
   Flip 6: 360x800  DPR 3.0  (접힘 커버: 306x340)

   [Galaxy Z Fold Series - CSS Viewport]
   Fold 3 커버: 360x816  DPR 3.0 | 펼침: 673x841  DPR 2.625
   Fold 4 커버: 360x816  DPR 3.0 | 펼침: 673x841  DPR 2.625
   Fold 5 커버: 360x816  DPR 3.0 | 펼침: 673x841  DPR 2.625
   Fold 6 커버: 360x816  DPR 3.0 | 펼침: 686x882  DPR 2.625

   핵심: Flip/Fold 커버 = 360px 폭
         Fold 펼침 = 673~686px 폭 (태블릿급)
         Flip 펼침 = 360px 폭 + 800px 높이 (21.9:9 초종횡비)
   ============================================ */

/* === Galaxy Z Fold 펼침 모드 (673~686px - 태블릿급 정사각 화면) === */
@media (min-width: 640px) and (max-width: 719px) {
  /* Fold 펼침 = 거의 정사각형 비율 (673x841 ~ 686x882) */
  .property-grid { grid-template-columns: repeat(2, 1fr); gap: 14px; padding: 0 16px; }
  .property-card-image { height: 160px; }

  .hero h1 { font-size: 28px; }
  .hero { padding: 36px 20px 28px; }
  .search-box { max-width: 520px; }

  /* 지도 - Fold 펼침 시 좌우 분할 */
  .map-body { flex-direction: row; }
  .map-area { flex: 1; height: calc(100vh - var(--nav-height) - 60px); }
  .map-sidebar { width: 280px; height: calc(100vh - var(--nav-height) - 60px); max-height: none; overflow-y: auto; border-left: 1px solid var(--gray-200); border-top: none; }

  /* 상세 - 2열 유지 */
  .detail-grid { grid-template-columns: 1fr 240px; }
  .detail-gallery { height: 280px; }

  /* 채팅 - 좌우 분할 */
  .chat-layout { flex-direction: row; height: calc(100vh - var(--nav-height)); }
  .chat-sidebar { width: 240px; height: 100%; border-right: 1px solid var(--gray-200); border-bottom: none; max-height: none; }

  /* 관리자 - 사이드바 + 메인 */
  .admin-layout { flex-direction: row; }
  .admin-sidebar { width: 200px; }
  .admin-stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* 블로그 2열 */
  .blog-grid { grid-template-columns: repeat(2, 1fr); }

  /* 도구 */
  .tools-page { max-width: 640px; }
}

/* === Galaxy Flip/Fold 커버 + 일반 스마트폰 (360px 폭) === */
@media (max-width: 412px) {
  /* 네비게이션 */
  .navbar { height: 52px; padding: 0 10px; }
  .nav-logo i { font-size: 20px; }
  .nav-logo span { font-size: 15px; }
  .nav-mobile-toggle { width: 36px; height: 36px; font-size: 18px; }
  .dark-toggle { font-size: 16px; padding: 3px; }
  .main-content { padding-top: 52px; }

  /* 히어로 */
  .hero { padding: 24px 10px 20px; }
  .hero h1 { font-size: 20px; line-height: 1.3; }
  .hero p { font-size: 12px; margin-bottom: 18px; }
  .search-box { border-radius: var(--radius-sm); }
  .search-box input { padding: 10px 12px; font-size: 14px; }
  .search-box button { padding: 10px; font-size: 14px; }

  /* 필터/탭 */
  .filter-bar { padding: 8px 10px; gap: 6px; }
  .filter-bar select { font-size: 11px; padding: 5px 6px; }
  .deal-tabs { padding: 6px 10px; gap: 4px; }
  .deal-tab { padding: 6px 10px; font-size: 11px; }

  /* 매물 카드 */
  .property-grid { padding: 0 10px; gap: 10px; }
  .property-card-image { height: 150px; }
  .property-card-body { padding: 10px; }
  .property-title { font-size: 13px; line-height: 1.3; }
  .property-price { font-size: 15px; }
  .property-address { font-size: 11px; }
  .property-meta { font-size: 11px; gap: 6px; }
  .property-meta span { gap: 2px; }
  .property-tags span { font-size: 9px; padding: 1px 5px; }
  .price-tag { font-size: 11px; padding: 3px 8px; }

  /* 지도 */
  .map-page-wrap { height: calc(100vh - 52px); }
  .map-controls { padding: 6px 8px; gap: 6px; }
  .map-search-bar { padding: 4px 8px; }
  .map-search-bar input { font-size: 13px; }
  .map-filters select { font-size: 11px; padding: 4px 6px; }
  .map-area { height: 50vh; min-height: 220px; }
  .map-sidebar { max-height: 42vh; }
  .map-sidebar-header { padding: 8px 10px; font-size: 12px; }

  /* 매물 상세 */
  .detail-gallery { height: 180px; }
  .detail-content { padding: 12px; }
  .detail-title { font-size: 17px; }
  .detail-price { font-size: 18px; }
  .detail-info-table td { padding: 7px 8px; font-size: 12px; }
  .detail-agent-card { margin: 10px; padding: 12px; }
  .detail-agent-card .btn { padding: 8px 12px; font-size: 12px; }

  /* 채팅 */
  .chat-sidebar { max-height: 28vh; }
  .chat-room-item { padding: 10px; }
  .chat-room-name { font-size: 13px; }
  .chat-bubble { max-width: 88%; font-size: 13px; padding: 8px 10px; }
  .chat-input-area { padding: 6px 8px; }
  .chat-input-area input { padding: 8px 10px; font-size: 13px; }
  .chat-input-area button { padding: 8px 12px; }

  /* 도구/계산기 */
  .tools-page { padding: 14px 10px; }
  .tools-page h2 { font-size: 17px; }
  .tools-page h3 { font-size: 15px; }
  .tools-tabs { padding: 3px; }
  .tools-tab { padding: 7px 8px; font-size: 11px; }
  .tool-card { padding: 12px; }
  .tool-card input { font-size: 14px; padding: 8px; }
  .tool-card label { font-size: 12px; }

  /* 체크리스트 */
  .checklist-phase-header { padding: 8px 10px; font-size: 13px; }
  .checklist-item { padding: 7px 10px; gap: 8px; }
  .checklist-item label { font-size: 13px; }
  .checklist-item input[type="checkbox"] { width: 16px; height: 16px; }
  .checklist-stats { font-size: 12px; }

  /* 관리자 */
  .admin-sidebar-nav a { font-size: 12px; padding: 6px 10px; }
  .admin-content { padding: 12px; }
  .admin-stat-card { padding: 10px; }
  .admin-stat-card .stat-value { font-size: 20px; }
  .admin-stat-card .stat-label { font-size: 11px; }
  .admin-table { font-size: 11px; }
  .admin-table th, .admin-table td { padding: 6px 4px; }

  /* 블로그 */
  .blog-card-image { height: 140px; }
  .blog-card-body { padding: 10px; }
  .blog-card-title { font-size: 14px; }
  .blog-card-excerpt { font-size: 12px; }
  .blog-detail-title { font-size: 18px; }
  .blog-detail-article { padding: 12px; font-size: 14px; }

  /* 마이페이지 */
  .mypage-section { padding: 12px; margin: 10px; }
  .mypage-header { gap: 10px; }

  /* 인증 */
  .auth-card { margin: 10px; padding: 20px 14px; }
  .auth-card h2 { font-size: 20px; }
  .auth-card input { padding: 10px; font-size: 14px; }

  /* 버튼 */
  .btn { padding: 8px 14px; font-size: 13px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }

  /* 모달 */
  .modal-content { margin: 6px; border-radius: var(--radius-sm); }
  .modal-header { padding: 12px; font-size: 15px; }
  .modal-body { padding: 12px; }

  /* 섹션 */
  .section-title { font-size: 16px; }
  .section-header { padding: 0 10px; }
  .empty-state { padding: 30px 10px; }
  .empty-state p { font-size: 13px; }
  .toast { font-size: 12px; padding: 8px 12px; }
}

/* === Galaxy Z Flip 펼침 (360x800, 21.9:9 초종횡비 - 세로로 매우 긴 화면) === */
@media (max-width: 380px) and (min-height: 780px) {
  /* 세로가 길어서 스크롤 콘텐츠에 유리 → 이미지/갤러리를 더 크게 */
  .property-card-image { height: 180px; }
  .detail-gallery { height: 220px; }
  .hero { padding: 28px 10px 22px; }

  /* 지도 - 세로 공간 활용 */
  .map-area { height: 48vh; min-height: 300px; }
  .map-sidebar { max-height: 44vh; }

  /* 채팅 - 메시지 영역 넓게 */
  .chat-messages { min-height: 50vh; }
  .chat-sidebar { max-height: 25vh; }

  /* 스크롤 힌트 - 아래 콘텐츠 있음을 암시 */
  .property-grid { padding-bottom: 20px; }
}

/* === Galaxy Z Fold 커버 (360x816, 24.5:9 좁고 긴 화면) === */
@media (max-width: 380px) and (min-height: 800px) and (max-height: 840px) {
  /* Fold 커버는 360px 폭에 816px 높이 - 일반폰보다 약간 좁고 길다 */
  .hero h1 { font-size: 19px; }
  .search-box input { padding: 9px 10px; }
  .property-card-body { padding: 10px; }
  .filter-bar select { max-width: 80px; }
}

/* === Galaxy Z Flip 커버 디스플레이 (Flip 5/6: 306x340, 거의 정사각형) === */
@media (max-width: 320px) and (max-height: 360px) {
  /* 극소형 정사각형 - 최소한의 정보만 표시 */
  .navbar { height: 40px; padding: 0 6px; }
  .nav-logo span { font-size: 12px; }
  .nav-logo i { font-size: 16px; }
  .nav-mobile-toggle { width: 28px; height: 28px; font-size: 14px; }
  .dark-toggle { display: none; }
  .main-content { padding-top: 40px; }

  .hero { padding: 12px 6px 10px; }
  .hero h1 { font-size: 14px; line-height: 1.2; }
  .hero p { display: none; }
  .search-box { flex-direction: column; }
  .search-box input { padding: 6px 8px; font-size: 12px; }
  .search-box button { padding: 6px; font-size: 12px; }

  .property-grid { padding: 0 6px; gap: 6px; }
  .property-card-image { height: 80px; }
  .property-card-body { padding: 6px; }
  .property-title { font-size: 11px; }
  .property-price { font-size: 12px; }
  .property-address, .property-meta, .property-tags { display: none; }

  .filter-bar { padding: 4px 6px; }
  .deal-tabs { padding: 4px 6px; }
  .deal-tab { padding: 4px 8px; font-size: 10px; }

  .section-title { font-size: 13px; }
  .section-header { padding: 0 6px; }
  .btn { padding: 4px 8px; font-size: 11px; }
  .modal-content { margin: 4px; }
}

/* === Galaxy Z Flip 커버 (Flip 3/4: 260x512, 매우 좁음) === */
@media (max-width: 280px) {
  .navbar { height: 36px; }
  .nav-logo span { display: none; }
  .main-content { padding-top: 36px; }
  .hero { padding: 8px 4px; }
  .hero h1 { font-size: 13px; }
  .hero p { display: none; }
  .property-card-image { height: 60px; }
  .property-card-body { padding: 4px; }
  .property-title { font-size: 10px; }
  .property-price { font-size: 11px; }
  .search-box input { font-size: 11px; padding: 5px 6px; }
}

/* === Galaxy Z Fold 펼침 (가로 모드 - 841x673 ~ 882x686) === */
@media (min-width: 800px) and (max-width: 900px) and (min-height: 640px) and (max-height: 720px) {
  /* Fold 가로 펼침 = 넓지만 높이 제한 */
  .property-grid { grid-template-columns: repeat(3, 1fr); }
  .hero { padding: 24px 20px; }
  .hero h1 { font-size: 28px; }
  .map-body { flex-direction: row; }
  .map-area { flex: 1; height: calc(100vh - var(--nav-height) - 50px); }
  .map-sidebar { width: 300px; max-height: none; height: calc(100vh - var(--nav-height) - 50px); }
  .detail-grid { grid-template-columns: 1fr 280px; }
  .detail-gallery { height: 250px; }
}

/* === Foldable Screen Spanning API (브라우저 지원 시) === */
@media (horizontal-viewport-segments: 2) {
  /* Galaxy Fold 펼침 - 가운데 힌지 기준 좌우 분할 */
  .map-body { flex-direction: row; }
  .map-area { width: env(viewport-segment-width 0 0); height: 100%; }
  .map-sidebar { width: env(viewport-segment-width 1 0); height: 100%; max-height: none; }
  .detail-grid { grid-template-columns: env(viewport-segment-width 0 0) env(viewport-segment-width 1 0); }
  .chat-layout { flex-direction: row; }
  .chat-sidebar { width: env(viewport-segment-width 0 0); }
  .chat-messages { width: env(viewport-segment-width 1 0); }
}

@media (vertical-viewport-segments: 2) {
  /* Galaxy Flip 접힘 - 상하 분할 (Flex Mode) */
  .map-body { flex-direction: column; }
  .map-area { height: env(viewport-segment-height 0 0); }
  .map-sidebar { height: env(viewport-segment-height 1 0); max-height: none; overflow-y: auto; }
  .detail-gallery { height: env(viewport-segment-height 0 0); }
  .detail-content { height: env(viewport-segment-height 1 0); overflow-y: auto; }
}

/* === Tall/Narrow Screens (일반적으로 세로가 긴 폰) === */
@media (max-width: 420px) and (min-height: 800px) {
  .map-area { height: 45vh; }
  .map-sidebar { max-height: 48vh; }
  .chat-messages { max-height: 55vh; }
  .detail-gallery { height: 220px; }
  .property-card-image { height: 170px; }
}

/* === Safe Area (iPhone notch + Samsung punch hole) === */
@supports (padding: env(safe-area-inset-top)) {
  .navbar { padding-top: env(safe-area-inset-top); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .nav-mobile-menu { padding-bottom: env(safe-area-inset-bottom); padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .chat-input-area { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .main-content { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
  .modal-content { margin-bottom: calc(10px + env(safe-area-inset-bottom)); }
}

/* === Smooth Scrolling & Touch === */
@media (hover: none) {
  * { -webkit-tap-highlight-color: transparent; }
  .map-property-list, .chat-messages, .admin-sidebar-nav, .deal-tabs, .tools-tabs {
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
  }
  .map-sidebar, .chat-sidebar { overscroll-behavior: contain; }
}
