/* ===========================================================
   GarageConnect - 共通スタイル
   青系（プライマリ: #1A6FD4）/ LINE WORKS インスパイア
   =========================================================== */

:root {
  --primary: #1A6FD4;
  --primary-dark: #0E4FA0;
  --primary-light: #E6F1FB;
  --primary-mid: #378ADD;
  --primary-bg: #F4F8FD;
  --accent: #0C447C;

  --success: #1D9E75;
  --success-light: #EAF7F1;
  --warning: #BA7517;
  --warning-light: #FAEEDA;
  --danger: #A32D2D;
  --danger-light: #FCEBEB;
  --info: #3C7BCC;

  --gray-50: #F8FAFC;
  --gray-100: #F1F5F9;
  --gray-200: #E2E8F0;
  --gray-300: #CBD5E1;
  --gray-400: #94A3B8;
  --gray-500: #64748B;
  --gray-600: #475569;
  --gray-700: #374151;
  --gray-800: #1E293B;
  --gray-900: #0F172A;

  --sidebar-bg: #0C2A4D;
  --sidebar-bg-hover: #143C6B;
  --sidebar-text: #B5D4F4;
  --sidebar-text-active: #FFFFFF;

  --font: 'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic', 'Meiryo', sans-serif;
  --radius: 8px;
  --radius-lg: 12px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.10), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.10), 0 4px 6px -4px rgba(15, 23, 42, 0.05);

  --sidebar-w: 72px;
  --subnav-w: 290px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }

/* ============ レイアウト ============ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) var(--subnav-w) 1fr;
  height: 100vh;
  width: 100vw;
}
.app--no-subnav {
  grid-template-columns: var(--sidebar-w) 1fr;
}

/* ============ アイコンサイドバー ============ */
.sidebar {
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  color: var(--sidebar-text);
}
.sidebar__logo {
  width: 44px; height: 44px;
  background: linear-gradient(135deg, #1A6FD4 0%, #378ADD 100%);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: white; font-weight: 800; font-size: 18px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(26, 111, 212, 0.4);
}
.sidebar__nav { display: flex; flex-direction: column; gap: 4px; flex: 1; width: 100%; align-items: center; }
.sidebar__item {
  position: relative;
  width: 52px; height: 52px;
  border-radius: 10px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--sidebar-text);
  font-size: 10px;
  gap: 2px;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.sidebar__item:hover { background: var(--sidebar-bg-hover); color: white; }
.sidebar__item.is-active {
  background: rgba(26, 111, 212, 0.35);
  color: white;
}
.sidebar__item.is-active::before {
  content: ''; position: absolute; left: -12px; top: 14px; bottom: 14px;
  width: 3px; background: white; border-radius: 0 3px 3px 0;
}
.sidebar__item .icon { width: 22px; height: 22px; }
.sidebar__item .badge {
  position: absolute; top: 6px; right: 6px;
  background: #E24B4A; color: white; font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 4px; border: 2px solid var(--sidebar-bg);
}
.sidebar__profile {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
  color: white; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  margin-top: auto;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.2);
}

/* ============ サブナビゲーション ============ */
.subnav {
  background: white;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.subnav__header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.subnav__title { font-size: 17px; font-weight: 700; color: var(--gray-900); }
.subnav__action {
  width: 30px; height: 30px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500); transition: background 0.15s, color 0.15s;
}
.subnav__action:hover { background: var(--gray-100); color: var(--primary); }
.subnav__search {
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-100);
}
.subnav__search-input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8' stroke-width='2'><path stroke-linecap='round' stroke-linejoin='round' d='M21 21l-4.35-4.35M11 19a8 8 0 100-16 8 8 0 000 16z'/></svg>") no-repeat 10px center;
  background-size: 16px 16px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, background-color 0.15s;
}
.subnav__search-input:focus {
  border-color: var(--primary);
  background-color: white;
}
.subnav__body { flex: 1; overflow-y: auto; }
.subnav__section-title {
  padding: 14px 18px 6px;
  font-size: 11px; font-weight: 700; color: var(--gray-500);
  letter-spacing: 0.08em; text-transform: uppercase;
}

/* ============ メインコンテンツ ============ */
.main {
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--gray-50);
}
.topbar {
  height: var(--topbar-h);
  background: white;
  border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.topbar__title { font-size: 16px; font-weight: 700; color: var(--gray-900); flex: 1; }
.topbar__actions { display: flex; gap: 8px; align-items: center; }
.topbar__btn {
  width: 36px; height: 36px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--gray-500);
  position: relative;
  transition: background 0.15s, color 0.15s;
}
.topbar__btn:hover { background: var(--gray-100); color: var(--primary); }
.topbar__btn .dot {
  position: absolute; top: 8px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%; background: #E24B4A;
  border: 2px solid white;
}

