html {
  font-size: 14px;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  margin-bottom: 60px;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--bs-secondary-color);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* ========== Human Future レイアウト（元デザイン再現） ========== */
.hf-body {
  margin: 0;
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  font-family: 'Noto Sans JP', sans-serif;
  background: #f5f7fa;
  overflow: hidden;
}

/* スクロールバーを薄い色に */
.hf-body ::-webkit-scrollbar {
  width: 2px;
  height: 2px;
}
.hf-body ::-webkit-scrollbar-track {
  background: #fafbfc;
}
.hf-body ::-webkit-scrollbar-thumb {
  background: #e2e8f0;
  border-radius: 3px;
}
.hf-body ::-webkit-scrollbar-thumb:hover {
  background: #cbd5e1;
}
.hf-chat-section,
.hf-sidebar-left,
.hf-studio-column,
.hf-avatar-list,
.hf-references-list {
  scrollbar-color: #e2e8f0 #fafbfc;
}

.hf-header {
  background: #fff;
  border-top: 3px solid #202586;
  padding: 0.75rem 1.5rem;
  flex-shrink: 0;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
}

.hf-header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  max-width: none;
}

.hf-header-inner .hf-header-logo {
  justify-self: start;
}

.hf-header-inner .hf-header-tabs {
  justify-self: center;
}

.hf-header-inner .hf-header-icons {
  justify-self: end;
  margin-left: 0;
}

.hf-header-logo {
  color: #202586;
  text-decoration: none;
  font-weight: 600;
  font-size: 1.1rem;
}

.hf-header-logo-img {
  display: block;
  height: 36px;
  width: auto;
  object-fit: contain;
}

.hf-header-tabs {
  display: flex;
  gap: 0.5rem;
}

.hf-tab {
  color: #64748b;
  text-decoration: none;
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: #e2e8f0;
  font-size: 0.9rem;
}

.hf-tab:hover {
  color: #475569;
  background: #cbd5e1;
}

.hf-tab.active {
  color: #fff;
  background: #202586;
}

.hf-header-icons {
  display: flex;
  gap: 0.75rem;
  margin-left: auto;
}

.hf-icon {
  font-size: 1.1rem;
  cursor: pointer;
  color: #475569;
}

/* ヘッダー右上: ユーザー画像＋クリックで右からドロップダウン */
.hf-header-user-wrap {
  position: relative;
}
.hf-header-user-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
}
.hf-header-user-img {
  width: 36px;
  height: 36px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.hf-header-user-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1099;
}
.hf-header-user-overlay.is-open {
  display: block;
}
.hf-header-user-dropdown {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  max-width: 90vw;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0, 0, 0, 0.15);
  z-index: 1100;
  transform: translateX(100%);
  transition: transform 0.25s ease;
  overflow-y: auto;
}
.hf-header-user-dropdown.is-open {
  transform: translateX(0);
}
.hf-header-user-dropdown-inner {
  padding: 1.5rem 1.25rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}
.hf-header-user-dropdown-img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.hf-header-user-link {
  display: block;
  width: 100%;
  padding: 0.6rem 0.75rem;
  color: #1e293b;
  text-decoration: none;
  font-size: 0.95rem;
  border-radius: 8px;
  text-align: left;
  transition: background 0.2s;
}
.hf-header-user-link:hover {
  background: #f1f5f9;
}
.hf-header-user-link-signout {
  margin-top: 0.5rem;
  color: #64748b;
}

.hf-app {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #f5f7fa;
}

/* 左ペインラッパー: 20% + 隙間8px + ボタン20px。縮小時は 10% */
.hf-left-pane-wrap {
  flex: 0 0 calc(20% + 28px);
  min-width: 0;
  display: flex;
  align-self: stretch;
  margin-left: 8px;
  margin-right: 0;
  margin-top: 8px;
  margin-bottom: 8px;
  transition: flex-basis 0.25s ease;
}

.hf-left-pane-wrap.collapsed {
  flex: 0 0 10%;
  min-width: 56px;
}
.hf-left-pane-wrap.collapsed .hf-sidebar-left {
  padding-right: 1rem;
}

