:root {
  --color-bg: #ffffff;
  --color-surface: #f7f8fa;
  --color-surface-2: #eef0f4;
  --color-border: #e4e7ec;
  --color-text: #131415;
  --color-text-muted: #363a3f;
  --color-text-subtle: #6d757e;
  /* Squad beyond brand colors (https://squadbeyond.com/) */
  --color-primary: #007deb;
  --color-primary-hover: #0662b3;
  --color-primary-soft: #f2f9ff;
  --color-primary-dark: #092843;
  /* Callout box colors */
  --color-warn-bg: #fff7e6;
  --color-warn-border: #f5a623;
  --color-warn-text: #6b4400;
  --color-info-bg: #f2f9ff;
  --color-info-border: #4db2ff;
  --color-info-text: #0b5a9f;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow-md: 0 4px 12px rgba(16, 24, 40, 0.06);
  --max-width: 1120px;
  /* Noto Sans JP を最優先 (index.html で Google Fonts 読込)。フォールバックに OS フォント */
  --font-sans: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  /* Prevent horizontal scroll causing layout jitter on mobile */
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  /* Reserve scrollbar space so width doesn't jump when scrollbar appears */
  scrollbar-gutter: stable;
  /* Allow Japanese text to wrap cleanly */
  word-break: break-word;
  overflow-wrap: anywhere;
}

img, svg, video {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ===== Header ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--color-border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.02em;
  color: var(--color-text);
}

.logo-img {
  height: 40px;       /* ヘッダー (76px) に対してしっかり見えるサイズ */
  width: auto;
  display: block;
}

.logo-sub {
  /* 「| FAQ」のサブラベル。ロゴ本体と縦線で区切る */
  position: relative;
  padding-left: 14px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
}
.logo-sub::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 24px;
  background: var(--color-border);
}

.logo:hover {
  text-decoration: none;
}

@media (max-width: 560px) {
  .header-inner { height: 60px; }
  .logo-img { height: 30px; }
  .logo-sub { font-size: 13px; padding-left: 10px; }
  .logo-sub::before { height: 18px; }
}

.header-nav {
  display: flex;
  gap: 28px;
}

.header-nav a {
  color: var(--color-text-muted);
  font-size: 14px;
  font-weight: 500;
}

.header-nav a:hover {
  color: var(--color-text);
  text-decoration: none;
}

.header-nav a[aria-current="page"] {
  color: var(--color-text);
}

/* ===== Hero (Squad beyond ブランドの薄青グラデ) ===== */
.hero {
  background: linear-gradient(180deg, var(--color-primary-soft) 0%, #ffffff 100%);
  padding: 56px 0 48px;
  border-bottom: 1px solid var(--color-border);
  position: relative;
}
/* Hero 上部に細いブランドラインを入れる */
.hero::before {
  content: "";
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--color-primary) 0%, var(--color-info-border) 100%);
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--color-text-subtle);
}
.breadcrumb a {
  color: var(--color-text-muted);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--color-primary); text-decoration: underline; }
.breadcrumb .bc-sep {
  color: var(--color-text-subtle);
  opacity: 0.6;
  font-size: 11px;
}
.breadcrumb .bc-current {
  color: var(--color-text);
  font-weight: 500;
  /* 長い記事タイトルの折り返し制御 */
  max-width: 480px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.hero-lead {
  margin: 0 0 28px;
  color: var(--color-text-muted);
  font-size: 16px;
  max-width: 640px;
}

.search-box {
  position: relative;
  max-width: 640px;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--color-text-subtle);
  pointer-events: none;
}

#faq-search {
  width: 100%;
  padding: 16px 48px 16px 50px;
  font-size: 16px;
  font-family: inherit;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#faq-search::placeholder {
  color: var(--color-text-subtle);
}

#faq-search:focus {
  border-color: var(--color-primary);
  /* ブランドカラー #007deb の薄い透過リング */
  box-shadow: 0 0 0 4px rgba(0, 125, 235, 0.15);
}

.search-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-clear:hover {
  background: var(--color-border);
}

