:root {
  --bg: #f6f7f9;
  --card: #ffffff;
  --text: #1b1f24;
  --muted: #6b7280;
  --line: #e5e7eb;
  --navy: #0B1220;
  --navy-2: #1B2740;
  --orange: #FF7A1A;
  --sky: #38BDF8;
  --brand: #E8650C;
  --brand-weak: #FFF1E6;
  --link: #0284C7;
  --ok: #0f9d58;
  --ok-weak: #e6f6ee;
  --warn: #b45309;
  --warn-weak: #fdf3e6;
  --danger: #d93025;
  --radius: 10px;
  --font: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.6 var(--font); }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }

/* 헤더 */
.hd { background: var(--navy); border-bottom: 1px solid #000; position: sticky; top: 0; z-index: 10; color: #E2E8F0; }
.logo img { height: 30px; display: block; }
.hd .btn { background: var(--navy-2); border-color: #2A3A5C; color: #E2E8F0; }
.hd .btn:hover { border-color: #3B4F7A; }
.hd .btn.primary { background: var(--orange); border-color: var(--orange); color: var(--navy); font-weight: 600; }
.hd .menu-btn { color: #E2E8F0; }
.hd .hd-search input { background: var(--navy-2); border-color: #2A3A5C; color: #E2E8F0; }
.hd .hd-search input::placeholder { color: #8A97AD; }
.hd-top { display: flex; align-items: center; gap: 12px; height: 56px; }
.logo { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.logo b { color: var(--brand); }
.hd-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.nav { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 10px 12px; white-space: nowrap; color: #94A3B8; border-bottom: 2px solid transparent; font-size: 14px; }
.nav a:hover { text-decoration: none; color: #fff; }
.nav a.on { color: #fff; font-weight: 600; border-color: var(--orange); }

/* 버튼 */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.btn:hover { text-decoration: none; border-color: #cbd2db; }
.btn.primary { background: var(--orange); border-color: var(--orange); color: var(--navy); font-weight: 600; }
.btn.primary:hover { background: #F26B0F; }
.btn.danger { color: var(--danger); }
.btn.sm { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* 레이아웃 */
main, main.wrap { padding-top: 20px; padding-bottom: 48px; min-height: 60vh; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; margin: 4px 0 4px; }
.page-desc { color: var(--muted); margin: 0 0 16px; font-size: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sp { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* 홈 */
.hero { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px 24px; margin-bottom: 16px; }
.hero h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -0.02em; }
.hero p { margin: 0 0 16px; color: var(--muted); }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.sec-h h2 { font-size: 16px; margin: 0; }
.sec-h a { font-size: 13px; color: var(--muted); }
.notice-bar { background: var(--brand-weak); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a.item { display: block; padding: 11px 2px; }
.list a.item:hover { text-decoration: none; background: #fafbfc; }
.item-t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-m { font-size: 12px; color: var(--muted); display: flex; gap: 8px; flex-wrap: wrap; margin-top: 2px; }
.cc { color: var(--brand); font-weight: 600; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; font-size: 14px; }

.badge { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 5px; background: #eef0f3; color: #374151; vertical-align: 1px; white-space: nowrap; }
.badge.open { background: var(--warn-weak); color: var(--warn); }
.badge.solved { background: var(--ok-weak); color: var(--ok); }
.badge.closed { background: #eef0f3; color: var(--muted); }
.badge.brand { background: var(--brand-weak); color: var(--brand); }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.chip { padding: 5px 11px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: 13px; cursor: pointer; }
.chip.on { background: var(--text); color: #fff; border-color: var(--text); }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar input { flex: 1; min-width: 160px; }
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 16px; }

/* 폼 */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
input[type=text], input[type=number], input[type=search], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand-weak); border-color: var(--brand); }
textarea { min-height: 260px; resize: vertical; line-height: 1.6; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.alert { border-radius: 8px; padding: 10px 14px; font-size: 13px; margin-bottom: 14px; background: var(--warn-weak); color: #7c3d06; }
.alert.info { background: var(--brand-weak); color: #0b4a96; }
.err { color: var(--danger); font-size: 13px; min-height: 18px; }

/* 글 보기 */
.post-h { border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 16px; }
.post-h h1 { font-size: 21px; margin: 6px 0; letter-spacing: -0.02em; }
.post-body { white-space: pre-wrap; word-break: break-word; line-height: 1.75; }
.facts { display: flex; gap: 16px; flex-wrap: wrap; background: #fafbfc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; font-size: 14px; }
.facts b { font-weight: 600; margin-right: 6px; color: var(--muted); }
.imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-top: 16px; }
.imgs img { width: 100%; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }
.cmt { border-top: 1px solid var(--line); padding: 12px 0; }
.cmt.accepted { background: var(--ok-weak); border-radius: 8px; padding: 12px; border-top: 0; margin: 6px 0; }
.cmt-m { font-size: 12px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cmt-b { white-space: pre-wrap; word-break: break-word; margin-top: 4px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 12px; }
.linkbtn:hover { color: var(--text); text-decoration: underline; }

/* 견적 */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.seg button { border: 0; background: var(--card); padding: 8px 18px; cursor: pointer; }
.seg button.on { background: var(--text); color: #fff; }
.qgrid { display: grid; grid-template-columns: minmax(280px, 380px) 1fr; gap: 16px; align-items: start; }
@media (max-width: 820px) { .qgrid { grid-template-columns: 1fr; } }
.qin .r { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.qin .r > span { width: 110px; flex: none; font-size: 13px; color: var(--muted); }
.qin .r input[type=number] { width: 90px; }
.qin .r select { flex: 1; }
.qin .units .u { display: flex; gap: 6px; margin-bottom: 6px; }
.qin .units .u select { flex: 1; }
.qin .units .u input { width: 70px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { border: 1px solid var(--line); border-radius: 7px; padding: 4px 10px; font-size: 13px; cursor: pointer; user-select: none; }
.checks label:has(input:checked) { background: var(--brand-weak); border-color: var(--brand); }
.checks input { display: none; }
table.qt { width: 100%; border-collapse: collapse; font-size: 14px; }
table.qt th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 6px 4px; }
table.qt td { border-bottom: 1px solid var(--line); padding: 5px 4px; vertical-align: middle; }
table.qt td.num, table.qt th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.qt input { padding: 5px 7px; font-size: 14px; }
table.qt input.q { width: 70px; text-align: right; }
table.qt input.p { width: 110px; text-align: right; }
table.qt input.nm { min-width: 120px; }
table.qt tr.noprice input.p { border-color: #f0b25a; background: var(--warn-weak); }
.qsum { margin-top: 12px; display: grid; gap: 4px; justify-content: end; text-align: right; font-variant-numeric: tabular-nums; }
.qsum .tot { font-size: 20px; font-weight: 700; }

/* 문서 */
.doc { max-width: 820px; }
.doc h1 { font-size: 22px; }
.doc h2 { font-size: 17px; margin-top: 28px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; margin: 8px 0; }
.doc th, .doc td { border: 1px solid var(--line); padding: 7px 9px; text-align: left; vertical-align: top; }
.doc th { background: #fafbfc; }
@media (max-width: 640px) { .doc table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; } .doc th, .doc td { min-width: 72px; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.draft { background: var(--warn-weak); color: #7c3d06; padding: 10px 14px; border-radius: 8px; font-size: 13px; }

/* 로그인 */
.login-box { max-width: 380px; margin: 24px auto; }
.sns { display: flex; width: 100%; height: 46px; border-radius: 8px; align-items: center; justify-content: center; font-weight: 600; margin-bottom: 10px; border: 1px solid var(--line); cursor: pointer; }
.sns:hover { text-decoration: none; filter: brightness(0.97); }
.sns.naver { background: #03c75a; color: #fff; border-color: #03c75a; }
.sns.kakao { background: #fee500; color: #191919; border-color: #fee500; }
.sns.google { background: #fff; color: #1f1f1f; }
.consent { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 8px; }
.consent label { display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.consent details { margin: 6px 0 0 26px; font-size: 13px; color: var(--muted); }
.consent table { border-collapse: collapse; font-size: 12px; margin-top: 6px; width: 100%; }
.consent th, .consent td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; }

/* 광고 */
.ad-slot { margin: 16px 0; min-height: 0; }

/* 푸터 */
.ft { border-top: 1px solid var(--line); background: var(--card); padding: 20px 0 28px; font-size: 13px; color: var(--muted); }
.ft-links { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.ft-links a.b { color: var(--text); font-weight: 600; }

/* 인쇄 (견적서) */
@media print {
  .hd, .ft, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: 0; padding: 0; }
}

/* ---------- 커뮤니티 구조 (홈 포털, 사이드, 베스트) ---------- */
.menu-btn { border: 0; background: none; font-size: 20px; cursor: pointer; padding: 4px 6px; margin-left: -6px; }
.hd-search { flex: 1; max-width: 320px; margin-left: 8px; }
.hd-search input { padding: 6px 10px; font-size: 13px; background: var(--bg); }
@media (max-width: 640px) { .hd-search { display: none; } }
.mega { border-top: 1px solid var(--line); background: var(--card); box-shadow: 0 8px 16px rgba(0,0,0,.06); }
.mega-in { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px 20px; padding-top: 14px; padding-bottom: 16px; }
.mega h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.mega a { display: block; padding: 4px 0; font-size: 14px; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .layout { grid-template-columns: minmax(0, 1fr); } }
.side { position: sticky; top: 112px; display: grid; gap: 12px; }
@media (max-width: 900px) { .side { position: static; } }
.side-box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.side-box h3 { font-size: 14px; margin: 0 0 8px; }
ol.hot { list-style: none; margin: 0; padding: 0; }
ol.hot li a { display: flex; gap: 8px; padding: 5px 0; font-size: 13px; align-items: baseline; }
ol.hot li a b { color: var(--brand); width: 16px; flex: none; font-variant-numeric: tabular-nums; }
ol.hot .t, ul.dense .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.boards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 12px; }
.boards-grid > *, .layout > * { min-width: 0; }
.bx { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.bx-h { display: flex; justify-content: space-between; align-items: baseline; border-bottom: 1px solid var(--line); padding-bottom: 6px; margin-bottom: 4px; }
.bx-h a.n { font-weight: 700; font-size: 15px; color: var(--brand); }
.bx-h a.more { font-size: 12px; color: var(--muted); }
ul.dense { list-style: none; margin: 0; padding: 0; }
ul.dense li a { display: flex; gap: 6px; align-items: baseline; padding: 4px 0; font-size: 14px; }
ul.dense li a:hover { text-decoration: none; }
ul.dense li a:hover .t { text-decoration: underline; }
ul.dense .empty { padding: 14px 0; }
.cat { font-size: 12px; color: var(--muted); flex: none; }
.pic { font-size: 11px; color: var(--ok); flex: none; }
ul.dense .cc, ol.hot .cc { font-size: 12px; flex: none; }

.strip { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px; }
.strip b { font-size: 15px; }

.badge.best { background: #fde8e8; color: #c62828; }
.badge.staff { background: #0B1220; color: #fff; }
.badge.hot { background: #fff1e0; color: #c25e00; }
.badge.notice { background: var(--text); color: #fff; }
li.pinned { background: #fafbfc; }
.list a.item.has-thumb { display: flex; gap: 10px; align-items: center; }
.thumb { width: 56px; height: 56px; object-fit: cover; border-radius: 6px; flex: none; border: 1px solid var(--line); }
.item-body { min-width: 0; flex: 1; }
.item-m .up { color: #c62828; }

.votes { display: flex; gap: 10px; justify-content: center; margin: 24px 0 4px; }
.vote { border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 20px; cursor: pointer; display: grid; justify-items: center; min-width: 96px; }
.vote b { font-size: 18px; font-variant-numeric: tabular-nums; }
.vote.on.up { border-color: #c62828; color: #c62828; background: #fff5f5; }
.vote.on.down { border-color: var(--muted); background: #f3f4f6; }
.vote-hint { text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- 브랜드 (열교환소) ---------- */
.cc { color: var(--link); }
.bx-h a.n { color: var(--navy); }
.bx-h a.n::before { content: ''; display: inline-block; width: 4px; height: 14px; background: var(--orange); border-radius: 2px; margin-right: 7px; vertical-align: -1px; }
ol.hot li a b { color: var(--orange); }
.sec-h h2, .side-box h3 { color: var(--navy); }
.mega { background: var(--navy); border-top-color: #1E293B; }
.mega h4 { color: #64748B; }
.mega a { color: #E2E8F0; }
.notice-bar { background: #EAF6FD; }

.banner { position: relative; border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; background: var(--navy); }
.banner img { display: block; width: 100%; height: auto; }
.banner a.hit { position: absolute; border-radius: 10px; }
.banner a.hit:focus-visible { outline: 3px solid var(--sky); }
.banner-m { display: none; background: var(--navy); color: #F8FAFC; border-radius: var(--radius); padding: 22px 20px; margin-bottom: 12px; }
.banner-m .tag { display: inline-block; font-size: 12px; color: #CBD5E1; border: 1px solid #334155; border-radius: 999px; padding: 3px 10px; margin-bottom: 10px; }
.banner-m h2 { margin: 0 0 8px; font-size: 22px; line-height: 1.35; letter-spacing: -0.02em; }
.banner-m h2 em { font-style: normal; color: var(--orange); }
.banner-m p { margin: 0 0 14px; color: #94A3B8; font-size: 14px; }
.banner-m .btn.ghost { background: transparent; border-color: var(--sky); color: var(--sky); }
@media (max-width: 640px) { .banner { display: none; } .banner-m { display: block; } }

.ft .ft-logo { height: 24px; margin-bottom: 8px; display: block; }
.login-symbol { width: 56px; height: 56px; display: block; margin: 0 auto 10px; }

/* 점검 수정: 긴 제목이 사이드 칸을 밀어내는 문제 */
.side > * { min-width: 0; }
.side-box { overflow: hidden; }
ol.hot li a .t, ul.dense li a .t { flex: 1 1 auto; }

/* 점검 수정: 푸터 바닥 고정, 스크롤바 폭 흔들림 방지 */
body { min-height: 100vh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }

/* 점검 수정: 모바일 터치 영역·필터 줄 */
@media (max-width: 640px) {
  .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: -16px; margin-right: -16px; padding: 0 16px; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; padding: 7px 12px; }
  .linkbtn { padding: 6px 4px; font-size: 13px; }
  .bx-h a.more { padding: 6px 0 6px 10px; }
  .ft-links a { padding: 6px 0; display: inline-block; }
  ul.dense li a { padding: 7px 0; }
  ol.hot li a { padding: 7px 0; }
  .page-title { font-size: 20px; }
}