/* 左ペイン: ネイビー背景・白文字。アコーディオン展開時は内側でスクロール。
   アバターとスクロールバーの間に 8px 隙間（padding-right で実施。ラッパーを 8px 広げているので実質の横幅は 20% のまま） */
.hf-sidebar-left {
  flex: 1;
  min-width: 0;
  min-height: 0;
  background: #202586;
  color: #fff;
  padding: 1rem;
  padding-right: calc(1rem + 8px);
  box-sizing: border-box;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 12px 0 0 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

/* 左ペイン縮小ボタン（学習サイトの並びの右端） */
.hf-pane-collapse-btn.hf-pane-collapse-left {
  flex-shrink: 0;
  width: 20px;
  min-width: 20px;
  background: #202586;
  color: #fff;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 0 8px rgba(0, 0, 0, 0.1);
  transition: background 0.2s;
}

.hf-pane-collapse-btn.hf-pane-collapse-left:hover {
  background: #2d3599;
}

.hf-pane-collapse-btn.hf-pane-collapse-left .hf-pane-collapse-icon {
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.25s ease;
}

.hf-left-pane-wrap.collapsed .hf-pane-collapse-btn.hf-pane-collapse-left .hf-pane-collapse-icon {
  transform: rotate(180deg);
}

.hf-sidebar-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
  color: #fff;
}

.hf-avatar-strip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1rem;
  width: 100%;
}

.hf-avatar-scroll {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}