.search-result {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ===== Main Grid ===== */
.main-grid {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 48px;
  padding-top: 48px;
  padding-bottom: 80px;
}

/* ===== Sidebar ===== */
.sidebar {
  position: sticky;
  top: 88px;
  align-self: start;
}

.sidebar-title {
  margin: 0 0 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ===== Sidebar Tree (カテゴリ → サブカテゴリ → 記事) ===== */
.sidebar-list {
  list-style: none;
  margin: 0 0 32px;
  padding: 0;
  /* スクロール可能に。記事数が多いカテゴリでサイドバーが画面外に伸びないように */
  max-height: calc(100vh - 140px);
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.sidebar-list ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.sidebar-list li { margin: 0; }

/* ベースの行 (Home / カテゴリ / サブカテゴリ / 記事 共通) */
.sb-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
}
.sb-link:hover {
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}
.sb-link.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-left-color: var(--color-primary);
}

/* Home (カテゴリ一覧) */
.sb-home-link { font-weight: 600; margin-bottom: 6px; }
.sb-home-icon { font-size: 14px; opacity: 0.7; }

/* カテゴリ行 (summary) */
.sb-cat-toggle { margin: 2px 0; }
.sb-cat-toggle > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  border-radius: var(--radius-sm);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.sb-cat-toggle > summary::-webkit-details-marker { display: none; }
.sb-cat-toggle > summary:hover { background: var(--color-surface); }

/* 展開 chevron (回転で開閉表現) */
.sb-chevron {
  display: inline-block;
  font-size: 10px;
  color: var(--color-text-subtle);
  transition: transform 0.18s;
  flex-shrink: 0;
  width: 12px;
  text-align: center;
}
details[open] > summary > .sb-chevron { transform: rotate(90deg); }

/* 件数バッジ */
.sb-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-subtle);
  font-variant-numeric: tabular-nums;
}

.sb-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* カテゴリ展開後の body */
.sb-cat-body {
  padding: 4px 0 6px 12px;
  border-left: 1px solid var(--color-surface-2);
  margin-left: 16px;
}

/* 「カテゴリ全体を見る」リンク */
.sb-cat-link {
  display: block;
  padding: 5px 10px;
  margin: 2px 0 4px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--color-primary);
  border-radius: var(--radius-sm);
}
.sb-cat-link:hover { background: var(--color-primary-soft); text-decoration: none; }
.sb-cat-link.active { background: var(--color-primary-soft); }

/* サブカテゴリ行 */
.sb-sub-toggle { margin: 2px 0; }
.sb-sub-toggle > summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.sb-sub-toggle > summary::-webkit-details-marker { display: none; }
.sb-sub-toggle > summary:hover { background: var(--color-surface); color: var(--color-text); }

/* 記事リーフ */
.sb-articles {
  padding: 2px 0 4px 12px;
  border-left: 1px solid var(--color-surface-2);
  margin-left: 16px;
}
.sb-articles-flat {
  /* サブカテゴリが無いカテゴリでの記事リスト (ネスト浅め) */
  padding: 4px 0;
  border-left: none;
  margin-left: 0;
}
.sb-article {
  display: block;
  padding: 5px 10px;
  font-size: 12.5px;
  font-weight: 400;
  color: var(--color-text-muted);
  border-radius: var(--radius-sm);
  border-left: 2px solid transparent;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.5;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.sb-article:hover {
  background: var(--color-surface);
  color: var(--color-text);
  text-decoration: none;
}
.sb-article.active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
  border-left-color: var(--color-primary);
  font-weight: 600;
}

.sidebar-contact {
  padding: 20px;
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
}

.sidebar-contact-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 600;
}

.sidebar-contact-text {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1.6;
}