.main__content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ============ ボタン ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.btn--primary {
  background: var(--primary); color: white;
  box-shadow: 0 1px 2px rgba(26,111,212,0.3);
}
.btn--primary:hover { background: var(--primary-dark); }
.btn--secondary {
  background: white; color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.btn--secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn--ghost { color: var(--gray-600); }
.btn--ghost:hover { background: var(--gray-100); }
.btn--danger { background: var(--danger); color: white; }
.btn--danger:hover { background: #8A2424; }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--lg { padding: 11px 22px; font-size: 14px; }
.btn .icon { width: 16px; height: 16px; }

/* ============ カード ============ */
.card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.card__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card__title { font-size: 14px; font-weight: 700; color: var(--gray-900); }
.card__body { padding: 20px; }

/* ============ バッジ ============ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.badge--blue { background: var(--primary-light); color: var(--accent); }
.badge--green { background: var(--success-light); color: #0F6E56; }
.badge--red { background: var(--danger-light); color: #791F1F; }
.badge--amber { background: var(--warning-light); color: #633806; }
.badge--gray { background: var(--gray-100); color: var(--gray-600); }
.badge--purple { background: #EEEDFE; color: #3C3489; }
.badge--teal { background: #E1F5EE; color: #085041; }

/* ============ アバター ============ */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: white; font-weight: 700;
  flex-shrink: 0;
}
.avatar--sm { width: 28px; height: 28px; font-size: 11px; }
.avatar--md { width: 36px; height: 36px; font-size: 13px; }
.avatar--lg { width: 48px; height: 48px; font-size: 16px; }
.avatar--xl { width: 64px; height: 64px; font-size: 22px; }

.avatar-bg-1 { background: linear-gradient(135deg, #1A6FD4 0%, #378ADD 100%); }
.avatar-bg-2 { background: linear-gradient(135deg, #1D9E75 0%, #34C29B 100%); }
.avatar-bg-3 { background: linear-gradient(135deg, #BA7517 0%, #E2A04C 100%); }
.avatar-bg-4 { background: linear-gradient(135deg, #534AB7 0%, #7A6FE6 100%); }
.avatar-bg-5 { background: linear-gradient(135deg, #A32D2D 0%, #E24B4A 100%); }
.avatar-bg-6 { background: linear-gradient(135deg, #0C447C 0%, #1A6FD4 100%); }
.avatar-bg-7 { background: linear-gradient(135deg, #085041 0%, #0F6E56 100%); }
.avatar-bg-8 { background: linear-gradient(135deg, #633806 0%, #BA7517 100%); }

.avatar--online { position: relative; }
.avatar--online::after {
  content: ''; position: absolute; bottom: 0; right: 0;
  width: 10px; height: 10px; border-radius: 50%;
  background: #22C55E; border: 2px solid white;
}
.avatar--away::after { background: #F59E0B; }
.avatar--busy::after { background: #EF4444; }
.avatar--offline::after { background: var(--gray-400); }

/* ============ スクロールバー ============ */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--gray-300);
  border-radius: 6px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); background-clip: padding-box; border: 2px solid transparent; }

/* ============ ユーティリティ ============ */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.text-xs { font-size: 11px; }
.text-sm { font-size: 12px; }
.text-base { font-size: 14px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.text-2xl { font-size: 22px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.text-gray { color: var(--gray-500); }
.text-gray-dark { color: var(--gray-700); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-success { color: var(--success); }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============ フォーム要素 ============ */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
}
.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius);
  background: white;
  font-size: 13px;
  color: var(--gray-800);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 111, 212, 0.1);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-help { font-size: 11px; color: var(--gray-500); margin-top: 4px; }

/* ============ 表 ============ */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--gray-50);
  color: var(--gray-700);
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  border-bottom: 1px solid var(--gray-200);
  white-space: nowrap;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
}
.data-table tr:hover td { background: var(--gray-50); }
.data-table tr:last-child td { border-bottom: none; }

/* ============ モックバー（ヘッダーに表示するナビ） ============ */
.mock-bar {
  position: fixed;
  bottom: 16px; right: 16px;
  background: rgba(15, 23, 42, 0.92);
  color: white;
  padding: 10px 16px;
  border-radius: 24px;
  font-size: 12px;
  font-weight: 600;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.3);
  z-index: 1000;
  backdrop-filter: blur(8px);
}
.mock-bar a {
  background: rgba(255,255,255,0.15);
  padding: 4px 10px;
  border-radius: 14px;
  font-size: 11px;
  transition: background 0.15s;
}
.mock-bar a:hover { background: rgba(255,255,255,0.28); }
.mock-bar .label { opacity: 0.7; font-size: 11px; }


/* ============================================================
   トークルーム連携バー（room-scope-bar + room-tabs）
   チャット・ノート・予定・タスク・フォルダ・画像 が
   各トークルームに紐づくことを示す共通UI
   ============================================================ */
.room-scope-bar {
  background: linear-gradient(135deg, #F4F8FD 0%, #EAF4FF 100%);
  border-bottom: 1px solid var(--gray-200);
  padding: 10px 24px 0;
}
.room-scope-bar__top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
}
.room-scope-bar__back {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--primary);
  background: rgba(255,255,255,0.7);
  border: 1px solid var(--gray-200);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}
.room-scope-bar__back:hover { background: white; border-color: var(--primary); }
.room-scope-bar__back svg { width: 16px; height: 16px; }
.room-scope-bar__info { flex: 1; min-width: 0; }
.room-scope-bar__name {
  font-size: 14px; font-weight: 700; color: var(--gray-900);
  display: flex; align-items: center; gap: 8px;
}
.room-scope-bar__name .badge { font-size: 10px; }
.room-scope-bar__sub { font-size: 11.5px; color: var(--gray-600); margin-top: 1px; }
.room-scope-bar__actions { display: flex; gap: 4px; }
.room-scope-bar__pill {
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 12px;
  color: var(--gray-700);
  display: inline-flex; align-items: center; gap: 5px;
  font-weight: 600;
  white-space: nowrap;
}
.room-scope-bar__pill:hover { border-color: var(--primary); color: var(--primary); }
.room-scope-bar__pill svg { width: 13px; height: 13px; }

.room-tabs {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.room-tabs::-webkit-scrollbar { display: none; }
.room-tab {
  padding: 9px 14px;
  font-size: 12.5px; font-weight: 600;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 6px;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  cursor: pointer;
}
.room-tab:hover { color: var(--primary); background: rgba(255,255,255,0.5); }
.room-tab svg { width: 15px; height: 15px; }
.room-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); background: white; }
.room-tab__count {
  background: var(--gray-200);
  color: var(--gray-700);
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 8px;
  min-width: 18px; text-align: center;
}
.room-tab.is-active .room-tab__count {
  background: var(--primary);
  color: white;
}

/* チャット画面ではトーク中なのでヘッダー直下にタブのみ表示 */
.room-tabs--inline {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 20px;
}

/* ============================================================
   モバイル対応 (iPhone / Android 等のスマートフォン)
   ============================================================ */
@media (max-width: 768px) {
  body {
    overflow: auto;
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: rgba(26,111,212,0.1);
  }

  /* アプリ全体を縦積みに */
  .app, .app--no-subnav {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100vh;
    width: 100%;
    padding-bottom: 64px; /* ボトムナビの分 */
  }

  /* サイドバー → ボトムタブバーに変身 */
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: 60px;
    flex-direction: row;
    align-items: stretch;
    padding: 4px 0;
    z-index: 100;
    border-top: 1px solid rgba(255,255,255,0.1);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.18);
    /* iOSのセーフエリア対応 */
    padding-bottom: env(safe-area-inset-bottom, 0);
    height: calc(60px + env(safe-area-inset-bottom, 0));
  }
  .sidebar__logo { display: none; }
  .sidebar__profile { display: none; }
  .sidebar__nav {
    flex-direction: row;
    width: 100%;
    justify-content: space-around;
    align-items: stretch;
    gap: 0;
  }
  .sidebar__item {
    flex: 1;
    width: auto;
    max-width: 88px;
    height: 100%;
    border-radius: 0;
    font-size: 9.5px;
    padding: 4px 0;
    gap: 2px;
  }
  .sidebar__item .icon { width: 22px; height: 22px; }
  .sidebar__item.is-active { background: transparent; color: var(--sidebar-text-active); }
  .sidebar__item.is-active::before { display: none; }
  .sidebar__item.is-active .icon { color: var(--primary-mid); }
  .sidebar__item .badge {
    top: 2px;
    right: calc(50% - 18px);
    min-width: 14px; height: 14px;
    font-size: 8px;
    border: 2px solid var(--sidebar-bg);
  }
  /* 5つを残し、6番目以降は非表示にして横幅を確保 */
  .sidebar__item:nth-child(n+6) { display: none; }

  /* サブナビ → フル幅、下にメインが続く */
  .subnav {
    width: 100%;
    border-right: none;
    border-bottom: 6px solid var(--gray-100);
    max-height: 56vh;
  }
  .subnav__body { max-height: 40vh; }

  /* メイン → フル幅 */
  .main {
    width: 100%;
    flex: 1;
    overflow: visible;
  }
  .main__content { overflow: visible; padding: 16px 14px; }

  /* トップバーは画面上部に固定 */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    padding: 0 14px;
    gap: 8px;
  }
  .topbar__title { font-size: 14px; }

  /* グリッドの再構成 */
  .kpi-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px; }
  .kpi-card { padding: 12px 14px; }
  .kpi-card__value { font-size: 18px; }
  .system-status { flex-direction: column; }
  .chart-grid { grid-template-columns: 1fr !important; }
  .feature-grid, .screen-grid { grid-template-columns: 1fr !important; }
  .ab-grid { grid-template-columns: 1fr !important; }
  .file-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .theme-grid { grid-template-columns: 1fr !important; }
  .user-stats { grid-template-columns: repeat(2, 1fr) !important; }
  .audit-meta { flex-wrap: wrap; }
  .audit-meta > * { min-width: 45%; }

  /* テーブルは横スクロール可能に */
  .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 600px; }

  /* ログイン画面 */
  .login-card { grid-template-columns: 1fr !important; }
  .login-card__hero { padding: 28px 22px; }
  .login-card__form { padding: 28px 22px; }
  .hero-title { font-size: 20px !important; }
  .form-title { font-size: 18px !important; }

  /* プロフィール */
  .profile-banner { height: 80px; }
  .profile-card { padding: 0 18px 18px; }
  .profile-card__avatar { width: 72px; height: 72px; margin-top: -36px; font-size: 28px; }
  .profile-card__name { font-size: 17px; }
  .profile-meta { gap: 14px; }
  .settings-content { padding: 14px; }
  .settings-tabs { font-size: 11.5px; gap: 0; }
  .settings-tab { padding: 9px 10px; }
  .setting-section { padding: 16px 18px; }

  /* カレンダー */
  .cal-toolbar { gap: 8px; padding: 10px 14px; flex-wrap: wrap; }
  .cal-month-label { font-size: 15px; flex: 1; }
  .cal-view-switch { margin-left: 0; }
  .cal-wrap { padding: 12px 10px; }
  .cal-days { grid-auto-rows: minmax(72px, 1fr); }
  .cal-day { padding: 4px; }
  .cal-day__num { font-size: 11px; }
  .cal-day__num small { display: none; }
  .cal-event { font-size: 9px; padding: 1px 3px; }

  /* タスク（カンバンは横スクロールでそのまま） */
  .kanban-toolbar { gap: 8px; padding: 10px 14px; }
  .kanban-title { font-size: 16px; }
  .kanban-sub { display: block; margin-left: 0; margin-top: 2px; }
  .kanban-board { padding: 14px 14px 80px; }
  .kanban-col { width: 270px; max-height: none; }

  /* 掲示板 */
  .board-content { padding: 14px; max-width: 100%; }
  .board-header__title { font-size: 18px; }
  .post-item { padding: 14px 16px; }
  .post-title { font-size: 15px; }
  .post-footer { flex-wrap: wrap; gap: 8px; }
  .post-meta { margin-left: 0; }

  /* ファイル */
  .file-toolbar { padding: 10px 14px; flex-wrap: wrap; gap: 8px; }
  .file-content { padding: 14px; }
  .storage-stats { flex-direction: column; align-items: stretch; gap: 14px; padding: 14px; }
  .storage-meta { padding-left: 0; border-left: none; padding-top: 12px; border-top: 1px solid var(--gray-200); flex-wrap: wrap; }
  .breadcrumb { font-size: 12px; }

  /* 通知 */
  .notif-content { padding: 14px; }
  .notif-header__title { font-size: 18px; }
  .dnd-card { padding: 12px 14px; }
  .notif-tabs { font-size: 11px; }
  .notif-tab { padding: 7px 10px; font-size: 11px; }

  /* 管理者 */
  .admin-banner { padding: 10px 14px; font-size: 11px; }
  .admin-banner__msg { font-size: 11px; }
  .admin-nav { padding: 0 14px; }
  .admin-nav__item { padding: 11px 10px; font-size: 12px; }

  /* チャット */
  .chat-header { padding: 0 14px; gap: 10px; min-height: 56px; }
  .chat-header__name { font-size: 14px; }
  .chat-body { padding: 14px; }
  .chat-composer { padding: 10px 12px 12px; position: sticky; bottom: 0; }
  .composer-input-wrap { padding: 6px 10px; }
  .msg { max-width: 92%; }
  .msg__bubble { font-size: 13px; padding: 9px 12px; }

  /* アドレス帳 */
  .ab-toolbar { padding: 10px 14px; gap: 8px; }
  .ab-search { max-width: 100%; padding: 9px 12px 9px 36px; }
  .ab-filter-row { padding: 10px 14px; gap: 6px; }
  .ab-content { padding: 14px; }

  /* 組織図 */
  .org-toolbar { padding: 10px 14px; flex-wrap: wrap; }
  .org-canvas { padding: 24px 14px; }

  /* ノート */
  .note-header { padding: 10px 14px; gap: 10px; }
  .note-tabs { padding: 0 14px; overflow-x: auto; }
  .note-tab { white-space: nowrap; padding: 9px 10px; font-size: 12px; }
  .note-content { padding: 14px; }
  .note-toolbar { flex-wrap: wrap; }
  .note-search { max-width: 100%; }
  .note-card { padding: 14px 16px; }
  .note-card__title { font-size: 15px; }

  /* ハブ画面 */
  .hub-header { padding: 32px 18px 28px; }
  .hub-title { font-size: 1.8rem; }
  .hub-subtitle { font-size: 0.95rem; }
  .hub-content { padding: 24px 14px 60px; }
  .hub-meta { gap: 14px; }

  /* タッチターゲット確保 */
  .btn { min-height: 36px; }
  .form-input, .form-select, .form-textarea { font-size: 14px; min-height: 40px; }

  /* ルームバー モバイル調整 */
  .room-scope-bar { padding: 8px 14px 0; }
  .room-scope-bar__top { padding-bottom: 8px; gap: 8px; }
  .room-scope-bar__pill { font-size: 11px; padding: 5px 9px; }
  .room-scope-bar__sub { display: none; }
  .room-tabs--inline { padding: 0 8px; }
  .room-tab { padding: 8px 10px; font-size: 11.5px; }

  /* モックバーをボトムナビと重ならないように */
  .mock-bar {
    bottom: 72px;
    right: 8px;
    left: 8px;
    max-width: calc(100% - 16px);
    font-size: 11px;
    padding: 8px 12px;
    justify-content: center;
    flex-wrap: wrap;
  }
}

/* ============ 狭い画面 (< 480px) ============ */
@media (max-width: 480px) {
  .topbar__title { font-size: 13px; }
  .kpi-grid { grid-template-columns: 1fr !important; }
  .file-grid { grid-template-columns: 1fr !important; }
  .data-table th, .data-table td { padding: 8px 10px; font-size: 11.5px; }
  .hub-title { font-size: 1.5rem; }
  .doc-title { font-size: 1.4rem; }
  .sidebar__item { font-size: 9px; }
  .sidebar__item .icon { width: 20px; height: 20px; }
  .cal-day { min-height: 60px; }
  .cal-event { font-size: 8.5px; }
  .cal-day__num { font-size: 10px; }
}

/* ============================================================
   チャット画面専用スタイル（mock S-02 から移植）
   ============================================================ */

/* --- サイドバー：チャット一覧アイテム --- */
.chat-list-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.1s;
  position: relative;
}
.chat-list-item:hover { background: var(--gray-50); }
.chat-list-item.is-active {
  background: var(--primary-light);
  border-left-color: var(--primary);
}
.chat-list-item__avatar { flex-shrink: 0; }
.chat-list-item__body   { flex: 1; min-width: 0; }
.chat-list-item__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 2px;
}
.chat-list-item__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-list-item__time {
  font-size: 10px;
  color: var(--gray-400);
  flex-shrink: 0;
}
.chat-list-item__msg {
  font-size: 12px;
  color: var(--gray-500);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.chat-list-item__unread {
  position: absolute;
  right: 10px;
  bottom: 12px;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* --- メイン：メッセージ --- */
.chat-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.date-divider {
  text-align: center;
  margin: 12px 0;
  font-size: 11px;
  color: var(--gray-400);
  position: relative;
}
.date-divider span {
  background: var(--gray-50);
  padding: 3px 14px;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
}
.msg {
  display: flex;
  gap: 10px;
  max-width: 80%;
  margin-bottom: 6px;
}
.msg__avatar { flex-shrink: 0; }
.msg__body   { flex: 1; min-width: 0; }
.msg__meta {
  display: flex;
  gap: 8px;
  align-items: baseline;
  margin-bottom: 3px;
}
.msg__name { font-size: 12.5px; font-weight: 700; color: var(--gray-900); }
.msg__role { font-size: 10px;   color: var(--gray-500); }
.msg__time { font-size: 10px;   color: var(--gray-400); }
.msg__bubble {
  background: white;
  padding: 10px 14px;
  border-radius: 0 14px 14px 14px;
  font-size: 13.5px;
  color: var(--gray-800);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  line-height: 1.6;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.msg--mine {
  align-self: flex-end;
  flex-direction: row-reverse;
}
.msg--mine .msg__meta { justify-content: flex-end; }
.msg--mine .msg__bubble {
  background: var(--primary);
  color: white;
  border-radius: 14px 0 14px 14px;
  border-color: var(--primary);
}

/* ============================================================
   チャット画面 追加スタイル（お気に入り・フィルタ・メンション 他）
   ============================================================ */

/* --- お気に入りフィルタータブ（CSS-only） --- */
.cf-radio { position: absolute; opacity: 0; pointer-events: none; }

.chat-filter-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 12px 10px;
  border-bottom: 1px solid var(--gray-100);
  background: white;
}
.chat-filter-tab {
  flex: 1;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  text-align: center;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  background: var(--gray-100);
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.chat-filter-tab:hover { background: var(--gray-200); }
.chat-filter-tab svg   { width: 13px; height: 13px; }
.chat-filter-tab__count {
  background: rgba(0,0,0,0.08);
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
}

#cf-all:checked ~ .chat-filter-tabs label[for="cf-all"],
#cf-fav:checked ~ .chat-filter-tabs label[for="cf-fav"] {
  background: var(--primary);
  color: white;
}
#cf-all:checked ~ .chat-filter-tabs label[for="cf-all"] .chat-filter-tab__count,
#cf-fav:checked ~ .chat-filter-tabs label[for="cf-fav"] .chat-filter-tab__count {
  background: rgba(255,255,255,0.25);
  color: white;
}

/* お気に入りタブ選択時：非お気に入りを隠す */
#cf-fav:checked ~ .subnav__body .chat-list-item:not(.is-favorite),
#cf-fav:checked ~ .subnav__body .subnav__section-title:not(.is-fav-title) {
  display: none;
}
.subnav__section-title.is-fav-title { display: none; }
#cf-fav:checked ~ .subnav__body .subnav__section-title.is-fav-title { display: block; }

/* --- お気に入りスター --- */
.chat-list-item { position: relative; }
.chat-fav-star {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-300);
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  cursor: pointer;
  background: transparent;
  border: 0;
}
.chat-list-item:hover .chat-fav-star,
.chat-list-item.is-favorite .chat-fav-star {
  opacity: 1;
}
.chat-list-item.is-favorite .chat-fav-star { color: #F59E0B; }
.chat-fav-star:hover { background: var(--gray-100); color: #F59E0B; }
.chat-fav-star svg { width: 14px; height: 14px; }

/* 未読バッジがあるアイテムはスター位置を左にずらす */
.chat-list-item:has(.chat-list-item__unread) .chat-fav-star { right: 36px; }

/* --- アバター ステータスドット --- */
.avatar { position: relative; }
.avatar--online::after,
.avatar--away::after,
.avatar--busy::after,
.avatar--offline::after {
  content: '';
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid white;
}
.avatar--online::after  { background: #22C55E; }
.avatar--away::after    { background: #F59E0B; }
.avatar--busy::after    { background: #EF4444; }
.avatar--offline::after { background: var(--gray-400); }

/* --- メッセージ メンション強調 --- */
.msg__bubble.is-mention {
  border-color: rgba(26,111,212,0.3);
  background: #F4F8FD;
}
.msg__bubble .mention {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  font-size: 12.5px;
}
.msg__bubble .mention.mention--me {
  background: var(--primary);
  color: white;
}
.msg--mine .msg__bubble .mention {
  background: rgba(255,255,255,0.25);
  color: white;
}

/* メンション受信時の通知マーク（チャット一覧） */
.chat-list-item__mention-mark {
  display: inline-block;
  background: var(--primary);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  margin-right: 4px;
  line-height: 1.2;
}

/* --- リアクション --- */
.msg__reactions {
  display: flex;
  gap: 5px;
  margin-top: 5px;
  flex-wrap: wrap;
}
.reaction {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 2px 8px;
  font-size: 11px;
  color: var(--gray-700);
  cursor: pointer;
}
.reaction:hover { border-color: var(--primary); }
.reaction.is-mine {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--accent);
}
.reaction-count { font-weight: 600; }

/* 自分の発言（メンションのとき） */
.msg--mine .msg__bubble.is-mention {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

/* --- subnav__search 補強 --- */
.subnav__search { padding: 4px 12px 8px; }
.subnav__search-input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  background: var(--gray-50) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%239AA3AD' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") no-repeat 10px center;
  background-size: 14px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 12.5px;
  outline: none;
}
.subnav__search-input:focus {
  border-color: var(--primary);
  background-color: white;
}

/* --- 「セクションタイトル」を多少強化 --- */
.subnav__section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gray-500);
  padding: 12px 14px 6px;
  font-weight: 700;
}

/* ============================================================
   チャンネル一覧（コンパクト表示）
   ============================================================ */
.channel-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}
.channel-item:hover { background: var(--gray-50); color: var(--gray-900); }
.channel-item.is-active {
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 600;
}
.channel-item .hash {
  color: var(--gray-400);
  font-weight: 700;
  flex-shrink: 0;
}
.channel-item.is-active .hash { color: var(--primary); }
.channel-item__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-item .badge-count {
  margin-left: auto;
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
  flex-shrink: 0;
}
.channel-item.is-active .badge-count {
  background: var(--primary);
  color: white;
}

/* チャンネル行のスター位置調整 */
.channel-item { position: relative; }
.channel-item .chat-fav-star {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray-300);
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  cursor: pointer;
  background: transparent;
  border: 0;
}
.channel-item:hover .chat-fav-star,
.channel-item.is-favorite .chat-fav-star { opacity: 1; }
.channel-item.is-favorite .chat-fav-star { color: #F59E0B; }
.channel-item .chat-fav-star:hover { background: var(--gray-100); color: #F59E0B; }
.channel-item .chat-fav-star svg { width: 14px; height: 14px; }

/* バッジカウント有りのスター位置調整 */
.channel-item:has(.badge-count) .chat-fav-star { right: 38px; }

/* お気に入りタブ選択時：チャンネル側も絞り込み */
#cf-fav:checked ~ .subnav__body .channel-item:not(.is-favorite) { display: none; }

/* ============================================================
   サイドバーの新規ボタン と フィルタ切替の JS用クラス
   ============================================================ */

/* JS でフィルタ ON にしたとき：is-favorite 以外を隠す */
.subnav__body--fav-only .chat-list-item:not(.is-favorite),
.subnav__body--fav-only .channel-item:not(.is-favorite),
.subnav__body--fav-only .subnav__section-title:not(.is-fav-title) {
  display: none;
}

/* フィルタタブの is-active（JSで付与） */
.chat-filter-tab.is-active {
  background: var(--primary);
  color: white;
}
.chat-filter-tab.is-active .chat-filter-tab__count {
  background: rgba(255,255,255,0.25);
  color: white;
}

/* ============================================================
   新規チャット モーダル
   ============================================================ */
.nc-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.nc-modal.is-open { display: flex; }

.nc-modal__dialog {
  background: white;
  border-radius: 14px;
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 48px rgba(0,0,0,0.18);
  overflow: hidden;
}
.nc-modal__header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  gap: 12px;
}
.nc-modal__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  flex: 1;
  margin: 0;
}
.nc-modal__close {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 0;
  color: var(--gray-500);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.nc-modal__close:hover { background: var(--gray-100); color: var(--gray-900); }

.nc-modal__body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
.nc-modal__footer {
  padding: 14px 20px;
  border-top: 1px solid var(--gray-100);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  background: var(--gray-50);
}

.nc-type-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  background: var(--gray-100);
  padding: 4px;
  border-radius: 10px;
}
.nc-type-tab {
  flex: 1;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-600);
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.nc-type-tab:hover { color: var(--gray-900); }
.nc-type-tab.is-active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.nc-form-row { margin-bottom: 14px; }
.nc-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.nc-input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
}
.nc-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(26,111,212,0.1); }

.nc-user-list {
  max-height: 280px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--gray-50);
}
.nc-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
}
.nc-user:last-child { border-bottom: 0; }
.nc-user:hover { background: white; }
.nc-user input { margin: 0; flex-shrink: 0; }
.nc-user__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}
.nc-user__name {
  font-weight: 600;
  color: var(--gray-900);
  font-size: 13px;
}
.nc-user__pos {
  font-size: 11px;
  color: var(--gray-500);
}

/* ボタン補強 */
.btn--primary {
  background: var(--primary);
  color: white;
  border: 1px solid var(--primary);
}
.btn--primary:hover { background: var(--primary-dark); }
.btn--secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-200);
}
.btn--secondary:hover { background: var(--gray-50); }

/* ============================================================
   チャット コンポーザー（添付バー・入力欄・送信）
   ============================================================ */
.chat-composer {
  background: white;
  border-top: 1px solid var(--gray-200);
  padding: 12px 16px 14px;
}
.composer-toolbar {
  display: flex;
  position: relative;
  gap: 4px;
  padding-bottom: 8px;
}
.composer-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.composer-btn:hover { background: var(--gray-100); color: var(--primary); }
.composer-btn svg   { width: 18px; height: 18px; }

