/* ==========================================================================
   동탄·오산·평택·수원 아파트 시세 모니터 - 파스텔 감성 테마 (CSS)
   부드럽고 감성적인 파스텔 톤 & 세련된 현대적 레이아웃
   ========================================================================== */

:root {
  /* 파스텔 배경 및 기본 팔레트 */
  --bg-primary: #f8fafc;
  --bg-cream: #fdfbf7;
  --bg-card: #ffffff;
  --bg-card-hover: #ffffff;
  
  --border-subtle: #e2e8f0;
  --border-soft: #cbd5e1;
  --border-focus: #a5b4fc;

  /* 텍스트 컬러 (파스텔 배경에 최적화된 편안하고 선명한 차콜/슬레이트) */
  --text-main: #1e293b;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  /* 포인트 파스텔 그라디언트 */
  --accent-lavender: #818cf8;
  --accent-lavender-gradient: linear-gradient(135deg, #818cf8 0%, #a78bfa 100%);
  --accent-mint-gradient: linear-gradient(135deg, #34d399 0%, #10b981 100%);
  --accent-peach: #fb923c;
  --accent-sky: #38bdf8;

  /* 상태별 파스텔 톤 배지 */
  --status-new-bg: #ecfdf5;
  --status-new-border: #a7f3d0;
  --status-new-text: #059669;

  --status-stable-bg: #eff6ff;
  --status-stable-border: #bfdbfe;
  --status-stable-text: #2563eb;

  --status-excluded-bg: #fff1f2;
  --status-excluded-border: #fecdd3;
  --status-excluded-text: #e11d48;

  /* 링크 버튼별 파스텔 팔레트 */
  --link-map-bg: #f0fdf4;
  --link-map-border: #bbf7d0;
  --link-map-text: #166534;

  --link-kakao-bg: #fefce8;
  --link-kakao-border: #fef08a;
  --link-kakao-text: #854d0e;

  --link-land-bg: #eff6ff;
  --link-land-border: #bfdbfe;
  --link-land-text: #1d4ed8;

  --link-kb-bg: #fff7ed;
  --link-kb-border: #fed7aa;
  --link-kb-text: #c2410c;

  /* 부드러운 파스텔 그림자 */
  --shadow-sm: 0 2px 6px rgba(148, 163, 184, 0.08);
  --shadow-card: 0 10px 25px -5px rgba(148, 163, 184, 0.12), 0 8px 10px -6px rgba(148, 163, 184, 0.08);
  --shadow-card-hover: 0 20px 35px -10px rgba(148, 163, 184, 0.22);
  --shadow-mint: 0 8px 20px -4px rgba(52, 211, 153, 0.35);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-full: 9999px;

  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-family);
  background: var(--bg-primary);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  /* 부드럽고 따뜻한 파스텔 오로라 그라디언트 배경 */
  background-image: 
    radial-gradient(at 0% 0%, #fef3c7 0px, transparent 40%),
    radial-gradient(at 100% 0%, #e0e7ff 0px, transparent 45%),
    radial-gradient(at 50% 100%, #fce7f3 0px, transparent 40%),
    radial-gradient(at 10% 80%, #d1fae5 0px, transparent 40%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

/* ================== 토스트 알림 ================== */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast-message {
  pointer-events: auto;
  background: #ffffff;
  border: 1px solid var(--status-new-border);
  box-shadow: 0 12px 30px rgba(16, 185, 129, 0.15), 0 4px 10px rgba(0, 0, 0, 0.05);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  color: var(--text-main);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  max-width: 380px;
}

.toast-message.toast-info {
  border-color: #c7d2fe;
  box-shadow: 0 12px 30px rgba(99, 102, 241, 0.15);
}

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(50px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ================== 레이아웃 컨테이너 ================== */
.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 32px 70px 32px;
}

/* ================== 헤더 ================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap;
  gap: 16px;
}

.brand-section {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-md);
  background: var(--accent-lavender-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  box-shadow: 0 8px 18px rgba(129, 140, 248, 0.35);
  color: #fff;
}

.brand-title h1 {
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.brand-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.badge-tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 0.74rem;
  font-weight: 700;
  background: #ede9fe;
  color: #6366f1;
  border: 1px solid #ddd6fe;
}

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

/* 버튼류 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-update {
  background: var(--accent-mint-gradient);
  color: #ffffff;
  box-shadow: var(--shadow-mint);
  border: 1px solid rgba(52, 211, 153, 0.3);
}

.btn-update:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 26px -4px rgba(52, 211, 153, 0.45);
}

.btn-update.is-updating .btn-icon {
  display: inline-block;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.btn-secondary {
  background: #ffffff;
  color: #334155;
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.btn-sm {
  padding: 8px 12px;
  font-size: 0.82rem;
}

/* ================== 조건 요약 배너 ================== */
.rules-banner {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius-lg);
  padding: 16px 22px;
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  box-shadow: var(--shadow-sm);
}

.rules-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.rule-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  color: #334155;
}

.rule-chip b {
  color: #4f46e5;
}

.update-date-info {
  font-size: 0.84rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ================== KPI 통계 카드 ================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-card-hover);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.stat-icon {
  font-size: 1.2rem;
}

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #0f172a;
}

.stat-footer {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 6px;
}

.stat-card.card-new { border-top: 4px solid #34d399; }
.stat-card.card-excluded { border-top: 4px solid #fb7185; }
.stat-card.card-stable { border-top: 4px solid #818cf8; }
.stat-card.card-region { border-top: 4px solid #38bdf8; }

/* ================== 필터 및 툴바 ================== */
.toolbar-section {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 22px;
  margin-bottom: 26px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: var(--shadow-card);
}

.tabs-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.segmented-control {
  display: inline-flex;
  background: #f1f5f9;
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid #e2e8f0;
  gap: 4px;
  flex-wrap: wrap;
}

.seg-btn {
  background: transparent;
  border: none;
  color: #475569;
  padding: 8px 16px;
  font-size: 0.86rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 6px;
}

.seg-btn:hover { color: #0f172a; }
.seg-btn.active {
  background: #ffffff;
  color: #4f46e5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.status-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill-btn {
  padding: 7px 15px;
  border-radius: var(--radius-full);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--border-subtle);
  background: #ffffff;
  color: var(--text-muted);
  transition: all var(--transition-fast);
}

.status-pill-btn:hover {
  background: #f8fafc;
  color: var(--text-main);
}

.status-pill-btn.active-all {
  background: #1e293b;
  color: #ffffff;
  border-color: #1e293b;
}

.status-pill-btn.active-new {
  background: var(--status-new-bg);
  color: var(--status-new-text);
  border-color: var(--status-new-border);
}

.status-pill-btn.active-stable {
  background: var(--status-stable-bg);
  color: var(--status-stable-text);
  border-color: var(--status-stable-border);
}

.status-pill-btn.active-excluded {
  background: var(--status-excluded-bg);
  color: var(--status-excluded-text);
  border-color: var(--status-excluded-border);
}

.filters-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 260px;
}

.search-box input {
  width: 100%;
  padding: 10px 16px 10px 42px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-box input:focus {
  background: #ffffff;
  border-color: var(--accent-lavender);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

.search-box .search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  font-size: 1rem;
}

.filter-selects {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.custom-select {
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 0.86rem;
  cursor: pointer;
  outline: none;
}

.custom-select:focus {
  border-color: var(--accent-lavender);
  background: #ffffff;
}

.view-toggle {
  display: flex;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #f8fafc;
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all var(--transition-fast);
}

.view-btn.active {
  background: #ffffff;
  color: #4f46e5;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ⭐️ 빠른 정렬 칩 버튼 그룹 ⭐️ */
.quick-sort-section {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 14px;
  border-top: 1px dashed var(--border-subtle);
}

.quick-sort-label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.quick-sort-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.sort-chip {
  background: #f8fafc;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 6px 13px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  user-select: none;
}

.sort-chip:hover {
  background: #f1f5f9;
  color: var(--text-main);
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.sort-chip.active {
  background: #ede9fe;
  color: #4f46e5;
  border-color: #c7d2fe;
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.15);
}

/* ================== 결과 카드 그리드 ================== */
.apt-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 22px;
}

.apt-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-card);
  transition: all var(--transition-smooth);
  position: relative;
}

.apt-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-card-hover);
  border-color: #cbd5e1;
}

.apt-card.is-excluded {
  background: #fffafa;
  border-color: #fecdd3;
}

.apt-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}

.region-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  background: #f1f5f9;
  color: #334155;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.status-badge.badge-new {
  background: var(--status-new-bg);
  border: 1px solid var(--status-new-border);
  color: var(--status-new-text);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.18);
  animation: pastelPulse 2.4s infinite ease-in-out;
}

@keyframes pastelPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.88; transform: scale(1.02); }
}

