/* Paperlogy (페이퍼로지) - https://noonnu.cc/font_page/1456, SIL OFL */
@font-face {
  font-family: "Paperozi";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-4Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Paperozi";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-5Medium.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Paperozi";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-6SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Paperozi";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-7Bold.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Paperozi";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/2408-3@1.0/Paperlogy-8ExtraBold.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}

/* Neo둥근모 - https://noonnu.cc/font_page/386, SIL OFL (메인 타이틀 "Trady" 전용) */
@font-face {
  font-family: "NeoDonggeunmo";
  src: url("https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2001@1.3/NeoDunggeunmo.woff") format("woff");
  font-weight: normal;
  font-display: swap;
}

:root {
  /* Medium Spring Green + Dark Gray 브랜드 팔레트 (변수명은 기존 navy/teal 유지) */
  --navy: #171717;
  --navy-dark: #0d0d0d;
  --teal: #21f1a8;
  --teal-light: #e6fcf3;
  --white: #ffffff;
  --gray-bg: #f4f6f9;
  --gray-text: #5c6675;
  --border: #e3e7ee;
  --shadow: 0 4px 16px rgba(23, 23, 23, 0.08);
  --shadow-hover: 0 8px 24px rgba(23, 23, 23, 0.12);
  --radius: 16px;
  --tabnav-height: 64px;
  /* 챗봇/체크리스트/FTA 진단 세 기능이 공유하는 상태 색상 (에러/rate-limit 톤 통일) */
  --error-bg: #fdecea;
  --error-text: #c0392b;
  --error-border: #f3b6b0;
  --warn-bg: #fff4e5;
  --warn-text: #a15c00;
  --warn-border: #ffd699;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Paperozi", -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif;
  background: var(--gray-bg);
  color: var(--navy);
  -webkit-font-smoothing: antialiased;
}

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

/* 헤더 */
.header {
  background: var(--navy);
  color: var(--white);
  padding: clamp(14px, 3vw, 20px) clamp(16px, 4vw, 24px);
}

.header__inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.header__menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--white);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease;
}

.header__menu-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.header__brand {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.header__logo {
  font-family: "NeoDonggeunmo", "Paperozi", sans-serif;
  font-size: clamp(20px, 5vw, 26px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--teal);
}

/* 탭 네비게이션 (데스크톱: 상단) */
.tabnav {
  display: flex;
  gap: 4px;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 24px 0;
  background: var(--gray-bg);
}

.tabnav__item {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--gray-text);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: background 0.2s ease, color 0.2s ease;
}

.tabnav__item:hover {
  color: var(--navy);
  background: rgba(0, 180, 166, 0.08);
}

.tabnav__item.is-active {
  color: var(--teal);
  background: var(--white);
  box-shadow: var(--shadow);
}

.tabnav__icon {
  font-size: 18px;
  line-height: 1;
}

/* 사이드 메뉴 (햄버거 → About / Contact / 도움말 / 광고 문의) */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(23, 23, 23, 0.5);
  animation: fadeIn 0.2s ease;
}

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 21;
  width: min(320px, 85vw);
  display: flex;
  flex-direction: column;
  background: var(--white);
  box-shadow: 0 0 32px rgba(23, 23, 23, 0.25);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  background: var(--navy);
  color: var(--white);
}

.drawer__brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--teal);
}

.drawer__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--white);
  font-size: 16px;
  cursor: pointer;
}

.drawer__close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.drawer__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.drawer__section {
  border-bottom: 1px solid var(--border);
}

.drawer__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
}

.drawer__summary::-webkit-details-marker {
  display: none;
}

.drawer__summary::after {
  content: "⌄";
  margin-left: auto;
  color: var(--gray-text);
  transition: transform 0.2s ease;
}

.drawer__section[open] .drawer__summary::after {
  transform: rotate(180deg);
}

.drawer__content {
  padding: 0 4px 16px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray-text);
}

.drawer__content p {
  margin: 0 0 10px;
}