.composer-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  background: var(--gray-50);
  transition: border-color 0.15s, background 0.15s;
}
.composer-input-wrap:focus-within {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 3px rgba(26,111,212,0.05);
}
.composer-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  font-size: 13.5px;
  font-family: inherit;
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 24px;
  max-height: 120px;
  padding: 0;
}
.composer-send {
  background: var(--primary);
  color: white;
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
}
.composer-send:hover  { background: var(--primary-dark); }
.composer-send svg    { width: 16px; height: 16px; transform: rotate(90deg); }
.composer-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* タイピングインジケーター */
.typing {
  font-size: 11px;
  color: var(--gray-500);
  padding: 6px 4px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 19px;
}
.typing[hidden] { display: none !important; }
.typing-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--primary);
  animation: gc-typing 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes gc-typing {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

/* 添付ボタンの「未実装」ヒント */
.composer-btn[data-stub]::after {
  content: '近日';
  position: absolute;
  transform: translate(20px, -10px);
  font-size: 8px;
  background: var(--gray-200);
  color: var(--gray-600);
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.composer-btn[data-stub] { position: relative; }
.composer-btn[data-stub]:hover::after { opacity: 1; }

/* ============================================================
   カレンダー画面（S-03 から移植）
   ============================================================ */

/* ツールバー */
.cal-toolbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.cal-nav-btn:hover { background: var(--gray-100); color: var(--primary); }

.cal-today {
  padding: 6px 14px;
  background: white;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  text-decoration: none;
  cursor: pointer;
}
.cal-today:hover { background: var(--gray-50); border-color: var(--primary); color: var(--primary); }

.cal-month-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}

.cal-view-switch {
  display: flex;
  gap: 0;
  margin-left: auto;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 3px;
}
.cal-view-btn {
  padding: 6px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.cal-view-btn.is-active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* カレンダー本体 */
.cal-wrap {
  padding: 16px 20px;
  height: 100%;
  display: flex;
  box-sizing: border-box;
}
.cal-grid {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
}
.cal-weekday {
  padding: 10px 12px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
}
.cal-weekday.sun { color: var(--danger); }
.cal-weekday.sat { color: var(--info, #2C7CC7); }

.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.cal-day {
  border-right: 1px solid var(--gray-100);
  border-bottom: 1px solid var(--gray-100);
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  cursor: pointer;
  background: white;
  transition: background 0.1s;
  overflow: hidden;
}
.cal-day:hover           { background: var(--gray-50); }
.cal-day:nth-child(7n)   { border-right: none; }
.cal-day--other          { background: #FBFCFE; color: var(--gray-400); }
.cal-day--other .cal-day__num { color: var(--gray-300); }
.cal-day--today          { background: rgba(26, 111, 212, 0.04); }
.cal-day--today .cal-day__num {
  background: var(--primary);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.cal-day__num {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 4px;
}
.cal-day--holiday .cal-day__num  { color: var(--danger); }
.cal-day--saturday .cal-day__num { color: var(--info, #2C7CC7); }
.cal-day__num small {
  font-size: 9px;
  color: var(--gray-400);
  font-weight: normal;
  margin-left: 4px;
}
.cal-day__events { display: flex; flex-direction: column; gap: 2px; }

.cal-event {
  font-size: 10.5px;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--primary-light);
  color: var(--accent);
  border-left: 3px solid var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.5;
}
.cal-event--green  { background: var(--success-light); color: #0F6E56; border-left-color: var(--success); }
.cal-event--amber  { background: var(--warning-light); color: #633806; border-left-color: var(--warning); }
.cal-event--red    { background: var(--danger-light);  color: #791F1F; border-left-color: var(--danger); }
.cal-event--purple { background: #EEEDFE; color: #3C3489; border-left-color: #534AB7; }
.cal-event--teal   { background: #E1F5EE; color: #085041; border-left-color: #0F6E56; }
.cal-event--ghost  { background: var(--gray-100); color: var(--gray-600); border-left-color: var(--gray-400); }
.cal-event--full   {
  background: var(--primary);
  color: white;
  border-left: none;
}
.cal-event__more {
  font-size: 10px;
  color: var(--gray-500);
  cursor: pointer;
  padding: 1px 6px;
}

/* ====== サブナビ：アジェンダカード ====== */
.agenda-card {
  margin: 12px 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #1A6FD4 0%, #378ADD 100%);
  color: white;
  border-radius: var(--radius);
}
.agenda-card__label {
  font-size: 10px;
  opacity: 0.85;
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}
.agenda-card__count { font-size: 22px; font-weight: 700; }
.agenda-card__next  { font-size: 12px; opacity: 0.9; margin-top: 6px; }

/* ====== サブナビ：ミニカレンダー ====== */
.mini-cal {
  padding: 14px;
  border-bottom: 1px solid var(--gray-100);
}
.mini-cal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
}
.mini-cal__nav { display: flex; gap: 2px; }
.mini-cal__nav a {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.mini-cal__nav a:hover { background: var(--gray-100); color: var(--primary); }
.mini-cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  font-size: 11px;
}
.mini-cal__weekday {
  text-align: center;
  padding: 4px 0;
  font-size: 10px;
  color: var(--gray-500);
  font-weight: 600;
}
.mini-cal__weekday.sun { color: var(--danger); }
.mini-cal__weekday.sat { color: var(--info, #2C7CC7); }
.mini-cal__day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--gray-700);
  cursor: pointer;
  position: relative;
}
.mini-cal__day:hover    { background: var(--gray-100); }
.mini-cal__day.is-today { background: var(--primary); color: white; font-weight: 700; }
.mini-cal__day.is-other { color: var(--gray-300); }
.mini-cal__day.has-event::after {
  content: '';
  position: absolute;
  bottom: 1px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--primary);
}
.mini-cal__day.is-today.has-event::after { background: white; }

/* ====== サブナビ：フィルター ====== */
.cal-filters { padding: 8px 0; }
.cal-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 18px;
  font-size: 12.5px;
  color: var(--gray-700);
  cursor: pointer;
}
.cal-filter:hover { background: var(--gray-50); }
.cal-filter input {
  width: 14px;
  height: 14px;
  accent-color: var(--primary);
}
.cal-filter__color {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ============================================================
   タスク管理（カンバン）画面（S-04 から移植）
   ============================================================ */
.kanban-toolbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.kanban-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
}
.kanban-sub {
  font-size: 12px;
  color: var(--gray-500);
  margin-left: 4px;
}
.kanban-view {
  display: flex;
  gap: 0;
  background: var(--gray-100);
  border-radius: 8px;
  padding: 3px;
}
.kanban-view button {
  padding: 6px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.kanban-view button.is-active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.kanban-view svg { width: 14px; height: 14px; }

.kanban-filter-pill {
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  font-size: 12px;
  color: var(--gray-700);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-family: inherit;
}
.kanban-filter-pill:hover { border-color: var(--primary); }
.kanban-filter-pill svg { width: 12px; height: 12px; color: var(--gray-400); }
.kanban-filter-pill.is-active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  font-weight: 600;
}

/* カンバン本体 */
.kanban-board {
  display: flex;
  gap: 14px;
  padding: 20px 24px 80px;
  min-width: max-content;
}
.kanban-col {
  width: 290px;
  flex-shrink: 0;
  background: var(--gray-100);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--topbar-h) - 80px);
}
.kanban-col__header {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--gray-200);
}
.kanban-col__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--gray-400);
  flex-shrink: 0;
}
.kanban-col__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-800);
}
.kanban-col__count {
  background: white;
  color: var(--gray-600);
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 9px;
}
.kanban-col__add {
  margin-left: auto;
  width: 24px;
  height: 24px;
  border-radius: 5px;
  color: var(--gray-500);
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.kanban-col__add:hover { background: white; color: var(--primary); }

.kanban-col--todo   .kanban-col__dot { background: #94A3B8; }
.kanban-col--doing  .kanban-col__dot { background: var(--primary); }
.kanban-col--review .kanban-col__dot { background: var(--warning); }
.kanban-col--done   .kanban-col__dot { background: var(--success); }
.kanban-col--hold   .kanban-col__dot { background: var(--danger); }

.kanban-col__body {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card {
  background: white;
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
  display: block;
  text-decoration: none;
  color: inherit;
}
.task-card:hover {
  box-shadow: var(--shadow-md, 0 4px 12px rgba(0,0,0,0.08));
  transform: translateY(-1px);
}
.task-card__top {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 7px;
}
.task-card__id {
  font-size: 10px;
  color: var(--gray-500);
  font-weight: 600;
}
.task-card__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  line-height: 1.5;
  margin-bottom: 8px;
}
.task-card__vehicle {
  font-size: 11px;
  color: var(--gray-500);
  margin-bottom: 6px;
}
.task-card__tags {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.task-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}
.task-card__assignees { display: flex; }
.task-card__assignees .avatar {
  border: 2px solid white;
  margin-left: -7px;
}
.task-card__assignees .avatar:first-child { margin-left: 0; }
.task-card__due {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-600);
}
.task-card__due.is-urgent  { color: var(--danger); }
.task-card__due.is-warning { color: var(--warning); }
.task-card__progress {
  height: 4px;
  background: var(--gray-100);
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.task-card__progress > div {
  height: 100%;
  background: var(--primary);
}

/* ============================================================
   カレンダー リストビュー
   ============================================================ */
.cal-list {
  padding: 16px 24px 80px;
  max-width: 880px;
  margin: 0 auto;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  width: 100%;
}
.cal-list__day {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--gray-100);
}
.cal-list__date {
  text-align: center;
  padding: 8px 0;
  border-radius: 8px;
  background: var(--gray-50);
}
.cal-list__date-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-800);
}
.cal-list__date-wd {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 600;
}
.cal-list__date-wd.sun { color: var(--danger); }
.cal-list__date-wd.sat { color: var(--info, #2C7CC7); }
.cal-list__date-ym {
  font-size: 10px;
  color: var(--gray-400);
  margin-top: 2px;
}
.cal-list__events {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cal-list__event {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
  width: 100%;
}
.cal-list__event:hover {
  border-color: var(--primary);
  box-shadow: 0 2px 6px rgba(0,0,0,0.05);
}
.cal-list__event-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.cal-list__event-time {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  min-width: 100px;
  flex-shrink: 0;
}
.cal-list__event-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cal-list__event-loc {
  font-size: 11px;
  color: var(--gray-500);
  flex-shrink: 0;
}

/* セルクリック時のフィードバック（cal-day を pointer に） */
.cal-day[data-date] { cursor: pointer; }

/* button 要素として描画される .cal-event の上書き
   元の .cal-event のもつ背景色・border-left 色は維持しつつ、
   ブラウザ標準の button スタイル（border の上/右/下、フォント、太字、中央寄せ）だけを打ち消す */
button.cal-event {
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 400;
  text-align: left;
  cursor: pointer;
  display: block;
  width: 100%;
  border-top: 0;
  border-right: 0;
  border-bottom: 0;
  margin: 0;
}
button.cal-event__more {
  background: transparent;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  color: var(--gray-500);
  padding: 1px 6px;
  text-align: left;
  display: block;
}

/* ============================================================
   タスク リストビュー
   ============================================================ */
.task-list {
  padding: 16px 24px 80px;
}
.task-list__table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.task-list__table thead th {
  background: var(--gray-50);
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
.task-list__table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
  vertical-align: middle;
}
.task-list__row {
  cursor: pointer;
  transition: background 0.1s;
}
.task-list__row:hover { background: var(--gray-50); }
.task-list__row:last-child td { border-bottom: 0; }

/* kanban view button: a要素対応 */
.kanban-view__btn {
  padding: 6px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}
.kanban-view__btn.is-active {
  background: white;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}
.kanban-view__btn svg { width: 14px; height: 14px; }

/* ============================================================
   掲示板（S-05 から移植）
   ============================================================ */
.board-list { display: flex; flex-direction: column; }
.board-cat {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.board-cat:hover { background: var(--gray-50); }
.board-cat.is-active {
  background: var(--primary-light);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--primary);
}
.board-cat__icon {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-400);
  flex-shrink: 0;
}
.board-cat__count {
  margin-left: auto;
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 8px;
}
.board-cat.is-active .board-cat__count { background: var(--primary); color: white; }

/* メイン */
.board-content {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px;
}
.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.board-header__title { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.board-header__sub   { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.board-filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.board-filter {
  padding: 6px 14px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  font-size: 12px;
  color: var(--gray-700);
  cursor: pointer;
  text-decoration: none;
}
.board-filter:hover { border-color: var(--primary); }
.board-filter.is-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.post-item {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.post-item:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(0,0,0,0.07);
}
.post-item.is-pinned {
  background: linear-gradient(135deg, #FFFEF7 0%, #FFFBED 100%);
  border-color: #F5E0A0;
}
.post-item.is-urgent {
  border-left: 4px solid var(--danger);
}
.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 8px;
}
.post-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.post-pin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #B45309;
  font-size: 11px;
  font-weight: 700;
}
.post-pin svg { width: 12px; height: 12px; }
.post-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 6px;
  line-height: 1.4;
}
.post-excerpt {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.6;
  margin: 0 0 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--gray-500);
  flex-wrap: wrap;
}
.post-author { display: flex; align-items: center; gap: 6px; }
.post-author__name { color: var(--gray-700); font-weight: 600; }
.post-meta { display: flex; gap: 14px; margin-left: auto; }
.post-meta span { display: inline-flex; align-items: center; gap: 4px; }
.post-meta svg { width: 13px; height: 13px; }
.post-read   { color: var(--success); font-weight: 600; }
.post-unread { color: var(--primary); font-weight: 600; }

/* ============================================================
   ノート（S-13 から移植）
   ============================================================ */
.room-list { padding: 4px 0; display: flex; flex-direction: column; }
.room-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.room-item:hover { background: var(--gray-50); }
.room-item.is-active {
  background: var(--primary-light);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--primary);
}
.room-item__hash { color: var(--gray-400); font-weight: 700; flex-shrink: 0; }
.room-item.is-active .room-item__hash { color: var(--primary); }
.room-item__count {
  margin-left: auto;
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 10px; font-weight: 700;
  padding: 1px 6px; border-radius: 8px;
}
.room-item.is-active .room-item__count { background: var(--primary); color: white; }

.note-tabs {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.note-tabs::-webkit-scrollbar { display: none; }
.note-tab {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
}
.note-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.note-tab:hover { color: var(--primary); }

.note-content {
  padding: 20px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.note-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.note-sort-pill {
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  font-size: 12px;
  color: var(--gray-700);
  cursor: pointer;
}
.note-sort-pill:hover { border-color: var(--primary); }

.note-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--warning);
  letter-spacing: 0.05em;
  margin: 18px 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.note-section-title svg { width: 14px; height: 14px; }

.note-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.note-card:hover { border-color: var(--primary); box-shadow: 0 4px 14px rgba(0,0,0,0.07); }
.note-card.is-pinned {
  background: linear-gradient(135deg, #FFFEF7 0%, #FFFBED 100%);
  border-color: #F5E0A0;
}
.note-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.note-card__tags { display: flex; gap: 5px; flex-wrap: wrap; }
.note-card__pin {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #B45309;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}
.note-card__pin svg { width: 12px; height: 12px; }
.note-card__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 6px;
  line-height: 1.4;
}
.note-card__excerpt {
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.7;
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.note-card__footer {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--gray-500);
  padding-top: 10px;
  border-top: 1px solid var(--gray-100);
}
.note-card__author { display: flex; align-items: center; gap: 6px; }
.note-card__author span { color: var(--gray-700); font-weight: 600; }
.note-card__stats {
  display: flex;
  gap: 12px;
  margin-left: auto;
}
.note-card__stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--gray-500);
  font-weight: 500;
}

.note-create-banner {
  background: linear-gradient(135deg, var(--primary-light) 0%, #F4F8FD 100%);
  border: 1px dashed var(--primary);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background 0.15s;
  width: 100%;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.note-create-banner:hover { background: var(--primary-light); }
.note-create-banner svg { width: 24px; height: 24px; color: var(--primary); flex-shrink: 0; }
.note-create-banner__body { flex: 1; }
.note-create-banner__title { font-size: 13.5px; font-weight: 700; color: var(--accent); }
.note-create-banner__sub { font-size: 11.5px; color: var(--gray-600); margin-top: 1px; }

/* ============================================================
   画像ギャラリー（S-14 から移植）
   ============================================================ */
.gallery-toolbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.gallery-count { font-size: 13px; color: var(--gray-700); font-weight: 600; }
.gallery-count strong { color: var(--gray-900); font-size: 15px; }
.gallery-filter {
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  font-size: 12px;
  color: var(--gray-700);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  text-decoration: none;
}
.gallery-filter:hover { border-color: var(--primary); }
.gallery-filter.is-active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.gallery-filter svg { width: 12px; height: 12px; }
.gallery-view {
  display: inline-flex;
  gap: 2px;
  background: var(--gray-100);
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 3px;
}
.gallery-view > * {
  padding: 6px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  display: flex;
  align-items: center;
  gap: 5px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
}
.gallery-view > *:not(.is-active):hover {
  background: rgba(255,255,255,0.6);
  color: var(--gray-900);
}
.gallery-view > .is-active {
  background: white;
  color: var(--primary);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);
  border: 1px solid rgba(26, 111, 212, 0.18);
}
.gallery-view > .is-active svg { color: var(--primary); }
.gallery-view svg { width: 14px; height: 14px; }

.gallery-content { padding: 16px 20px 40px; }

.gallery-section-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--gray-500);
  margin: 14px 0 10px;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 6px;
}

