/* ============================================================
   라떼는 — 공통 스타일
   - 모든 페이지가 이 파일 하나를 공유합니다.
   - 색·글꼴을 바꾸고 싶으면 아래 :root 변수만 수정하면
     사이트 전체에 한 번에 반영됩니다.
   - 테마: 따뜻한 라떼(크림 배경 + 카라멜 포인트)
   ============================================================ */
@import url("https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/variable/pretendardvariable-dynamic-subset.min.css");

:root {
  --bg: #f4f5f7;           /* 연회색 페이지 배경 (네이버·토스 톤) */
  --card: #ffffff;
  --text: #1e2124;         /* near-black */
  --sub: #6b7280;          /* 뉴트럴 그레이 */
  --accent: #9a6338;       /* 커피 브라운 (포인트로만 사용) */
  --accent-dark: #7c4e2b;
  --accent-soft: #f2ebe3;
  --border: #e7e9ec;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(30, 33, 36, .06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Malgun Gothic", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}
.container { max-width: 920px; margin: 0 auto; padding: 0 20px; }
a { color: var(--accent-dark); text-decoration: none; }

/* ---------- 상단 공통 메뉴 (GNB) ---------- */
.gnb {
  position: sticky; top: 0; z-index: 50;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.gnb-inner { display: flex; align-items: center; gap: 16px; height: 56px; }
.gnb-logo {
  display: flex; align-items: center; gap: 7px; flex-shrink: 0;
  font-weight: 800; font-size: 21px; color: var(--text); letter-spacing: -.5px;
}
.gnb-logo .logo-mark { width: 24px; height: 24px; color: var(--accent); }
.gnb-menu {
  display: flex; gap: 4px; overflow-x: auto; white-space: nowrap;
  -ms-overflow-style: none; scrollbar-width: none;
}
.gnb-menu::-webkit-scrollbar { display: none; }
.gnb-menu a { color: var(--sub); font-weight: 600; font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.gnb-menu a:hover { background: var(--accent-soft); color: var(--accent-dark); }
.gnb-menu a.active { background: var(--accent-soft); color: var(--accent-dark); }

main.container { padding-top: 28px; padding-bottom: 48px; min-height: calc(100vh - 260px); }

/* ---------- 홈 히어로 ---------- */
.hero { text-align: center; padding: 40px 0 8px; }
.hero h1 {
  font-size: 33px; font-weight: 800; letter-spacing: -1px;
  margin: 0 0 10px; line-height: 1.3;
}
.hero h1 .accent { color: var(--accent); }
.hero p { color: var(--sub); margin: 0 0 22px; }
.search-box { max-width: 480px; margin: 0 auto; }
.search-box input {
  width: 100%; padding: 14px 20px; font-size: 16px;
  border: 1.5px solid var(--border); border-radius: 999px;
  outline: none; background: var(--card); box-shadow: var(--shadow);
}
.search-box input:focus { border-color: var(--accent); }

/* ---------- 도구 카드 그리드 ---------- */
.section-title { font-size: 18px; font-weight: 700; margin: 34px 0 12px; }
.section-title .more { float: right; font-size: 14px; font-weight: 600; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.sub-head {
  grid-column: 1 / -1; font-size: 14px; font-weight: 700; color: var(--accent-dark);
  margin: 10px 2px 0; padding-left: 8px; border-left: 3px solid var(--accent);
}
.sub-head:first-child { margin-top: 0; }
.tool-card {
  display: block; background: var(--card);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; color: var(--text);
  transition: border-color .12s, box-shadow .12s;
}
a.tool-card:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(30, 33, 36, .08); }
.tool-card .icon { width: 34px; height: 34px; color: var(--accent); }
.tool-card .icon svg { width: 100%; height: 100%; }
.tool-card h3 { margin: 10px 0 4px; font-size: 17px; }
.tool-card p { margin: 0; color: var(--sub); font-size: 14px; }
.tool-card.disabled { opacity: .55; cursor: default; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 700; color: var(--sub);
  background: #f0e7db; border-radius: 6px; padding: 2px 8px;
  margin-left: 6px; vertical-align: 2px;
}
.badge.sample { color: #0F6E56; background: #E1F5EE; }

/* ---------- 페이지 공통 ---------- */
.page-title {
  font-size: 26px; font-weight: 800; letter-spacing: -.7px; margin: 8px 0 4px;
  display: flex; align-items: center; gap: 10px;
}
.page-title .title-icon { width: 28px; height: 28px; color: var(--accent); flex-shrink: 0; }
.page-desc { color: var(--sub); margin: 0 0 20px; }
.panel {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); margin-bottom: 20px;
}
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--sub); margin-bottom: 6px; }
.field .hint { font-size: 13px; color: var(--accent-dark); margin-top: 4px; min-height: 16px; }
.field input[type="text"], .field input[type="number"], .field select {
  width: 100%; padding: 12px 14px; font-size: 16px;
  border: 1.5px solid var(--border); border-radius: 10px;
  outline: none; background: #fff; color: var(--text);
}
.field input:focus, .field select:focus { border-color: var(--accent); }
.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1; }