.drawer__content--faq p {
  margin: 0 0 14px;
}

.drawer__content strong {
  color: var(--navy);
}

.drawer__emails {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.drawer__emails a {
  color: var(--teal);
  font-weight: 600;
  text-decoration: none;
}

.drawer__emails a:hover {
  text-decoration: underline;
}

.drawer__cta {
  display: block;
  text-align: center;
  padding: 10px;
  border-radius: 10px;
  background: var(--teal);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.drawer__link-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  text-decoration: none;
}

.drawer__link-button:hover {
  color: var(--teal);
}

/* 메인 콘텐츠 */
.main {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
  background: var(--white);
  border-radius: var(--radius);
}

.tabpanel {
  display: none;
}

.tabpanel.is-active {
  display: block;
  animation: fadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* 환율 위젯 */
.fx-widget {
  margin-bottom: 24px;
  padding: 20px;
  background: var(--teal-light);
  border: 1px solid var(--teal);
  border-radius: var(--radius);
}

.fx-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.fx-widget__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 6px;
}

.fx-widget__refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: var(--white);
  color: var(--teal);
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.4s ease, opacity 0.2s ease;
}

.fx-widget__refresh:hover {
  transform: rotate(90deg);
}

.fx-widget__refresh:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.fx-widget__refresh.is-spinning {
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.fx-widget__body {
  min-height: 72px;
}

.fx-status {
  margin: 0;
  padding: 20px 0;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-text);
}

.fx-status--error {
  color: var(--error-text);
}

.fx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 12px;
}

.fx-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px 10px;
  background: var(--white);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.fx-item__flag {
  font-size: 22px;
}

.fx-item__code {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.fx-item__label {
  font-size: 11px;
  color: var(--gray-text);
}

.fx-item__value {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 700;
  color: var(--teal);
  white-space: nowrap;
}

.fx-widget__note {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--gray-text);
}

.fx-widget__updated {
  margin: 6px 0 0;
  text-align: right;
  font-size: 11px;
  color: var(--gray-text);
}

/* 기능 소개 카드 */
.card-grid {
  display: grid;
  /* 뷰포트 폭에 따라 열 개수가 자동으로 늘고 줄어, 특정 브레이크포인트에 기대지 않는다 */
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  align-items: start;
  gap: 16px;
}

.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(16px, 4vw, 24px) clamp(14px, 3vw, 20px);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* 홈 카드 3개는 <button>으로 렌더링되어 클릭 시 해당 탭으로 이동한다 */
button.card {
  display: block;
  width: 100%;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card__icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.card__title {
  margin: 0 0 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--navy);
}

.card__desc {
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--gray-text);
}

/* 홈 카드 그리드 4번째 칸: 실시간 무역 뉴스 */
.news-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  cursor: default;
}

.news-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.news-card__title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 6px;
}

.news-card__refresh {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--gray-bg);
  color: var(--teal);
  font-size: 13px;
  cursor: pointer;
  transition: transform 0.4s ease, opacity 0.2s ease;
}

.news-card__refresh:hover {
  transform: rotate(90deg);
}

.news-card__refresh:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.news-card__refresh.is-spinning {
  animation: spin 0.6s linear infinite;
}

.news-card__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.news-card__select {
  flex: 1 1 110px;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  font-family: inherit;
  font-size: 11px;
  color: var(--navy);
}

.news-card__select:focus {
  outline: none;
  border-color: var(--teal);
}

.news-card__status {
  padding: 14px 0;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-text);
}

.news-card__status--error {
  color: var(--error-text);
}

.news-card__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.news-card__list[hidden] {
  display: none;
}

.news-card__item {
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.news-card__item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.news-card__item-link {
  display: block;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--navy);
  text-decoration: none;
}

.news-card__item-link:hover {
  color: var(--teal);
  text-decoration: underline;
}

.news-card__item-meta {
  display: block;
  margin-top: 3px;
  font-size: 10px;
  color: var(--gray-text);
}