.hf-avatar-all-btn {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.hf-avatar-all-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.hf-avatar-list {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-width: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

/* 左サイドバー: アバターは10個表示し、同時に見えるのは6つ（従来通り） */
.hf-avatar-list.hf-avatar-list-show-6 {
  max-width: calc(40px * 6 + 0.5rem * 5);
}

.hf-avatar-list::-webkit-scrollbar {
  display: none;
}

.hf-avatar-chip {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-block;
  border: 2px solid rgba(255, 255, 255, 0.3);
}

.hf-avatar-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hf-avatar-chip-selected {
  border-color: #ea580c !important;
  box-shadow: inset 0 0 0 2px #ea580c;
}

/* AIコーチ: マウスオーバーでSwiper外に拡大プレビューを表示 */
.hf-coach-avatar-preview {
  display: none;
  position: fixed;
  width: 140px;
  height: 140px;
  left: max(1rem, min(10vw, 80px));
  top: 115px;
  transform: translateX(-50%);
  z-index: 1000;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  background: #fff;
  pointer-events: none;
}
.hf-coach-avatar-preview.is-visible {
  display: block;
}
.hf-coach-avatar-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hf-coach-avatar-list .hf-avatar-chip {
  position: relative;
  z-index: 1;
}

.hf-course-bar {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  padding: 0.6rem 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.hf-menu {
  list-style: none;
  padding: 0;
  margin: 0;
}

.hf-menu-placeholder {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  padding: 0.5rem 0;
  margin: 0;
}

.hf-menu-group {
  margin-bottom: 0.25rem;
}

.hf-menu-group summary {
  cursor: pointer;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: #e2e8f0;
}

.hf-menu-group summary:hover {
  color: #fff;
  text-decoration: underline;
}

.hf-menu-sub {
  list-style: none;
  padding-left: 1rem;
  margin: 0.25rem 0 0.75rem 0;
}

.hf-menu-sub-item {
  padding: 0.25rem 0;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

/* 小分類が「クリックできる」ことを明示 */
.hf-menu-sub-item:hover {
  color: #fff;
  text-decoration: underline;
}

.hf-menu-sub-bullet {
  flex-shrink: 0;
  font-size: 0.65em;
  line-height: 1;
  opacity: 0.9;
}

.hf-menu-check {
  flex-shrink: 0;
}

.hf-menu-sub-item.active {
  color: #93c5fd;
  font-weight: 500;
}

/* 中央・右ペイン用コンテナ - 画面全体に広がる */
.hf-main {
  flex: 1;
  min-width: 0;
  display: flex;
  overflow: hidden;
  margin: 8px 8px 8px 0;
}

.hf-index-root {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.hf-index-root > .hf-content-columns {
  flex: 1;
  min-width: 0;
}

.hf-content-columns {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

/* 右ペインラッパー: 30% → 20% で縮小可能 */
.hf-right-pane-wrap {
  flex: 0 0 30%;
  min-width: 0;
  display: flex;
  align-self: stretch;
  transition: flex-basis 0.25s ease;
}

.hf-right-pane-wrap.collapsed {
  flex: 0 0 20%;
  min-width: 160px;
}

/* 中央ペイン: 角丸白カード・独立スクロール（残り幅を占有して広めに） */
.hf-chat-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 1rem 1.5rem;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin: 0 6px 0 0;
}

/* Coach: 左上の固定コーチアバター6種（gpt_male, gpt_female, gemini_male, gemini_female, claude_male, claude_female） */
.hf-coach-avatar-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
  align-items: center;
}
.hf-coach-avatar-chip {
  display: inline-flex;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  border: 2px solid #e2e8f0;
  box-sizing: border-box;
}
.hf-coach-avatar-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hf-chat-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1rem 0;
}

/* チャット欄（中央ペイン内で独立スクロール。参照資料は下に固定表示） */
.hf-chat-section {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 10px;
}

.hf-chat-messages {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  min-width: 0;
}

.hf-chat-placeholder {
  color: #94a3b8;
  font-size: 0.9rem;
  padding: 1.5rem 0;
  margin: 0;
  text-align: center;
}

#hf-chat-result:not(:empty) ~ .hf-chat-placeholder { display: none; }

/* サンプル準拠: history-item（1メッセージ行）— 重なり防止。メッセージ内の日付と吹き出しは適度に詰める */
.history-item {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  width: 100%;
  min-width: 0;
  flex-shrink: 0;
}

.history-item.reverse .message-category {
  margin-left: auto;
}

/* アバターのメッセージの直後にユーザーメッセージが続くとき、その上の余白を広げる */
.history-item:not(.reverse) + .history-item.reverse {
  margin-top: 1rem;
}

/* ユーザーのメッセージの直後にアバターメッセージが続くとき、その上の余白を広げる */
.history-item.reverse + .history-item:not(.reverse) {
  margin-top: 1rem;
}

.history-date {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: #64748b;
  margin: 0.25rem 0 0 0;
  min-width: 2.5rem;
}

/* メッセージ本体: send=AIアバター（左・幅広）、sendto=生徒（右・幅狭） */
.message-category {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  max-width: 100%;
}

/* AIアバター返答: 幅を大きく取る（左側・広い吹き出し）— はみ出し防止 */
.message-category.send {
  max-width: 85%;
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow-x: hidden;
}

/* 1行目: send＋アバター と Re:枠を横一列に（テーブルで確実に）。アバター側はタイトルと本文の間を詰める */
.hf-send-header-table {
  width: 100%;
  border: none;
  border-collapse: collapse;
  margin: 0 0 0.2rem 0;
  padding: 0;
  table-layout: fixed;
  vertical-align: middle;
  display: table;
  min-height: 3rem;
}

.hf-send-header-table tbody,
.hf-send-header-table tr {
  display: table-row;
}

.hf-send-header-table td {
  border: none;
  padding: 0;
  vertical-align: middle;
}

.hf-send-header-cell-left {
  width: 1%;
  min-width: 5rem;
  white-space: nowrap;
  padding-right: 0.75rem;
  vertical-align: middle;
}

.hf-send-header-cell-left .message-send,
.hf-send-header-cell-left .myFigure3 {
  display: inline-block;
  vertical-align: middle;
  margin: 0;
}

.hf-send-header-cell-left .myFigure3 {
  margin-left: 0.35rem;
}

/* Re: の枠 — アバターと離し、重ならないように */
.hf-send-header-cell-right {
  width: 99%;
  min-width: 0;
  padding-left: 0.25rem;
  vertical-align: middle;
}

.hf-send-header-cell-right .message-title {
  margin: 0;
  display: block;
}

/* 従来の flex 版（テーブル未使用時のフォールバック） */
.hf-body .message-category.send .hf-send-header {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  width: 100%;
}

/* send: とアバターを横並びに（display:block / unicode-bidi の上書き） */
.hf-body .message-category.send .hf-send-header .message-container.hf-send-avatar-row {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center;
  gap: 0.35rem;
  flex: 0 0 auto;
  unicode-bidi: normal;
}

.hf-body .message-category.send .hf-send-header .message-container.hf-send-avatar-row > .message-send,
.hf-body .message-category.send .hf-send-header .message-container.hf-send-avatar-row > .myFigure3 {
  flex: 0 0 auto;
  min-width: 0;
}

.message-category.send .hf-send-header .message-title {
  flex: 1 1 0%;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  margin: 0;
}

.message-category.send .message-text-summary,
.message-category.send .message-title {
  background: #e8f4fc;
  border: 1px solid #b8d4e8;
  border-radius: 12px;
  padding: 0.75rem 1rem;
  margin: 0;
}

.message-category.send .message-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

/* 2行目: 本文（テーブルの下に余白は最小に詰める） */
.message-category.send .message-text-summary {
  min-width: 0;
  margin-top: 0.2rem;
  margin-bottom: 0;
}

.message-category.send .message-text-summary {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #334155;
}

.message-category.send .summary-text {
  margin: 0;
}

.message-send {
  font-size: 0.7rem;
  color: #94a3b8;
  margin: 0;
}

/* 生徒の送信: 幅を狭く（右側・狭い吹き出し） */
.message-category.sendto {
  max-width: 48%;
  min-width: 0;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0.5rem;
  overflow-x: hidden;
}

.message-category.sendto .message-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.message-category.sendto .message-container {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.message-category.sendto .message-title,
.message-category.sendto .message-text {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 0.6rem 0.9rem;
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #334155;
}

.message-category.sendto .message-title {
  font-weight: 600;
}

/* エクササイズのやり取り：薄いオレンジの枠・背景（自由な質問は水色のまま） */
/* 自由な設問（EXERCISE_FLG=1）: 青枠 */
.hf-chat-free .message-category.send .message-text-summary,
.hf-chat-free .message-category.send .message-title {
  background: #e8f4fc;
  border-color: #7eb8da;
}
.hf-chat-free .message-category.sendto .message-title,
.hf-chat-free .message-category.sendto .message-text {
  background: #f0f8fc;
  border-color: #b8d4e8;
}

.hf-chat-exercise .message-category.send .message-text-summary,
.hf-chat-exercise .message-category.send .message-title {
  background: #fef3e6;
  border-color: #e8c4a0;
}

/* エクササイズ右側（社員）は社長より薄いオレンジ */
.hf-chat-exercise .message-category.sendto .message-title,
.hf-chat-exercise .message-category.sendto .message-text {
  background: #fefaf5;
  border-color: #f0ddc8;
}

.message-text-summary.hf-summary-clickable {
  cursor: pointer;
}

/* 要約クリックで全文モーダルを開く */
.hf-summary-clickable {
  cursor: pointer;
}
.hf-summary-clickable:hover {
  filter: brightness(0.98);
}

/* 全文表示モーダル */
.hf-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.2s ease, visibility 0.2s;
}
.hf-modal.hf-modal-open {
  visibility: visible;
  opacity: 1;
}
.hf-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}
.hf-modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.hf-modal-title {
  flex-shrink: 0;
  margin: 0;
  padding: 1rem 3rem 0.5rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: #1e293b;
}
.hf-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 32px;
  height: 32px;
  border: none;
  background: #f1f5f9;
  color: #475569;
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hf-modal-close:hover {
  background: #e2e8f0;
}
.hf-modal-body {
  padding: 0 1.25rem 1.25rem;
  overflow-y: auto;
  font-size: 0.9rem;
  line-height: 1.7;
  color: #334155;
}
.hf-modal-body p {
  margin: 0 0 0.75rem 0;
}
.hf-modal-body p:last-child {
  margin-bottom: 0;
}

/* 参照資料プレビュー（PDF・画像・動画）実験用 */
.hf-ref-preview-modal .hf-modal-content {
  max-width: 90vw;
  max-height: 90vh;
  width: 720px;
}
.hf-ref-preview-body {
  display: flex;
  flex-direction: column;
  padding: 0 1.25rem 1.25rem;
  overflow: hidden;
}
.hf-ref-preview-content {
  flex: 1;
  min-height: 200px;
  max-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  border-radius: 8px;
  overflow: auto;
}
.hf-ref-preview-iframe {
  width: 100%;
  min-height: 400px;
  height: 70vh;
  border: none;
  border-radius: 8px;
}
.hf-ref-preview-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
}
.hf-ref-preview-video {
  max-width: 100%;
  max-height: 70vh;
}
.hf-ref-preview-open-link {
  margin: 0.75rem 0 0 0;
  font-size: 0.9rem;
}
.hf-ref-preview-open-link a {
  color: #0369a1;
  text-decoration: underline;
}

/* アバター一覧モーダル */
.hf-avatar-all-modal .hf-avatar-all-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}
.hf-avatar-all-modal .hf-avatar-all-modal-content {
  position: relative;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  max-width: 90vw;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hf-avatar-all-modal .hf-avatar-all-modal-title {
  flex-shrink: 0;
  margin: 0;
  padding: 1rem 3rem 0.5rem 1.25rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #1e293b;
}
.hf-avatar-all-modal .hf-avatar-all-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  width: 36px;
  height: 36px;
  border: none;
  background: #ea580c;
  color: #fff;
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hf-avatar-all-modal .hf-avatar-all-modal-close:hover {
  background: #c2410c;
}
.hf-avatar-all-modal .hf-avatar-all-modal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 1rem;
  padding: 1rem 1.25rem 1.25rem;
  overflow-y: auto;
}
.hf-avatar-all-modal-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.15s ease;
}
.hf-avatar-all-modal-item:hover {
  background: #f1f5f9;
}
.hf-avatar-all-modal-item-img {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: #e2e8f0;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}
.hf-avatar-all-modal-item-name {
  font-size: 0.8rem;
  color: #334155;
  text-align: center;
  line-height: 1.3;
}

/* アバター画像（サンプル myFigure3 互換） */
.myFigure3.hf-chat-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e2e8f0;
  background-size: cover;
  background-position: center;
  margin: 0;
}

