:root {
  --indigo: #1a3c6e;
  --indigo-dark: #12294d;
  --sakura: #e8607a;
  --bg: #f7f7f5;
  --card-bg: #ffffff;
  --border: #e5e5e2;
  --text: #2b2b28;
  --text-muted: #767672;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  overflow-x: hidden;
  max-width: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--indigo);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 20px 12px;
}

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

.brand {
  display: flex;
  align-items: center;
  padding: 8px 10px 20px;
}

.brand-logo {
  width: 170px;
  height: auto;
  display: block;
  background: #fff;
  border-radius: 6px;
  padding: 4px 8px;
}

/* 모바일 햄버거 버튼 (데스크톱에서는 숨김) */
.hamburger-btn {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 34px;
  height: 34px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  flex-shrink: 0;
}

.hamburger-btn span {
  display: block;
  width: 100%;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}


.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  text-align: left;
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
}

.nav-item.active {
  background: rgba(255,255,255,0.16);
  color: #fff;
  font-weight: 600;
}

.nav-item.ai-nav {
  margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-top: 12px;
}

.badge {
  margin-left: auto;
  background: var(--sakura);
  color: #fff;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
}

.sidebar-ad { margin-top: 12px; }

/* Main */
.main {
  flex: 1;
  padding: 32px 40px;
  max-width: 960px;
}

.view-header h1 {
  margin: 0 0 4px;
  font-size: 26px;
}

.view-header .sub {
  color: var(--text-muted);
  margin: 0 0 20px;
  font-size: 14px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.card h3 {
  margin: 0 0 12px;
  font-size: 15px;
}

.card.highlight {
  background: linear-gradient(135deg, var(--indigo), #2c5aa0);
  color: #fff;
  border: none;
}

.card.highlight p { color: rgba(255,255,255,0.9); }

.preview-list {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--text-muted);
}

.preview-list li { padding: 4px 0; }

.link-btn {
  background: none;
  border: none;
  color: var(--indigo);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  text-decoration: none;
  display: inline-block;
}

.cta-btn {
  background: var(--sakura);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
  display: inline-block;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--sakura);
  width: 0%;
  transition: width 0.3s ease;
}

.progress-wrap span {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}

/* Content helpers */
.step-list {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.8;
}

.step-list li { padding: 2px 0; }

.info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
  display: block;
  overflow-x: auto;
  white-space: nowrap;
}

