/* スカウト内チャット。
 * 色・角丸・余白は composition-tokens.css の値から派生させる。
 * このファイル以外（Blade）に生の色値を書かないこと。
 */
:root {
  /* MINEブランドブルー。差し替えはこの1行で足りる */
  --chat-blue: var(--comp-color-primary, #2E7BF6);
  --chat-bubble-own-bg: var(--comp-color-primary-soft, #EAF1FE);
  --chat-bubble-own-text: var(--comp-color-text-primary, #1B2A44);
  --chat-bubble-other-bg: var(--comp-color-surface, #FFFFFF);
  --chat-bubble-other-border: var(--comp-color-divider, #EEF2F7);
  --chat-bubble-other-text: var(--comp-color-text-primary, #1B2A44);
  --chat-meta-text: var(--comp-color-text-muted, #A6B0C2);
  --chat-page-bg: var(--comp-color-bg-page, #F7FAFD);
  --chat-surface: var(--comp-color-surface, #FFFFFF);
  --chat-divider: var(--comp-color-divider, #EEF2F7);
  --chat-text: var(--comp-color-text-primary, #1B2A44);
  --chat-text-sub: var(--comp-color-text-secondary, #7C88A0);
  --chat-danger: var(--comp-color-alert-text, #E14B3E);
  --chat-danger-bg: var(--comp-color-alert-bg, #FFEDEC);

  --chat-radius-bubble: 18px;
  --chat-radius-bubble-tail: 6px;
  --chat-radius-card: var(--comp-radius-card, 20px);
  --chat-radius-pill: 999px;
  --chat-space: 16px;
  --chat-max-width: 720px;

  /* 事務所ヘッダーの高さ（全ページ共通のヘッダー。agency-client-header.css の .agency-header の height と同じ値にすること）。 */
  --agency-header-h: 68px;
}

/* ---------- 一覧 ---------- */
.ch-page {
  background: var(--chat-page-bg);
  min-height: 100vh;
  padding: 20px 16px 120px;
}
/* スレッド詳細（PC2ペイン）は自前でスクロール領域を確保するため、
   一覧ページ用の余分な下パディングを持たない */
.ch-page--chat {
  padding-bottom: 20px;
}
/* agency/layouts/app.blade.php の <main class="agency-content"> が上下30pxの
   パディングを持っており、それが --agency-header-h の余白計算に含まれていない
   ぶんだけ位置がずれてしまうため、このページに限り打ち消す。 */
.agency-content:has(> .ch-page--chat) {
  padding: 0;
}
.ch-page__inner {
  max-width: var(--chat-max-width);
  margin: 0 auto;
}
.ch-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--chat-text);
  margin: 0 0 16px;
}
.ch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ch-list__item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px;
  background: var(--chat-surface);
  border-radius: var(--chat-radius-card);
  box-shadow: var(--comp-shadow-card, 0 2px 12px rgba(27, 42, 68, 0.06));
  text-decoration: none;
  color: inherit;
}
.ch-list__item.is-active {
  background: #f1f6ff;
}
.ch-list__item--application.is-active { background: #f1faf5; }
.ch-list__item:focus-visible { outline: 2px solid var(--chat-blue); outline-offset: 2px; }
/* 未読は名前も本文も濃く、既読は落として影も消す */
.ch-list__item.is-read {
  box-shadow: none;
}
.ch-list__item.is-read .ch-list__name,
.ch-list__item.is-read .ch-list__preview {
  color: var(--chat-text-sub);
  font-weight: 400;
}
.ch-list__item.is-unread .ch-list__name,
.ch-list__item.is-unread .ch-list__preview {
  color: var(--chat-text);
}
.ch-list__item.is-unread .ch-list__preview {
  font-weight: 700;
}
.ch-list__avatar {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--comp-color-surface-input, #EEF2F7);
  color: var(--chat-meta-text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.ch-list__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.ch-list__body {
  flex: 1;
  min-width: 0;
}
.ch-list__name {
  font-size: 15px;
  font-weight: 700;
  color: var(--chat-text);
  margin: 0 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch-list__kind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin-bottom: 5px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}
.ch-list__kind--application { background: #e5f4eb; color: #167448; }
.ch-list__kind--scout { background: #e9f1ff; color: #1753a2; }
.ch-list__preview {
  font-size: 13px;
  color: var(--chat-text-sub);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch-list__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  flex-shrink: 0;
}
.ch-list__time {
  font-size: 11px;
  color: var(--chat-meta-text);
  white-space: nowrap;
}
.ch-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: var(--chat-radius-pill);
  background: var(--chat-danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.ch-status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--chat-radius-pill);
  font-size: 11px;
  font-weight: 700;
  background: var(--comp-color-surface-input, #EEF2F7);
  color: var(--chat-text-sub);
}
.ch-status--scheduling { background: var(--comp-color-primary-soft, #EAF1FE); color: var(--chat-blue); }
.ch-status--scheduled { background: #E7F6EE; color: #12A05C; }
.ch-status--closed { background: var(--comp-color-surface-input, #EEF2F7); color: var(--chat-meta-text); }

/* ---- 通知一覧 ---- */
.ch-noti-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.ch-noti-head .ch-title { margin: 0; }
.ch-noti {
  display: block;
}
.ch-noti__content {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.ch-noti__content:focus-visible,
.ch-noti__action:focus-visible {
  outline: 2px solid var(--chat-blue);
  outline-offset: 2px;
}
.ch-noti__icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--comp-color-primary-soft, #EAF1FE);
  color: var(--chat-blue);
  font-size: 14px;
}
.ch-noti__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--chat-text);
  margin: 0 0 4px;
}
.ch-noti__action {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  margin: 10px 0 0 48px;
  padding: 6px 12px;
  border-radius: 6px;
  background: var(--chat-blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.ch-noti.is-unread {
  background: var(--comp-color-primary-soft, #EAF1FE);
}
.ch-noti__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--chat-danger);
}

/* ---- 通知一覧モーダル ---- */
body.ch-noti-modal-open {
  overflow: hidden;
}
.ch-noti-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
}
.ch-noti-modal[hidden] {
  display: none;
}
.ch-noti-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(27, 42, 68, 0.38);
}
.ch-noti-modal__panel {
  position: absolute;
  top: 63px;
  right: 16px;
  width: min(380px, calc(100vw - 24px));
  max-height: min(72vh, 560px);
  overflow: auto;
  background: var(--chat-surface);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(27, 42, 68, 0.22);
  padding: 14px 14px 16px;
  box-sizing: border-box;
}
body:has(.agency-header) .ch-noti-modal__panel {
  top: calc(var(--agency-header-h, 68px) + 8px);
}
.ch-noti-modal__close {
  position: absolute;
  top: 8px;
  right: 10px;
  width: 32px;
  height: 32px;
  border: 0;
  background: transparent;
  color: var(--chat-text-sub);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.ch-noti-modal .ch-noti-head {
  margin-bottom: 10px;
  padding-right: 28px;
}
.ch-noti-modal .ch-title {
  font-size: 16px;
}
.ch-noti-modal .ch-list {
  gap: 6px;
}
.ch-noti-modal .ch-list__item {
  padding: 12px;
  border-radius: 14px;
}
.ch-noti-modal .ch-empty {
  padding: 28px 12px;
}
.ch-noti-fallback {
  max-width: 400px;
  margin: 24px auto 0;
  padding: 16px;
  background: var(--chat-surface);
  border-radius: 16px;
  box-shadow: var(--comp-shadow-card, 0 2px 12px rgba(27, 42, 68, 0.06));
}
@media (max-width: 768px) {
  .ch-noti-modal__panel {
    top: 63px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: calc(100vh - 80px);
  }
}

.ch-empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--chat-text-sub);
  font-size: 14px;
  background: var(--chat-surface);
  border-radius: var(--chat-radius-card);
}

/* ---------- お知らせ記事の詳細 ---------- */
.ch-article {
  background: var(--chat-surface);
  border-radius: var(--chat-radius-card);
  box-shadow: var(--comp-shadow-card, 0 2px 12px rgba(27, 42, 68, 0.06));
  padding: 24px;
}
.ch-article__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--chat-text-sub);
  font-size: 13px;
  text-decoration: none;
  margin-bottom: 16px;
}
.ch-article__date {
  font-size: 12px;
  color: var(--chat-meta-text);
  margin: 0 0 6px;
}
.ch-article__title {
  font-size: 19px;
  font-weight: 700;
  color: var(--chat-text);
  margin: 0 0 18px;
  line-height: 1.5;
}
.ch-article__body {
  font-size: 14.5px;
  line-height: 1.9;
  color: var(--chat-text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ch-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 16px;
  -webkit-overflow-scrolling: touch;
}
.ch-filter {
  flex: 0 0 auto;
  padding: 8px 14px;
  border-radius: var(--chat-radius-pill);
  border: 1px solid var(--chat-divider);
  background: var(--chat-surface);
  color: var(--chat-text-sub);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.ch-filter.is-active {
  background: var(--chat-blue);
  border-color: var(--chat-blue);
  color: #fff;
}
.ch-origin {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 2px 7px;
  border-radius: 3px;
  background: #e7f0ff;
  color: #1753a2;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
}
.ch-origin i { margin-right: 3px; }
.ch-origin--application { background: #e7f5ed; color: #167448; }
.ch-context {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--chat-divider);
  background: #f7fafc;
  color: var(--chat-text-sub);
  font-size: 12px;
  line-height: 1.5;
}
.ch-context a { color: #1753a2; margin-left: auto; }
.ch-context__heading { display: flex; align-items: flex-start; gap: 8px; flex-basis: 100%; min-width: 0; }
.ch-context__heading .ch-origin { flex: none; }
.ch-context__title { min-width: 0; overflow-wrap: anywhere; }
.ch-context--talent-project > a { margin-left: 0; }
.ch-context__rules { display: flex; flex-direction: column; align-items: center; gap: 3px; margin-left: auto; }
.ch-context__rules .ch-rules-btn { margin-left: 0; }
.ch-context__rules-note { font-size: 10px; line-height: 1.4; color: var(--chat-text-sub); }
.ch-context--application { background: #f1faf5; border-left: 4px solid #198457; }
.ch-context--scout { background: #f2f7ff; border-left: 4px solid #286bd1; }

/* ---------- スレッド詳細 ---------- */
.ch-thread {
  max-width: var(--chat-max-width);
  margin: 0 auto;
}

/* タレント側の単独ページ：ヘッダーと入力欄を固定し、やり取りの部分だけをスクロールさせる。
 * position:sticky はこのサイトの body{overflow-x:hidden} の影響で機能しないため使わない
 * （スクロールの主体が body 自身になり、sticky の基準が効かなくなる）。
 * 代わりに画面全体を1つのflex縦積みにして、中央だけ overflow-y:auto にする。 */
/* スマホでは 100vh / 100dvh がURLバーの表示・非表示で伸び縮みし、そのたびに
 * コンテナの高さが変わってスクロールがガタつく（＝スクロールが固い）。
 * さらに高さが可視領域より大きくなった瞬間はページ自体がスクロールしてしまい、
 * 相手名のヘッダーが上に流れてしまう。
 * 画面に貼り付ける position:fixed なら可視領域そのものが基準になるため、
 * ヘッダーと入力欄は常に上下へ固定され、間のやり取りだけがスクロールする。 */
.ch-thread--standalone {
  position: fixed;
  /* このページだけサイトヘッダーを出さないため、上に空白帯を残さず
     相手名を画面の一番上に固定する（戻る導線はヘッダー内の「‹」）。 */
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--chat-page-bg);
}
.ch-thread--standalone .ch-head,
.ch-thread--standalone .ch-composer {
  flex: 0 0 auto;
}
.ch-thread--standalone .ch-stream {
  flex: 1 1 auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  /* 端まで来たときにページ側へスクロールが伝播すると、指を離すまで
     反応しなくなることがあるため、このコンテナ内で完結させる */
  overscroll-behavior: contain;
  min-height: 0;
}

.ch-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--chat-surface);
  border-bottom: 1px solid var(--chat-divider);
}
.ch-head__back {
  color: var(--chat-text-sub);
  font-size: 18px;
  text-decoration: none;
  flex-shrink: 0;
}
.ch-head__name {
  flex: 1;
  min-width: 0;
  font-size: 16px;
  font-weight: 700;
  color: var(--chat-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ch-head__menu {
  position: relative;
  flex-shrink: 0;
}
.ch-head__menu-btn {
  border: none;
  background: transparent;
  color: var(--chat-text-sub);
  font-size: 18px;
  padding: 4px 8px;
  cursor: pointer;
}
.ch-head__menu-list {
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 160px;
  background: var(--chat-surface);
  border: 1px solid var(--chat-divider);
  border-radius: 12px;
  box-shadow: var(--comp-shadow-card, 0 2px 12px rgba(27, 42, 68, 0.06));
  overflow: hidden;
  z-index: 10;
}
.ch-head__menu-list button {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  text-align: left;
  font-size: 13px;
  color: var(--chat-text);
  cursor: pointer;
}
.ch-head__menu-list button:hover { background: var(--comp-color-surface-input, #EEF2F7); }
.ch-head__menu-list button.is-danger { color: var(--chat-danger); }

.ch-scout {
  background: var(--chat-surface);
  border-bottom: 1px solid var(--chat-divider);
}
.ch-scout__summary {
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--chat-text-sub);
  cursor: pointer;
  list-style: none;
}
.ch-scout__summary::-webkit-details-marker { display: none; }
.ch-scout__body {
  padding: 0 16px 16px;
  font-size: 13px;
  line-height: 1.8;
  color: var(--chat-text);
  white-space: pre-wrap;
}

.ch-stream {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ch-date {
  align-self: center;
  margin: 12px 0;
  padding: 4px 14px;
  border-radius: var(--chat-radius-pill);
  background: rgba(27, 42, 68, 0.06);
  color: var(--chat-text-sub);
  font-size: 11px;
  font-weight: 700;
}
.ch-system {
  align-self: center;
  margin: 8px 0;
  padding: 6px 16px;
  border-radius: var(--chat-radius-pill);
  background: rgba(27, 42, 68, 0.05);
  color: var(--chat-text-sub);
  font-size: 12px;
  text-align: center;
  max-width: 90%;
}

.ch-row {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  max-width: 100%;
  margin-top: 8px;
}
.ch-row--own { flex-direction: row; justify-content: flex-end; }
.ch-row--other { flex-direction: row; justify-content: flex-start; }

.ch-bubble {
  max-width: min(76%, 480px);
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.ch-row--own .ch-bubble {
  background: var(--chat-bubble-own-bg);
  color: var(--chat-bubble-own-text);
  border-radius: var(--chat-radius-bubble) var(--chat-radius-bubble-tail) var(--chat-radius-bubble) var(--chat-radius-bubble);
}
.ch-row--other .ch-bubble {
  background: var(--chat-bubble-other-bg);
  color: var(--chat-bubble-other-text);
  border: 1px solid var(--chat-bubble-other-border);
  border-radius: var(--chat-radius-bubble-tail) var(--chat-radius-bubble) var(--chat-radius-bubble) var(--chat-radius-bubble);
}

/* 承認と同時に自動投稿される1通目（スカウト文面）だけ、通常のやり取りと見分けられる色にする */
.ch-bubble--scout {
  background: #FFF7E6 !important;
  border: 1px solid #F5CB7A !important;
  color: var(--chat-text) !important;
}
.ch-scout-tag {
  display: block;
  margin-bottom: 6px;
  color: #B9821E;
  font-size: 11px;
  font-weight: 700;
}

.ch-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: var(--chat-meta-text);
  white-space: nowrap;
  padding-bottom: 2px;
}
/* 時刻は吹き出しの外側の足元：自分は左下、相手は右下 */
.ch-row--own .ch-meta { align-items: flex-end; order: -1; }
.ch-row--other .ch-meta { align-items: flex-start; order: 1; }
.ch-meta__read { font-size: 10px; }

/* ---------- 日程カード ---------- */
.ch-sched {
  max-width: min(86%, 480px);
  background: var(--chat-surface);
  border: 1px solid var(--chat-divider);
  border-radius: 14px;
  overflow: hidden;
}
.ch-row--own .ch-sched { border-top: 3px solid var(--chat-blue); }
.ch-sched__head {
  padding: 12px 14px 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--chat-text);
}
.ch-sched__note {
  padding: 6px 14px 0;
  font-size: 13px;
  line-height: 1.7;
  color: var(--chat-text);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.ch-link {
  color: var(--chat-blue);
  text-decoration: underline;
  overflow-wrap: anywhere;
}
.ch-sched__slots {
  list-style: none;
  margin: 10px 0 0;
  padding: 0 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ch-sched__slot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--chat-divider);
  border-radius: 10px;
  font-size: 13px;
  color: var(--chat-text);
}
.ch-sched__slot.is-accepted {
  border-color: var(--chat-blue);
  background: var(--comp-color-primary-soft, #EAF1FE);
  font-weight: 700;
}
.ch-sched__pick {
  flex-shrink: 0;
  padding: 6px 12px;
  border: none;
  border-radius: var(--chat-radius-pill);
  background: var(--chat-blue);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.ch-sched__foot {
  padding: 12px 14px;
}
.ch-sched__alt {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--chat-blue);
  border-radius: var(--chat-radius-pill);
  background: transparent;
  color: var(--chat-blue);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.ch-sched__state {
  padding: 10px 14px 14px;
  font-size: 12px;
  color: var(--chat-text-sub);
}
.ch-sched__notice {
  margin: 0 14px 14px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #FFF7E6;
  border: 1px solid #F5CB7A;
  color: #7A5A17;
  font-size: 12px;
  line-height: 1.6;
}

/* ---------- 入力欄 ---------- */
.ch-composer {
  background: var(--chat-surface);
  border-top: 1px solid var(--chat-divider);
  padding: 10px 16px 16px;
}
.ch-quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.ch-quick__btn {
  padding: 8px 14px;
  border: 1px solid var(--chat-blue);
  border-radius: var(--chat-radius-pill);
  background: var(--comp-color-primary-soft, #EAF1FE);
  color: var(--chat-blue);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}
.ch-templates {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.ch-templates[hidden] { display: none; }
.ch-templates__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.ch-templates__manage {
  flex-shrink: 0;
  padding: 8px 12px;
  border: 1px solid var(--chat-divider);
  border-radius: var(--chat-radius-pill);
  color: var(--chat-text-sub);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.ch-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.ch-toolbar__btn {
  padding: 7px 12px;
  border: 1px solid var(--chat-divider);
  border-radius: var(--chat-radius-pill);
  background: var(--chat-surface);
  color: var(--chat-text-sub);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
}
.ch-toolbar__btn--submit { background: #087cff; border-color: #087cff; color: #fff; }
.ch-toolbar__btn--submit:hover, .ch-toolbar__btn--submit:focus-visible { background: #0665d1; border-color: #0665d1; color: #fff; }
.ch-form {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.ch-form__input {
  flex: 1;
  min-height: 44px;
  max-height: 140px;
  padding: 11px 14px;
  border: 1px solid var(--chat-divider);
  border-radius: 18px;
  background: var(--comp-color-surface-input, #EEF2F7);
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  font-family: inherit;
  color: var(--chat-text);
}
.ch-form__input:focus {
  outline: none;
  border-color: var(--chat-blue);
}
.ch-form__send {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 50%;
  background: var(--chat-blue);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}
.ch-form__send:disabled { opacity: .4; cursor: default; }

.ch-locked {
  padding: 14px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--chat-text-sub);
  background: var(--comp-color-surface-input, #EEF2F7);
  border-radius: 12px;
}

.ch-flash {
  margin: 12px 16px 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
}
.ch-flash--error { background: var(--chat-danger-bg); color: var(--chat-danger); }
.ch-flash--success { background: #E7F6EE; color: #12A05C; }

/* ---------- 日程調整モーダル（スマホはボトムシート） ---------- */
.ch-modal[hidden] { display: none !important; }
.ch-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.ch-modal__backdrop {
  position: absolute;
  inset: 0;
  background: var(--comp-color-overlay, rgba(27, 42, 68, 0.4));
}
.ch-modal__sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
  background: var(--chat-surface);
  border-radius: 20px 20px 0 0;
  padding: 20px 20px 24px;
}
.ch-modal__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--chat-text);
  margin: 0 0 4px;
}
.ch-modal__lead {
  font-size: 12px;
  color: var(--chat-text-sub);
  margin: 0 0 16px;
}
.ch-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.ch-preset {
  padding: 6px 12px;
  border: 1px solid var(--chat-divider);
  border-radius: var(--chat-radius-pill);
  background: var(--chat-surface);
  color: var(--chat-text-sub);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.ch-format {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.ch-format input {
  accent-color: var(--chat-blue);
  margin: 0;
}
.ch-format:has(input:checked) {
  border-color: var(--chat-blue);
  background: var(--comp-color-primary-soft, #EAF1FE);
  color: var(--chat-blue);
}
.ch-modal__hint {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--chat-text-sub);
}
.ch-modal__hint[hidden] { display: none; }
.ch-sched__format {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  border-radius: var(--chat-radius-pill);
  background: var(--comp-color-primary-soft, #EAF1FE);
  color: var(--chat-blue);
  font-size: 11px;
  font-weight: 700;
}
.ch-slot-row {
  border: 1px solid var(--chat-divider);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
}
.ch-slot-row__label {
  font-size: 12px;
  font-weight: 700;
  color: var(--chat-text-sub);
  margin-bottom: 8px;
}
.ch-slot-row__fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.ch-slot-row__times {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.ch-slot-row__sep { color: var(--chat-text-sub); font-size: 13px; }
.ch-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--chat-divider);
  border-radius: 10px;
  background: var(--comp-color-surface-input, #EEF2F7);
  font-size: 14px;
  font-family: inherit;
  color: var(--chat-text);
}
.ch-textarea {
  width: 100%;
  min-height: 72px;
  padding: 10px 12px;
  border: 1px solid var(--chat-divider);
  border-radius: 10px;
  background: var(--comp-color-surface-input, #EEF2F7);
  font-size: 14px;
  font-family: inherit;
  line-height: 1.7;
  resize: vertical;
  color: var(--chat-text);
}
.ch-modal__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}
.ch-btn {
  flex: 1;
  padding: 13px;
  border: none;
  border-radius: var(--chat-radius-pill);
  background: var(--chat-blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.ch-btn--ghost {
  background: transparent;
  border: 1px solid var(--chat-divider);
  color: var(--chat-text-sub);
}

/* ---------- ヘッダーの相手アイコン ---------- */
/* タップ時に開く詳細モーダルは、事務所側は「タレント検索」、タレント側は
   「スカウト管理」の詳細モーダルをそのまま流用する（別デザインを作らない）。
   そのため、このコンポーネント自体はアイコンの見た目だけを持つ。 */
.ch-head__avatar {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--comp-color-surface-input, #EEF2F7);
  cursor: pointer;
}

@media (min-width: 640px) {
  .ch-modal { align-items: center; }
  .ch-modal__sheet { border-radius: 20px; }
  .ch-slot-row__fields { grid-template-columns: 1fr 1.4fr; align-items: center; }
}

/* ---------- PC 2ペイン（事務所側） ---------- */
@media (max-width: 1023px) {
  .ch-page--chat .ch-detail-filters { display: none; }
  .ch-page--chat .ch-split__list { display: none; }
}

@media (min-width: 1024px) {
  .ch-page--chat {
    box-sizing: border-box;
    height: calc(100vh - var(--agency-header-h));
    min-height: 0;
    display: flex;
    flex-direction: column;
  }
  .ch-detail-filters {
    flex: 0 0 auto;
    width: 100%;
  }
  .ch-split {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 16px;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
  }
  .ch-split .ch-thread { max-width: none; }

  /* PCの事務所ヘッダーが固定（agency/layouts/app.blade.php）になった分だけ
     body に padding-top が付くので、その残り高さぶんだけを一覧・詳細それぞれで
     スクロールさせる。ch-page 自体の上下パディングぶんも差し引く。 */
  .ch-split__list {
    height: 100%;
    overflow-y: auto;
  }
  .ch-split__detail {
    height: 100%;
    background: var(--chat-surface);
    border-radius: var(--chat-radius-card);
    overflow: hidden;
  }
  .ch-split .ch-thread {
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  .ch-split .ch-thread .ch-head,
  .ch-split .ch-thread .ch-composer {
    flex: 0 0 auto;
  }
  .ch-split .ch-thread .ch-stream {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    min-height: 0;
  }
  .ch-split .ch-head { border-radius: var(--chat-radius-card) var(--chat-radius-card) 0 0; }
  .ch-split .ch-head__back { display: none; }
}

/* ベルの小窓の「すべて見る」（受信箱へ） */
.ch-noti-all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 44px;
  margin-top: 8px;
  border-radius: 12px;
  color: var(--chat-blue);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}
.ch-noti-all:hover { background: var(--comp-color-primary-soft, #EAF1FE); }
.ch-noti-all:focus-visible { outline: 2px solid var(--chat-blue); outline-offset: 2px; }

/* ---------- 案件のチャット：いまのSTEP ---------- */
.ch-steps { padding: 10px 16px 12px; background: var(--chat-surface); border-bottom: 1px solid var(--chat-divider); }
.ch-steps__now { margin: 0 0 8px; font-size: 13px; color: var(--chat-text); }
.ch-steps__now strong { color: var(--chat-blue); font-size: 14px; }
.ch-steps__list { display: flex; gap: 6px; margin: 0; padding: 0; list-style: none; overflow-x: auto; }
.ch-steps__list li { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 5px 10px; border-radius: var(--chat-radius-pill); background: var(--comp-color-surface-input, #EEF2F7); color: var(--chat-text-sub); font-size: 11px; font-weight: 700; white-space: nowrap; }
.ch-steps__list li span { width: 18px; height: 18px; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 10px; }
.ch-steps__list li.is-done { background: #E6F6EC; color: #15803D; }
.ch-steps__list li.is-current { background: var(--chat-blue); color: #fff; }
.ch-steps__list li.is-current span { color: var(--chat-blue); }

/* ---------- 案件のチャット：銀行口座のカード ---------- */
.ch-bank { max-width: min(86%, 420px); background: var(--chat-surface); border: 1px solid var(--chat-divider); border-top: 3px solid var(--chat-blue); border-radius: 14px; padding: 12px 14px 14px; }
.ch-bank__head { font-size: 13px; font-weight: 700; color: var(--chat-text); }
.ch-bank__text { margin: 6px 0 10px; font-size: 13px; line-height: 1.7; color: var(--chat-text-sub); }
.ch-bank__btn { padding: 9px 18px; border: 0; border-radius: var(--chat-radius-pill); background: var(--chat-blue); color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; }
.ch-bank__list { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 10px 0 0; font-size: 13px; }
.ch-bank__list dt { color: var(--chat-text-sub); }
.ch-bank__list dd { margin: 0; color: var(--chat-text); font-weight: 700; word-break: break-all; }
.ch-bank__note { margin: 10px 0 0; font-size: 11px; color: var(--chat-text-sub); }
.ch-bankform { display: grid; gap: 8px; }
.ch-quick__btn i { margin-right: 4px; }
.ch-steps__list { scrollbar-width: none; }
.ch-steps__list::-webkit-scrollbar { display: none; }
@media (max-width: 480px) {
  .ch-steps__list { gap: 4px; }
  .ch-steps__list li { padding: 5px 7px; gap: 4px; font-size: 10px; }
  .ch-steps__list li span { width: 16px; height: 16px; }
}

/* タレントの通知一覧先頭：LINE通知への案内 */
.ch-noti-line-guide { display: flex; align-items: center; gap: 10px; padding: 11px 14px; margin: 0 0 10px; border-radius: 10px; background: #edf9f0; color: #287c42; text-decoration: none; line-height: 1.5; font-size: 13px; }
.ch-noti-line-guide:hover { background: #e3f5e8; color: #226d39; text-decoration: none; }
.ch-noti-line-guide:focus-visible { outline: 2px solid #06c755; outline-offset: 2px; }
.ch-noti-line-guide > .fa-line { color: #06c755; font-size: 25px; flex-shrink: 0; }
.ch-noti-line-guide > span { flex: 1; }
.ch-noti-line-guide > .fa-chevron-right { font-size: 10px; flex-shrink: 0; }
.ch-list__prematch { display:inline-block; margin-right:4px; padding:0 5px; border-radius:4px; background:#fff1d6; color:#8a5a00; font-size:10px; font-weight:700; }

/* 案件チャットの「投稿ルール」ボタンとポップアップ */
.ch-rules-btn { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; padding: 5px 12px; border: 1px solid #bfd6fb; border-radius: 999px; background: #fff; color: #1f63d8; font-size: 12px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.ch-rules-btn:hover { background: #eaf1fe; }
/* iOS/WebKitでは高さ未指定のdialog内のflex本文が0pxに縮むため、高さを明示する。 */
.ch-rules { width: min(560px, 94vw); height: min(760px, 86vh); height: min(760px, 86dvh); max-height: 86vh; max-height: 86dvh; padding: 0; border: 0; border-radius: 16px; color: #1b2a44; box-shadow: 0 18px 50px rgba(15, 30, 55, .28); overflow: hidden; }
.ch-rules[open] { display: flex; flex-direction: column; }
.ch-rules::backdrop { background: rgba(15, 30, 55, .5); }
.ch-rules__head { flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; border-bottom: 1px solid #e6ecf5; }
.ch-rules__head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.ch-rules__head h2 i { color: #2e7bf6; margin-right: 6px; }
.ch-rules__head p { margin: 4px 0 0; font-size: 13px; font-weight: 700; color: #d13b4b; }
.ch-rules__close { flex: none; width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f2f5f9; color: #4a5a78; font-size: 16px; cursor: pointer; }
.ch-rules__close:hover { background: #e4eaf3; }
.ch-rules__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 8px 20px 20px; -webkit-overflow-scrolling: touch; }
.ch-rules__sec { margin-top: 22px; }
.ch-rules__sec h3 { position: relative; margin: 0 0 12px; padding-left: 12px; font-size: 15px; font-weight: 800; }
.ch-rules__sec h3::before { content: ''; position: absolute; left: 0; top: 3px; bottom: 3px; width: 4px; border-radius: 2px; background: #2e7bf6; }
.ch-rules__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ch-rules__card { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border: 1px solid #e6ecf5; border-radius: 12px; background: #fff; min-width: 0; }
.ch-rules__card.is-wide { grid-column: 1 / -1; background: #f3f8ff; border-color: #bfd6fb; }
.ch-rules__card.is-attention { background: #fff8ec; border-color: #f5d9a6; }
.ch-rules__card small { font-size: 11px; font-weight: 700; color: #6b7a93; }
.ch-rules__card strong { font-size: 14px; font-weight: 800; line-height: 1.5; overflow-wrap: anywhere; }
.ch-rules__card > span { font-size: 11px; line-height: 1.6; color: #6b7a93; }
.ch-rules__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-rules__tags b { padding: 3px 10px; border: 1px solid #bfd6fb; border-radius: 999px; background: #fff; color: #1f63d8; font-size: 14px; font-weight: 800; }
.ch-rules__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.ch-rules__list li { position: relative; padding-left: 20px; font-size: 14px; line-height: 1.8; overflow-wrap: anywhere; }
.ch-rules__list li::before { content: ''; position: absolute; left: 3px; top: 11px; width: 7px; height: 7px; border-radius: 50%; background: #9db8e6; }
.ch-rules__list--check li::before { content: '\f00c'; font-family: 'Font Awesome 5 Free'; font-weight: 900; left: 0; top: 0; width: auto; height: auto; background: none; color: #1f9d55; font-size: 12px; }
.ch-rules__foot { flex: 0 0 auto; padding: 12px 20px 16px; border-top: 1px solid #e6ecf5; text-align: center; }
.ch-rules__ok { min-width: 160px; padding: 10px 24px; border: 0; border-radius: 999px; background: #2e7bf6; color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
@media (max-width: 520px) { .ch-rules__grid { grid-template-columns: 1fr; } .ch-rules-btn { margin-left: 0; } }
.ch-rules-btn.is-urgent { border-color: #d13b4b; background: #d13b4b; color: #fff; }
.ch-rules-btn.is-urgent:hover { background: #b92f3e; }
.ch-rules-nudge { display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; padding: 4px 12px; border: 1px solid #f3b9c0; border-radius: 999px; background: #fdecee; color: #c02a3b; font-size: 12px; font-weight: 800; cursor: pointer; }
.ch-rules-nudge:hover { background: #fadde1; }
.ch-rules__tags b.is-common { border-color: #f5c98e; background: #fff3e3; color: #b15f00; }
.ch-rules__legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.ch-rules__legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; border: 1px solid #bfd6fb; background: #fff; }
.ch-rules__legend i.is-common { border-color: #f5c98e; background: #fff3e3; }

/* 契約の提案カード（応募を採用したあとの、条件確認のチャット） */
.ch-agree { max-width: min(420px, 86vw); padding: 14px 16px; border: 1px solid #cfe0f7; border-radius: 14px; background: #f5f9ff; }
.ch-agree.is-old { opacity: .6; }
.ch-agree__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; font-weight: 800; color: #1f5fbf; }
.ch-agree__list { display: grid; grid-template-columns: 4.5em 1fr; gap: 4px 10px; margin: 0 0 10px; font-size: 13px; line-height: 1.6; }
.ch-agree__list dt { color: #667085; font-weight: 700; }
.ch-agree__list dd { margin: 0; word-break: break-word; overflow-wrap: anywhere; }
.ch-agree__note { margin: 0 0 10px; font-size: 12px; color: #475467; line-height: 1.6; }
.ch-agree__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ch-agree__actions form { margin: 0; }
.ch-agree__btn { min-height: 40px; padding: 0 18px; border: 0; border-radius: 999px; background: #16a34a; color: #fff; font-size: 14px; font-weight: 800; cursor: pointer; font-family: inherit; }
.ch-agree__btn--ghost { background: #fff; color: #667085; border: 1px solid #d0d5dd; }
.ch-agree__edit { margin-top: 8px; font-size: 13px; }
.ch-agree__edit summary { cursor: pointer; color: #1f5fbf; font-weight: 700; }
.ch-agree__edit form { display: grid; gap: 8px; margin-top: 8px; }
.ch-agree__edit label { display: grid; gap: 4px; font-weight: 700; color: #344054; }
.ch-agree__edit input, .ch-agree__edit textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #d0d5dd; border-radius: 8px; font-family: inherit; font-size: 14px; }

/* クライアント：タレントが契約に同意したあとの、お支払いへ進むボタン（チャットの上部と契約カード） */
.ch-agree__btn--link { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; }
.ch-paybar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 0; padding: 10px 14px; background: #FFF7E6; border-bottom: 1px solid #F5CB7A; font-size: 13px; font-weight: 700; color: #8A5A00; }
.ch-paybar i { margin-right: 4px; }
.ch-paybar__btn { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 16px; border-radius: 999px; background: #16a34a; color: #fff; font-size: 13px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.ch-paybar__btn:hover { color: #fff; filter: brightness(.96); text-decoration: none; }

/* 提出時点の要約から、その回の提出詳細へ移動する。 */
.ch-bubble--report { display: block; text-decoration: none; white-space: normal; min-width: 180px; }
.ch-bubble--report:hover { filter: brightness(.97); }
.ch-bubble--report:focus-visible { outline: 3px solid #1479ed; outline-offset: 3px; }
.ch-report-summary { display: block; white-space: pre-line; margin: 6px 0; font-size: 13px; }
.ch-report-link { display: block; font-weight: 700; text-decoration: underline; font-size: 12px; }

/* 現在のSTEPを見出しに残し、ナビゲーションは開閉する。 */
.ch-accordion > summary { display: block; position: relative; cursor: pointer; list-style: none; padding-right: 26px; margin-bottom: 0; }
.ch-accordion > summary::-webkit-details-marker { display: none; }
.ch-accordion > summary::after { content: ''; position: absolute; right: 4px; top: 5px; width: 8px; height: 8px; border-right: 2px solid #8091aa; border-bottom: 2px solid #8091aa; transform: rotate(45deg); }
.ch-accordion[open] > summary::after { top: 9px; transform: rotate(225deg); }
.ch-accordion > .ch-steps__list { margin-top: 12px; }
.ch-accordion > .ch-rules-nudge { margin-top: 10px; }
.ch-accordion > summary:focus-visible { outline: 2px solid #287bea; outline-offset: 4px; border-radius: 3px; }

/* タレントに届く検収完了は、通常の提出通知よりはっきり区切る。 */
.ch-row--other .ch-bubble--completed { position:relative; width:380px; max-width:min(88%,480px); padding:22px; background:linear-gradient(135deg,#f0fbf5,#fff); color:#173e30; border:1px solid #a9d8bd; border-radius:14px; box-shadow:0 4px 14px #17653e0a; }
.ch-completed-icon { display:flex; align-items:center; justify-content:center; width:44px; height:44px; margin-bottom:12px; border-radius:50%; color:white; background:#269b67; font-size:25px; font-weight:700; }
.ch-completed-label { display:block; color:#258052; font-size:12px; font-weight:700; }
.ch-completed-title { display:block; margin:6px 0; color:#173e30; font-size:21px; line-height:1.5; }
.ch-completed-text { display:block; font-size:13px; line-height:1.8; }
.ch-bubble--completed .ch-report-summary { margin-top:14px; padding:12px; border:1px solid #dfede4; border-radius:8px; background:#ffffffb3; color:#65766c; font-size:12px; }
.ch-bubble--completed .ch-report-summary:empty { display:none; }
.ch-completed-note { display:block; margin:10px 0; font-size:12px; color:#65766c; }
.ch-bubble--completed .ch-report-link { margin-top:14px; color:#238657; }
@media(max-width:600px){.ch-row--other .ch-bubble--completed{padding:18px}.ch-completed-title{font-size:20px}}

.ch-project-greeting { margin: 4px 0 12px; color: #6b7280; font-size: 13px; }
button.ch-paybar__btn { border: 0; cursor: pointer; font-family: inherit; }
.ch-project-payment { color: #1b2a44; font-weight: 400; }
.ch-project-payment .ch-rules__body { line-height: 1.7; }
.ch-project-payment .ch-paybar__btn { margin: 8px 12px 8px 0; }

.ch-review { display: inline-flex; }
.ch-review-dialog { width: min(440px, calc(100vw - 32px)); padding: 24px; border: 0; border-radius: 16px; color: #1b2a44; box-shadow: 0 18px 50px rgba(15, 30, 55, .28); }
.ch-review-dialog::backdrop { background: rgba(15, 30, 55, .5); }
.ch-review-dialog__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ch-review-dialog__head h2 { margin: 0; font-size: 18px; font-weight: 800; }
.ch-review-dialog__close { width: 36px; height: 36px; border: 0; border-radius: 50%; background: #f2f5f9; color: #4a5a78; cursor: pointer; font-size: 22px; }
.ch-review-dialog p { margin: 14px 0 20px; font-size: 14px; line-height: 1.7; }
.ch-review-dialog__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.ch-review-dialog__actions form { margin: 0; }
.ch-toolbar__btn--review { background: #16a34a; border-color: #16a34a; color: #fff; }
.ch-toolbar__btn--review:hover, .ch-toolbar__btn--review:focus-visible { background: #15803d; border-color: #15803d; color: #fff; }