.status-badge.badge-stable {
  background: var(--status-stable-bg);
  border: 1px solid var(--status-stable-border);
  color: var(--status-stable-text);
}

.status-badge.badge-excluded {
  background: var(--status-excluded-bg);
  border: 1px solid var(--status-excluded-border);
  color: var(--status-excluded-text);
}

.data-freshness-warning {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
  background: #fffbeb;
  color: #92400e;
  font-weight: 700;
}

.refresh-status-panel {
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #cbd5e1;
  border-radius: var(--radius-md);
  background: #f8fafc;
  color: #334155;
  font-size: 0.88rem;
  line-height: 1.7;
}

.refresh-recovery-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.refresh-recovery-controls select,
.refresh-recovery-controls button {
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: white;
  color: #334155;
  font: inherit;
}

.refresh-recovery-controls button { cursor: pointer; }
.refresh-recovery-controls button:hover { background: #eff6ff; }

.apt-card-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.apt-card-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.apt-price-box {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.price-main-label {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.price-main-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.price-main-val.price-highlight {
  color: #059669;
}

.price-main-val.price-excluded {
  color: #e11d48;
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.price-sub-info {
  text-align: right;
  font-size: 0.82rem;
}

.asking-price {
  color: var(--text-muted);
  font-weight: 500;
}

.trend-indicator {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 0.78rem;
  font-weight: 700;
}

.trend-indicator.up { color: #e11d48; }
.trend-indicator.down { color: #0284c7; }
.trend-indicator.flat { color: var(--text-dim); }

/* ================== ⭐️ 분양 ~ 현재 시세 점선 그래프 ================== */
.price-chart-box {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 12px 14px 10px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  transition: all var(--transition-fast);
}

.price-chart-box:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 0.82rem;
  flex-wrap: wrap;
  gap: 6px;
}

.chart-title {
  font-weight: 700;
  color: #334155;
  display: flex;
  align-items: center;
  gap: 5px;
}

.chart-gain-badge {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  display: inline-flex;
  align-items: center;
  gap: 3px;
  letter-spacing: -0.01em;
}

.chart-gain-badge.gain-plus {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #a7f3d0;
}

.chart-gain-badge.gain-minus {
  background: #eff6ff;
  color: #2563eb;
  border: 1px solid #bfdbfe;
}

.price-history-svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-dot {
  transition: all 0.2s ease;
  cursor: pointer;
}

.chart-dot:hover {
  r: 5.5;
}

.apt-specs-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.spec-cell {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  text-align: center;
}

.spec-title {
  font-size: 0.72rem;
  color: var(--text-dim);
  display: block;
}

.spec-val {
  font-size: 0.84rem;
  font-weight: 700;
  color: #334155;
}

.exclude-alert {
  background: #fff1f2;
  border: 1px solid #fecdd3;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.8rem;
  color: #be123c;
  margin-bottom: 14px;
}

.notes-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  line-height: 1.45;
}

/* ================== ⭐️ 신규: 단지별 파스텔 바로가기 링크 버튼 ================== */
.card-actions-wrapper {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  margin-top: 4px;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-dim);
  min-width: 32px;
}

.action-buttons-group {
  display: flex;
  gap: 6px;
  flex: 1;
}

.link-btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: all var(--transition-fast);
  cursor: pointer;
}

/* (a) 지도 링크 버튼 파스텔 스타일 */
.link-btn.btn-naver-map {
  background: var(--link-map-bg);
  border: 1px solid var(--link-map-border);
  color: var(--link-map-text);
}

.link-btn.btn-naver-map:hover {
  background: #dcfce7;
  transform: translateY(-1px);
}

.link-btn.btn-kakao-map {
  background: var(--link-kakao-bg);
  border: 1px solid var(--link-kakao-border);
  color: var(--link-kakao-text);
}

.link-btn.btn-kakao-map:hover {
  background: #fef9c3;
  transform: translateY(-1px);
}

/* (b) 시세 링크 버튼 파스텔 스타일 */
.link-btn.btn-naver-land {
  background: var(--link-land-bg);
  border: 1px solid var(--link-land-border);
  color: var(--link-land-text);
}

.link-btn.btn-naver-land:hover {
  background: #dbeafe;
  transform: translateY(-1px);
}

.link-btn.btn-kb-land {
  background: var(--link-kb-bg);
  border: 1px solid var(--link-kb-border);
  color: var(--link-kb-text);
}

.link-btn.btn-kb-land:hover {
  background: #ffedd5;
  transform: translateY(-1px);
}

/* ================== 테이블 뷰 ================== */
.table-container {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  box-shadow: var(--shadow-card);
}

.apt-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.apt-table th {
  background: #f8fafc;
  color: var(--text-muted);
  font-weight: 700;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

/* ⭐️ 표 행(컬럼)별 오름차순/내림차순 정렬 스타일 ⭐️ */
.apt-table th.sortable {
  cursor: pointer;
  user-select: none;
  transition: background var(--transition-fast), color var(--transition-fast);
}

.apt-table th.sortable:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.apt-table th.sortable.active-sort {
  background: #ede9fe;
  color: #4f46e5;
  border-bottom: 2px solid #6366f1;
}

.sort-indicator {
  display: inline-block;
  margin-left: 5px;
  font-size: 0.76rem;
  color: #4f46e5;
  font-weight: 800;
}

.table-header-tip {
  padding: 10px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  color: #64748b;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.table-header-tip b {
  color: #4f46e5;
}

.apt-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-main);
  white-space: nowrap;
  transition: background var(--transition-fast);
}

.apt-table tbody tr {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.apt-table tbody tr:hover td {
  background: #f8fafc;
}

.apt-table tbody tr.row-selected td {
  background: #f5f3ff !important;
}

.apt-table tr.row-excluded td {
  opacity: 0.65;
  background: #fffdfd;
}

.table-links-cell {
  display: flex;
  gap: 5px;
}

.table-mini-btn {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
}

/* ================== 모달 ================== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-fast);
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-box {
  background: #ffffff;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  padding: 30px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0f172a;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-close:hover { color: #0f172a; }

.modal-body {
  font-size: 0.92rem;
  color: var(--text-main);
  line-height: 1.6;
}

.guide-step {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
}

.guide-step h4 {
  font-size: 0.98rem;
  color: #4f46e5;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}

/* ================== 단지 카드 내 평형 선택 드롭다운 (이미지 스타일 셀렉트) ================== */
.card-area-select-box {
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: all var(--transition-fast);
}

.card-area-select-box:hover {
  border-color: #cbd5e1;
  background: #ffffff;
}

.card-area-select-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-area-select-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #475569;
  display: flex;
  align-items: center;
  gap: 5px;
}

.card-area-select-label .icon {
  font-size: 0.95rem;
}

.card-area-select-badge {
  font-size: 0.74rem;
  font-weight: 700;
  color: #4f46e5;
  background: #eef2ff;
  border: 1px solid #c7d2fe;
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.card-select-dropdown-wrapper {
  position: relative;
  width: 100%;
}

.card-area-dropdown {
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: #ffffff;
  border: 1.5px solid #cbd5e1;
  border-radius: 9px;
  padding: 9px 32px 9px 12px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #1e293b;
  font-family: inherit;
  cursor: pointer;
  outline: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all var(--transition-fast);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-area-dropdown:hover {
  border-color: #818cf8;
  background: #ffffff;
}

.card-area-dropdown:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}

.card-select-dropdown-wrapper::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  color: #6366f1;
  pointer-events: none;
  font-weight: 800;
}

/* 카드 가격 갱신 시 부드러운 하이라이트 애니메이션 */
@keyframes priceUpdatePulse {
  0% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.02); filter: brightness(1.08); }
  100% { transform: scale(1); filter: brightness(1); }
}

.apt-card.price-updated .apt-price-box {
  animation: priceUpdatePulse 0.45s ease-out;
}

@media (max-width: 768px) {
  .app-container { padding: 16px; }
  .app-header { flex-direction: column; align-items: flex-start; }
  .rules-banner { flex-direction: column; align-items: flex-start; }
  .filters-row { flex-direction: column; align-items: stretch; }
  .apt-cards-grid { grid-template-columns: 1fr; }
}

/* 저장 서버에 연결되지 않은 조회 모드의 조작 상태 */
button:disabled, select:disabled, input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

[hidden] { display: none !important; }