.info-table th, .info-table td {
  border: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.info-table th {
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 700;
}

.update-card {
  background: #eef4ff;
  border-color: #cddcf5;
  font-size: 14px;
  line-height: 1.6;
}

/* Auto blog posts */
.posts-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.post-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.post-card:hover {
  border-color: var(--indigo);
}

.post-card-body {
  padding: 14px 16px;
}

/* 카테고리별 아이캐쳐 배너 (실사 이미지 대신 그라데이션+이모지) */
.post-card-banner {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.post-detail-banner {
  height: 160px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  margin-bottom: 16px;
}

.cat-visa { background: linear-gradient(135deg, #1a3c6e, #3a5ba0); }
.cat-housing { background: linear-gradient(135deg, #c97b4a, #e8a75f); }
.cat-hospital { background: linear-gradient(135deg, #d9534f, #e8607a); }
.cat-school { background: linear-gradient(135deg, #2f8f76, #4fb89a); }
.cat-insurance { background: linear-gradient(135deg, #4a6fa5, #6b8cae); }
.cat-pension { background: linear-gradient(135deg, #b8860b, #d4a017); }
.cat-tax { background: linear-gradient(135deg, #5c4a72, #7d6a94); }

.post-detail-title {
  margin: 4px 0 16px;
  font-size: 24px;
  line-height: 1.3;
}

.post-detail-body {
  font-size: 15px;
  line-height: 1.8;
}

.post-detail-body h3 {
  margin: 24px 0 10px;
  font-size: 17px;
  color: var(--indigo);
}

.post-detail-body p {
  margin: 0 0 14px;
}

.post-detail-body ul, .post-detail-body ol {
  margin: 0 0 14px;
  padding-left: 20px;
}

.post-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.post-title {
  margin: 0 0 4px;
  font-size: 14px;
}

.post-excerpt {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Affiliate */
.section-title {
  font-size: 14px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin: 4px 0 10px;
}

.affiliate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-bottom: 6px;
}

.affiliate-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.aff-icon {
  font-size: 24px;
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  border-radius: 10px;
}

.aff-body { flex: 1; }

.aff-body h4 { margin: 0 0 4px; font-size: 14px; }

.aff-body p { margin: 0; font-size: 12px; color: var(--text-muted); line-height: 1.4; }

.aff-btn {
  flex-shrink: 0;
  background: var(--indigo);
  color: #fff;
  text-decoration: none;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.affiliate-disclosure { margin-bottom: 20px; }

/* Ads */
.ad-slot {
  /* 애드센스 승인 전까지는 광고 자리를 화면에 표시하지 않습니다.
     승인 후에는 아래 display:none 줄만 지우고, 실제 애드센스 코드로 이 안을 채우면 됩니다. */
  display: none;
  background: #f0efe9;
  border: 1px dashed #c9c8c1;
  color: #a3a29b;
  text-align: center;
  border-radius: var(--radius);
  font-size: 12px;
}

.ad-slot-sidebar {
  padding: 30px 8px;
  color: rgba(255,255,255,0.4);
  background: rgba(255,255,255,0.06);
  border: 1px dashed rgba(255,255,255,0.2);
}

.ad-slot-banner {
  padding: 18px;
  margin: 4px 0 20px;
}

/* Forms */
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.inline-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.inline-form button {
  flex-shrink: 0;
  background: var(--indigo);
  color: #fff;
  border: none;
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
}

/* Lists */
.todo-list, .event-list, .checklist {
  list-style: none;
  padding: 0;
  margin: 0;
}

.todo-list li, .event-list li, .checklist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.todo-list li:last-child, .event-list li:last-child, .checklist li:last-child {
  border-bottom: none;
}

.todo-list li.done span.label, .checklist li.done span.label {
  text-decoration: line-through;
  color: var(--text-muted);
}

.del-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: #c0453c;
  cursor: pointer;
  font-size: 13px;
}

.event-date {
  font-weight: 700;
  color: var(--indigo);
  min-width: 90px;
}

/* Calculator */
.calc-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
  align-items: end;
}

.calc-form label {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.calc-form input {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

.calc-form button {
  background: var(--sakura);
  color: #fff;
  border: none;
  padding: 10px 14px;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  height: 40px;
}

.calc-result {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  background: var(--bg);
  border-radius: 8px;
  padding: 16px;
}

.result-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.result-item span {
  font-size: 12px;
  color: var(--text-muted);
}

.result-item strong {
  font-size: 18px;
  color: var(--indigo);
}

.note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

/* Chat */
.paywall-card {
  background: #fff4e8;
  border-color: #f0d9b8;
  font-size: 14px;
}

.chat-window {
  height: 260px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-msg {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
}

.chat-msg.bot {
  background: var(--bg);
  align-self: flex-start;
}

.chat-msg.user {
  background: var(--indigo);
  color: #fff;
  align-self: flex-end;
}

/* Responsive */
@media (max-width: 780px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: column; align-items: stretch; overflow: visible; padding: 12px 16px; }
  .sidebar-header { width: 100%; }
  .brand { padding: 4px 0; }
  .hamburger-btn { display: flex; }

  /* 기본적으로 메뉴는 닫혀 있고, 햄버거 클릭 시 .nav-open이 붙으면서 펼쳐짐 */
  .nav { display: none; flex-direction: column; width: 100%; margin-top: 10px; gap: 2px; }
  .sidebar.nav-open .nav { display: flex; }
  .nav-item { white-space: normal; }

  .sidebar-ad { display: none; }
  .main { padding: 20px; }

  /* 좁은 화면에서 입력폼이 잘리지 않도록 세로로 쌓기 */
  .inline-form { flex-direction: column; }
  .inline-form button { width: 100%; }
  .calc-form { grid-template-columns: 1fr; }
}