.gallery-grid {
  column-count: 7;
  column-gap: 6px;
  margin-bottom: 16px;
}
@media (max-width: 1600px) { .gallery-grid { column-count: 6; } }
@media (max-width: 1300px) { .gallery-grid { column-count: 5; } }
@media (max-width: 1050px) { .gallery-grid { column-count: 4; } }
@media (max-width: 800px)  { .gallery-grid { column-count: 3; } }
@media (max-width: 500px)  { .gallery-grid { column-count: 2; } }

.gallery-item {
  break-inside: avoid;
  margin-bottom: 6px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
  background: white;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  font-family: inherit;
  padding: 0;
}
.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}
.gallery-item__media {
  width: 100%;
  background: linear-gradient(135deg, #E2E8F0 0%, #CBD5E1 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255,255,255,0.85);
  font-size: 28px;
  position: relative;
  overflow: hidden;
}
.gallery-item__media::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 30% 20%, rgba(255,255,255,0.15) 0%, transparent 50%);
}
.gallery-item__media.h-tall     { aspect-ratio: 3/4; }
.gallery-item__media.h-square   { aspect-ratio: 1; }
.gallery-item__media.h-wide     { aspect-ratio: 16/10; }
.gallery-item__media.h-portrait { aspect-ratio: 9/16; }

.gallery-item__type-badge {
  position: absolute;
  top: 4px;
  left: 4px;
  background: rgba(15, 23, 42, 0.65);
  color: white;
  font-size: 8.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 0.04em;
}
.gallery-item__duration {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(15, 23, 42, 0.7);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.gallery-item__duration svg { width: 10px; height: 10px; }

.gallery-item__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 50%, rgba(15,23,42,0.85) 100%);
  color: white;
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  transition: opacity 0.2s;
}
.gallery-item:hover .gallery-item__overlay { opacity: 1; }
.gallery-item__caption { font-size: 11px; font-weight: 600; line-height: 1.4; }
.gallery-item__meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
  font-size: 10px;
  opacity: 0.85;
}

.gallery-item__footer {
  padding: 5px 7px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: var(--gray-600);
}
.gallery-item__footer .avatar { flex-shrink: 0; }
.gallery-item__footer-info { flex: 1; min-width: 0; overflow: hidden; }
.gallery-item__footer-name {
  color: var(--gray-800);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-item__footer-time { font-size: 9px; color: var(--gray-500); }

/* メディアバリエーション */
.media-1 { background: linear-gradient(135deg, #1E40AF 0%, #3B82F6 100%); }
.media-2 { background: linear-gradient(135deg, #B91C1C 0%, #EF4444 100%); }
.media-3 { background: linear-gradient(135deg, #15803D 0%, #22C55E 100%); }
.media-4 { background: linear-gradient(135deg, #7E22CE 0%, #A855F7 100%); }
.media-5 { background: linear-gradient(135deg, #C2410C 0%, #F97316 100%); }
.media-6 { background: linear-gradient(135deg, #475569 0%, #94A3B8 100%); }
.media-7 { background: linear-gradient(135deg, #0F766E 0%, #14B8A6 100%); }
.media-8 { background: linear-gradient(135deg, #BE185D 0%, #EC4899 100%); }

/* 統計バー */
.gallery-stats {
  display: flex;
  gap: 14px;
  padding: 12px 18px;
  margin-bottom: 14px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  align-items: center;
}
.gallery-stat__label { font-size: 11px; color: var(--gray-500); }
.gallery-stat__value { font-size: 17px; font-weight: 700; color: var(--gray-900); }
.gallery-stat { flex: 1; min-width: 90px; }
.gallery-stat__divider {
  width: 1px;
  height: 36px;
  background: var(--gray-200);
}

/* ギャラリーカード内アバターは少し小さく */
.gallery-item__footer .avatar--sm { width: 20px; height: 20px; font-size: 9px; }
.gallery-item__footer-name { font-size: 10.5px; }
.gallery-item__overlay { padding: 6px; }
.gallery-item__caption { font-size: 10px; line-height: 1.35; }
.gallery-item__meta-row { font-size: 9px; margin-top: 4px; }

/* ============================================================
   ギャラリー リスト表示
   ============================================================ */
.gallery-list {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
}
.gallery-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  width: 100%;
  background: white;
  border: 0;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background 0.1s;
}
.gallery-row:last-child { border-bottom: 0; }
.gallery-row:hover { background: var(--gray-50); }
.gallery-row__thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.9);
  font-size: 20px;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
.gallery-row__badge {
  position: absolute;
  bottom: 2px;
  right: 2px;
  background: rgba(15, 23, 42, 0.7);
  color: white;
  font-size: 8px;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 2px;
  letter-spacing: 0.04em;
}
.gallery-row__body { flex: 1; min-width: 0; overflow: hidden; }
.gallery-row__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}
.gallery-row__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--gray-500);
  flex-wrap: wrap;
}
.gallery-row__size {
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 600;
  flex-shrink: 0;
}

/* ============================================================
   ファイル管理（S-06 から移植）
   ============================================================ */
.folder-list { display: flex; flex-direction: column; padding: 6px 0; }
.folder-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.folder-item:hover { background: var(--gray-50); }
.folder-item.is-active {
  background: var(--primary-light);
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--primary);
}
.folder-item svg { width: 16px; height: 16px; flex-shrink: 0; color: var(--warning); }
.folder-item.is-active svg { color: var(--primary); }

.file-toolbar {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-700);
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}
.breadcrumb__item {
  padding: 4px 8px;
  border-radius: 5px;
  cursor: pointer;
  text-decoration: none;
  color: var(--gray-700);
  white-space: nowrap;
}
.breadcrumb__item:hover { background: var(--gray-100); }
.breadcrumb__item.is-current {
  color: var(--gray-900);
  font-weight: 600;
}
.breadcrumb__sep { color: var(--gray-400); }

.file-content { padding: 20px 24px; }

.storage-stats {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.storage-bar-wrap { flex: 1; min-width: 200px; }
.storage-bar-label {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--gray-600);
  margin-bottom: 6px;
}
.storage-bar {
  height: 8px;
  background: var(--gray-100);
  border-radius: 4px;
  overflow: hidden;
}
.storage-bar > div {
  height: 100%;
  background: linear-gradient(90deg, #1A6FD4, #378ADD);
  border-radius: 4px;
}
.storage-meta {
  display: flex;
  gap: 18px;
  padding-left: 24px;
  border-left: 1px solid var(--gray-200);
}
.storage-meta__item { font-size: 11px; color: var(--gray-500); }
.storage-meta__item strong {
  display: block;
  font-size: 15px;
  color: var(--gray-900);
  font-weight: 700;
}

/* フォルダーグリッド */
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.file-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.15s, border-color 0.15s;
}
.file-card:hover {
  border-color: var(--primary);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.file-card__preview {
  height: 90px;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.file-card__preview svg { width: 40px; height: 40px; }
.file-card__body { padding: 8px 12px; }
.file-card__name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-900);
  margin-bottom: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-card__meta {
  font-size: 10.5px;
  color: var(--gray-500);
  display: flex;
  justify-content: space-between;
}

.file-section-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-500);
  margin: 14px 0 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ファイル一覧テーブル */
.file-table-wrap {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.file-table {
  width: 100%;
  border-collapse: collapse;
}
.file-table thead th {
  background: var(--gray-50);
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--gray-200);
}
.file-table tbody td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: middle;
}
.file-table__row {
  cursor: pointer;
  transition: background 0.1s;
}
.file-table__row:hover { background: var(--gray-50); }
.file-table__row:last-child td { border-bottom: 0; }

.file-row { display: flex; align-items: center; gap: 10px; }
.file-row__icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.file-row__icon.pdf    { background: var(--danger-light); color: var(--danger); }
.file-row__icon.doc    { background: var(--primary-light); color: var(--primary); }
.file-row__icon.xls    { background: var(--success-light); color: var(--success); }
.file-row__icon.img    { background: #FAEEDA; color: var(--warning); }
.file-row__icon.mov    { background: #EEEDFE; color: #534AB7; }
.file-row__icon.zip    { background: var(--gray-200); color: var(--gray-700); }
.file-row__icon.folder { background: var(--warning-light); color: var(--warning); }
.file-row__name { font-size: 13px; font-weight: 500; color: var(--gray-900); }
.file-row__sub  { font-size: 10.5px; color: var(--gray-500); margin-top: 1px; }

/* ============================================================
   通知センター（S-07 から移植）
   ============================================================ */
.notif-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.notif-header__title { font-size: 22px; font-weight: 700; color: var(--gray-900); }
.notif-header__sub   { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.notif-tabs {
  display: flex;
  gap: 4px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 16px;
}
.notif-tab {
  flex: 1;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-600);
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
}
.notif-tab:hover { background: var(--gray-50); color: var(--gray-900); }
.notif-tab.is-active { background: var(--primary); color: white; }
.notif-tab__count {
  background: var(--gray-200);
  color: var(--gray-700);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 8px;
}
.notif-tab.is-active .notif-tab__count {
  background: rgba(255,255,255,0.2);
  color: white;
}

.dnd-card {
  background: linear-gradient(135deg, #0C2A4D 0%, #143C6B 100%);
  color: white;
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.dnd-card__icon {
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.15);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dnd-card__icon svg { width: 20px; height: 20px; }
.dnd-card__body { flex: 1; }
.dnd-card__title { font-size: 14px; font-weight: 700; margin-bottom: 2px; }
.dnd-card__sub   { font-size: 11.5px; opacity: 0.75; }

.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  background: rgba(255,255,255,0.25);
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.2s;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  transition: left 0.2s;
}
.toggle.is-on { background: var(--success); }
.toggle.is-on::after { left: 23px; }

.notif-day-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  letter-spacing: 0.05em;
  margin: 18px 0 8px;
  padding-left: 4px;
}
.notif-list {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.notif-item {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background 0.1s;
  position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--gray-50); }
.notif-item.is-unread { background: rgba(26,111,212,0.04); }
.notif-item.is-unread::before {
  content: '';
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
}
.notif-item__icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.notif-item__icon svg { width: 18px; height: 18px; }
.notif-item__icon.chat    { background: var(--primary-light); color: var(--primary); }
.notif-item__icon.mention { background: #FAEEDA; color: var(--warning); }
.notif-item__icon.task    { background: var(--success-light); color: var(--success); }
.notif-item__icon.cal     { background: #EEEDFE; color: #534AB7; }
.notif-item__icon.board   { background: var(--danger-light); color: var(--danger); }
.notif-item__icon.file    { background: #E1F5EE; color: #0F6E56; }
.notif-item__body { flex: 1; min-width: 0; }
.notif-item__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 2px;
}
.notif-item__title { font-size: 13px; font-weight: 700; color: var(--gray-900); }
.notif-item__time  { font-size: 10.5px; color: var(--gray-400); flex-shrink: 0; }
.notif-item__msg   { font-size: 12.5px; color: var(--gray-600); line-height: 1.5; }
.notif-item__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}
.notif-item__btn {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  background: white;
  border: 1px solid var(--gray-200);
  color: var(--gray-700);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}
.notif-item__btn.is-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}
.notif-item__btn:hover { background: var(--gray-50); }
.notif-item__btn.is-primary:hover { background: var(--primary-dark); }

/* ============================================================
   通知遷移時の一瞬ハイライト
   ============================================================ */
@keyframes gc-flash {
  0%   { box-shadow: 0 0 0 0 rgba(26, 111, 212, 0); background-color: rgba(26, 111, 212, 0); }
  20%  { box-shadow: 0 0 0 4px rgba(26, 111, 212, 0.4); background-color: rgba(26, 111, 212, 0.18); }
  100% { box-shadow: 0 0 0 0 rgba(26, 111, 212, 0); background-color: rgba(26, 111, 212, 0); }
}
.gc-flash {
  animation: gc-flash 1.8s ease-out 1;
  position: relative;
  z-index: 1;
}
/* チャットメッセージ：bubble 自体も少し弾ませる */
.msg.gc-flash .msg__bubble {
  animation: gc-bubble-flash 1.8s ease-out 1;
  transform-origin: center;
}
@keyframes gc-bubble-flash {
  0%   { transform: scale(1); }
  25%  { transform: scale(1.02); }
  100% { transform: scale(1); }
}
/* 対象に少し色を残しておくフェード（補完） */
.gc-flash-soft {
  transition: background-color 1.5s ease;
}

/* ===== task detail modal: inline status pill + progress slider ===== */
.td-status-inline { position: relative; display: inline-block; }
.td-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid transparent;
  cursor: default;
  user-select: none;
}
.td-status-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-400);
}
.td-status-pill__chev {
  opacity: 0.5;
  transition: transform 0.15s;
  display: none;
}
.td-status-pill.is-clickable {
  cursor: pointer;
  border-color: var(--gray-200);
  transition: background 0.15s, border-color 0.15s;
}
.td-status-pill.is-clickable:hover {
  background: var(--gray-50);
  border-color: var(--gray-300);
}
.td-status-pill.is-clickable .td-status-pill__chev {
  display: inline-block;
}
.td-status-pill[aria-expanded="true"] .td-status-pill__chev {
  transform: rotate(180deg);
}
.td-status-menu {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.08);
  padding: 4px;
  min-width: 160px;
  z-index: 30;
}
.td-status-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  border: 0;
  background: transparent;
  border-radius: 5px;
  font-size: 12px;
  color: var(--gray-700);
  cursor: pointer;
  text-align: left;
}
.td-status-menu button:hover {
  background: var(--gray-50);
}
.td-status-menu__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* インライン進捗スライダー */
.td-progress-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: transparent;
  margin: 4px 0 0;
  padding: 0;
  cursor: pointer;
}
.td-progress-slider::-webkit-slider-runnable-track {
  height: 4px;
  background: transparent;
  border-radius: 2px;
}
.td-progress-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  cursor: pointer;
  margin-top: -5px;
}
.td-progress-slider::-moz-range-track {
  height: 4px;
  background: transparent;
  border-radius: 2px;
}
.td-progress-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--primary);
  border: 2px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  cursor: pointer;
}
.td-progress-slider:disabled {
  cursor: default;
}
.td-progress-slider:disabled::-webkit-slider-thumb {
  background: var(--gray-400);
}
.td-progress-slider:disabled::-moz-range-thumb {
  background: var(--gray-400);
}

/* ===== profile / settings (S-08) ===== */
.settings-content {
  max-width: 920px;
  margin: 0 auto;
  padding: 24px;
}
.profile-flash {
  background: var(--success-light);
  color: #0F6E56;
  border: 1px solid #BDE5D6;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 16px;
  display: flex; align-items: center; gap: 8px;
}
.profile-flash--error {
  background: #FCEBEB;
  color: var(--danger);
  border-color: #F5C2C2;
}
.profile-banner {
  background: linear-gradient(135deg, #0E4FA0 0%, #1A6FD4 50%, #378ADD 100%);
  height: 120px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  position: relative;
  overflow: hidden;
}
.profile-banner::after {
  content: ''; position: absolute; bottom: -50px; right: -50px;
  width: 240px; height: 240px; border-radius: 50%;
  background: rgba(255,255,255,0.06);
}
.profile-banner__edit {
  position: absolute; top: 14px; right: 16px;
  color: white;
  background: rgba(255,255,255,0.18);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11.5px; font-weight: 600;
  display: flex; align-items: center; gap: 5px;
  border: 0;
  cursor: pointer;
  backdrop-filter: blur(4px);
}
.profile-banner__edit svg { width: 14px; height: 14px; }
.profile-banner__edit:hover { background: rgba(255,255,255,0.28); }

.profile-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-top: none;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  padding: 0 28px 24px;
  margin-bottom: 20px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.profile-card__avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  border: 4px solid white;
  margin-top: -48px;
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 38px; font-weight: 700;
  box-shadow: var(--shadow-md);
}
.profile-card__info { margin-top: 14px; }
.profile-card__name {
  font-size: 20px; font-weight: 700;
  color: var(--gray-900);
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.profile-card__sub { font-size: 13px; color: var(--gray-500); margin-top: 3px; }
.profile-meta {
  display: flex; gap: 24px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--gray-100);
  flex-wrap: wrap;
}
.profile-meta__item { font-size: 12px; color: var(--gray-500); }
.profile-meta__item strong {
  display: block;
  color: var(--gray-900); font-weight: 600;
  font-size: 13px; margin-top: 2px;
}

.settings-tabs {
  display: flex;
  border-bottom: 1px solid var(--gray-200);
  margin-bottom: 18px;
  overflow-x: auto;
  gap: 2px;
}
.settings-tab {
  padding: 10px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--gray-600);
  border: 0;
  background: transparent;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.settings-tab:hover { color: var(--primary); }
.settings-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }

.setting-section {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 22px 26px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}
.setting-section__title {
  font-size: 14px; font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}
.setting-section__title svg { width: 16px; height: 16px; color: var(--primary); }
.setting-section__sub {
  font-size: 12px; color: var(--gray-500);
  margin-bottom: 16px;
}

.setting-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 0;
  border-top: 1px solid var(--gray-100);
}
.setting-row:first-of-type { border-top: none; padding-top: 4px; }
.setting-row__body { flex: 1; }
.setting-row__title { font-size: 13.5px; font-weight: 600; color: var(--gray-900); margin-bottom: 2px; display: flex; align-items: center; flex-wrap: wrap; }
.setting-row__sub { font-size: 11.5px; color: var(--gray-500); line-height: 1.5; }