.btn-contact {
  display: inline-block;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.btn-contact:hover {
  background: var(--color-surface-2);
  text-decoration: none;
}

/* ===== Category Grid (TOP) ===== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.category-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  grid-template-areas:
    "icon body meta"
    "icon body meta";
  align-items: center;
  gap: 16px;
  padding: 22px 24px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  text-decoration: none;
  position: relative;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.category-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
  box-shadow: 0 10px 24px -10px rgba(0, 125, 235, 0.25);
  text-decoration: none;
}

.category-card-icon {
  grid-area: icon;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.category-card-icon svg {
  width: 26px;
  height: 26px;
}

.category-card-body {
  grid-area: body;
  min-width: 0;
}

.category-card-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.category-card-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--color-text-muted);
  line-height: 1.55;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.category-card-meta {
  grid-area: meta;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.category-card-count {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.category-card-count small {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-subtle);
  margin-left: 2px;
}

.category-card-arrow {
  font-size: 14px;
  color: var(--color-text-subtle);
  transition: transform 0.18s ease, color 0.18s ease;
}

.category-card:hover .category-card-arrow {
  transform: translateX(3px);
  color: var(--color-primary);
}

/* アクセントカラー (各カテゴリのアイコン背景)
   .cc-blue は Squad beyond ブランドカラー (#007deb) に統一。
   他は意図的にバリエーションを残してカテゴリ識別性を確保 */
.cc-blue    .category-card-icon { background: var(--color-primary-soft); color: var(--color-primary); }
.cc-violet  .category-card-icon { background: #f5f3ff; color: #7c3aed; }
.cc-indigo  .category-card-icon { background: #eef2ff; color: #4f46e5; }
.cc-emerald .category-card-icon { background: #ecfdf5; color: #059669; }
.cc-orange  .category-card-icon { background: #fff7ed; color: #ea580c; }
.cc-amber   .category-card-icon { background: #fffbeb; color: #d97706; }
.cc-slate   .category-card-icon { background: #f1f5f9; color: #475569; }
.cc-teal    .category-card-icon { background: #f0fdfa; color: #0d9488; }
.cc-pink    .category-card-icon { background: #fdf2f8; color: #db2777; }
.cc-yellow  .category-card-icon { background: #fefce8; color: #ca8a04; }

@media (max-width: 560px) {
  .category-grid { grid-template-columns: 1fr; gap: 10px; }
  .category-card { padding: 16px 18px; gap: 12px; }
  .category-card-icon { width: 40px; height: 40px; }
  .category-card-icon svg { width: 22px; height: 22px; }
  .category-card-count { font-size: 15px; }
}

/* 戻るリンク / パンくず */
.category-back {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--color-text-subtle);
}

.category-back a {
  color: var(--color-text-muted);
  text-decoration: none;
}

.category-back a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.bc-sep {
  margin: 0 6px;
  color: var(--color-text-subtle);
}

/* ===== Article List (記事タイトル + 要約のリスト) ===== */
.article-list { margin-bottom: 32px; }

.sub-section { margin-bottom: 28px; }
.sub-section:last-child { margin-bottom: 0; }

.sub-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-muted);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: none;
}

.sub-title::before {
  content: "";
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--color-primary);
  border-radius: 2px;
}

.sub-count {
  display: inline-block;
  padding: 1px 8px;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: 11px;
  font-weight: 500;
  border-radius: 10px;
}

.article-list-body {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  overflow: hidden;
}

.article-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
  background: #fff;
  text-decoration: none;
  border-bottom: 1px solid var(--color-surface-2);
  transition: background 0.12s;
}

.article-card:last-child { border-bottom: none; }

.article-card:hover {
  background: #fafbfc;
  text-decoration: none;
}

.article-card-body {
  flex: 1;
  min-width: 0;
}

.article-card-title {
  margin: 0 0 6px;
  font-size: 15.5px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.55;
  letter-spacing: -0.005em;
}

.article-card-summary {
  margin: 0;
  font-size: 13.5px;
  color: var(--color-text-muted);
  line-height: 1.65;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* カテゴリ詳細用: 要約なし、タイトル余白詰める */
.article-card-compact .article-card-title { margin-bottom: 0; }
.article-card-compact .article-card-summary { display: none; }

/* カテゴリ詳細のカード: タイトルを大きく、要約は薄くしてメリハリ */
.sub-section .article-card-title {
  font-size: 17px;
}
.sub-section .article-card-summary {
  color: var(--color-text-subtle);
  font-size: 13px;
}

/* 検索結果のハイライト */
.article-card mark,
.article-detail-body mark {
  background: #fff3a8;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: 600;
}

.article-card-cta {
  font-size: 12.5px;
  color: var(--color-primary);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.article-card:hover .article-card-cta {
  transform: translateX(2px);
}

.article-card-cat {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-size: 11px;
  font-weight: 500;
  border-radius: 8px;
  vertical-align: 1px;
  letter-spacing: 0.01em;
}

/* ===== Article Detail (個別 FAQ ページ) ===== */
.article-detail {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 40px 44px 48px;
}

.article-detail-title {
  margin: 0 0 28px;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.45;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--color-surface-2);
  color: var(--color-text);
}

.article-detail-body {
  font-size: 16px;
  line-height: 1.9;
  color: var(--color-text);
}

/* 本文を /api/faq/{id} で取得中のプレースホルダー */
.article-body-loading {
  color: var(--color-text-subtle);
  padding: 24px 0;
  text-align: center;
  font-size: 14px;
}

/* HubSpot からの冗長な空 div / 空 p を見えないようにする */
.article-detail-body div:empty { display: none; }
.article-detail-body p.is-empty { display: none; }

/* 画像: 中央寄せ・影付き */
.article-detail-body img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 24px auto;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  box-shadow: var(--shadow-sm);
}

/* 見出し階層を明確に (色は本文と同じ黒、青はリンク予約とする) */
.article-detail-body h1,
.article-detail-body h2,
.article-detail-body h3,
.article-detail-body h4,
.article-detail-body h5 {
  font-weight: 700;
  line-height: 1.45;
  color: var(--color-text);
}

.article-detail-body h1 {
  /* タイトルと重複するため通常は非表示 (JS でも削除しているが念のため) */
  display: none;
}

.article-detail-body h2 {
  font-size: 22px;
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-surface-2);
}

.article-detail-body h3 {
  font-size: 19px;
  margin: 32px 0 12px;
  padding-left: 14px;
  border-left: 4px solid var(--color-primary);
  line-height: 1.4;
}

.article-detail-body h4 {
  font-size: 16.5px;
  margin: 24px 0 10px;
  /* color は親見出しルールで --color-text を継承 */
}

.article-detail-body h5 {
  font-size: 15px;
  margin: 20px 0 8px;
}

.article-detail-body p {
  margin: 0 0 16px;
}

.article-detail-body ul,
.article-detail-body ol {
  margin: 12px 0 20px;
  padding-left: 28px;
}
.article-detail-body li { margin-bottom: 8px; }
.article-detail-body li > p { margin: 0 0 8px; }
.article-detail-body ol > li { padding-left: 4px; }
/* ol のマーカー (1., 2., ...) は本文と同じ黒・太字 */
.article-detail-body ol > li::marker { font-weight: 700; color: var(--color-text); }

/* 番号付きリスト内の見出しは「ステップ見出し」として強調 */
.article-detail-body ol > li > h4,
.article-detail-body ol > li > h3 {
  margin: 0 0 6px;
  padding-left: 0;
  border-left: none;
  color: var(--color-text);
  font-size: 17px;
}

/* ===== ステップ UI =====
   HubSpot からの素 HTML が <ol><li><h3 or h4>...</h3></li></ol> の構造になっているとき、
   番号を青いバッジ (1 / 2 / 3 …) として強調表示する。:has() で自動判定。 */
.article-detail-body ol:has(> li > h3, > li > h4) {
  list-style: none;
  counter-reset: step;
  padding-left: 0;
  margin: 24px 0 28px;
}
.article-detail-body ol:has(> li > h3, > li > h4) > li {
  counter-increment: step;
  position: relative;
  padding: 4px 0 12px 56px;
  margin-bottom: 14px;
  min-height: 44px;
}
.article-detail-body ol:has(> li > h3, > li > h4) > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 6px rgba(0, 125, 235, 0.25);
}
.article-detail-body ol:has(> li > h3, > li > h4) > li > h3,
.article-detail-body ol:has(> li > h3, > li > h4) > li > h4 {
  margin-top: 6px;
}
.article-detail-body ol:has(> li > h3, > li > h4) > li > p:first-of-type {
  margin-top: 4px;
}

.article-detail-body a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.article-detail-body a:hover { color: var(--color-primary-hover); }

/* 外部 (旧 KB に飛ぶ) リンクには ↗ アイコンを付ける */
.article-detail-body a.external-link::after {
  content: " ↗";
  font-size: 0.85em;
  opacity: 0.7;
  text-decoration: none;
  display: inline-block;
  margin-left: 1px;
}

/* strong は太字のみ。色は本文色を継承 (青文字はリンクに予約) */
.article-detail-body strong { color: inherit; font-weight: 700; }

.article-detail-body pre {
  background: var(--color-surface);
  padding: 14px 16px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 14px;
  margin: 16px 0;
}

.article-detail-body code {
  background: var(--color-surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
}

.article-detail-body table {
  border-collapse: collapse;
  margin: 16px 0;
  width: 100%;
  font-size: 14.5px;
}

.article-detail-body th,
.article-detail-body td {
  border: 1px solid var(--color-border);
  padding: 10px 14px;
  text-align: left;
}

.article-detail-body th {
  background: var(--color-surface);
  font-weight: 700;
}

/* ===== Callout box (⚠️注意 / 💡ヒント / 補足) ===== */
.article-detail-body .callout {
  margin: 20px 0;
  padding: 16px 20px 4px;
  border-radius: 8px;
  border-left: 4px solid var(--color-info-border);
  background: var(--color-info-bg);
}
.article-detail-body .callout > h3,
.article-detail-body .callout > h4 {
  margin: 0 0 8px;
  padding: 0;
  border: none;
  color: var(--color-info-text);
  font-size: 15.5px;
}
.article-detail-body .callout p:last-child,
.article-detail-body .callout ul:last-child,
.article-detail-body .callout ol:last-child { margin-bottom: 12px; }

.article-detail-body .callout.callout-warn {
  border-left-color: var(--color-warn-border);
  background: var(--color-warn-bg);
}
.article-detail-body .callout.callout-warn > h3,
.article-detail-body .callout.callout-warn > h4 {
  color: var(--color-warn-text);
}

@media (max-width: 560px) {
  .article-card { padding: 14px 16px; gap: 12px; }
  .article-card-cta { display: none; }
  .article-detail { padding: 24px 18px 28px; }
  .article-detail-title { font-size: 22px; }
  .article-detail-body { font-size: 15.5px; line-height: 1.85; }
  .article-detail-body h2 { font-size: 19px; }
  .article-detail-body h3 { font-size: 17px; }
}

/* loading state */
.loading {
  padding: 40px;
  text-align: center;
  color: var(--color-text-subtle);
}

/* ===== Content / FAQ ===== */
.content {
  min-width: 0;
}

.faq-category {
  margin-bottom: 48px;
}

.faq-category:last-of-type {
  margin-bottom: 24px;
}

.category-title {
  margin: 0 0 16px;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border);
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-item {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.faq-item:hover {
  border-color: var(--color-primary);
}

.faq-item[open] {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
}

.faq-item summary {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 18px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.q-mark {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  font-weight: 700;
  font-size: 14px;
  border-radius: 50%;
}

.q-text {
  flex: 1;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.6;
  color: var(--color-text);
  padding-top: 3px;
}

.chevron {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  margin-top: 5px;
  position: relative;
  transition: transform 0.2s ease;
}

.chevron::before,
.chevron::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 10px;
  height: 2px;
  background: var(--color-text-muted);
  border-radius: 1px;
  transform-origin: center;
}

.chevron::before {
  transform: translate(-75%, -50%) rotate(45deg);
}

.chevron::after {
  transform: translate(-25%, -50%) rotate(-45deg);
}

.faq-item[open] .chevron {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 20px 20px 62px;
  color: var(--color-text-muted);
  font-size: 14.5px;
  line-height: 1.8;
  border-top: 1px solid var(--color-surface-2);
  padding-top: 16px;
  margin-top: -1px;
}

.faq-answer p {
  margin: 0 0 12px;
}

.faq-answer p:last-child {
  margin-bottom: 0;
}

.faq-answer img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: 12px 0;
  border: 1px solid var(--color-border);
}

.faq-answer h1, .faq-answer h2, .faq-answer h3, .faq-answer h4 {
  margin: 20px 0 10px;
  font-weight: 600;
  line-height: 1.4;
}

.faq-answer h1 { font-size: 18px; }
.faq-answer h2 { font-size: 17px; }
.faq-answer h3 { font-size: 16px; }
.faq-answer h4 { font-size: 14px; }

.faq-answer ul, .faq-answer ol {
  margin: 8px 0 12px;
  padding-left: 24px;
}

.faq-answer li {
  margin-bottom: 4px;
}

.faq-answer a {
  color: var(--color-primary);
  text-decoration: underline;
  word-break: break-all;
}

.faq-answer pre {
  background: var(--color-surface);
  padding: 12px 14px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 13px;
  margin: 12px 0;
}

.faq-answer code {
  background: var(--color-surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.faq-answer table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
  font-size: 13px;
}

.faq-answer th, .faq-answer td {
  border: 1px solid var(--color-border);
  padding: 6px 10px;
  text-align: left;
}

.faq-answer th {
  background: var(--color-surface);
  font-weight: 600;
}

.faq-source {
  margin-top: 16px !important;
  padding-top: 12px;
  border-top: 1px solid var(--color-surface-2);
  font-size: 13px;
  color: var(--color-text-muted);
}

.faq-source a {
  color: var(--color-primary);
}

/* ===== No Results ===== */
.no-results {
  padding: 48px 24px;
  text-align: center;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border);
}

/* ===== CTA Card ===== */
.cta-card {
  margin-top: 48px;
  padding: 32px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  text-align: center;
}

.cta-card h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
}

.cta-card p {
  margin: 0 0 20px;
  color: var(--color-text-muted);
  font-size: 14.5px;
}

.btn-primary {
  display: inline-block;
  padding: 12px 24px;
  background: var(--color-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
  text-decoration: none;
}

/* ===== Footer ===== */
.site-footer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface);
  padding: 40px 0 32px;
  margin-top: 40px;
}

.footer-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.footer-logo {
  height: 32px;
  width: auto;
  display: block;
  opacity: 0.9;
}

.footer-copy {
  margin: 0;
  font-size: 12px;
  color: var(--color-text-subtle);
}

.footer-nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-nav a {
  font-size: 13px;
  color: var(--color-text-muted);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ===== Chat FAB ===== */
.chat-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 125, 235, 0.35);
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}

.chat-fab:hover {
  background: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 125, 235, 0.45);
}