/* 이 앱에 대하여 */
.about {
  margin-top: 24px;
  padding: 20px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.about__title {
  margin: 0 0 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.about__text {
  margin: 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray-text);
}

/* 품목 분류 챗봇 */
.chat {
  display: flex;
  flex-direction: column;
  /* 뷰포트 높이에 비례해 늘어나되, 너무 작거나 크게는 자라지 않도록 상하한을 둔다 */
  height: clamp(360px, 70vh, 560px);
}

.chat__messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.chat__bubble {
  max-width: min(85%, 460px);
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat__bubble--user {
  align-self: flex-end;
  background: var(--teal);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.chat__bubble--ai {
  align-self: flex-start;
  background: var(--white);
  color: var(--navy);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-bottom-left-radius: 4px;
}

.chat__bubble--error {
  align-self: flex-start;
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
  border-bottom-left-radius: 4px;
}

.chat__bubble--error-rate {
  align-self: flex-start;
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
  border-bottom-left-radius: 4px;
}

.chat__bubble--typing {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 14px 16px;
}

.chat__bubble--typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--gray-text);
  animation: typingBounce 1.2s infinite ease-in-out;
}

.chat__bubble--typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.chat__bubble--typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat__form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.chat__input {
  flex: 1;
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
  color: var(--navy);
}

.chat__input:focus {
  outline: none;
  border-color: var(--teal);
}

.chat__input:disabled {
  background: var(--gray-bg);
  opacity: 0.7;
}

.chat__send {
  padding: 0 22px;
  border: none;
  border-radius: 12px;
  background: var(--teal);
  color: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.chat__send:disabled {
  opacity: 0.6;
  cursor: default;
}

.chat__disclaimer {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
  color: var(--gray-text);
}

/* AI 답변에서 감지한 관세율을 계산기로 바로 보내는 버튼 */
.chat__rate-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-self: flex-start;
  max-width: 85%;
}

.chat__rate-btn {
  padding: 6px 12px;
  border: 1px solid var(--teal);
  border-radius: 999px;
  background: var(--teal-light);
  color: var(--teal);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.chat__rate-btn:hover {
  background: var(--teal);
  color: var(--white);
}

/* 관세·부가세 개산 계산기 */
.tariff-calc {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 20px;
  padding: 20px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tariff-calc__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 6px;
}

.tariff-calc__disclaimer {
  margin: 0;
  padding: 12px 14px;
  background: var(--warn-bg);
  color: var(--warn-text);
  border: 1px solid var(--warn-border);
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.6;
  font-weight: 600;
}

.tariff-calc__form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
}

.tariff-calc__empty {
  margin: 0;
  padding: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--gray-text);
  background: var(--white);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.tariff-calc__result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.tariff-calc__result[hidden] {
  display: none;
}

.tariff-calc__step {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.tariff-calc__step:last-child {
  border-bottom: none;
}

.tariff-calc__step-label {
  color: var(--gray-text);
}

.tariff-calc__step-value {
  color: var(--navy);
  font-weight: 700;
  white-space: nowrap;
}

.tariff-calc__step--total {
  padding-top: 12px;
  border-top: 2px solid var(--teal);
  border-bottom: none;
}

.tariff-calc__step--total .tariff-calc__step-label {
  color: var(--navy);
  font-weight: 700;
}

.tariff-calc__step--total .tariff-calc__step-value {
  color: var(--teal);
  font-size: 17px;
}

/* 서류 체크리스트 */
.checklist {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.checklist__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.radio-group {
  display: flex;
  gap: 10px;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  color: var(--navy);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.radio-option:has(input:checked) {
  border-color: var(--teal);
  background: var(--teal-light);
  color: var(--teal);
  font-weight: 700;
}

.radio-option input {
  accent-color: var(--teal);
}

.form-select,
.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  font-family: inherit;
  font-size: 14px;
  color: var(--navy);
}

.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--teal);
}

.checklist__submit {
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--teal);
  color: var(--white);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.checklist__submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.checklist__status {
  padding: 18px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-text);
  background: var(--gray-bg);
  border-radius: var(--radius);
}