.hf-chat-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #e2e8f0;
  background-size: cover;
  background-position: center;
}

/* 参照資料枠（チャット欄と別エリア・左右ボタン＋スワイプ） */
.hf-references-section {
  flex-shrink: 0;
  border-top: 1px solid #e2e8f0;
  padding-top: 1rem;
  margin-top: 0.5rem;
  background: #f8fafc;
  border-radius: 0 0 12px 12px;
  margin-left: -1rem;
  margin-right: -1.5rem;
  margin-bottom: -1rem;
  padding-left: 1rem;
  padding-right: 1.5rem;
  padding-bottom: 1rem;
}

.hf-references-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.hf-references-strip {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.hf-ref-scroll {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border: 1px solid #cbd5e1;
  background: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #475569;
  transition: background 0.2s, color 0.2s;
}

.hf-ref-scroll:hover {
  background: #e2e8f0;
  color: #1e293b;
}

.hf-references-list {
  display: flex;
  gap: 0.75rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  min-width: 0;
  padding: 0.25rem 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.hf-references-list.hf-swiper {
  cursor: grab;
  user-select: none;
}

.hf-references-list.hf-swiper:active,
.hf-references-list.hf-swiper.hf-swiper-dragging {
  cursor: grabbing;
}

.hf-ref-thumb {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.hf-ref-thumb-img {
  width: 80px;
  height: 60px;
  background: #e0e0e0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 6px;
  display: block;
  object-fit: cover;
}
.hf-ref-thumb-img[src] {
  /* img タグでサムネイル表示時 */
  font-size: 0;
  vertical-align: top;
}

.hf-ref-thumb-label {
  font-size: 0.8rem;
  color: #333;
}

/* 参照資料：小分類ドキュメント（サムネイル＋リンク） */
a.hf-ref-doc {
  text-decoration: none;
  color: inherit;
  max-width: 100px;
}
a.hf-ref-doc:hover .hf-ref-thumb-label { text-decoration: underline; }

.hf-ref-docs-placeholder {
  margin: 0;
  padding: 0.5rem 0;
  font-size: 0.9rem;
  color: #64748b;
}

/* 左ペイン・参照資料のスワイパー共通（マウス/ペンでドラッグスクロール） */
.hf-avatar-list.hf-swiper {
  cursor: grab;
  user-select: none;
}

.hf-avatar-list.hf-swiper:active,
.hf-avatar-list.hf-swiper.hf-swiper-dragging {
  cursor: grabbing;
}

/* 右ペイン: 角丸白カード・独立スクロール */
.hf-studio-column {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 1rem 1.25rem;
  background: #fff;
  border-radius: 12px 0 0 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  overflow-y: auto;
}

/* 右ペイン縮小ボタン（スタジオの右端） */
.hf-pane-collapse-btn.hf-pane-collapse-right {
  flex-shrink: 0;
  width: 20px;
  min-width: 20px;
  background: #e2e8f0;
  color: #475569;
  border: none;
  border-radius: 0 8px 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 8px;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.06);
  transition: background 0.2s;
}

.hf-pane-collapse-btn.hf-pane-collapse-right:hover {
  background: #cbd5e1;
}

.hf-pane-collapse-btn.hf-pane-collapse-right .hf-pane-collapse-icon {
  font-size: 1.2rem;
  line-height: 1;
  transition: transform 0.25s ease;
}

.hf-right-pane-wrap.collapsed .hf-pane-collapse-btn.hf-pane-collapse-right .hf-pane-collapse-icon {
  transform: rotate(180deg);
}

.hf-studio-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem 0;
}

.hf-studio-mode {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.hf-studio-meta {
  font-size: 0.85rem;
  color: #444;
  margin: 0 0 0.25rem 0;
}

.hf-studio-meta-unselected {
  color: #94a3b8;
}

.hf-studio-note {
  display: flex;
  gap: 1rem;
  margin: 0 0 1rem 0;
  font-size: 0.9rem;
}

.hf-studio-note label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.hf-answer-box {
  background: #fde4d4;
  padding: 1rem;
  border-radius: 8px;
  margin-bottom: 1.25rem;
}

.hf-answer-box-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 0.5rem 0;
}

.hf-answer-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.hf-answer-title-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #1e293b;
}