.chat-fab svg {
  width: 20px;
  height: 20px;
}

.chat-fab-label {
  white-space: nowrap;
}

/* ===== Chat Panel ===== */
.chat-panel[hidden] {
  display: none !important;
}

.chat-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 101;
  /* HubSpot / Intercom 級のサイズ感に拡大 */
  width: 440px;
  max-width: calc(100vw - 32px);
  height: 720px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(16, 24, 40, 0.18), 0 4px 12px rgba(16, 24, 40, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: chat-pop-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes chat-pop-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--color-primary);
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.chat-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chat-avatar {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.chat-name {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}

.chat-status {
  margin: 0;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-close,
.chat-new {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.chat-close {
  font-size: 18px;
}

.chat-new svg {
  width: 16px;
  height: 16px;
}

.chat-close:hover,
.chat-new:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* [hidden] 属性は display:flex を持つ要素では効かないので明示的に上書き */
.chat-new[hidden],
.chat-close[hidden],
.chat-input-area[hidden] {
  display: none !important;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-message {
  display: flex;
  max-width: 88%;
}

.chat-message.user {
  align-self: flex-end;
  justify-content: flex-end;
}

.chat-message.bot {
  align-self: flex-start;
}

.chat-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message.user .chat-bubble {
  background: var(--color-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-message.bot .chat-bubble {
  background: #fff;
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-bottom-left-radius: 4px;
}

/* ===== 回答内の参考画面 (スクリーンショット) ===== */
.chat-shots {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--color-surface-2);
}
.chat-shots-title {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-subtle);
  letter-spacing: 0.02em;
}
.chat-shot {
  margin: 0 0 10px;
}
.chat-shot:last-child {
  margin-bottom: 0;
}
.chat-shot a {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-shot a:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0, 125, 235, 0.15);
}
.chat-shot img {
  display: block;
  width: 100%;
  height: auto;
}
.chat-shot figcaption {
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--color-text-subtle);
  line-height: 1.45;
}

.chat-sources {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--color-surface-2);
  font-size: 12px;
  color: var(--color-text-muted);
}

.chat-sources-title {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-subtle);
  letter-spacing: 0.02em;
}