.checklist__status--error {
  background: var(--error-bg);
  color: var(--error-text);
}

.checklist__status--error-rate {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.checklist__result {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

/* display:flex가 [hidden]의 기본 display:none보다 우선 적용되는 문제를 막는다 */
.checklist__result[hidden] {
  display: none;
}

.checklist__result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.checklist__progress {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--teal);
}

.checklist__reset {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--navy);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.checklist__reset:hover {
  border-color: var(--teal);
  color: var(--teal);
}

.checklist__items {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.checklist__item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.checklist__item input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--teal);
  flex-shrink: 0;
  cursor: pointer;
}

.checklist__item label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
}

.checklist__item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.checklist__item-desc {
  font-size: 12px;
  color: var(--gray-text);
  line-height: 1.4;
}

.checklist__item:has(input:checked) {
  background: var(--teal-light);
  border-color: var(--teal);
}

.checklist__item:has(input:checked) .checklist__item-name {
  text-decoration: line-through;
  color: var(--gray-text);
}

/* FTA 진단 (문답형 위저드) */
.fta {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.fta__progress {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.fta__progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  transition: background 0.25s ease, transform 0.25s ease;
}

.fta__progress-dot.is-active {
  background: var(--teal);
  transform: scale(1.3);
}

.fta__progress-dot.is-done {
  background: var(--teal);
}

.fta__form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: 220px;
  padding: 24px 20px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.fta__step {
  display: none;
  flex-direction: column;
  gap: 14px;
}

.fta__step.is-active {
  display: flex;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.fta__question {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.radio-group--stack {
  flex-direction: column;
}

.fta__nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
}

.fta__prev,
.fta__next,
.fta__submit {
  padding: 12px 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--navy);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease, border-color 0.2s ease;
}

.fta__prev:disabled {
  opacity: 0.4;
  cursor: default;
}

.fta__next,
.fta__submit {
  margin-left: auto;
  border: none;
  background: var(--teal);
  color: var(--white);
}

.fta__submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.fta__status {
  padding: 18px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-text);
  background: var(--gray-bg);
  border-radius: var(--radius);
}

.fta__status--error {
  background: var(--error-bg);
  color: var(--error-text);
}

.fta__status--error-rate {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.fta__result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.fta__result[hidden] {
  display: none;
}

.fta__card {
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.7;
  color: var(--navy);
  white-space: pre-wrap;
}

.fta__restart {
  align-self: flex-start;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--navy);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.fta__restart:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* 인코텀즈 도우미 */
.incoterms {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.incoterms__title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
}

.incoterms__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--gray-text);
}

.incoterms-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.incoterms-table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  font-size: 13px;
}

.incoterms-table th,
.incoterms-table td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.incoterms-table thead th {
  background: var(--gray-bg);
  color: var(--navy);
  font-weight: 700;
  white-space: nowrap;
}

.incoterms-table tbody th {
  background: var(--gray-bg);
  color: var(--navy);
  font-weight: 700;
  white-space: nowrap;
}

.incoterms-table tbody tr:last-child td,
.incoterms-table tbody tr:last-child th {
  border-bottom: none;
}

.incoterms-table tbody td {
  color: var(--gray-text);
}

/* 모바일에서는 표 대신 조건별 카드로 전환 (기본 숨김, ≤640px에서만 표시) */
.incoterms-cards {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.incoterms-card {
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.incoterms-card__code {
  font-size: 16px;
  font-weight: 700;
  color: var(--teal);
}

.incoterms-card__name {
  margin: 2px 0 10px;
  font-size: 12px;
  color: var(--gray-text);
}

.incoterms-card__row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
}

.incoterms-card__row:first-of-type {
  border-top: none;
}

.incoterms-card__row-label {
  color: var(--gray-text);
  flex-shrink: 0;
}

.incoterms-card__row-value {
  color: var(--navy);
  font-weight: 600;
  text-align: right;
}

/* 조건별 상세 설명 (드로어와 동일한 <details> 아코디언 패턴) */
.incoterms-accordions {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border);
}