.hf-answer-title-input {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.hf-answer-question {
  font-size: 0.85rem;
  margin: 0 0 1.5rem 0;
  line-height: 1.5;
  color: #1e293b;
  background: #fff;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

.hf-answer-question-label {
  font-weight: 600;
}

.hf-answer-question-body {
  display: inline;
}

.hf-answer-input {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 0.9rem;
  resize: vertical;
  margin-bottom: 0.75rem;
  box-sizing: border-box;
}

/* スタジオ「質問を書く」モード時: 枠全体の背景を薄い水色に（タイトル・入力枠は白のまま） */
.hf-answer-box.hf-answer-box--question {
  background: #e6f4f8;
}

.hf-answer-actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.hf-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 6px;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
}

.hf-btn-back {
  background: #d1d5db;
  color: #374151;
}

.hf-btn-submit {
  background: #ea580c;
  color: #fff;
}

.hf-studio-features-intro {
  font-size: 0.85rem;
  color: #444;
  margin: 0 0 0.5rem 0;
  line-height: 1.4;
}

.hf-studio-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem 0;
  font-size: 0.85rem;
}

.hf-studio-features li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.hf-feature-icon {
  font-size: 1rem;
}

.hf-studio-links {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.85rem;
}

.hf-studio-links li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  cursor: pointer;
}