.chat-sources-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-sources-list li {
  margin: 0;
}

.chat-sources-list li::before {
  content: "↗";
  display: inline-block;
  width: 14px;
  color: var(--color-primary);
  font-size: 11px;
  flex-shrink: 0;
}

.chat-sources-list a {
  display: inline;
  color: var(--color-primary);
  font-size: 13px;
  line-height: 1.5;
  text-decoration: none;
  font-weight: 500;
  word-break: break-word;
}

.chat-sources-list a:hover {
  text-decoration: underline;
}

/* ===== 初期サジェスト (カテゴリ式、新スレッド冒頭でだけ表示) ===== */
.chat-suggestions {
  margin-top: 4px;
}

.chat-suggestions-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chat-suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.05s;
}

.chat-suggestion-icon {
  flex-shrink: 0;
  width: 24px;
  font-size: 18px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.chat-suggestion-label {
  flex: 1;
}

.chat-suggestion:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.chat-suggestion:active {
  transform: scale(0.99);
}

/* ===== ビュー共通 (Home / Conversation / History の中身) ===== */
/* overflow は各 view が個別に持つ (Conversation は .chat-messages 側で持つので親には付けない) */
.chat-view {
  flex: 1;
  min-height: 0;       /* flex children が overflow-y: auto を効かせるために必要 */
  background: var(--color-surface);
}
.chat-view[hidden] {
  display: none !important;
}

/* ===== Home view ===== */
.chat-home {
  overflow-y: auto;
  padding: 18px 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.chat-home-greeting {
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 14px 16px;
}

.chat-home-section-title {
  margin: 0 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-subtle);
  letter-spacing: 0.04em;
}

.chat-home-continue-card {
  width: 100%;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--color-primary);
  border-radius: 12px;
  box-shadow: 0 2px 6px rgba(0, 125, 235, 0.08);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, transform 0.05s;
  position: relative;
}
.chat-home-continue-card:hover {
  background: var(--color-primary-soft);
}
.chat-home-continue-card:active {
  transform: scale(0.99);
}
.chat-home-continue-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.4;
  /* 長いタイトルは 2 行で省略 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-home-continue-meta {
  font-size: 12px;
  color: var(--color-text-subtle);
}
.chat-home-continue-arrow {
  margin-top: 4px;
  font-size: 12px;
  color: var(--color-primary);
  font-weight: 600;
}

/* ===== Conversation view (chat-messages の親) ===== */
.chat-conversation {
  display: flex;
  flex-direction: column;
  padding: 0;
}
.chat-conversation .chat-messages {
  /* 既存 .chat-messages のスタイルを継承するが、view 内で全高に */
  flex: 1;
}

