* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: #f5f7f9;
  color: #222;
  line-height: 1.5;
}

header {
  background: #2e7d6b;
  color: #fff;
  padding: 20px 16px;
}
header h1 { margin: 0; font-size: 1.4rem; }
header a { color: #fff; text-decoration: none; }

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

/* 검색/필터 */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.filters select,
.filters input {
  padding: 10px 12px;
  font-size: 1rem;
  border: 1px solid #ccd3d9;
  border-radius: 8px;
  background: #fff;
}
.filters input { flex: 1; min-width: 180px; }
.cost-filters { margin-top: -8px; }
.cost-filters label { display: flex; align-items: center; gap: 6px; color: #555; font-size: 0.9rem; }
.cost-filters select { padding: 6px 10px; font-size: 0.95rem; }

.card .card-cost { color: #1f2933; }
.card-cost b { color: #2e7d6b; font-size: 1.05rem; }
.cost-none { color: #999; font-size: 0.9rem; font-weight: 400; }

/* 상세: 월 예상 비용 */
.cost-box .cost-filters { margin: 0 0 12px; }
.cost-total { font-size: 1.6rem; font-weight: 700; color: #2e7d6b; margin: 4px 0 12px; }
.cost-total small { font-size: 0.95rem; color: #666; font-weight: 400; }
.cost-lines { width: 100%; border-collapse: collapse; }
.cost-lines th, .cost-lines td { padding: 8px 0; border-bottom: 1px solid #eef0f2; text-align: left; vertical-align: top; font-weight: 400; }
.cost-lines td.num { text-align: right; font-weight: 700; white-space: nowrap; padding-left: 12px; }
.cost-lines .how { display: block; color: #777; font-size: 0.85rem; }

.count { color: #666; margin: 0 0 12px; font-size: 0.95rem; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.card {
  display: block;
  background: #fff;
  border: 1px solid #e2e7eb;
  border-radius: 12px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.card:hover { border-color: #2e7d6b; box-shadow: 0 2px 8px rgba(0,0,0,0.06); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2 { margin: 0; font-size: 1.1rem; }
.card p { margin: 6px 0 0; color: #555; font-size: 0.95rem; }

.empty { text-align: center; color: #777; padding: 40px 0; }

.filters select:disabled { color: #aaa; background: #f0f2f4; }

.more {
  display: block;
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  font-size: 1rem;
  color: #2e7d6b;
  background: #fff;
  border: 1px solid #2e7d6b;
  border-radius: 8px;
  cursor: pointer;
}
.more:hover { background: #e3f1ed; }
.more[hidden] { display: none; }

/* 등급 배지 */
.grade {
  display: inline-block;
  min-width: 2.2em;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  text-align: center;
  white-space: nowrap;
}
.grade-A { background: #d8f3e8; color: #1b6b4f; }
.grade-B { background: #e1effc; color: #1d5a94; }
.grade-C { background: #fdf3d6; color: #8a6400; }
.grade-D { background: #fde6d8; color: #9a4a12; }
.grade-E { background: #fbdede; color: #9b1c1c; }

/* 구 표시 태그 */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: #e3f1ed;
  color: #2e7d6b;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.grade-none { background: #eef0f2; color: #888; font-weight: 500; }

/* 아직 없는 정보 */
.pending { color: #999; }

/* 보조 설명 (평가 연도 등) */
.sub { display: block; color: #777; font-size: 0.9rem; margin-top: 4px; }

/* 상세 */
.back { display: inline-block; margin-bottom: 16px; color: #2e7d6b; text-decoration: none; }
.back:hover { text-decoration: underline; }
.detail {
  background: #fff;
  border: 1px solid #e2e7eb;
  border-radius: 12px;
  padding: 24px;
}
.detail h2 { margin: 0 0 20px; font-size: 1.5rem; }
.detail dl { margin: 0; display: grid; grid-template-columns: 100px 1fr; row-gap: 14px; }
.detail dt { color: #666; font-weight: 600; }
.detail dd { margin: 0; }
.detail a { color: #2e7d6b; }

@media (max-width: 480px) {
  .detail dl { grid-template-columns: 1fr; row-gap: 4px; }
  .detail dd { margin-bottom: 10px; }
}

footer { text-align: center; color: #888; font-size: 0.85rem; padding: 0 16px 24px; }

/* 상세 정보 (비용·직원·방 구성·프로그램) */
.detail.extra { margin-top: 16px; }
.detail h3 { margin: 0 0 14px; font-size: 1.15rem; }
.detail h3 small, .detail h4 small { color: #777; font-weight: 500; font-size: 0.85rem; margin-left: 4px; }
.note { color: #777; font-size: 0.85rem; margin: 12px 0 0; }
.free { color: #555; margin: 10px 0 0; }

.costs { width: 100%; border-collapse: collapse; }
.costs th, .costs td { padding: 8px 0; border-bottom: 1px solid #eef0f2; text-align: left; vertical-align: top; }
.costs th { font-weight: 600; width: 9em; }
.costs .num { font-weight: 700; white-space: nowrap; padding-right: 16px; }
.costs .basis { color: #666; font-size: 0.9rem; }
.costs tr.cost-cont > * { border-bottom: none; padding-bottom: 2px; }

.stats {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px;
}
.stats li {
  display: flex; justify-content: space-between; gap: 8px;
  background: #f5f7f9; border-radius: 8px; padding: 8px 12px;
}
.stats li span { color: #555; min-width: 0; }
.stats li b { white-space: nowrap; }
.stats.rooms li { background: #e3f1ed; }
.facilities { color: #555; margin: 12px 0 0; font-size: 0.95rem; }

.pgm-group { margin-top: 12px; }
.pgm-group h4 { margin: 0 0 6px; font-size: 1rem; color: #2e7d6b; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: #f5f7f9; border: 1px solid #e2e7eb; border-radius: 999px; padding: 2px 10px; font-size: 0.9rem; }
details summary { cursor: pointer; color: #2e7d6b; font-weight: 600; }

@media (max-width: 480px) {
  .detail { padding: 18px 16px; }
  .costs th { width: auto; }
  .costs tr { display: grid; grid-template-columns: 1fr auto; }
  .costs .basis { grid-column: 1 / -1; padding-top: 0; }
}

/* 비교 담기 */
.list li { position: relative; }
.list .compare-btn { position: absolute; right: 16px; bottom: 14px; }
.compare-btn {
  padding: 6px 12px; font-size: 0.9rem; border-radius: 999px; cursor: pointer;
  border: 1px solid #2e7d6b; background: #fff; color: #2e7d6b;
}
.compare-btn.on { background: #2e7d6b; color: #fff; }
.detail-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.detail-title h2 { margin: 0; }
.detail-title .compare-btn { flex-shrink: 0; margin-top: 4px; }

.compare-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: #fff; border-top: 1px solid #dde3e8;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}
.compare-bar[hidden] { display: none; }
body.has-compare-bar { padding-bottom: 72px; }
.link-btn { background: none; border: none; color: #777; text-decoration: underline; cursor: pointer; font-size: 0.9rem; padding: 0; }
.compare-go { background: #2e7d6b; color: #fff; text-decoration: none; padding: 8px 18px; border-radius: 8px; font-weight: 600; }
.compare-go.disabled { background: #cfd8dc; color: #fff; cursor: default; }

/* 비교 화면 */
.compare-controls { margin-bottom: 12px; }
.compare-wrap { overflow-x: auto; background: #fff; border: 1px solid #e2e7eb; border-radius: 12px; }
.compare-table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 560px; }
.compare-table th, .compare-table td { padding: 10px 12px; border-bottom: 1px solid #eef0f2; text-align: left; vertical-align: top; }
.compare-table thead th { background: #f5f7f9; }
.compare-table thead th a { color: #1f2933; font-size: 1.05rem; }
.compare-table th[scope="row"] { width: 130px; color: #666; font-weight: 600; background: #fafbfc; }
.compare-table .sub { display: block; color: #888; font-size: 0.85rem; }
.compare-table .best { background: #e3f1ed; }
.compare-table th[scope="row"] { position: sticky; left: 0; z-index: 1; }
.page-title { margin: 12px 0 12px; font-size: 1.4rem; }
.compare-table .group th { background: #eef3f1; color: #2e7d6b; font-size: 0.95rem; }
.compare-table .remove { margin-top: 6px; }
.compare-table td a { color: #2e7d6b; }
.swipe-hint { display: none; color: #888; font-size: 0.85rem; text-align: center; margin: 0 0 8px; }
@media (max-width: 600px) {
  .compare-table th[scope="row"] { width: 96px; }
  .swipe-hint { display: block; }
}

/* 추정 표시와 근거 */
.estimate { display: inline-block; font-size: 0.75rem; font-weight: 600; color: #8a6400; background: #fdf3d6; border-radius: 4px; padding: 1px 6px; vertical-align: middle; }
.list-divider { list-style: none; margin: 12px 0 0; padding: 8px 12px; color: #555; font-size: 0.9rem; background: #eef3f1; border-radius: 8px; }
.basis-list { margin: 12px 0 0; padding-left: 18px; color: #555; font-size: 0.88rem; }
.basis-list li { margin: 4px 0; }
