:root {
  --line-green: #e84660;
  --line-green-dark: #d1334e;
  --my-bubble: #fce4e8;
  --my-bubble-text: #1f2329;
  --other-bubble: #fff;
  --other-bubble-text: #1f2329;
  --chat-bg: #eceef2;
  --chat-header-bg: rgba(255, 255, 255, 0.96);
  --nav-bg: #232530;
  --surface-bg: #fff;
  --body-bg: #f3f4f7;
  --pane-bg: #eef0f4;
  --sub-panel-bg: #f4f5f8;
  --item-hover: #f7f8fa;
  --item-active: #fdf0f2;
  --item-border: #f0f1f5;
  --input-bg: #fff;
  --input-border: #d1d5de;
  --border-color: #e2e4ea;
  --text-main: #1f2329;
  --text-sub: #6b7280;
}

/* ダークモード配色 */
[data-bs-theme="dark"] {
  --my-bubble: #4a252e;
  --my-bubble-text: #f8fafc;
  --other-bubble: #282c38;
  --other-bubble-text: #f1f5f9;
  --chat-bg: #181c24;
  --chat-header-bg: rgba(28, 31, 41, 0.96);
  --nav-bg: #14161f;
  --surface-bg: #1e212b;
  --body-bg: #12141b;
  --pane-bg: #151821;
  --sub-panel-bg: #151821;
  --item-hover: #262a36;
  --item-active: rgba(232, 70, 96, 0.18);
  --item-border: #2a2e3b;
  --input-bg: #262a36;
  --input-border: #3a4052;
  --border-color: #2d3242;
  --text-main: #e2e8f0;
  --text-sub: #94a3b8;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  background-color: var(--body-bg);
  color: var(--text-main);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
}

.hidden {
  display: none !important;
}

.text-accent {
  color: var(--line-green) !important;
}

/* Bootstrap拡張ボタン */
.btn-line {
  background-color: var(--line-green);
  border-color: var(--line-green);
  color: #fff;
}
.btn-line:hover,
.btn-line:focus {
  background-color: var(--line-green-dark);
  border-color: var(--line-green-dark);
  color: #fff;
}