.hf-link-icon {
  font-size: 1rem;
}

/* ========== ログイン画面（Human Future ロゴ・サインイン） ========== */
.hf-login-body {
  margin: 0;
  min-height: 100vh;
  background: #ffffff;
  font-family: 'Noto Sans JP', sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hf-login-root {
  width: 100%;
  max-width: 400px;
  padding: 2rem;
  box-sizing: border-box;
}

.hf-login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.hf-login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.hf-login-brand-icon {
  display: inline-flex;
  flex-shrink: 0;
  line-height: 0;
}

.hf-login-brand-icon svg {
  display: block;
  width: 40px;
  height: 40px;
}

.hf-login-brand-text {
  font-size: 1.5rem;
  font-weight: 600;
  color: #333333;
  letter-spacing: 0.02em;
}

.hf-login-logo {
  margin-bottom: 0.5rem;
}

.hf-login-logo-img {
  display: block;
  height: auto;
  max-width: 220px;
  width: 100%;
}

.hf-login-logo-text {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: #202586;
  letter-spacing: 0.02em;
  text-align: center;
}

.hf-login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 1.25rem;
}

.hf-login-error {
  width: 100%;
  padding: 0.5rem 0.75rem;
  background: #ffebee;
  color: #c62828;
  font-size: 0.875rem;
  border-radius: 8px;
  box-sizing: border-box;
}