.incoterms-accordion {
  border-bottom: 1px solid var(--border);
}

.incoterms-accordion__summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 4px;
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
  list-style: none;
}

.incoterms-accordion__summary::-webkit-details-marker {
  display: none;
}

.incoterms-accordion__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--teal-light);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.incoterms-accordion__summary::after {
  content: "⌄";
  margin-left: auto;
  color: var(--gray-text);
  transition: transform 0.2s ease;
}

.incoterms-accordion[open] .incoterms-accordion__summary::after {
  transform: rotate(180deg);
}

.incoterms-accordion__content {
  margin: 0 0 14px;
  padding: 0 4px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--gray-text);
}

/* AI 추천 진입 CTA */
.incoterms-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px;
  background: var(--teal-light);
  border: 1px dashed var(--teal);
  border-radius: var(--radius);
  text-align: center;
}

.incoterms-cta__desc {
  margin: 0;
  font-size: 13px;
  color: var(--navy);
  font-weight: 600;
}

.incoterms-cta__btn {
  padding: 12px 24px;
  border: none;
  border-radius: 10px;
  background: var(--teal);
  color: var(--white);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.incoterms-cta__btn:hover {
  opacity: 0.9;
}

/* AI 추천 위저드 */
.incoterms-advisor {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  background: var(--gray-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.incoterms-advisor[hidden] {
  display: none;
}

.incoterms-advisor__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.incoterms-advisor__title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}

.incoterms-advisor__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 8px;
  background: var(--white);
  color: var(--navy);
  font-size: 13px;
  cursor: pointer;
}

.incoterms-advisor__close:hover {
  color: var(--teal);
}

.incoterms-advisor__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.incoterms-advisor__submit {
  padding: 13px;
  border: none;
  border-radius: 10px;
  background: var(--teal);
  color: var(--white);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.incoterms-advisor__submit:disabled {
  opacity: 0.6;
  cursor: default;
}

.incoterms-advisor__status {
  padding: 18px;
  text-align: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-text);
  background: var(--white);
  border-radius: var(--radius);
}

.incoterms-advisor__status--error {
  background: var(--error-bg);
  color: var(--error-text);
}

.incoterms-advisor__status--error-rate {
  background: var(--warn-bg);
  color: var(--warn-text);
}

.incoterms-advisor__result {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.incoterms-advisor__result[hidden] {
  display: none;
}

.incoterms-advisor__card {
  padding: 20px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-size: 14px;
  line-height: 1.7;
  color: var(--navy);
  white-space: pre-wrap;
}

.incoterms-advisor__restart {
  align-self: flex-start;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--white);
  color: var(--navy);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.incoterms-advisor__restart:hover {
  border-color: var(--teal);
  color: var(--teal);
}

/* 무역 용어 미니사전: 본문에 자동으로 표시되는 인라인 용어 버튼 */
.glossary-term {
  display: inline;
  position: relative;
  padding: 1px 3px;
  margin: 0 -1px;
  border: none;
  border-radius: 4px;
  background: var(--teal-light);
  font: inherit;
  color: var(--navy);
  cursor: help;
  transition: background 0.15s ease, color 0.15s ease;
}

.glossary-term:hover,
.glossary-term:focus-visible {
  background: var(--teal);
  color: var(--white);
  outline: none;
}

/* 호버 시 즉시(로딩 없이) 뜨는 순수 CSS 툴팁 */
.glossary-term::after {
  content: attr(data-short);
  position: absolute;
  left: 50%;
  bottom: 100%;
  transform: translateX(-50%) translateY(-6px);
  width: max-content;
  max-width: 220px;
  padding: 8px 10px;
  background: var(--navy);
  color: var(--white);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  border-radius: 8px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 30;
}

.glossary-term:hover::after,
.glossary-term:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-10px);
}