/* ===== チャット (履歴) タブ view ===== */
/* レイアウト: 上にリスト (スクロール) + 下に「チャットをはじめる」ボタン */
.chat-tab-chat {
  display: flex;
  flex-direction: column;
}
.chat-tab-chat-list-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
}
.chat-tab-chat-cta-wrap {
  padding: 12px 14px 14px;
  background: #fff;
  border-top: 1px solid var(--color-border);
}
.chat-start-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 20px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 125, 235, 0.25);
  transition: background 0.15s, transform 0.05s;
}
.chat-start-btn:hover { background: var(--color-primary-hover); }
.chat-start-btn:active { transform: scale(0.99); }
.chat-start-btn svg { width: 16px; height: 16px; }

.chat-history-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
/* ChannelTalk 風: avatar + 本文(タイトル/プレビュー) + 右端に日付/バッジ */
.chat-history-item {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 12px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  align-items: start;
}
.chat-history-item:hover {
  background: var(--color-primary-soft);
}
.chat-history-item-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-primary-soft);
  color: var(--color-primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.chat-history-item-body {
  min-width: 0; /* truncate のため必須 */
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.chat-history-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-history-item-preview {
  font-size: 12.5px;
  color: var(--color-text-subtle);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.chat-history-item-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.chat-history-item-date {
  font-size: 11.5px;
  color: var(--color-text-subtle);
  white-space: nowrap;
}
/* 旧 .chat-history-item-meta 互換 (古い行レイアウト) */
.chat-history-item-meta {
  font-size: 12px;
  color: var(--color-text-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
}
.chat-history-badge {
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 10px;
  letter-spacing: 0.02em;
}
.chat-history-badge-active {
  background: var(--color-primary-soft);
  color: var(--color-primary);
}
.chat-history-badge-resolved {
  background: #e8f5ec;
  color: #2e7d3a;
}
.chat-history-badge-closed {
  background: var(--color-surface-2);
  color: var(--color-text-subtle);
}
.chat-history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 48px 16px;
  text-align: center;
}
.chat-history-empty-emoji {
  font-size: 44px;
  line-height: 1;
}
.chat-history-empty-title {
  margin: 4px 0 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
}
.chat-history-empty-text {
  margin: 0;
  font-size: 13px;
  color: var(--color-text-subtle);
  line-height: 1.6;
}

/* ===== AI 回答内の構造化スタイル (Markdown 風レンダラー出力) ===== */
/* 親 .chat-bubble は white-space: pre-wrap (AI 出力の改行を保持) だが、
   構造化されたタグ内では HTML 中の空白・改行は無視させる。
   これがないと <li> 間のインデント改行が「空行」として描画される。 */
.chat-bubble h4.chat-section-heading,
.chat-bubble p,
.chat-bubble ul.chat-bubble-list,
.chat-bubble ul.chat-bubble-list li {
  white-space: normal;
}

.chat-bubble h4.chat-section-heading {
  margin: 12px 0 4px;
  font-size: 13px;
  font-weight: 700;
  color: var(--color-primary);
  letter-spacing: 0.02em;
}
.chat-bubble h4.chat-section-heading:first-child {
  margin-top: 0;
}
.chat-bubble p {
  margin: 0 0 6px;
  line-height: 1.65;
}
.chat-bubble p:last-child {
  margin-bottom: 0;
}
.chat-bubble p + p {
  margin-top: 0;
}
.chat-bubble ul.chat-bubble-list {
  margin: 2px 0 6px;
  padding-left: 0;
  list-style: none;
}
.chat-bubble ul.chat-bubble-list li {
  position: relative;
  padding: 1px 0 1px 14px;
  font-size: 13.5px;
  line-height: 1.55;
}
.chat-bubble ul.chat-bubble-list li::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 11px;
  width: 4px;
  height: 4px;
  background: var(--color-primary);
  border-radius: 50%;
}
/* 番号付きリスト (手順: 1. 2. 3.) */
.chat-bubble ol.chat-bubble-ol {
  margin: 2px 0 6px;
  padding-left: 1.5em;
  white-space: normal;
}
.chat-bubble ol.chat-bubble-ol li {
  white-space: normal;
  padding: 1px 0;
  font-size: 13.5px;
  line-height: 1.55;
}
.chat-bubble ol.chat-bubble-ol li::marker {
  color: var(--color-primary);
  font-weight: 700;
}
.chat-bubble strong {
  font-weight: 700;
  color: var(--color-text);
}

/* ===== 会話冒頭サジェスト (chat-intro-suggestions) ===== */
.chat-intro-suggestions {
  margin-top: 4px;
}
.chat-intro-suggestions-title {
  margin: 4px 2px 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-subtle);
  letter-spacing: 0.04em;
}

/* ===== 戻るボタン (ヘッダー左) ===== */
.chat-back {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin-right: 8px;
  transition: background 0.15s;
}
.chat-back:hover { background: rgba(255, 255, 255, 0.28); }
.chat-back svg { width: 16px; height: 16px; }
.chat-back[hidden] { display: none !important; }

/* ===== 下部タブナビ (ChannelTalk 風) ===== */
.chat-tab-nav {
  display: flex;
  background: #fff;
  border-top: 1px solid var(--color-border);
  padding: 6px 8px;
  gap: 4px;
  flex-shrink: 0;
}
.chat-tab-nav[hidden] { display: none !important; }
.chat-tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: 8px;
  color: var(--color-text-subtle);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chat-tab-btn:hover {
  background: var(--color-surface);
  color: var(--color-text-muted);
}
.chat-tab-btn.active {
  color: var(--color-primary);
}
.chat-tab-icon-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-tab-icon {
  width: 22px;
  height: 22px;
}
.chat-tab-label {
  line-height: 1.2;
}
.chat-tab-badge {
  position: absolute;
  top: -4px;
  right: -8px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e74c3c;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chat-tab-badge[hidden] { display: none !important; }

/* ===== 解決確認 / 未解決オプション (会話内インラインプロンプト) ===== */
.chat-inline-prompt {
  margin: 6px 0 4px;
  padding: 12px 14px;
  background: #fff;
  border: 1px dashed var(--color-border);
  border-radius: 10px;
}
.chat-inline-prompt-text {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-muted);
}
.chat-inline-prompt-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chat-inline-prompt-actions-stack {
  flex-direction: column;
}
.chat-inline-btn {
  flex: 1;
  min-width: 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 500;
  color: var(--color-text);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chat-inline-btn:hover {
  background: var(--color-primary-soft);
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.chat-inline-btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}
.chat-inline-btn-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  color: #fff;
}
.chat-inline-link {
  display: inline-block;
  margin-top: 4px;
  color: var(--color-primary);
  font-weight: 500;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
.chat-inline-link:hover {
  color: var(--color-primary-hover);
}

.chat-typing {
  display: inline-flex;
  gap: 4px;
  padding: 4px 0;
}

.chat-bubble-thinking .chat-thinking-text {
  margin-top: 4px;
  font-size: 13px;
  color: var(--color-text-subtle);
  line-height: 1.5;
}

.chat-typing span {
  width: 7px;
  height: 7px;
  background: var(--color-text-subtle);
  border-radius: 50%;
  animation: chat-typing 1.2s infinite ease-in-out;
}

.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }

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

.chat-input-area {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px;
  background: #fff;
  border-top: 1px solid var(--color-border);
}

#chat-input {
  flex: 1;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  resize: none;
  outline: none;
  max-height: 120px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

#chat-input:focus {
  border-color: var(--color-primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(0, 125, 235, 0.15);
}

.chat-send {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-primary);
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.15s, opacity 0.15s;
}