.hf-login-field {
  width: 100%;
}

.hf-login-input {
  width: 100%;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  font-family: inherit;
  color: #333;
  background: #e8f0fe;
  border: 1px solid #dadce0;
  border-radius: 24px;
  box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s;
}

.hf-login-input::placeholder {
  color: #5f6368;
}

.hf-login-input:hover {
  border-color: #c4c7cc;
}

.hf-login-input:focus {
  outline: none;
  border-color: #3683f2;
  background: #e8f0fe;
}

.hf-login-submit {
  width: 100%;
  padding: 0.875rem 1.5rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #232895;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(35, 40, 149, 0.35);
  transition: background 0.2s, box-shadow 0.2s;
}

.hf-login-submit:hover {
  background: #1e2480;
  box-shadow: 0 3px 6px rgba(35, 40, 149, 0.4);
}

.hf-login-submit:active {
  box-shadow: 0 1px 2px rgba(35, 40, 149, 0.3);
}

/* ========== 共通エラー画面（HF_Login/Error） ========== */
.hf-error-root {
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 2rem;
}

.hf-error-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 0.25rem;
}

.hf-error-logo-img {
  display: block;
  height: 48px;
  width: auto;
  object-fit: contain;
}

.hf-error-breadcrumb {
  font-size: 1.125rem;
  color: #475569;
  margin: 0;
  font-weight: 500;
}

.hf-error-card {
  width: 100%;
  border-radius: 14px;
  box-sizing: border-box;
}

.hf-error-message-card {
  background: #f1f5f9;
  padding: 1.75rem 2rem;
  text-align: center;
}

.hf-error-message {
  margin: 0;
  font-size: 1.25rem;
  color: #1e293b;
  font-weight: 500;
}

.hf-error-content-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.hf-error-content-label {
  display: inline-block;
  background: #f1f5f9;
  color: #475569;
  font-size: 1rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  width: fit-content;
  font-weight: 500;
}

.hf-error-content-body {
  min-height: 120px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #fafbfc;
  padding: 1rem 1.25rem;
}

.hf-error-content-text {
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.hf-error-content-empty {
  margin: 0;
  font-size: 1rem;
  color: #94a3b8;
}

.hf-error-actions {
  width: 100%;
  display: flex;
  justify-content: center;
  padding-top: 0.75rem;
}

.hf-error-btn {
  display: inline-block;
  padding: 0.75rem 2.5rem;
  font-size: 1.0625rem;
  font-weight: 500;
  color: #fff;
  background: #202586;
  border: none;
  border-radius: 10px;
  text-decoration: none;
  box-shadow: 0 2px 4px rgba(32, 37, 134, 0.25);
  transition: background 0.2s, box-shadow 0.2s;
}

.hf-error-btn:hover {
  background: #1e2480;
  box-shadow: 0 3px 6px rgba(32, 37, 134, 0.35);
  color: #fff;
}

.hf-error-btn:active {
  box-shadow: 0 1px 2px rgba(32, 37, 134, 0.3);
}

/* ========== ダッシュボード（大元画像準拠・_LayoutDashboard） ========== */
.hf-db-body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Noto Sans JP', sans-serif;
  background: #f5f7fa;
}

.hf-db-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background: #fff;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

.hf-db-header-left {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.75rem;
}

.hf-db-header-logo {
  height: 48px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
}

.hf-db-header-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
  color: #475569;
}

.hf-db-header-right {
  flex-shrink: 0;
}

.hf-db-header-profile {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e2e8f0;
}