/* 클릭/탭 시 뜨는 공용 팝오버 (전체 정의) */
.glossary-popover {
  position: fixed;
  z-index: 40;
  width: min(300px, 85vw);
  padding: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  animation: fadeIn 0.15s ease;
}

.glossary-popover__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.glossary-popover__term {
  font-size: 14px;
  font-weight: 700;
  color: var(--teal);
}

.glossary-popover__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border: none;
  border-radius: 6px;
  background: var(--gray-bg);
  color: var(--navy);
  font-size: 11px;
  cursor: pointer;
}

.glossary-popover__short {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.5;
}

.glossary-popover__full {
  margin: 0;
  font-size: 12px;
  color: var(--gray-text);
  line-height: 1.6;
}

/* 홈 화면 진입점 */
.glossary-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px;
  margin-top: 16px;
  border: 1px dashed var(--teal);
  border-radius: var(--radius);
  background: var(--teal-light);
  color: var(--navy);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s ease;
}

.glossary-entry:hover {
  opacity: 0.85;
}

/* 용어사전 전체보기 모달 */
.glossary-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(23, 23, 23, 0.5);
  animation: fadeIn 0.2s ease;
}

.glossary-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 26;
  width: min(480px, 90vw);
  max-height: min(600px, 85vh);
  display: flex;
  flex-direction: column;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
  overflow: hidden;
  animation: fadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.glossary-modal[hidden] {
  display: none;
}

.glossary-modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  background: var(--navy);
  color: var(--white);
  flex-shrink: 0;
}

.glossary-modal__title {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.glossary-modal__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex-shrink: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--white);
  font-size: 15px;
  cursor: pointer;
}

.glossary-modal__close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.glossary-modal__search {
  margin: 16px 20px 0;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  color: var(--navy);
  flex-shrink: 0;
}

.glossary-modal__search:focus {
  outline: none;
  border-color: var(--teal);
}

.glossary-modal__list {
  flex: 1;
  overflow-y: auto;
  padding: 12px 20px 20px;
}

.glossary-modal__item {
  border-bottom: 1px solid var(--border);
}

.glossary-modal__item:last-child {
  border-bottom: none;
}

.glossary-modal__summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 4px;
  cursor: pointer;
  list-style: none;
}

.glossary-modal__summary::-webkit-details-marker {
  display: none;
}

.glossary-modal__term {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
}

.glossary-modal__short {
  font-size: 12px;
  color: var(--gray-text);
}

.glossary-modal__full {
  margin: 0 0 12px;
  padding: 0 4px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--gray-text);
}

.glossary-modal__empty {
  padding: 24px 4px;
  text-align: center;
  font-size: 13px;
  color: var(--gray-text);
}

/* 반응형: 모바일 - 하단 탭바로 전환 */
@media (max-width: 640px) {
  .tabnav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    max-width: none;
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    background: var(--white);
    border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(23, 23, 23, 0.08);
  }

  .tabnav__item {
    flex-direction: column;
    gap: 2px;
    padding: 8px 2px;
    border-radius: 12px;
    font-size: 10px;
  }

  .tabnav__label {
    white-space: nowrap;
  }

  .tabnav__item.is-active {
    box-shadow: none;
    background: var(--teal-light);
  }

  .main {
    padding: 16px;
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
    border-radius: 0;
  }

  .fx-widget {
    padding: 16px;
  }

  .fx-grid {
    gap: 8px;
  }

  .fx-item {
    padding: 10px 4px;
  }

  .fx-item__value {
    font-size: 13px;
  }

  .radio-group {
    flex-direction: column;
  }

  .checklist__result-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .fta__form {
    padding: 18px 16px;
    min-height: 0;
  }

  .fta__nav {
    flex-wrap: wrap;
  }

  .incoterms-table-wrap {
    display: none;
  }

  .incoterms-cards {
    display: flex;
  }
}