.chat-send:hover:not(:disabled) {
  background: var(--color-primary-hover);
}

.chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.chat-send svg {
  width: 18px;
  height: 18px;
}

/* ===== Responsive ===== */
@media (max-width: 880px) {
  .main-grid {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 32px;
  }

  .sidebar {
    position: static;
  }

  .sidebar-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 24px;
  }

  .sidebar-list a {
    border-left: none;
    border: 1px solid var(--color-border);
    background: #fff;
    padding: 6px 12px;
    font-size: 13px;
  }

  .sidebar-list a.active {
    border-color: var(--color-primary);
  }

  .sidebar-contact {
    display: none;
  }

  .hero {
    padding: 40px 0 32px;
  }

  .hero h1 {
    font-size: 28px;
  }
}

@media (max-width: 560px) {
  .container {
    padding: 0 16px;
  }

  .header-inner {
    height: 56px;
  }

  .header-nav {
    gap: 14px;
  }

  .header-nav a {
    font-size: 13px;
  }

  .hero {
    padding: 32px 0 24px;
  }

  .hero h1 {
    font-size: 22px;
    line-height: 1.4;
  }

  .hero-lead {
    font-size: 14px;
    margin-bottom: 20px;
  }

  #faq-search {
    padding: 14px 44px 14px 46px;
    font-size: 16px; /* iOS auto-zoom 防止: 16px 以上を維持 */
  }

  .main-grid {
    padding-top: 24px;
    padding-bottom: 56px;
    gap: 24px;
  }

  .category-title {
    font-size: 18px;
  }

  .faq-item summary {
    padding: 14px;
    gap: 10px;
  }

  .q-text {
    font-size: 14px;
  }

  .faq-answer {
    padding: 14px 14px 14px 14px;
    font-size: 14px;
  }

  .cta-card {
    padding: 24px 18px;
    margin-top: 32px;
  }

  .cta-card h3 {
    font-size: 18px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  /* --- Chat FAB --- */
  .chat-fab {
    bottom: 16px;
    right: 16px;
    padding: 14px;
    border-radius: 50%;
  }
  .chat-fab-label { display: none; }

  /* --- Chat Panel: bottom-sheet style on mobile --- */
  .chat-panel {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: 88vh;
    height: 88dvh; /* mobile browser chrome を考慮 */
    max-height: 88vh;
    max-height: 88dvh;
    border-radius: 18px 18px 0 0;
    animation: chat-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  }

  @keyframes chat-slide-up {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .chat-header {
    padding: 12px 16px;
  }

  .chat-messages {
    padding: 14px;
  }

  .chat-input-area {
    padding: 10px 12px;
    padding-bottom: max(10px, env(safe-area-inset-bottom));
  }
}