/* --- ログイン画面 --- */
.login-screen {
  height: 100dvh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: linear-gradient(135deg, #fdecef 0%, #f1f0f7 100%);
}

[data-bs-theme="dark"] .login-screen {
  background: linear-gradient(135deg, #26151b 0%, #171923 100%);
}

.login-card {
  width: 100%;
  max-width: 390px;
  background: var(--surface-bg);
  padding: 32px 28px;
  border-radius: 16px;
}

[data-bs-theme="dark"] .login-card .text-dark {
  color: var(--text-main) !important;
}

[data-bs-theme="dark"] .search-box .bg-light,
[data-bs-theme="dark"] .msg-search-bar .bg-light,
[data-bs-theme="dark"] .login-card .bg-light,
[data-bs-theme="dark"] #userCountLabel.bg-light {
  background-color: var(--input-bg) !important;
  color: var(--text-main) !important;
  border-color: var(--border-color) !important;
}

[data-bs-theme="dark"] .table-light th {
  background-color: #262a36 !important;
  color: var(--text-main) !important;
  border-color: var(--border-color) !important;
}

.login-icon-circle {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background-color: var(--line-green);
  color: #fff;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* --- メインレイアウト（PC 3カラム） --- */
.app-shell {
  display: flex;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
}

/* 左ナビゲーションレール */
.nav-rail {
  width: 68px;
  flex-shrink: 0;
  background-color: var(--nav-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 14px 0;
  gap: 8px;
  z-index: 20;
}

.nav-profile {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: var(--line-green);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  user-select: none;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
}

.nav-profile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nav-profile:hover {
  opacity: 0.9;
}

.nav-item {
  position: relative;
  width: 56px;
  padding: 8px 4px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: #9aa2b4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav-item.active {
  color: #fff;
  background: rgba(232, 70, 96, 0.28);
}

.nav-icon {
  font-size: 19px;
  line-height: 1.1;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
}

.nav-logout,
.nav-settings {
  margin-top: auto;
}

.unread-nav-badge {
  position: absolute;
  top: 4px;
  right: 5px;
  background-color: var(--line-green);
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
}

/* 中央リストペイン */
.list-pane {
  width: 310px;
  flex-shrink: 0;
  background: var(--surface-bg);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.pane-inner {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.pane-header {
  height: 58px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.search-box {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.scroll-list {
  flex: 1;
  overflow-y: auto;
}

/* トーク一覧アイテム */
.room-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--item-border);
  cursor: pointer;
  transition: background 0.12s;
}

.room-item:hover {
  background: var(--item-hover);
}

.room-item.active {
  background: var(--item-active);
}

.avatar-circle {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #e2e6ee;
  color: #334155;
  font-weight: 700;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

[data-bs-theme="dark"] .avatar-circle {
  background: #33394a;
  color: #e2e8f0;
}

.avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-circle.avatar-xl {
  width: 72px;
  height: 72px;
  font-size: 26px;
}

.avatar-circle.clickable-avatar {
  cursor: pointer;
}
.avatar-circle.clickable-avatar:hover {
  opacity: 0.88;
}

.avatar-circle.group {
  background: #fde6ea;
  color: #c92a44;
}

[data-bs-theme="dark"] .avatar-circle.group {
  background: rgba(232, 70, 96, 0.22);
  color: #f88da0;
}

.room-meta {
  flex: 1;
  min-width: 0;
}

.room-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}

.room-title {
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.room-pin-icon {
  color: var(--line-green);
  font-size: 12px;
  margin-right: 3px;
}

.room-time {
  font-size: 11px;
  color: var(--text-sub);
  flex-shrink: 0;
}

.room-bottom-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.room-preview {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.unread-pill {
  background: var(--line-green);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* 社員一覧アイテム */
.user-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--item-border);
  cursor: pointer;
}
.user-item:hover {
  background: var(--item-hover);
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name-row {
  font-size: 14px;
  font-weight: 700;
}

.user-dept-row {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 2px;
}

/* --- 右メインペイン --- */
.main-pane {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--pane-bg);
}

.empty-chat-state {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

/* チャット画面 */
.chat-container {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
  background-color: var(--chat-bg);
}

.chat-header {
  height: 58px;
  padding: 0 16px;
  background: var(--chat-header-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.mobile-back-btn {
  display: none;
  background: transparent;
  border: none;
  color: var(--line-green-dark);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 4px;
  flex-shrink: 0;
}

.chat-header-info {
  flex: 1;
  min-width: 0;
}

.chat-subtitle {
  font-size: 11px;
  color: var(--text-sub);
}

/* トーク内検索バー */
.msg-search-bar {
  padding: 8px 14px;
  background: var(--surface-bg);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

/* アナウンス（上部固定）バー */
.pinned-message-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface-bg);
  border-bottom: 1px solid var(--border-color);
  font-size: 13px;
  flex-shrink: 0;
}

.pinned-message-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.pinned-message-text:hover {
  text-decoration: underline;
}

/* ドラッグ＆ドロップオーバーレイ */
.drop-overlay {
  position: absolute;
  inset: 0;
  background: rgba(232, 70, 96, 0.18);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  pointer-events: none;
}

.drop-overlay-box {
  background: var(--surface-bg);
  color: var(--line-green-dark);
  border: 2px dashed var(--line-green);
  border-radius: 16px;
  padding: 28px 36px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
}

.messages-area {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* 日付区切り線 */
.date-divider {
  align-self: center;
  background: rgba(31, 35, 41, 0.45);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  margin: 6px 0;
  user-select: none;
}

[data-bs-theme="dark"] .date-divider {
  background: rgba(255, 255, 255, 0.14);
}

.msg-row {
  display: flex;
  flex-direction: column;
  max-width: 78%;
  transition: background-color 0.4s ease;
  border-radius: 12px;
}

.msg-row.highlight-flash {
  background-color: rgba(232, 70, 96, 0.22);
  padding: 4px;
}

.msg-row.mine {
  align-self: flex-end;
  align-items: flex-end;
}

.msg-row.others {
  align-self: flex-start;
  align-items: flex-start;
}

.msg-others-wrap {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.msg-avatar {
  width: 34px;
  height: 34px;
  font-size: 13px;
  margin-top: 2px;
}

.msg-sender {
  font-size: 11px;
  color: var(--text-sub);
  font-weight: 600;
  margin-bottom: 4px;
  padding: 0 4px;
}

.msg-bubble-line {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.msg-row.mine .msg-bubble-line {
  flex-direction: row-reverse;
}

.msg-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.48;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.msg-bubble a.msg-link {
  color: #0b5ed7;
  text-decoration: underline;
  word-break: break-all;
}

[data-bs-theme="dark"] .msg-bubble a.msg-link {
  color: #7cc4ff;
}

.mention-tag {
  background: rgba(232, 70, 96, 0.14);
  color: #b81d38;
  font-weight: 700;
  padding: 0 4px;
  border-radius: 4px;
}

[data-bs-theme="dark"] .mention-tag {
  background: rgba(232, 70, 96, 0.28);
  color: #fda4b4;
}

.msg-row.mine .msg-bubble {
  background-color: var(--my-bubble);
  color: var(--my-bubble-text);
  border-top-right-radius: 4px;
}

.msg-row.others .msg-bubble {
  background-color: var(--other-bubble);
  color: var(--other-bubble-text);
  border-top-left-radius: 4px;
}

.msg-bubble.stamp-bubble {
  background: transparent !important;
  box-shadow: none;
  padding: 2px;
}

/* 引用（リプライ）表示 */
.msg-reply-quote {
  border-left: 3px solid var(--line-green-dark);
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  padding: 4px 8px;
  margin-bottom: 6px;
  font-size: 12px;
  cursor: pointer;
}

[data-bs-theme="dark"] .msg-reply-quote {
  background: rgba(255, 255, 255, 0.08);
}

.msg-reply-quote-sender {
  font-weight: 700;
  font-size: 11px;
  opacity: 0.9;
}

.msg-reply-quote-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  opacity: 0.9;
}

/* メッセージアクションバー（リアクション・リプライ・固定） */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 3px;
  opacity: 0.25;
  transition: opacity 0.15s;
}

.msg-row:hover .msg-actions,
.msg-row:focus-within .msg-actions {
  opacity: 1;
}

.msg-action-btn {
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #334155;
  border-radius: 12px;
  font-size: 12px;
  padding: 2px 6px;
  cursor: pointer;
  line-height: 1.2;
}

[data-bs-theme="dark"] .msg-action-btn {
  background: rgba(30, 33, 43, 0.92);
  color: #e2e8f0;
}

.msg-action-btn:hover {
  background: var(--surface-bg);
  transform: scale(1.06);
}

/* リアクションバッジ一覧 */
.msg-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.reaction-chip {
  border: 1px solid var(--border-color);
  background: var(--surface-bg);
  color: var(--text-main);
  border-radius: 12px;
  padding: 1px 7px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

[data-bs-theme="dark"] .reaction-chip {
  background: #262a36;
  color: #e2e8f0;
  border-color: #3a4052;
}

.reaction-chip.reacted {
  border-color: var(--line-green);
  background: #fde6ea;
  color: #b81d38;
  font-weight: 700;
}

[data-bs-theme="dark"] .reaction-chip.reacted {
  background: rgba(232, 70, 96, 0.28);
  color: #fda4b4;
  border-color: var(--line-green);
}

/* 入力欄上のリプライプレビューバー */
.reply-preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface-bg);
  border-top: 1px solid var(--border-color);
  border-left: 4px solid var(--line-green);
  flex-shrink: 0;
}

.reply-preview-body {
  min-width: 0;
  flex: 1;
}

.reply-preview-sender {
  font-size: 11px;
  font-weight: 700;
  color: var(--line-green-dark);
}

.reply-preview-content {
  font-size: 12px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ペースト添付の送信前プレビューバー */
.pending-file-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  background: var(--surface-bg);
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.pending-file-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  flex-shrink: 0;
}

.pending-file-info {
  flex: 1;
  min-width: 0;
}

.pending-file-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.pending-file-size {
  font-size: 11px;
  color: var(--text-sub);
}

/* メンション候補ポップアップ */
.mention-suggest-box {
  background: var(--surface-bg);
  border-top: 1px solid var(--border-color);
  max-height: 200px;
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
}

.mention-suggest-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--item-border);
  font-size: 13px;
  color: var(--text-main);
}

.mention-suggest-item:last-child {
  border-bottom: none;
}

.mention-suggest-item:hover,
.mention-suggest-item.active {
  background: var(--item-active);
}

.mention-suggest-avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.mention-suggest-name {
  font-weight: 600;
}

.mention-suggest-dept {
  font-size: 11px;
  color: var(--text-sub);
  margin-left: 6px;
}

.msg-stamp-img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  display: block;
}

.msg-image {
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  display: block;
  cursor: zoom-in;
}

.file-card {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 165px;
}

.file-icon-box {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.07);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

[data-bs-theme="dark"] .file-icon-box {
  background: rgba(255, 255, 255, 0.12);
}

.file-name {
  font-size: 13px;
  font-weight: 600;
  word-break: break-all;
}

.file-size {
  font-size: 11px;
  opacity: 0.8;
}

.msg-status-col {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  font-size: 10px;
  color: var(--text-sub);
  line-height: 1.25;
  white-space: nowrap;
}

.msg-row.others .msg-status-col {
  align-items: flex-start;
}

.read-label {
  font-weight: 700;
  color: var(--line-green-dark);
}

[data-bs-theme="dark"] .read-label {
  color: #f88da0;
}

/* スタンプピッカー */
.stamp-picker {
  background: var(--surface-bg);
  border-top: 1px solid var(--border-color);
  height: 225px;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.stamp-picker-header {
  padding: 6px 10px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
}

.stamp-package-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  flex: 1;
  min-width: 0;
  scrollbar-width: none;
}

.stamp-package-tabs::-webkit-scrollbar {
  display: none;
}

.stamp-pkg-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 14px;
  border: 1px solid var(--border-color);
  background: var(--item-hover);
  color: var(--text-sub);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.12s;
}

.stamp-pkg-tab img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.stamp-pkg-tab:hover {
  border-color: var(--line-green);
  color: var(--text-main);
}

.stamp-pkg-tab.active {
  background: var(--item-active);
  border-color: var(--line-green);
  color: var(--line-green-dark);
}

[data-bs-theme="dark"] .stamp-pkg-tab.active {
  color: #fda4b4;
}

.stamp-pkg-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--item-hover);
}

.stamp-pkg-thumb {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: var(--surface-bg);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
  color: var(--text-sub);
  font-size: 20px;
}

.stamp-pkg-thumb img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

.stamp-pkg-info {
  flex: 1;
  min-width: 0;
}

.stamp-grid {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
}

.stamp-item-btn {
  background: var(--item-hover);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.stamp-item-btn:hover {
  border-color: var(--line-green);
  background: var(--item-active);
}

.stamp-item-btn img {
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.stamp-item-btn span {
  font-size: 10px;
  color: var(--text-sub);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* フッター入力欄 */
.chat-footer {
  padding: 10px 12px;
  background: var(--surface-bg);
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

.footer-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  font-size: 17px;
  color: var(--text-sub);
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.12s;
}

.footer-icon-btn:hover {
  background: var(--item-hover);
}

.chat-footer textarea {
  flex: 1;
  min-width: 0;
  resize: none;
  background: var(--input-bg);
  color: var(--text-main);
  border: 1px solid var(--input-border);
  border-radius: 18px;
  padding: 8px 14px;
  font-size: 14px;
  line-height: 1.4;
  max-height: 100px;
  outline: none;
}

.chat-footer textarea:focus {
  border-color: var(--line-green);
}

.btn-send {
  width: 40px;
  height: 36px;
  padding: 0;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* --- 管理者画面 & 設定画面 --- */
.admin-container,
.settings-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--sub-panel-bg);
}

.admin-header {
  height: 58px;
  padding: 0 20px;
  background: var(--surface-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.admin-tabs {
  display: flex;
  background: var(--surface-bg);
  border-bottom: 1px solid var(--border-color);
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
}

.admin-subtab {
  padding: 12px 4px;
  background: transparent;
  border: none;
  border-bottom: 3px solid transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  cursor: pointer;
}

.admin-subtab.active {
  color: var(--line-green-dark);
  border-bottom-color: var(--line-green);
}

.admin-body,
.settings-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.settings-inner {
  max-width: 680px;
  margin: 0 auto;
}

.status-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
}

.status-badge.active {
  background: #dcfce7;
  color: #166534;
}

.status-badge.inactive {
  background: #fee2e2;
  color: #991b1b;
}

.admin-stamp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.admin-stamp-card {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-align: center;
}

.admin-stamp-card img {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

/* --- カスタムモーダル --- */
.modal-backdrop-custom {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  z-index: 1050;
}

.modal-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface-bg);
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  max-height: 85dvh;
}

.modal-header-custom {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-body-custom {
  padding: 16px 18px;
  overflow-y: auto;
}

.modal-footer-custom {
  padding: 12px 18px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.checklist-box {
  margin-top: 8px;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-height: 220px;
  overflow-y: auto;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--item-border);
  font-size: 13px;
  cursor: pointer;
}

.member-pill-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.member-pill {
  background: var(--item-hover);
  border: 1px solid var(--border-color);
  padding: 5px 10px;
  border-radius: 16px;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.member-pill-name {
  cursor: pointer;
}

.member-remove-btn {
  border: none;
  background: transparent;
  color: #dc3545;
  padding: 0 2px;
  line-height: 1;
  cursor: pointer;
  font-size: 14px;
}

.image-modal-content {
  position: relative;
  max-width: 92vw;
  max-height: 90dvh;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.image-modal-content img {
  max-width: 92vw;
  max-height: 82dvh;
  border-radius: 8px;
  background: #fff;
}

/* 文字サイズ「大きめ」設定時 */
html[data-font-size="large"] .msg-bubble,
html[data-font-size="large"] .chat-footer textarea {
  font-size: 16px;
}

html[data-font-size="large"] .room-title,
html[data-font-size="large"] .user-name-row {
  font-size: 15.5px;
}

html[data-font-size="large"] .room-preview,
html[data-font-size="large"] .user-dept-row {
  font-size: 13.5px;
}

/* =========================================================
   スマホ表示（横幅 767px 以下）：1画面切り替えレイアウト
   ========================================================= */
@media (max-width: 767px) {
  .mobile-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
  }

  .app-shell[data-mobile-view="list"] .nav-rail {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 58px;
    flex-direction: row;
    justify-content: space-around;
    padding: 0 8px;
  }

  .app-shell[data-mobile-view="list"] .nav-profile {
    display: none;
  }

  .app-shell[data-mobile-view="list"] .nav-logout,
  .app-shell[data-mobile-view="list"] .nav-settings {
    margin-top: 0;
  }

  .app-shell[data-mobile-view="list"] .list-pane {
    width: 100vw;
    height: calc(100dvh - 58px);
    border-right: none;
  }

  .app-shell[data-mobile-view="list"] .main-pane {
    display: none;
  }

  .app-shell[data-mobile-view="detail"] .nav-rail,
  .app-shell[data-mobile-view="detail"] .list-pane {
    display: none;
  }

  .app-shell[data-mobile-view="detail"] .main-pane {
    width: 100vw;
    height: 100dvh;
  }

  .msg-row {
    max-width: 86%;
  }

  .msg-actions {
    opacity: 0.85;
  }
}