/* =================================================================
   앱 셸 (왼쪽 메뉴 · 상단 바) + 홈 + 재개발·시세 분석
   ================================================================= */

:root {
  --sidebar-w: 248px;
  --watch: #ea580c;
}

/* ---------- 셸 ---------- */
.app-main { min-height: 100vh; }

.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 300;
  display: flex; flex-direction: column; gap: 18px; padding: 20px 14px;
  background: #0f172a; color: #e2e8f0;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; padding: 4px 6px; }
.sidebar-logo { font-size: 28px; line-height: 1; }
.sidebar-brand b { display: block; font-size: 17px; letter-spacing: -0.3px; }
.sidebar-brand small { display: block; font-size: 11px; color: #94a3b8; margin-top: 2px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 10px;
  color: #cbd5e1; text-decoration: none; font-size: 14px; font-weight: 600;
}
.sidebar-nav a span { width: 22px; text-align: center; }
.sidebar-nav a:hover { background: #1e293b; color: #fff; }
.sidebar-nav a.active { background: #0284c7; color: #fff; }
.sidebar-foot { margin-top: auto; font-size: 11px; line-height: 1.6; color: #64748b; padding: 0 6px; }
.sidebar-backdrop { display: none; }

.topbar {
  display: none; position: sticky; top: 0; z-index: 200; align-items: center; gap: 10px;
  padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.btn-menu { border: 1px solid var(--border); background: #f8fafc; border-radius: 8px; width: 38px; height: 38px; font-size: 18px; cursor: pointer; }
.topbar b { font-size: 16px; }

/* 셸 안에서는 기존 공공임대 헤더를 고정하지 않는다 (상단 바와 겹침 방지) */
.app-shell .header-container { position: static; }

@media (min-width: 901px) {
  .app-main { margin-left: var(--sidebar-w); }
}

@media (max-width: 900px) {
  .topbar { display: flex; }
  .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 250; background: rgba(15, 23, 42, 0.45); }
}

/* ---------- 공통 조각 ---------- */
.muted { color: var(--text-light); }
.up { color: #dc2626; font-weight: 700; }
.down { color: #2563eb; font-weight: 700; }

.panel {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 18px; box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.panel-title { display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.panel-title h3 { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; }
.panel-title h3 small, .home-card h3 small { font-size: 12px; font-weight: 500; color: var(--text-muted); margin-left: 4px; }

.chip-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-row + .chip-row { margin-top: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--text-main);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.chip:hover { border-color: #94a3b8; }
.chip.active { background: #e0f2fe; border-color: #38bdf8; color: #075985; }
.chip-sm { padding: 5px 10px; font-size: 12px; }
.chip-hint { font-size: 12px; color: var(--text-muted); }
.gu-chips .chip.active { background: #0284c7; border-color: #0284c7; color: #fff; }
.gu-picker { margin-top: 10px; }
.gu-picker summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--primary-dark); padding: 4px 0; }
.gu-picker summary small { font-weight: 500; color: var(--text-muted); }
.gu-picker .gu-chips { margin-top: 8px; }
.dot, .map-legend i, .phase-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }

.btn-mini {
  display: inline-flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: #f8fafc; color: var(--text-main);
  font-size: 12px; font-weight: 600; text-decoration: none; cursor: pointer; font-family: inherit;
}
.btn-mini:hover { background: #e2e8f0; }

.tag { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; margin-left: 3px; }
.tag-go { background: #dcfce7; color: #166534; }
.tag-risk { background: #fee2e2; color: #991b1b; }
.tag-watch { background: #ffedd5; color: #9a3412; }

.news-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.news-list li { display: flex; flex-direction: column; gap: 2px; padding-bottom: 8px; border-bottom: 1px dashed var(--border); }
.news-list li:last-child { border-bottom: 0; }
.news-list a { color: var(--text-main); font-size: 14px; font-weight: 600; text-decoration: none; }
.news-list a:hover { color: var(--primary); text-decoration: underline; }
.news-list small { color: var(--text-muted); font-size: 12px; }

/* ---------- 홈 ---------- */
.home-hero { margin-bottom: 18px; }
.home-hero h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.home-hero p { color: var(--text-muted); margin-top: 4px; }
.home-hero .home-mine { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; padding: 8px 12px; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; font-size: 13px; color: #78350f; }
.home-mine a { color: var(--primary); font-weight: 700; text-decoration: none; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; }
.home-card {
  display: flex; flex-direction: column; gap: 10px; padding: 20px; border-radius: var(--radius-lg);
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-sm); color: inherit; text-decoration: none;
}
a.home-card:hover { border-color: #38bdf8; box-shadow: var(--shadow-md); }
.home-card h3 { font-size: 16px; font-weight: 800; }
.home-big { font-size: 34px; font-weight: 800; letter-spacing: -1px; color: var(--primary-dark); }
.home-big small { font-size: 14px; font-weight: 600; color: var(--text-muted); margin-left: 4px; letter-spacing: 0; }
.home-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--text-muted); }
.home-stats b { color: var(--text-main); }
.home-stats .warn b { color: #b45309; }
.home-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.home-list li { display: flex; flex-direction: column; font-size: 13px; padding: 7px 10px; background: #fff7ed; border-radius: 8px; }
.home-list small { color: var(--text-muted); }
.home-go { margin-top: auto; font-size: 13px; font-weight: 700; color: var(--primary); }
.home-loading { display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 13px; }
.home-news { margin-bottom: 12px; }
.home-note { margin-top: 8px; }

/* ---------- 재개발·시세 ---------- */
.redev-head { margin-bottom: 16px; }
.redev-head h2 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; }
.redev-head p { color: var(--text-muted); margin: 4px 0 10px; }
.disclaimer { padding: 10px 14px; border-radius: 10px; background: #fffbeb; border: 1px solid #fde68a; color: #92400e; font-size: 13px; }

.filter-rows { display: flex; flex-direction: column; gap: 12px; }
.redev-search { margin-top: 0; }

.summary-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
.summary-stats div { padding: 12px; border-radius: 12px; background: #f8fafc; text-align: center; }
.summary-stats b { display: block; font-size: 22px; font-weight: 800; }
.summary-stats span { font-size: 12px; color: var(--text-muted); }
.summary-stats .accent { background: #fff7ed; color: #9a3412; }
.summary-stats .warn { background: #fef2f2; color: #991b1b; }
.phase-bar { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: #f1f5f9; }
.phase-legend, .map-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.phase-legend span, .map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.panel .section-note { margin-top: 10px; }

.redev-map { height: 440px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); background: #f1f5f9; }
.map-loading { display: flex; align-items: center; justify-content: center; gap: 8px; height: 100%; color: var(--text-muted); font-size: 13px; }
.map-popup b { font-size: 14px; }
.map-popup ul { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 5px; max-height: 220px; overflow-y: auto; }
.map-popup li { display: flex; flex-direction: column; }
.map-popup small { color: #64748b; }
.map-site { border: 0; background: none; padding: 0; text-align: left; color: #0369a1; font-weight: 700; font-size: 13px; cursor: pointer; font-family: inherit; }
.map-site:hover { text-decoration: underline; }

.site-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-bottom: 18px; }
.site-card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px;
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-sm); scroll-margin-top: 70px;
}
.site-card.watch { border-color: #fdba74; box-shadow: 0 0 0 1px #fed7aa inset, var(--shadow-sm); }
.site-card.paused { background: #fafafa; }
.site-card.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 4px #38bdf8; } 100% { box-shadow: var(--shadow-sm); } }
.phase-badge { background: color-mix(in srgb, var(--c) 14%, white); color: color-mix(in srgb, var(--c) 75%, black); border: 1px solid color-mix(in srgb, var(--c) 35%, white); }
.badge-watch { background: #ffedd5; color: #9a3412; }
.badge-paused { background: #fee2e2; color: #991b1b; }
.site-name { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.35; }
.site-meta, .site-sub { font-size: 12px; color: var(--text-muted); }
.progress { height: 7px; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: 999px; }
.site-warn { font-size: 12px; color: #9a3412; background: #fff7ed; border-radius: 8px; padding: 7px 9px; }
.site-subway { font-size: 12px; color: var(--text-main); }
.site-subway small { color: var(--text-muted); }
.site-place { border-top: 1px dashed var(--border); padding-top: 10px; }
.amenity-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; }
.amenity-grid span { display: flex; flex-direction: column; align-items: center; padding: 8px 4px; border-radius: 10px; background: #f8fafc; font-size: 12px; color: var(--text-muted); }
.amenity-grid b { font-size: 18px; color: var(--text-main); }
.warn-text { color: #b45309; font-weight: 600; }
.map-popup small { display: block; }
.map-popup .map-site { margin-top: 6px; }
.site-price { font-size: 12px; padding: 8px 10px; border-radius: 8px; background: #f0f9ff; color: #0c4a6e; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.site-price.muted { background: #f8fafc; }
.site-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.site-news { border-top: 1px dashed var(--border); padding-top: 10px; display: flex; flex-direction: column; gap: 10px; }
.news-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; }
.news-head small { color: var(--text-muted); margin-left: 4px; }
.news-search { display: flex; flex-wrap: wrap; gap: 6px; }
.news-search input { flex: 1; min-width: 160px; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; font-family: inherit; }
.btn-more { grid-column: 1 / -1; padding: 12px; border-radius: 12px; border: 1px dashed #94a3b8; background: #fff; font-weight: 700; color: var(--text-muted); cursor: pointer; font-family: inherit; }

.price-controls { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.price-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 8px; }
.price-table td small { display: block; font-size: 11px; color: var(--text-light); }
.spark { margin: 4px 0 12px; }
.spark svg { width: 100%; height: 90px; background: #f8fafc; border-radius: 10px; }
.spark figcaption { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.spark .key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.spark .key.apt { background: #0284c7; }
.spark .key.rh { background: #ea580c; }
.note-list { margin: 12px 0 0 18px; font-size: 12px; color: var(--text-muted); display: flex; flex-direction: column; gap: 3px; }

.eval-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; margin-top: 10px; }
.eval-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--text-muted); }
.eval-form input, .eval-form select { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 14px; font-family: inherit; }
.eval-form .btn-zipzikeo-submit { height: 40px; }
.eval-form [hidden] { display: none; }
#eval-result { margin-top: 14px; }
.eval-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 14px; border: 1px solid #bae6fd; background: #f0f9ff; }
.eval-card h4 { font-size: 15px; font-weight: 800; }
.eval-lines p { font-size: 14px; margin-bottom: 6px; }
.eval-lines small { color: var(--text-muted); }
.eval-sites { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.eval-sites .section-note { flex-basis: 100%; }

.checklist { margin-left: 20px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.checklist li { font-size: 13px; }
.checklist b { display: block; font-size: 14px; }
.checklist span { color: var(--text-muted); }

/* ---------- 내 조건 맞춤 후보 ---------- */
.mine-panel { border-color: #fde68a; }
.mine-edit { margin-bottom: 10px; border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; background: #fffdf5; }
.mine-edit summary { cursor: pointer; font-size: 13px; color: var(--text-muted); }
.mine-edit summary b { color: var(--text-main); margin-right: 4px; }
.mine-edit-link { color: var(--primary); font-weight: 700; margin-left: 6px; }
.mine-form { margin-top: 12px; }
.place-pick { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 6px; }
.place-title { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.place-pick small { color: var(--text-light); font-weight: 500; }
.cand-list { list-style: none; display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.cand-list li { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid var(--border); background: #fff; }
.cand-rank { flex: none; width: 26px; height: 26px; border-radius: 50%; background: #fef3c7; color: #92400e; font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.cand-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.cand-main b { font-size: 14px; line-height: 1.35; }
.cand-main > small { color: var(--text-muted); font-size: 12px; }
.cand-bar { height: 6px; border-radius: 999px; background: #f1f5f9; overflow: hidden; }
.cand-bar span { display: block; height: 100%; background: #eab308; border-radius: 999px; }
.cand-parts { display: flex; flex-wrap: wrap; gap: 4px; }
.cand-parts span { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: #f0f9ff; color: #0c4a6e; }
.cand-parts span.zero { background: #f8fafc; color: var(--text-light); }
.cand-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.cand-score { font-size: 22px; font-weight: 800; color: #a16207; }
.cand-score small { font-size: 12px; margin-left: 1px; }
.mine-sub { font-size: 14px; font-weight: 800; margin: 16px 0 8px; }
.aging-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.aging-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 13px; padding: 9px 12px; border-radius: 10px; background: #fafaf9; border: 1px solid var(--border); }
.aging-list span { color: var(--text-muted); }
.aging-list .btn-mini { margin-left: auto; }

/* ---------- 청약·분양 ---------- */
.apply-card {
  display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 16px;
  background: #fff; border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.apply-card.status-open { border-color: #86efac; }
.apply-card.status-closed { background: #fafafa; }
.badge-flag { background: #f1f5f9; color: #334155; }
.apply-steps { list-style: none; display: flex; flex-direction: column; gap: 3px; padding: 8px 10px; border-radius: 10px; background: #f8fafc; }
.apply-steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.apply-steps li span { width: 110px; flex: none; color: var(--text-muted); }
.apply-steps li.past { opacity: 0.55; }
.apply-steps li.now b { color: #166534; }
.apply-steps li em { font-style: normal; font-size: 11px; font-weight: 700; color: #166534; background: #dcfce7; border-radius: 999px; padding: 1px 7px; }
.apply-models { border-top: 1px dashed var(--border); padding-top: 10px; }
.special-line { display: flex; flex-wrap: wrap; gap: 4px; font-size: 12px; }
.special-line span { padding: 2px 8px; border-radius: 999px; background: #f8fafc; color: var(--text-muted); }
.special-line span.mine { background: #fef3c7; color: #92400e; }
.special-line span.price { background: #f0f9ff; color: #0c4a6e; }
.event-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.event-list li { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 13px; }
.event-list li b { width: 44px; }
.event-list li small { color: var(--text-muted); margin-left: auto; }

@media (max-width: 720px) {
  .summary-stats { grid-template-columns: repeat(2, 1fr); }
  .redev-map { height: 320px; }
  .site-list { grid-template-columns: 1fr; }
  .panel { padding: 14px; border-radius: 16px; }
  .home-big { font-size: 28px; }
}