.mfa-status {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  background: var(--success-light);
  color: #0F6E56;
  border-radius: 12px;
  font-size: 11px; font-weight: 700;
}
.mfa-status svg { width: 12px; height: 12px; }

.badge-cert {
  display: inline-flex; align-items: center; gap: 4px;
  background: linear-gradient(135deg, var(--primary) 0%, #378ADD 100%);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px; font-weight: 600;
}
.badge-cert svg { width: 12px; height: 12px; }

.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.theme-card {
  border: 2px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 10px;
  cursor: pointer;
  text-align: center;
}
.theme-card.is-active { border-color: var(--primary); }
.theme-card[data-stub] { cursor: not-allowed; opacity: 0.7; }
.theme-card__preview {
  height: 60px;
  border-radius: 6px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
}
.theme-card--light .theme-card__preview { background: linear-gradient(135deg, #FAFBFD, #E2E8F0); }
.theme-card--dark .theme-card__preview { background: linear-gradient(135deg, #1E293B, #0F172A); }
.theme-card--auto .theme-card__preview {
  background: linear-gradient(90deg, #FAFBFD 50%, #0F172A 50%);
}
.theme-card__name { font-size: 12px; font-weight: 600; color: var(--gray-800); }

/* アバター色ピッカー */
.avatar-color-picker {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.avatar-color-picker__item {
  cursor: pointer;
  position: relative;
  display: inline-block;
}
.avatar-color-picker__item input { display: none; }
.avatar-color-picker__item .avatar {
  border: 2px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s;
}
.avatar-color-picker__item:hover .avatar { transform: scale(1.08); }
.avatar-color-picker__item input:checked + .avatar {
  box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary);
}

@keyframes gc-stub-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-2px); }
  40% { transform: translateX(2px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}
.toggle[data-stub] { cursor: not-allowed; }

/* status radio-pill picker (profile) */
.status-picker {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.status-picker__item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: white;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-700);
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.status-picker__item:hover {
  border-color: var(--gray-300);
  background: var(--gray-50);
}
.status-picker__item input { display: none; }
.status-picker__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--gc-status-color, var(--gray-400));
  box-shadow: 0 0 0 2px white, 0 0 0 3px var(--gc-status-color, var(--gray-300));
  flex-shrink: 0;
}
.status-picker__item:has(input:checked) {
  border-color: var(--gc-status-color, var(--primary));
  background: white;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--gc-status-color, var(--primary)) 18%, transparent);
  color: var(--gray-900);
}
@media (max-width: 720px) {
  .status-picker { grid-template-columns: repeat(2, 1fr); }
}

/* avatar uploader (profile) */
.avatar-upload {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-top: 8px;
}
.avatar-upload__preview {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  color: white;
  font-size: 28px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 3px solid white;
  box-shadow: 0 0 0 1px var(--gray-200);
}
.avatar-upload__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.avatar-upload__actions .btn { display: inline-flex; align-items: center; gap: 5px; }
.avatar-upload__help {
  flex-basis: 100%;
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

.avatar-upload__reset.is-disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* ===== chat sidebar collapsible sections ===== */
.chat-section { margin: 0; }
.chat-section > summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  transition: background 0.12s;
}
.chat-section > summary::-webkit-details-marker { display: none; }
.chat-section > summary:hover { background: var(--gray-50); }
.chat-section__chev {
  transition: transform 0.18s;
  transform: rotate(-90deg);
  color: var(--gray-500);
  flex-shrink: 0;
}
.chat-section[open] > summary .chat-section__chev { transform: rotate(0); }
.chat-section__count {
  margin-left: auto;
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  letter-spacing: 0;
  text-transform: none;
}

/* ===== chat bubble: fit content (相手側もこっち側も) ===== */
.msg__body { display: flex; flex-direction: column; }
.msg__bubble {
  width: fit-content;
  max-width: 100%;
}
.msg--mine .msg__body { align-items: flex-end; }

/* ===== user-card modal (Discord-inspired redesign) ===== */
.uc-modal { z-index: 110; }
.uc-modal__dialog {
  position: relative !important;
  max-width: 360px !important;
  padding: 0 !important;
  border-radius: 18px !important;
  overflow: hidden !important;
  background: white;
  box-shadow: 0 22px 70px rgba(0,0,0,0.25), 0 4px 14px rgba(0,0,0,0.08);
  transform-origin: center bottom;
  animation: uc-pop 0.32s cubic-bezier(0.2, 1.2, 0.4, 1.05);
}
@keyframes uc-pop {
  0% { opacity: 0; transform: translateY(20px) scale(0.94); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.uc-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 3;
  width: 30px; height: 30px;
  border: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.42);
  color: white;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: background 0.15s;
}
.uc-close:hover { background: rgba(0,0,0,0.62); }

/* ルーム詳細モーダルの閉じるボタンは白背景で目立たせる */
.rc-modal .uc-close {
  top: 10px; right: 10px;
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.95);
  color: #0F172A;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}
.rc-modal .uc-close:hover { background: #fff; }

/* バナー（カバー画像 or グラデーション） */
.uc-banner {
  height: 110px;
  background-size: cover;
  background-position: center;
  background-color: #1A6FD4;
  position: relative;
}
.uc-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 60%, rgba(0,0,0,0.12) 100%);
  pointer-events: none;
}
.uc-banner--gradient { background-image: none; }
.uc-banner--gradient::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.18) 100%);
  pointer-events: none;
}

/* アバター */
.uc-avatar-wrap {
  position: absolute;
  top: 60px;
  left: 22px;
  width: 96px; height: 96px;
}
.uc-avatar {
  width: 96px; height: 96px;
  border-radius: 50%;
  border: 5px solid white;
  background-color: var(--gray-300);
  color: white;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px; font-weight: 700;
  box-shadow: 0 4px 14px rgba(0,0,0,0.18);
  animation: uc-avatar-pop 0.4s cubic-bezier(0.3, 1.4, 0.5, 1) 0.08s both;
}
@keyframes uc-avatar-pop {
  0%   { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1);   opacity: 1; }
}
.uc-status-ring {
  position: absolute;
  bottom: 3px; right: 3px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: #64748B;
  border: 4px solid white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
}

/* 本文 */
.uc-content {
  padding: 56px 22px 22px;
}
.uc-head {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.uc-name {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--gray-900);
  line-height: 1.2;
}
.uc-role-chip {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 9px;
  background: linear-gradient(135deg, var(--primary) 0%, #378ADD 100%);
  color: white;
  border-radius: 8px;
}
.uc-sub {
  font-size: 12.5px;
  color: var(--gray-500);
  margin-top: 4px;
}

/* ステータスカード */
.uc-status-card {
  margin-top: 16px;
  background: var(--gray-50);
  border-radius: 10px;
  border: 1px solid var(--gray-100);
}
.uc-status-card__inner { padding: 12px 14px; }
.uc-status-line {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-700);
}
.uc-status-card__dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--gray-400);
  box-shadow: 0 0 0 3px rgba(100,116,139,0.12);
  flex-shrink: 0;
}
.uc-status-card__msg {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px dashed var(--gray-200);
  font-size: 12.5px;
  color: var(--gray-800);
  font-style: italic;
  line-height: 1.5;
  word-wrap: break-word;
}
.uc-status-card__msg::before {
  content: '"';
  color: var(--gray-300);
  font-size: 18px;
  vertical-align: -3px;
  margin-right: 2px;
}
.uc-status-card__msg::after {
  content: '"';
  color: var(--gray-300);
  font-size: 18px;
  vertical-align: -3px;
  margin-left: 2px;
}

/* メタ */
.uc-meta {
  margin-top: 14px;
  display: flex; flex-direction: column;
  gap: 2px;
}
.uc-meta-row {
  display: grid;
  grid-template-columns: 18px 60px 1fr;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  font-size: 12px;
  border-radius: 6px;
  transition: background 0.12s;
}
.uc-meta-row:hover { background: var(--gray-50); }
.uc-meta-row__icon {
  color: var(--gray-400);
  display: flex; align-items: center;
}
.uc-meta-row__key {
  color: var(--gray-500);
  font-weight: 600;
}
.uc-meta-row__val {
  color: var(--gray-900);
  word-break: break-all;
}

/* プロフィールバナー の削除ボタン（左上） */
.profile-banner__remove {
  position: absolute;
  top: 14px; left: 14px;
  color: white;
  background: rgba(0,0,0,0.42);
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
  transition: background 0.15s;
}
.profile-banner__remove:hover { background: rgba(220,38,38,0.75); }

/* clickable user references in chat */
[data-user-id] { cursor: pointer; }
.msg__avatar[data-user-id]:hover { opacity: 0.85; }
.msg__name[data-user-id]:hover { text-decoration: underline; }


/* ===== org chart (S-12) ===== */
.org-info {
  padding: 12px 24px;
  background: white;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13px;
  color: var(--gray-600);
  display: flex; align-items: center; gap: 12px;
}
.org-info strong { color: var(--gray-900); }
.org-info__sep { color: var(--gray-300); }

.org-zoom {
  display: flex; align-items: center; gap: 4px;
  background: var(--gray-100);
  border-radius: 6px;
  padding: 3px;
}
.org-zoom button {
  width: 26px; height: 26px;
  border-radius: 4px;
  color: var(--gray-700);
  border: 0;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.org-zoom button:hover { background: white; }
.org-zoom__value { padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--gray-700); }

.org-canvas {
  flex: 1;
  overflow: auto;
  background:
    linear-gradient(var(--gray-100) 1px, transparent 1px) 0 0 / 20px 20px,
    linear-gradient(90deg, var(--gray-100) 1px, transparent 1px) 0 0 / 20px 20px,
    var(--gray-50);
  padding: 40px 24px;
  min-height: 0;
}
/* org ページの main__content は flex column にして、canvas だけスクロール */
.main__content--org {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

/* ツリーレイアウト */
.org-tree, .org-tree ul {
  list-style: none;
  margin: 0; padding: 0;
  display: flex;
  justify-content: center;
  position: relative;
  transition: transform 0.15s ease;
}
/* outer tree: width=content + margin auto so overflow is scrollable on both sides */
.org-tree {
  padding-top: 0;
  width: max-content;
  margin: 0 auto;
}
.org-tree ul {
  padding-top: 28px;
}
.org-tree li {
  position: relative;
  padding: 28px 10px 0;
  text-align: center;
  flex-shrink: 0;
}
/* 親 → 子 の縦線 */
.org-tree li::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  width: 2px; height: 28px;
  background: var(--gray-300);
}
/* 兄弟をつなぐ横線 */
.org-tree li::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gray-300);
}
.org-tree li:first-child::after { left: 50%; }
.org-tree li:last-child::after  { right: 50%; }
.org-tree li:only-child::after  { display: none; }
.org-tree li:only-child::before { left: 50%; }
/* ルート（CEO ノード）のみ線を出さない */
.org-tree > li::before,
.org-tree > li::after { display: none; }
.org-tree > li { padding-top: 0; }