.hf-db-main {
  flex: 1;
  min-height: 0;
  padding: 1rem 1.5rem;
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.hf-db-root {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  flex: 1;
  min-height: 0;
  width: 100%;
}

/* オレンジ枠プレースホルダー（後から追加予定のためタグは残し非表示） */
.hf-db-placeholder {
  display: none !important;
  border: 2px solid #ff8b36;
  border-radius: 12px;
  min-height: 80px;
}

.hf-db-placeholder-left,
.hf-db-placeholder-right {
  flex: 0 0 120px;
}

.hf-db-top-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.hf-db-cards {
  display: flex;
  gap: 2rem;
  flex-wrap: nowrap;
  justify-content: center;
}

.hf-db-card {
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.hf-db-card-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 180px;
  overflow: hidden;
  border-radius: 24px;
}

.hf-db-card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.2s;
}

.hf-db-card-img-bright {
  opacity: 0;
}

.hf-db-card:hover .hf-db-card-img-bright {
  opacity: 1;
}

.hf-db-card:hover .hf-db-card-img:not(.hf-db-card-img-bright) {
  opacity: 0;
}

.hf-db-columns {
  display: flex;
  gap: 1rem;
  flex: 1;
  min-height: 0;
}

.hf-db-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: #eef1f5;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.hf-db-col-left {
  flex: 0 0 28%;
  border: 1px solid #cbd5e1;
}

.hf-db-col-center {
  flex: 1 1 auto;
}

.hf-db-col-right {
  flex: 0 0 28%;
  border: 1px solid #cbd5e1;
}

.hf-db-ops-gap {
  height: 1rem;
  flex-shrink: 0;
}

.hf-db-panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  color: #334155;
  flex-shrink: 0;
}

.hf-db-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1rem;
  background: #eef1f5;
}

.hf-db-col-right .hf-db-scroll {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  margin: 0 0.75rem 0.75rem;
  margin-top: 0;
  padding: 0.75rem 1rem;
  box-sizing: border-box;
}

/* 左カラム: 各AIエージェントからのメッセージ（青ヘッダー＋白メッセージボックス） */
.hf-db-agent-block {
  margin-bottom: 1rem;
}

.hf-db-agent-block:last-child {
  margin-bottom: 0;
}

.hf-db-agent-head {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.35rem 0;
  padding: 0.5rem 0.75rem;
  background: #202586;
  color: #fff;
  border-radius: 8px 8px 0 0;
}

.hf-db-agent-msg-box {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-top: none;
  border-radius: 0 0 8px 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
}

.hf-db-agent-msg {
  font-size: 0.875rem;
  color: #475569;
  margin: 0 0 0.5rem 0;
  line-height: 1.6;
}

.hf-db-agent-msg:last-child {
  margin-bottom: 0;
}

/* 中央カラム: 当月のセッション数（縦区切り線）＋学習進捗グラフ */
.hf-db-session-panel {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  padding: 1rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.hf-db-session-panel .hf-db-panel-title {
  background: transparent;
  border-bottom: none;
  padding-top: 0;
}

.hf-db-session-inner {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 0.5rem;
  padding: 0.5rem 0;
}

.hf-db-session-item {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: #475569;
}

.hf-db-session-num {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: #202586;
}

.hf-db-session-divider {
  width: 1px;
  align-self: stretch;
  background: #e2e8f0;
  min-height: 40px;
}

.hf-db-chart-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

.hf-db-chart-panel .hf-db-panel-title {
  flex-shrink: 0;
}

.hf-db-chart-subtitle {
  font-size: 0.85rem;
  color: #64748b;
  margin: 0 1rem 0.5rem;
  flex-shrink: 0;
}

.hf-db-chart-wrap {
  flex: 1;
  min-height: 240px;
  padding: 1rem;
  width: 100%;
  box-sizing: border-box;
}

/* 右カラム: 運営からのメッセージ（長文箇条書き） */
.hf-db-ops-list {
  list-style: disc;
  padding-left: 1.25rem;
  margin: 0;
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.7;
}

.hf-db-ops-list li {
  margin-bottom: 1rem;
}

.hf-db-ops-list li:last-child {
  margin-bottom: 0;
}