/* 세그먼트 (버튼처럼 생긴 선택지) */
.seg { display: flex; background: #f0e7db; border-radius: 10px; padding: 4px; gap: 4px; }
.seg label { flex: 1; cursor: pointer; margin: 0; }
.seg input { display: none; }
.seg span {
  display: block; text-align: center; padding: 9px 6px; border-radius: 8px;
  font-size: 14.5px; font-weight: 600; color: var(--sub); user-select: none;
}
.seg input:checked + span { background: #fff; color: var(--accent-dark); box-shadow: 0 1px 3px rgba(80, 60, 40, .14); }

.btn {
  display: block; width: 100%; padding: 14px; font-size: 16.5px; font-weight: 700;
  color: #fff; background: var(--accent); border: none; border-radius: 12px; cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-inline {
  padding: 4px 12px; font-size: 13.5px; font-weight: 700; color: #fff;
  background: var(--accent); border: none; border-radius: 8px; cursor: pointer;
}
.btn-sm {
  padding: 8px 14px; font-size: 14px; font-weight: 700; color: var(--accent-dark);
  background: var(--accent-soft); border: none; border-radius: 9px; cursor: pointer;
}
.btn-sm:hover { background: #ecdcc7; }

/* 결과 요약 카드 */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 8px; }
.stat { background: var(--accent-soft); border-radius: 12px; padding: 14px 16px; }
.stat .k { font-size: 13px; color: var(--accent-dark); font-weight: 600; }
.stat .v { font-size: 19px; font-weight: 800; margin-top: 2px; word-break: keep-all; }
.stat .s { font-size: 12.5px; color: var(--sub); margin-top: 2px; }
.stat.hi { background: var(--accent); }
.stat.hi .k { color: #f3e3d0; }
.stat.hi .v { color: #fff; }
.stat.hi .s { color: #f3e3d0; }

/* 표 */
.table-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--border); border-radius: 10px; }
table.sheet { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.sheet th, .sheet td { padding: 8px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sheet th { position: sticky; top: 0; background: #f6efe6; font-weight: 700; color: var(--sub); }
.sheet tr:last-child td { border-bottom: none; }
.sheet td:first-child, .sheet th:first-child { text-align: center; color: var(--sub); }

/* 안내문 / 오류 */
.note { font-size: 13.5px; color: var(--sub); background: #f6efe6; border-radius: 10px; padding: 12px 14px; margin-top: 16px; }
.error-box { background: #fdecea; color: #c0392b; }

/* 광고 자리 (애드센스 승인 후 이 자리에 광고 코드를 넣습니다) */
.ad-slot {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  color: #c2b39f; background: #fdfbf8;
  display: flex; align-items: center; justify-content: center;
  height: 90px; font-size: 13px; letter-spacing: .5px; margin: 24px 0;
}

/* ---------- 라떼블로그 ---------- */
.tabs { display: flex; gap: 8px; margin: 0 0 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  color: var(--sub); background: var(--card); border: 1.5px solid var(--border); cursor: pointer;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.post-item {
  display: block; padding: 16px 4px; border-bottom: 1px solid var(--border); color: var(--text);
}
.post-item:last-child { border-bottom: none; }
.post-item:hover .post-title { color: var(--accent-dark); }
.post-meta { font-size: 12.5px; color: var(--sub); display: flex; align-items: center; gap: 8px; }
.post-meta .badge { margin-left: 0; }
.post-title { font-size: 17px; font-weight: 700; margin: 6px 0 4px; }
.post-summary { font-size: 14px; color: var(--sub); }

.post-body { font-size: 16px; line-height: 1.75; }
.post-body h2 { font-size: 20px; margin: 28px 0 10px; }
.post-body p { margin: 10px 0; }
.post-body ul { padding-left: 22px; margin: 10px 0; }
.post-body li { margin: 4px 0; }
.post-body a { text-decoration: underline; text-underline-offset: 3px; }
.related-box {
  display: block; margin-top: 24px; padding: 16px 18px;
  background: var(--accent-soft); border-radius: 12px;
  font-weight: 700; color: var(--accent-dark);
}
.related-box:hover { background: #ecdcc7; }

/* ---------- 이미지 도구 ---------- */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; color: var(--sub);
  background: var(--card); cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon { width: 40px; height: 40px; color: var(--accent); margin: 0 auto 10px; }
.dropzone .dz-icon svg { width: 100%; height: 100%; }
.result-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.result-row:last-child { border-bottom: none; }
.result-row img { width: 52px; height: 52px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); flex-shrink: 0; }
.result-info { flex: 1; min-width: 0; }
.result-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-size { font-size: 13px; color: var(--sub); }
.save-good { color: #2e7d4f; font-weight: 700; }
.save-bad { color: #c0392b; font-weight: 700; }

/* ---------- 정부지원금 조회 ---------- */
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 600;
  color: var(--sub); background: var(--card); border: 1.5px solid var(--border); cursor: pointer;
}
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.gs-count { font-size: 14px; color: var(--sub); margin: 4px 2px 12px; }
.gs-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.gs-main { flex: 1; min-width: 0; }
.gs-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 7px; }
.gs-badge {
  font-size: 12px; font-weight: 700; border-radius: 6px; padding: 2px 8px;
  color: var(--accent-dark); background: var(--accent-soft);
}
.gs-badge.region { color: #185FA5; background: #E6F1FB; }
.gs-badge.soon { color: #A32D2D; background: #FCEBEB; }
.gs-badge.always { color: #5F5E5A; background: #F1EFE8; }
.gs-title { font-size: 16.5px; font-weight: 700; margin: 0 0 3px; word-break: keep-all; }
.gs-summary { font-size: 14px; color: var(--sub); margin: 0 0 6px; }
.gs-meta { font-size: 12.5px; color: var(--sub); }
.gs-meta b { color: var(--text); font-weight: 700; }
.gs-actions { flex-shrink: 0; }
.gs-actions .btn-sm { display: inline-block; white-space: nowrap; }

@media (max-width: 640px) {
  .gs-card { flex-direction: column; align-items: stretch; }
  .gs-actions .btn-sm { width: 100%; text-align: center; padding: 10px; }
}

/* ---------- 트렌드·순위 ---------- */
.trend-cols { display: flex; gap: 14px; }
.trend-cols > * { flex: 1; min-width: 0; margin-bottom: 0; }
.trend-col-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.trend-col-head h3 { margin: 0; font-size: 16px; }
.trend-col-head .src { font-size: 12px; color: var(--sub); }
@media (max-width: 640px) { .trend-cols { flex-direction: column; } }
.rank-list { }
.rank-row { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--border); }
.rank-row:last-child { border-bottom: none; }
.rank-num {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 15px; color: var(--sub); background: #f0e7db;
}
.rank-row.top .rank-num { color: #fff; background: var(--accent); }
.rank-name { flex: 1; min-width: 0; font-size: 16px; font-weight: 600; word-break: keep-all; }
.rank-name .g { font-size: 12.5px; color: var(--sub); font-weight: 400; margin-left: 6px; }
.rank-meta { flex-shrink: 0; font-size: 13px; color: var(--sub); }
.delta-up { color: #A32D2D; font-weight: 700; }
.delta-down { color: #185FA5; font-weight: 700; }
.delta-same { color: var(--sub); }
.share-bar { flex-shrink: 0; width: 84px; }
.share-bar .track { height: 8px; background: #f0e7db; border-radius: 999px; overflow: hidden; }
.share-bar .fill { height: 100%; background: var(--accent); border-radius: 999px; }
.share-bar .pct { font-size: 12px; color: var(--sub); margin-top: 3px; text-align: right; }

/* ---------- 금리 비교 ---------- */
.rate-row { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--border); }
.rate-row:last-child { border-bottom: none; }
.rate-rank {
  flex-shrink: 0; width: 26px; height: 26px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 14px; color: var(--sub); background: #eef0f3;
}
.rate-row.best .rate-rank { color: #fff; background: var(--accent); }
.rate-info { flex: 1; min-width: 0; }
.rate-bank { font-size: 15.5px; font-weight: 700; }
.rate-product { font-size: 12.5px; color: var(--sub); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rate-figure { flex-shrink: 0; text-align: right; }
.rate-main { font-size: 18px; font-weight: 800; color: var(--accent-dark); }
.rate-side { font-size: 12px; color: var(--sub); }
.rate-row .btn-sm { flex-shrink: 0; }

/* ---------- 푸터 ---------- */
.site-footer {
  border-top: 1px solid var(--border); background: #fff;
  padding: 28px 0 36px; color: var(--sub); font-size: 13px;
}
.site-footer .footer-brand {
  font-weight: 800; color: var(--text); font-size: 16px; margin: 0 0 8px; letter-spacing: -.3px;
}
.site-footer p { margin: 4px 0; }

/* ---------- 모바일 ---------- */
@media (max-width: 640px) {
  .hero { padding-top: 20px; }
  .hero h1 { font-size: 26px; }
  .page-title { font-size: 23px; }
  .panel { padding: 18px; }
  .stats { grid-template-columns: 1fr 1fr; }
}