/* ノード */
.node {
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: 12px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05), 0 4px 12px rgba(0,0,0,0.06);
  width: 200px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  display: inline-block;
  text-align: left;
  vertical-align: top;
}
.node:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(0,0,0,0.1);
}
.node__header {
  padding: 10px 12px;
  color: white;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
}
.node--ceo .node__header       { background: linear-gradient(135deg, #0E4FA0, #1A6FD4); }
.node--dept .node__header      { background: linear-gradient(135deg, #1A6FD4, #378ADD); }
.node--team .node__header      { background: linear-gradient(135deg, #0F6E56, #1D9E75); }
.node--team-sub .node__header  { background: linear-gradient(135deg, #475569, #64748B); }
.node--committee .node__header { background: linear-gradient(135deg, #BA7517, #E2A04C); }
.node--project .node__header   { background: linear-gradient(135deg, #534AB7, #7A6FE6); }

.node__body { padding: 12px; }
.node__avatar-row {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}
.node__avatar { flex-shrink: 0; }
.node__title  { font-size: 13.5px; font-weight: 700; color: var(--gray-900); line-height: 1.3; }
.node__role   { font-size: 11px; color: var(--gray-500); margin-top: 2px; }
.node__meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed var(--gray-200);
  font-size: 11px;
  color: var(--gray-500);
}
.node__count {
  display: inline-flex; align-items: center; gap: 4px;
  font-weight: 600;
  color: var(--primary);
}
.node__count svg { width: 12px; height: 12px; }

@media (max-width: 720px) {
  .node { width: 160px; }
  .node__title { font-size: 12.5px; }
}

/* org canvas drag-pan cursor */
.org-canvas { cursor: grab; user-select: none; }
.org-canvas.is-grabbing { cursor: grabbing; }
.org-canvas .node { cursor: pointer; }


/* ===== department detail modal ===== */
.dept-modal__header {
  padding: 22px 24px 18px;
  color: white;
  background: linear-gradient(135deg, #1A6FD4, #378ADD);
  position: relative;
}
.dept-modal__head-inner { position: relative; }
.dept-modal__type-pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  background: rgba(255,255,255,0.25);
  color: white;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  backdrop-filter: blur(4px);
}
.dept-modal__name {
  margin: 8px 0 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.dept-modal__parent {
  margin-top: 4px;
  font-size: 11.5px;
  color: rgba(255,255,255,0.78);
}

.dept-modal__body {
  padding: 18px 22px 22px;
  background: white;
  max-height: 70vh;
  overflow-y: auto;
}

.dept-modal__stats {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
.dept-modal__stat {
  flex: 1;
  background: var(--gray-50);
  border: 1px solid var(--gray-100);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
}
.dept-modal__stat-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
}
.dept-modal__stat-label {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}

.dept-modal__section { margin-top: 14px; }
.dept-modal__section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.dept-modal__count-chip {
  background: var(--gray-100);
  color: var(--gray-600);
  font-size: 10px;
  padding: 1px 8px;
  border-radius: 10px;
  letter-spacing: 0;
  text-transform: none;
}

.dept-modal__members {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
@media (max-width: 560px) {
  .dept-modal__members { grid-template-columns: 1fr; }
}

.dept-modal__member-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.dept-modal__member-card:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.dept-modal__member-info { flex: 1; min-width: 0; }
.dept-modal__member-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.dept-modal__member-sub {
  font-size: 11px;
  color: var(--gray-500);
  margin-top: 2px;
}
.dept-modal__mgr-mark {
  font-size: 9.5px;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, var(--primary), #378ADD);
  padding: 2px 7px;
  border-radius: 8px;
  letter-spacing: 0.04em;
}
.dept-modal__status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748B;
  flex-shrink: 0;
  box-shadow: 0 0 0 2px white, 0 0 0 3px rgba(100,116,139,0.25);
}

.dept-modal__children {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.dept-modal__child-chip {
  background: var(--dept-grad, linear-gradient(135deg, #1A6FD4, #378ADD));
  color: white;
  border: 0;
  padding: 6px 14px;
  border-radius: 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.dept-modal__child-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

/* ===== directory subnav (left sidebar) ===== */
.org-tree-list {
  padding: 4px 6px 12px;
}
.org-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--gray-700);
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.org-item svg {
  width: 13px;
  height: 13px;
  color: var(--gray-400);
  flex-shrink: 0;
}
.org-item:hover {
  background: var(--gray-100);
  color: var(--gray-900);
}
.org-item.is-active {
  background: var(--primary);
  color: white;
  font-weight: 600;
}
.org-item.is-active svg { color: white; }
.org-item__label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.org-item__count {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gray-500);
  background: var(--gray-100);
  padding: 1px 7px;
  border-radius: 10px;
  flex-shrink: 0;
}
.org-item.is-active .org-item__count {
  background: rgba(255,255,255,0.28);
  color: white;
}
.org-item.nest-1 { padding-left: 14px; }
.org-item.nest-2 { padding-left: 28px; }
.org-item.nest-3 { padding-left: 42px; }
.org-item.nest-2 svg, .org-item.nest-3 svg { display: none; }

/* cover banner actions (right-aligned cluster) */
.profile-banner__actions {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  gap: 8px;
}
.profile-banner__actions .profile-banner__edit {
  position: static; /* override absolute from older rule */
}
.profile-banner__reset.is-disabled {
  opacity: 0.45;
  cursor: not-allowed !important;
  pointer-events: none;
}

/* ===== admin pages (S-09, S-10) ===== */
.admin-banner {
  background: linear-gradient(135deg, #0C2A4D 0%, #143C6B 100%);
  color: white;
  padding: 14px 24px;
  display: flex; align-items: center; gap: 12px;
}
.admin-banner__badge {
  background: var(--danger);
  color: white;
  padding: 2px 9px;
  border-radius: 4px;
  font-size: 10.5px; font-weight: 700;
  letter-spacing: 0.05em;
}
.admin-banner__msg { font-size: 13px; opacity: 0.95; }

.admin-nav {
  background: white;
  border-bottom: 1px solid var(--gray-200);
  padding: 0 24px;
  display: flex; gap: 4px;
  overflow-x: auto;
}
.admin-nav__item {
  padding: 12px 14px;
  font-size: 13px;
  color: var(--gray-600);
  border-bottom: 2px solid transparent;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
}
.admin-nav__item:hover { color: var(--primary); }
.admin-nav__item.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.admin-nav__item.is-disabled { color: var(--gray-400); cursor: not-allowed; }
.admin-nav__item.is-disabled:hover { color: var(--gray-400); }

/* KPI grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
.kpi-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi-card__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kpi-card__label { font-size: 12px; color: var(--gray-500); font-weight: 600; }
.kpi-card__icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
}
.kpi-card__icon svg { width: 16px; height: 16px; }
.kpi-card__icon.blue  { background: var(--primary-light); color: var(--primary); }
.kpi-card__icon.green { background: var(--success-light); color: var(--success); }
.kpi-card__icon.amber { background: var(--warning-light); color: var(--warning); }
.kpi-card__icon.red   { background: var(--danger-light);  color: var(--danger);  }
.kpi-card__value { font-size: 26px; font-weight: 700; color: var(--gray-900); }
.kpi-card__sub { font-size: 11px; color: var(--gray-500); margin-top: 3px; display: flex; align-items: center; gap: 4px; }
.kpi-card__trend { font-weight: 600; }
.kpi-card__trend.up { color: var(--success); }
.kpi-card__trend.down { color: var(--danger); }

/* System status */
.system-status {
  display: flex; gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.status-card {
  flex: 1;
  min-width: 200px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
}
.status-card__indicator {
  width: 10px; height: 10px; border-radius: 50%;
  background: #22C55E;
  box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15);
  flex-shrink: 0;
}
.status-card__indicator.warn { background: #F59E0B; box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15); }
.status-card__indicator.error { background: #EF4444; box-shadow: 0 0 0 4px rgba(239, 68, 68, 0.15); }
.status-card__body { flex: 1; }
.status-card__name { font-size: 12px; font-weight: 600; color: var(--gray-900); }
.status-card__msg { font-size: 11px; color: var(--gray-500); margin-top: 1px; }

/* Chart card */
.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .chart-grid { grid-template-columns: 1fr; }
}
.chart-card {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.chart-card__title { font-size: 13px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.chart-card__sub { font-size: 11px; color: var(--gray-500); margin-bottom: 14px; }

/* Bar chart */
.bar-chart {
  display: flex; align-items: flex-end; gap: 6px;
  height: 180px; padding-top: 16px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; }
.bar {
  width: 80%; max-width: 36px;
  background: linear-gradient(180deg, #378ADD, var(--primary));
  border-radius: 4px 4px 0 0;
  align-self: flex-end;
  min-height: 0;
  transition: height 0.3s ease;
}
.bar-col__label { font-size: 10px; color: var(--gray-500); margin-top: auto; }

/* Donut */
.donut {
  width: 140px; height: 140px;
  border-radius: 50%;
  position: relative;
  margin: 0 auto;
}
.donut::before {
  content: ''; position: absolute;
  inset: 22px; background: white; border-radius: 50%;
}
.donut__center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  z-index: 1;
}
.donut__center strong { font-size: 18px; color: var(--gray-900); font-weight: 700; }
.donut__center span { font-size: 10px; color: var(--gray-500); }
.donut-legend { margin-top: 12px; display: flex; flex-direction: column; gap: 5px; }
.donut-legend__item {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--gray-700);
}
.donut-legend__dot { width: 10px; height: 10px; border-radius: 2px; }
.donut-legend__value { margin-left: auto; font-weight: 600; color: var(--gray-900); }

/* Data table (generic) */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  background: var(--gray-50);
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  padding: 10px 14px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-800);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }

/* User management (S-10) */
.user-stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
@media (max-width: 900px) {
  .user-stats { grid-template-columns: repeat(2, 1fr); }
}
.user-stat {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.user-stat__label { font-size: 11px; color: var(--gray-500); }
.user-stat__value { font-size: 20px; font-weight: 700; color: var(--gray-900); margin-top: 2px; }
.user-stat__sub { font-size: 11px; color: var(--gray-500); margin-top: 2px; }

.user-toolbar {
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex; align-items: center; gap: 10px;
  flex-wrap: wrap;
}
.user-search {
  flex: 1; max-width: 320px;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  background: var(--gray-50) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394A3B8' stroke-width='2'><path stroke-linecap='round' stroke-linejoin='round' d='M21 21l-4.35-4.35M11 19a8 8 0 100-16 8 8 0 000 16z'/></svg>") no-repeat 10px center;
  background-size: 16px 16px;
  font-size: 13px;
  outline: none;
}
.filter-chip {
  padding: 6px 12px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 16px;
  font-size: 12px; color: var(--gray-700);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}
.filter-chip:hover { border-color: var(--primary); }
.filter-chip.is-active { background: var(--primary); color: white; border-color: var(--primary); }

.role-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px; font-weight: 600;
}
.role-badge--super { background: linear-gradient(135deg, #1A6FD4, #378ADD); color: white; }
.role-badge--admin { background: var(--primary-light); color: var(--primary); }
.role-badge--user  { background: var(--gray-100); color: var(--gray-700); }
.role-badge--guest { background: var(--gray-50); color: var(--gray-500); border: 1px solid var(--gray-200); }

.user-row { display: flex; align-items: center; gap: 10px; }

.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 600;
}
.status-pill::before { content: ''; width: 7px; height: 7px; border-radius: 50%; }
.status-pill.online   { color: var(--success); }
.status-pill.online::before   { background: #22C55E; }
.status-pill.busy     { color: var(--warning); }
.status-pill.busy::before     { background: #EAB308; }
.status-pill.away     { color: var(--danger); }
.status-pill.away::before     { background: #EF4444; }
.status-pill.offline  { color: var(--gray-400); }
.status-pill.offline::before  { background: var(--gray-400); }
.status-pill.disabled { color: var(--danger); }
.status-pill.disabled::before { background: var(--danger); }

.row-actions { display: flex; gap: 2px; }
.row-actions button {
  width: 28px; height: 28px;
  border-radius: 6px;
  color: var(--gray-500);
  display: flex; align-items: center; justify-content: center;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.row-actions button:hover { background: var(--gray-100); color: var(--primary); }
.row-actions button svg { width: 16px; height: 16px; }

/* sidebar logout button (under profile avatar) */
.sidebar__logout-form {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}
.sidebar__logout {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.6);
  border: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sidebar__logout:hover {
  background: rgba(239, 68, 68, 0.18);
  color: #FCA5A5;
}

/* ===== logout confirm modal ===== */
.logout-modal__dialog {
  max-width: 380px !important;
  padding: 28px 28px 22px !important;
  text-align: center;
  border-radius: 14px !important;
  animation: uc-pop 0.28s cubic-bezier(0.2, 1.2, 0.4, 1.05);
}
.logout-modal__icon {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #FCEBEB;
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}
.logout-modal__title {
  margin: 0 0 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--gray-900);
}
.logout-modal__msg {
  margin: 0 0 22px;
  font-size: 13px;
  color: var(--gray-600);
  line-height: 1.6;
}
.logout-modal__actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}
.logout-modal__actions .btn {
  min-width: 110px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* ===== message edit / delete UI ===== */
.msg__body { position: relative; }
.msg__actions {
  position: absolute;
  top: 18px;
  right: -2px;
  display: none;
  gap: 2px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 5;
}
.msg:hover .msg__actions { display: flex; }
.msg--mine .msg__actions { right: auto; left: -2px; }
.msg__action-btn {
  width: 24px; height: 24px;
  border: 0;
  background: transparent;
  border-radius: 4px;
  color: var(--gray-500);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.msg__action-btn:hover { background: var(--gray-100); color: var(--primary); }
.msg__action-btn--danger:hover { background: var(--danger-light); color: var(--danger); }

.msg__edited-mark {
  font-size: 10px;
  color: var(--gray-400);
}

.msg__bubble--deleted {
  background: var(--gray-50) !important;
  color: var(--gray-500) !important;
  font-style: italic;
  border-color: var(--gray-200) !important;
  box-shadow: none !important;
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
}
.msg__bubble--deleted svg { flex-shrink: 0; }
.msg--deleted .msg__actions { display: none !important; }

/* インライン編集フォーム */
.msg__edit-form {
  margin-top: 4px;
  background: white;
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 8px;
  box-shadow: 0 2px 8px rgba(26,111,212,0.15);
  max-width: 100%;
}
.msg__edit-textarea {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13.5px;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
}
.msg__edit-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,111,212,0.12);
}
.msg__edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 6px;
}

/* ===== composer: edit-mode bar ===== */
.composer-edit-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: 8px;
  background: var(--primary-light);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  font-size: 12px;
  color: var(--primary);
}
.composer-edit-bar svg { flex-shrink: 0; }
.composer-edit-bar__label {
  font-weight: 600;
}
.composer-edit-bar__preview {
  color: var(--gray-700);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.composer-edit-bar__cancel {
  border: 0;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  width: 24px; height: 24px;
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.composer-edit-bar__cancel:hover { background: rgba(0,0,0,0.06); color: var(--danger); }

/* 編集モード時、入力欄を強調 */
.chat-composer.is-editing .composer-input-wrap {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,111,212,0.12);
}
.composer-send.is-editing {
  background: var(--success) !important;
}
.composer-send.is-editing:hover { filter: brightness(1.08); }

/* 編集対象メッセージのハイライト */
.msg.is-editing-target .msg__bubble {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* 旧 inline-edit 用のスタイル（残ってても害は無いが念のため隠す） */
.msg__edit-form { display: none !important; }

.composer-edit-bar[hidden] { display: none !important; }


/* --- 既読マーク（自分のメッセージ下） --- */
.msg__read {
  font-size: 10px;
  color: var(--gray-500);
  margin-top: 3px;
  padding: 0 4px;
  align-self: flex-end;
}
.msg--mine .msg__read { text-align: right; }

/* --- 絵文字ピッカー（リアクション用） --- */
.emoji-picker {
  position: fixed;
  display: flex;
  gap: 4px;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 24px;
  padding: 6px 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 9999;
}
.emoji-picker[hidden] { display: none !important; }
.emoji-picker__item {
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  padding: 4px 6px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s, transform 0.12s;
}
.emoji-picker__item:hover {
  background: var(--gray-100);
  transform: scale(1.2);
}


/* リアクション位置調整：空のときは表示せず、吹き出しの直下に密着 */
.msg__reactions:empty { display: none; }
.msg__reactions {
  margin-top: 3px;
}
.msg--mine .msg__reactions {
  justify-content: flex-end;
}

/* 吹き出し＋アクションボタンを横並び（吹き出しのすぐ右に近接） */
.msg__bubble-row {
  display: flex;
  align-items: center;
  gap: 4px;
}
.msg--mine .msg__bubble-row {
  flex-direction: row-reverse;
  justify-content: flex-end;
}
/* 旧 absolute 配置を上書き */
.msg__actions {
  position: static !important;
  top: auto !important;
  right: auto !important;
  left: auto !important;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}
.msg:hover .msg__actions {
  display: flex !important;
  opacity: 1;
  pointer-events: auto;
}

/* hover でガタつかないよう、非hover時もスペースは保持 */
.msg__actions {
  display: flex !important;
  visibility: hidden;
}
.msg:hover .msg__actions { visibility: visible; }

/* メッセージ右クリック用コンテキストメニュー */
.msg-ctxmenu {
  position: fixed;
  background: white;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  z-index: 10000;
  min-width: 180px;
  overflow: hidden;
}
.msg-ctxmenu[hidden] { display: none !important; }
.msg-ctxmenu__emojis {
  display: flex;
  gap: 2px;
  padding: 6px;
  border-bottom: 1px solid var(--gray-100);
}
.msg-ctxmenu__items {
  padding: 4px 0;
}
.msg-ctxmenu__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: none;
  border: 0;
  font-size: 13px;
  color: var(--gray-700);
  cursor: pointer;
  text-align: left;
}
.msg-ctxmenu__item:hover { background: var(--gray-100); color: var(--primary); }
.msg-ctxmenu__item--danger { color: var(--danger); }
.msg-ctxmenu__item--danger:hover { background: var(--danger-light); color: var(--danger); }

/* 新規チャット作成 エラーパネル */
.nc-errors {
  background: var(--danger-light, #fee);
  color: var(--danger, #c33);
  border: 1px solid var(--danger, #c33);
  border-radius: 6px;
  padding: 8px 12px;
  margin: 0 0 12px;
  font-size: 12px;
  line-height: 1.6;
}
.nc-errors[hidden] { display: none !important; }

/* デスクトップ通知 許可バナー */
.notif-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: linear-gradient(90deg, var(--primary-light, #e8f0fe), #fff);
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  font-size: 12px;
  color: var(--gray-700, #374151);
}
.notif-banner[hidden] { display: none !important; }
.notif-banner svg { color: var(--primary, #3b82f6); flex-shrink: 0; }
.notif-banner__text { flex: 1; }
.notif-banner__allow,
.notif-banner__dismiss {
  background: none;
  border: 1px solid transparent;
  padding: 4px 10px;
  border-radius: 5px;
  font-size: 12px;
  cursor: pointer;
}
.notif-banner__allow {
  background: var(--primary, #3b82f6);
  color: white;
  border-color: var(--primary, #3b82f6);
}
.notif-banner__allow:hover { background: var(--primary-dark, #2563eb); }
.notif-banner__dismiss { color: var(--gray-600, #4b5563); }
.notif-banner__dismiss:hover { background: var(--gray-100, #f3f4f6); }

/* ===== ルーム右クリック コンテキストメニュー ===== */
.room-ctxmenu {
  position: fixed;
  background: white;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.18);
  z-index: 10001;
  min-width: 220px;
  padding: 4px 0;
  font-size: 12.5px;
}
.room-ctxmenu[hidden] { display: none !important; }
.room-ctxmenu hr {
  border: 0;
  border-top: 1px solid var(--gray-100, #f3f4f6);
  margin: 4px 0;
}
.room-ctxmenu__name {
  padding: 8px 12px 4px;
  font-weight: 600;
  font-size: 12px;
  color: var(--gray-800, #1f2937);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}
.room-ctxmenu__section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--gray-500, #6b7280);
  text-transform: uppercase;
}
.room-ctxmenu__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 10px;
  background: none;
  border: 0;
  font-size: 12.5px;
  color: var(--gray-700, #374151);
  cursor: pointer;
  text-align: left;
}
.room-ctxmenu__item:hover { background: var(--gray-100, #f3f4f6); }
.room-ctxmenu__check {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.room-ctxmenu__item.is-on .room-ctxmenu__check::before {
  content: '✓';
  color: var(--primary, #3b82f6);
  font-weight: 700;
  font-size: 13px;
}

/* ミュート中のルームは少し薄く表示 */
.chat-list-item.is-muted .chat-list-item__name,
.channel-item.is-muted .channel-item__name {
  color: var(--gray-500, #6b7280);
}
.chat-list-item__mute,
.channel-item__mute {
  margin-right: 4px;
  color: var(--gray-400, #9ca3af);
  display: inline-flex;
  align-items: center;
}

/* ===== メンション補完ポップアップ ===== */
.mention-popup {
  position: fixed;
  background: white;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.12);
  z-index: 9999;
  max-height: 320px;
  overflow-y: auto;
  padding: 4px;
}
.mention-popup[hidden] { display: none !important; }
.mention-popup__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12.5px;
}
.mention-popup__item.is-active,
.mention-popup__item:hover {
  background: var(--primary-light, #e8f0fe);
}
.mention-popup__name {
  font-weight: 600;
  color: var(--gray-800, #1f2937);
  flex: 0 0 auto;
}
.mention-popup__pos {
  font-size: 11px;
  color: var(--gray-500, #6b7280);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mention-popup__empty {
  padding: 12px;
  color: var(--gray-400, #9ca3af);
  font-size: 12px;
  text-align: center;
}

/* チャンネル一覧のアイコン（# / 🔒 / 頭文字を色付き丸で表示） */
.channel-item__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
}
.channel-item.is-active .channel-item__icon {
  outline: 2px solid var(--primary, #3b82f6);
  outline-offset: 1px;
}

/* ===== ルームスコープバーの「ルーム切替」ドロップダウン ===== */
.rs-switcher { position: relative; display: inline-block; }
.rs-switcher__btn { list-style: none; cursor: pointer; }
.rs-switcher__btn::-webkit-details-marker { display: none; }
.rs-switcher__panel {
  position: absolute;
  right: 0;
  top: 38px;
  background: white;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.12);
  padding: 6px;
  min-width: 280px;
  max-height: 420px;
  overflow-y: auto;
  z-index: 100;
}
.rs-switcher__section-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--gray-500, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 8px 10px 4px;
  border-top: 1px solid var(--gray-100, #f3f4f6);
  margin-top: 2px;
}
.rs-switcher__section-title:first-child {
  border-top: 0;
  margin-top: 0;
}
.rs-switcher__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: var(--gray-800, #1f2937);
  font-size: 13px;
}
.rs-switcher__item:hover { background: var(--gray-100, #f3f4f6); }
.rs-switcher__item.is-current {
  background: var(--primary-light, #e8f0fe);
  color: var(--primary, #3b82f6);
  font-weight: 600;
}
.rs-switcher__icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.rs-switcher__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rs-switcher__empty {
  padding: 16px;
  text-align: center;
  color: var(--gray-400, #9ca3af);
  font-size: 12px;
}

/* ===== ルーム詳細モーダル ===== */
.rc-modal__dialog {
  position: relative;
  max-width: 460px;
  padding: 0;
  overflow: hidden;
}
.rc-banner {
  height: 96px;
  position: relative;
}
.rc-banner--gradient {
  background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(0,0,0,0.15));
}
.rc-avatar-wrap {
  position: relative;
  margin-top: -36px;
  display: flex;
  justify-content: center;
}
.rc-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  border: 4px solid white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.rc-content {
  padding: 12px 24px 24px;
  text-align: center;
}
.rc-name {
  font-size: 18px;
  font-weight: 700;
  margin: 8px 0 4px;
  color: var(--gray-900, #111827);
}
.rc-sub {
  font-size: 13px;
  color: var(--gray-500, #6b7280);
  margin-bottom: 12px;
}
.rc-description {
  font-size: 12.5px;
  color: var(--gray-700, #374151);
  background: var(--gray-50, #f9fafb);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  text-align: left;
}
.rc-meta {
  display: flex;
  justify-content: center;
  gap: 16px;
  font-size: 11px;
  color: var(--gray-500, #6b7280);
  margin-bottom: 16px;
}
.rc-meta-row__key {
  font-weight: 600;
  margin-right: 4px;
}
.rc-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-600, #4b5563);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-top: 1px solid var(--gray-100, #f3f4f6);
  padding-top: 12px;
  margin-bottom: 8px;
  justify-content: center;
}
.rc-section-title svg { color: var(--gray-500, #6b7280); }
.rc-members {
  max-height: 320px;
  overflow-y: auto;
  text-align: left;
}
.rc-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.1s;
}
.rc-member:hover { background: var(--gray-100, #f3f4f6); }
.rc-member__avwrap { position: relative; }
.rc-member__status {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 2px solid white;
}
.rc-member__body { flex: 1; overflow: hidden; }
.rc-member__name {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800, #1f2937);
  display: flex;
  align-items: center;
  gap: 6px;
}
.rc-member__pos {
  font-size: 11px;
  color: var(--gray-500, #6b7280);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rc-member__chip {
  display: inline-block;
  background: var(--gray-100, #f3f4f6);
  color: var(--gray-600, #4b5563);
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  font-weight: 600;
}
.rc-member__chip--owner {
  background: var(--primary-light, #e8f0fe);
  color: var(--primary, #3b82f6);
}
.rc-members__empty {
  padding: 24px;
  text-align: center;
  color: var(--gray-400, #9ca3af);
  font-size: 12px;
}

/* ルーム詳細モーダル: アイコン編集ボタン */
.rc-avatar-wrap { position: relative; width: fit-content; margin: -36px auto 0; }
.rc-avatar-edit {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary, #3b82f6);
  color: white;
  border: 2px solid white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.rc-avatar-edit:hover { background: var(--primary-dark, #2563eb); }
.rc-avatar-edit[hidden] { display: none !important; }

.rc-avatar-remove {
  position: absolute;
  left: -6px;
  top: -6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.rc-avatar-remove:hover { background: rgba(0,0,0,0.78); }
.rc-avatar-remove[hidden] { display: none !important; }

/* 通知画面: 未読件数のハイライト */
.notif-header__unread {
  font-weight: 700;
  color: var(--gray-500, #6b7280);
}
.notif-header__unread.has-unread {
  color: #E24B4A;
}
/* 未読タブ：件数が 0 以外なら赤い丸バッジ */
.notif-tab__count.has-unread {
  background: #E24B4A;
  color: white;
}
.notif-tab[data-tab-key="unread"] .notif-tab__count {
  /* 0件のときは灰色（既定） */
}

/* ===== メッセージ転送モーダル ===== */
.fwd-preview {
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 6px;
  padding: 8px 10px;
  background: var(--gray-50, #f9fafb);
  font-size: 12.5px;
  max-height: 120px;
  overflow-y: auto;
}
.fwd-preview__sender {
  font-weight: 700;
  color: var(--primary, #3b82f6);
  font-size: 11px;
  margin-bottom: 4px;
}
.fwd-preview__body {
  color: var(--gray-700, #374151);
  white-space: pre-wrap;
  word-break: break-word;
}
.fwd-rooms {
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 6px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
}
.fwd-room {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}
.fwd-room:hover { background: var(--gray-100, #f3f4f6); }
.fwd-room input[type=checkbox] { margin: 0; }
.fwd-room__av {
  width: 24px; height: 24px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: white; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.fwd-room__name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--gray-800, #1f2937);
}
.fwd-room__type {
  font-size: 10px;
  color: var(--gray-400, #9ca3af);
  background: var(--gray-100, #f3f4f6);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ===== メッセージ内 URL リンク + OGP プレビューカード ===== */
.msg-link {
  color: var(--primary, #3b82f6);
  text-decoration: underline;
  word-break: break-all;
}
.msg-link:hover { color: var(--primary-dark, #2563eb); }
.msg--mine .msg__bubble .msg-link {
  color: white;
  text-decoration: underline;
  text-decoration-color: rgba(255,255,255,0.6);
}

.msg-link-preview {
  display: flex;
  margin-top: 6px;
  max-width: 480px;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-left: 3px solid var(--primary, #3b82f6);
  border-radius: 6px;
  background: white;
  text-decoration: none;
  overflow: hidden;
  transition: background 0.1s;
}
.msg--mine .msg-link-preview {
  margin-left: auto;
}
.msg-link-preview:hover { background: var(--gray-50, #f9fafb); }
.msg-link-preview__img {
  width: 96px;
  flex-shrink: 0;
  background-color: var(--gray-100, #f3f4f6);
  background-size: cover;
  background-position: center;
}
.msg-link-preview__body {
  padding: 8px 10px;
  flex: 1;
  min-width: 0;
}
.msg-link-preview__site {
  font-size: 10px;
  color: var(--gray-500, #6b7280);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.msg-link-preview__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-900, #111827);
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.msg-link-preview__desc {
  font-size: 11.5px;
  color: var(--gray-600, #4b5563);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* プロフィール画面 右上のログアウトボタン */
.profile-card__logout {
  position: absolute;
  top: 16px;
  right: 20px;
  z-index: 2;
  margin: 0;
}

/* ===== ルーム内メッセージ検索バー ===== */
.room-search {
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  background: white;
  max-height: 50vh;
  display: flex;
  flex-direction: column;
}
.room-search[hidden] { display: none !important; }
.room-search__input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--gray-100, #f3f4f6);
}
.room-search__input-wrap svg { color: var(--gray-500, #6b7280); flex-shrink: 0; }
.room-search__input {
  flex: 1;
  border: 0;
  outline: 0;
  font-size: 13px;
  background: transparent;
  color: var(--gray-800, #1f2937);
}
.room-search__count {
  font-size: 11px;
  color: var(--gray-500, #6b7280);
  flex-shrink: 0;
}
.room-search__close {
  background: none;
  border: 0;
  padding: 4px;
  cursor: pointer;
  color: var(--gray-500, #6b7280);
  border-radius: 4px;
  display: flex;
}
.room-search__close:hover { background: var(--gray-100, #f3f4f6); }
.room-search__results {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
  background: var(--gray-50, #f9fafb);
}
.rs-item {
  display: flex;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  background: white;
  margin-bottom: 4px;
  border: 1px solid var(--gray-100, #f3f4f6);
}
.rs-item:hover {
  background: var(--primary-light, #e8f0fe);
  border-color: var(--primary, #3b82f6);
}
.rs-item__body { flex: 1; min-width: 0; }
.rs-item__meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: var(--gray-500, #6b7280);
  margin-bottom: 2px;
  align-items: baseline;
}
.rs-item__name { font-weight: 600; color: var(--gray-700, #374151); }
.rs-item__text {
  font-size: 12.5px;
  color: var(--gray-700, #374151);
  white-space: pre-wrap;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rs-hl {
  background: rgba(255, 220, 0, 0.5);
  color: inherit;
  font-weight: 700;
  padding: 0 1px;
  border-radius: 2px;
}
.rs-loading, .rs-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-400, #9ca3af);
}
/* 検索結果クリック時の一時ハイライト */
.msg--highlight .msg__bubble {
  animation: gc-msg-flash 2s ease-out;
}
@keyframes gc-msg-flash {
  0%   { box-shadow: 0 0 0 3px rgba(255, 220, 0, 0.7); background-color: #FFF8C5; }
  100% { box-shadow: 0 0 0 0 rgba(255, 220, 0, 0);   background-color: ; }
}

/* ===== ルーム詳細：メンバー追加 ===== */
.rc-section-title { position: relative; }
.rc-add-btn {
  position: absolute;
  right: 0;
  top: 8px;
  background: var(--primary, #3b82f6);
  color: white;
  border: 0;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-transform: none;
  letter-spacing: 0;
}
.rc-add-btn:hover { background: var(--primary-dark, #2563eb); }
.rc-add-btn[hidden] { display: none !important; }
.rc-add-panel {
  border: 1px solid var(--primary, #3b82f6);
  border-radius: 8px;
  margin-top: 8px;
  background: var(--gray-50, #f9fafb);
  text-align: left;
  display: flex;
  flex-direction: column;
}
.rc-add-panel[hidden] { display: none !important; }
.rc-add-panel__search {
  border: 0;
  border-bottom: 1px solid var(--gray-200, #e5e7eb);
  background: white;
  padding: 8px 12px;
  font-size: 12.5px;
  outline: 0;
  border-top-left-radius: 8px;
  border-top-right-radius: 8px;
}
.rc-add-panel__list {
  max-height: 240px;
  overflow-y: auto;
  padding: 4px;
}
.rc-add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12.5px;
}
.rc-add-row:hover { background: var(--gray-100, #f3f4f6); }
.rc-add-row input[type=checkbox] { margin: 0; }
.rc-add-row__name {
  flex: 1;
  color: var(--gray-800, #1f2937);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rc-add-row__pos {
  font-size: 10.5px;
  color: var(--gray-500, #6b7280);
}
.rc-add-empty {
  padding: 16px;
  text-align: center;
  font-size: 12px;
  color: var(--gray-400, #9ca3af);
}
.rc-add-panel__footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--gray-200, #e5e7eb);
  background: white;
  border-bottom-left-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* メンバー追加ボタンの + アイコンを濃く */
.rc-add-btn svg {
  stroke-width: 3.2 !important;
  filter: drop-shadow(0 0 0 currentColor);
}

/* ルーム詳細：rc-content をスクロール可能に（パネル展開時のはみ出し対策） */
.rc-modal__dialog { overflow: hidden; }
.rc-content {
  max-height: calc(80vh - 140px);
  overflow-y: auto;
}

.rc-add-btn__plus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px; height: 16px;
  background: white;
  color: var(--primary, #3b82f6);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  flex-shrink: 0;
}

/* ===== お気に入りモード修正 ===== */
/* セクション見出しは隠さない（折りたたみ可能を維持） */
#cf-fav:checked ~ .subnav__body .subnav__section-title:not(.is-fav-title) {
  display: flex !important;
}
.subnav__body--fav-only .subnav__section-title:not(.is-fav-title) {
  display: flex !important;
}
/* お気に入りが1件もないセクション（details）は全体を隠す */
#cf-fav:checked ~ .subnav__body .chat-section:not(:has(.is-favorite)),
.subnav__body--fav-only .chat-section:not(:has(.is-favorite)) {
  display: none !important;
}
/* JS クラスのフィルタもサポート */
.subnav__body--fav-only .chat-list-item:not(.is-favorite),
.subnav__body--fav-only .channel-item:not(.is-favorite) {
  display: none;
}

/* 管理ダッシュボード 会社ロゴカード */
.company-logo-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: white;
  border: 1px solid var(--gray-200, #e5e7eb);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 20px;
}
.company-logo-card__preview {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1A6FD4 0%, #378ADD 100%);
  color: white;
  font-weight: 800;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(26,111,212,0.3);
}
.company-logo-card__body { flex: 1; min-width: 0; }
.company-logo-card__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--gray-900, #111827);
}
.company-logo-card__sub {
  font-size: 11px;
  color: var(--gray-500, #6b7280);
  margin-top: 2px;
}
.company-logo-card__form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== チャットセクションヘッダー (subtle color分け) ===== */
.chat-section {
  border-top: 1px solid var(--gray-100);
}
.chat-section:first-of-type {
  border-top: none;
}
.chat-section[data-section="pinned"] > summary {
  background: #FEFBF3;
  color: #A16207;
}
.chat-section[data-section="dm"] > summary {
  background: #F5F9FF;
  color: #1D4ED8;
}
.chat-section[data-section="channel"] > summary {
  background: #F7F8FA;
  color: #4B5563;
}
.chat-section > summary:hover {
  filter: brightness(0.97);
}
.chat-section__count {
  background: rgba(255, 255, 255, 0.75) !important;
}

/* ===== ピン止めバー & ピン状態 ===== */
.pinned-bar {
  background: #FEFBF3;
  border-bottom: 1px solid #F6E8C8;
  flex-shrink: 0;
}
.pinned-bar__head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #A16207;
}
.pinned-bar__head:hover { background: #FEF7E4; }
.pinned-bar__count {
  background: rgba(245, 158, 11, 0.15);
  color: #92400E;
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 10px;
}
.pinned-bar__list {
  max-height: 240px;
  overflow-y: auto;
  border-top: 1px solid #F6E8C8;
}
.pinned-bar__item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  border-bottom: 1px solid #FAF1DD;
}
.pinned-bar__item:hover { background: #FEF7E4; }
.pinned-bar__body { flex: 1; min-width: 0; }
.pinned-bar__sender {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #A16207;
}
.pinned-bar__text {
  display: block;
  font-size: 12px;
  color: var(--gray-700);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pinned-bar__unpin {
  color: var(--gray-500);
  font-size: 18px;
  padding: 0 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.pinned-bar__unpin:hover { color: var(--danger); }

/* メッセージ自体に薄いピンマーク */
.msg--pinned .msg__bubble {
  border-left: 3px solid #F59E0B;
}
.msg--pinned .msg__meta::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 4px;
  vertical-align: -2px;
  background-color: #D97706;
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M16 9V4l1-1V2H7v1l1 1v5L6 11v2h5.2v7l.8 1l.8-1v-7H18v-2z'/></svg>") no-repeat center / contain;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='currentColor'><path d='M16 9V4l1-1V2H7v1l1 1v5L6 11v2h5.2v7l.8 1l.8-1v-7H18v-2z'/></svg>") no-repeat center / contain;
}

/* ジャンプ時のハイライト */
@keyframes msg-flash {
  0%, 100% { background: transparent; }
  20%, 60% { background: rgba(245, 158, 11, 0.18); }
}
.msg--highlight .msg__bubble {
  animation: msg-flash 1.8s ease;
}

/* --- お気に入りスターとの被り防止 (時刻が隠れないように右余白) --- */
.chat-list-item {
  padding-right: 34px;
}
.chat-list-item__time {
  font-size: 10px;
  white-space: nowrap;
}
.chat-list-item__msg {
  padding-right: 4px;
}

/* --- お気に入り星をメッセージ行に合わせる (時刻と被らない) --- */
.chat-list-item {
  padding-right: 14px;  /* 元に戻す */
}
.chat-fav-star {
  top: auto;
  bottom: 10px;
  transform: none;
}

/* --- メッセージプレビュー: 右下のお気に入り星と被らない余白 --- */
.chat-list-item__msg {
  padding-right: 28px;
}

/* === 画像添付プレビュー (composer 上部) === */
.composer-attachments {
  display: flex;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--gray-50);
  flex-wrap: wrap;
}
.composer-attachments[hidden] { display: none; }
.composer-attachment-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  background: white;
  border: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
}
.composer-attachment-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.composer-attachment-thumb__progress {
  font-size: 11px;
  color: var(--gray-500);
}
.composer-attachment-thumb__remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: white;
  border: none;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}
.composer-attachment-thumb__remove:hover { background: rgba(220, 38, 38, 0.85); }

/* === メッセージ吹き出し内の画像 === */
.msg__images {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
}
.msg__image-wrap {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  background: var(--gray-100);
  cursor: zoom-in;
  max-width: 280px;
  max-height: 280px;
}
.msg__image-wrap img {
  display: block;
  max-width: 280px;
  max-height: 280px;
  object-fit: cover;
}
/* 1枚のときは大きめ、2枚以上は半分 */
.msg__images--multi .msg__image-wrap {
  max-width: 137px;
  max-height: 137px;
}
.msg__images--multi .msg__image-wrap img {
  max-width: 137px;
  max-height: 137px;
}

/* === 画像 lightbox === */
.image-lightbox {
  position: fixed; inset: 0;
  z-index: 10000;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  cursor: zoom-out;
}
.image-lightbox[hidden] { display: none; }
.image-lightbox img {
  max-width: 92vw;
  max-height: 92vh;
  display: block;
  box-shadow: 0 8px 40px rgba(0,0,0,0.5);
  border-radius: 4px;
}

/* === チャット ドラッグ&ドロップ オーバーレイ === */
.main__content { position: relative; }
#chat-drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(37, 99, 235, 0.12);
  backdrop-filter: blur(2px);
  border: 3px dashed var(--primary);
  border-radius: 12px;
  pointer-events: none; /* drop イベントを下の要素に通す */
}
.chat-drop-overlay__inner {
  background: white;
  border-radius: 14px;
  padding: 28px 36px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.18);
  text-align: center;
  color: var(--primary);
  pointer-events: none;
}
.chat-drop-overlay__inner svg { margin: 0 auto 8px; display: block; color: var(--primary); }
.chat-drop-overlay__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-900);
  margin-bottom: 4px;
}
.chat-drop-overlay__sub {
  font-size: 12px;
  color: var(--gray-500);
}

/* === ギャラリー グリッド: 全アイテム同サイズ (Masonry 廃止 → CSS Grid) === */
.gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  column-count: unset !important;
}
.gallery-item {
  display: flex;
  flex-direction: column;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--gray-100);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  padding: 0;
}
.gallery-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.10);
}
/* aspect-ratio クラスを上書きして全部 1:1 に固定 */
.gallery-item__media,
.gallery-item__media.h-square,
.gallery-item__media.h-wide,
.gallery-item__media.h-tall,
.gallery-item__media.h-portrait {
  aspect-ratio: 1 / 1 !important;
  position: relative;
  overflow: hidden;
  background: var(--gray-100);
}
.gallery-item__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* === ギャラリー カードのアクションボタン (ホバー時に出現) === */
.gallery-item__actions {
  position: absolute;
  top: 6px;
  right: 6px;
  display: flex;
  gap: 4px;
  z-index: 2;
  opacity: 0;
  transition: opacity 0.15s;
}
.gallery-item:hover .gallery-item__actions { opacity: 1; }
.gallery-action-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: rgba(0,0,0,0.55);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  backdrop-filter: blur(2px);
}
.gallery-action-btn:hover { background: rgba(0,0,0,0.78); }
.gallery-action-btn--danger:hover { background: var(--danger); }
.gallery-action-btn svg { width: 15px; height: 15px; }

/* div に変えたカードでもクリック可能に見えるように */
.gallery-item, .gallery-row {
  cursor: pointer;
  user-select: none;
}
.gallery-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--gray-100);
  text-align: left;
  width: 100%;
}
.gallery-row:hover { background: var(--gray-50); }

/* 拡張子バッジとルーム名バッジの被り解消: 拡張子は左下へ */
.gallery-item__type-badge {
  top: auto !important;
  bottom: 6px;
  left: 6px;
}

/* メッセージ吹き出しが高さ inflate されないよう防御 */
.msg__bubble {
  min-height: 0 !important;
  height: auto !important;
  aspect-ratio: auto !important;
  align-self: flex-start;
}
.msg__bubble-row {
  align-items: flex-start;
}

/* どんな CSS が当たっても吹き出しを 1 行高さに矯正 (緊急復旧) */
.msg .msg__bubble[data-message-body] {
  padding: 10px 14px !important;
  width: fit-content !important;
  max-width: min(100%, 560px) !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  aspect-ratio: auto !important;
  display: inline-block !important;
  align-self: flex-start !important;
  flex: 0 0 auto !important;
  line-height: 1.6 !important;
}
.msg__bubble-row {
  display: flex !important;
  align-items: flex-start !important;
  min-height: 0 !important;
  height: auto !important;
}
.msg__body {
  min-height: 0 !important;
  height: auto !important;
}

/* CSS 適用確認マーカー: バブル左下に赤い点 */
.msg .msg__bubble[data-message-body]::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: red;
  vertical-align: middle;
  margin-left: 4px;
}

/* 最強 specificity (#chat-body 経由) で吹き出しサイズを矯正 */
#chat-body .msg .msg__bubble[data-message-body],
#chat-body .msg .msg__bubble--deleted {
  padding: 10px 14px !important;
  width: fit-content !important;
  max-width: min(100%, 560px) !important;
  min-width: 0 !important;
  min-height: 0 !important;
  height: auto !important;
  aspect-ratio: auto !important;
  align-self: flex-start !important;
  flex: 0 0 auto !important;
  display: inline-block !important;
  box-sizing: border-box !important;
  line-height: 1.6 !important;
}
#chat-body .msg__bubble-row {
  display: flex !important;
  align-items: flex-start !important;
  min-height: 0 !important;
}

/* 診断マーカー (赤点) は不要なので削除 */
.msg .msg__bubble[data-message-body]::after {
  content: none !important;
}

/* 緊急矯正用 CSS と診断 marker を解除 (上の partial 修正で不要に) */
.msg .msg__bubble[data-message-body]::after { content: none !important; }

/* 削除バブルは inline-flex を維持 (上記の inline-block 強制から除外) */
#chat-body .msg .msg__bubble--deleted {
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

/* user-stats: 4 ステートしか出さないので 4 列に修正 (右の空欄を解消) */
.user-stats { grid-template-columns: repeat(4, 1fr) !important; }
@media (max-width: 900px) {
  .user-stats { grid-template-columns: repeat(2, 1fr) !important; }
}

/* user-stats: 5番目にストレージを追加したので 5 列に戻す */
.user-stats { grid-template-columns: repeat(5, 1fr) !important; }
@media (max-width: 900px) {
  .user-stats { grid-template-columns: repeat(2, 1fr) !important; }
}


/* 自分ルームのバッジ (「自分」ピル) */
.chat-list-item__self-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border-radius: 10px;
  padding: 1px 8px;
  margin-right: 6px;
  vertical-align: 1px;
  line-height: 1.5;
  letter-spacing: 0.5px;
}

/* ===== チャット設定: 送信キー pill ===== */
.send-key-pill {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 14px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  min-width: 220px;
}
.send-key-pill:hover { border-color: var(--gray-300); background: var(--gray-50); }
.send-key-pill.is-active { border-color: var(--primary); background: var(--primary-light); }
.send-key-pill__kbd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--gray-900);
}
.send-key-pill.is-active .send-key-pill__kbd { color: var(--primary); }
.send-key-pill__desc {
  font-size: 11px;
  color: var(--gray-500);
}

/* ===== トグルスイッチ ===== */
.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.switch-row input[type=checkbox] { display: none; }
.switch-slider {
  position: relative;
  width: 38px;
  height: 22px;
  background: var(--gray-300);
  border-radius: 999px;
  transition: background .15s;
  flex-shrink: 0;
}
.switch-slider::after {
  content: ;
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  transition: transform .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch-row input:checked + .switch-slider { background: var(--primary); }
.switch-row input:checked + .switch-slider::after { transform: translateX(16px); }
.switch-label {
  font-size: 13px;
  color: var(--gray-700);
}

/* ===== コンポーザー用 絵文字ピッカー ===== */
.composer-emoji-popup[hidden] { display: none !important; }
.composer-emoji-popup {
  position: absolute;
  bottom: 56px;
  left: 36px;
  width: 320px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px;
  z-index: 100;
  display: flex;
  flex-direction: column;
}
.composer-emoji-popup__tabs {
  display: flex;
  gap: 2px;
  padding: 2px 2px 6px;
  border-bottom: 1px solid var(--gray-100);
}
.composer-emoji-popup__tab {
  flex: 1;
  font-size: 16px;
  background: transparent;
  border: 0;
  cursor: pointer;
  padding: 6px 0;
  border-radius: 6px;
  line-height: 1;
}
.composer-emoji-popup__tab:hover { background: var(--gray-100); }
.composer-emoji-popup__tab.is-active { background: var(--primary-light); }
.composer-emoji-popup__label {
  font-size: 11px;
  color: var(--gray-500);
  padding: 6px 4px 4px;
  font-weight: 600;
}
.composer-emoji-popup__grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  height: 240px;
  overflow-y: auto;
  padding: 2px;
  align-content: start;
}
.composer-emoji-popup__item {
  font-size: 20px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
}
.composer-emoji-popup__item:hover { background: var(--gray-100); }
.composer-emoji-popup__empty {
  font-size: 12px;
  color: var(--gray-400);
  padding: 24px 8px;
  text-align: center;
  grid-column: 1 / -1;
}

/* ===== ルーム詳細モーダル: キックボタン & 危険ゾーン ===== */
.rc-member { position: relative; }
.rc-member__kick {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid var(--gray-200);
  background: #fff;
  color: var(--gray-500);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.rc-member:hover .rc-member__kick { display: inline-flex; }
.rc-member__kick:hover {
  background: var(--danger, #DC2626);
  border-color: var(--danger, #DC2626);
  color: #fff;
}

.rc-danger-zone {
  margin-top: 16px;
  padding: 12px;
  border: 1px solid #FECACA;
  border-radius: 8px;
  background: #FEF2F2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.rc-danger-zone__hint {
  font-size: 11px;
  color: var(--gray-500);
}
.btn--danger {
  background: var(--danger, #DC2626);
  color: #fff;
  border: 0;
}
.btn--danger:hover { background: #B91C1C; }

/* ===== トライアル期限警告バナー ===== */
.trial-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  background: #FEF3C7;
  color: #92400E;
  border: 1px solid #FCD34D;
  border-radius: 8px;
  margin: 0 0 14px;
  font-size: 13px;
}
.trial-banner svg { flex-shrink: 0; margin-top: 1px; }
.trial-banner--critical {
  background: #FEE2E2;
  color: #991B1B;
  border-color: #FCA5A5;
}

/* ===== Superadmin 検索バー ===== */
.sa-search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.sa-search-bar__input {
  flex: 1;
  min-width: 200px;
  padding: 7px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 5px;
  font-size: 13px;
  background: #fff;
}
.sa-search-bar__input:focus { outline: 2px solid #1E293B; outline-offset: -1px; border-color: transparent; }
.sa-search-bar__status {
  padding: 7px 10px;
  border: 1px solid #E2E8F0;
  border-radius: 5px;
  font-size: 13px;
  background: #fff;
  cursor: pointer;
}

/* ===== Superadmin 会社名リンク ===== */
.sa-company-link {
  color: #0F172A;
  text-decoration: none;
  display: inline-block;
}
.sa-company-link:hover {
  color: #1A6FD4;
  text-decoration: underline;
}
.sa-company-link:hover strong { text-decoration: underline; }

/* ===== チャット: スクロール中に日付を上部中央に表示 (LINE風) ===== */
.chat-date-pill {
  position: fixed;
  z-index: 60;
  top: 0;
  left: 0;
  transform: translate(-50%, -6px);
  background: rgba(255, 255, 255, 0.92);
  color: #475569;
  border: 1px solid rgba(15, 23, 42, 0.08);
  backdrop-filter: blur(6px);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 12px;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease, transform 0.18s ease;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.chat-date-pill.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ===== チャット: 日付区切り (LINE風) ===== */
.chat-day-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 10px;
  padding: 0 6px;
}
.chat-day-sep::before,
.chat-day-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(15, 23, 42, 0.10);
}
.chat-day-sep__label {
  font-size: 11px;
  font-weight: 600;
  color: #64748B;
  background: rgba(255, 255, 255, 0.75);
  padding: 4px 12px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
