/* ============================================================
   Quest Design System v2.0
   Hotel Quality × Minimal × Architecture
   ============================================================ */
:root {
  /* ── Quest Brand ── */
  --quest-navy:      #1a2d5a;
  --quest-navy-dark: #0f1c3c;
  --quest-navy-mid:  #2a4080;

  /* ── Accent aliases (既存コード互換) ── */
  --accent:          #2a4080;
  --accent-dark:     #1a2d5a;
  --accent-muted:    #eef1f9;

  /* ── Surfaces ── */
  --surface:         #ffffff;
  --surface-2:       #f7f8fc;
  --surface-3:       #eef0f6;

  /* ── Borders ── */
  --border:          #e2e5ee;
  --border-dark:     #c4cadb;

  /* ── Sidebar ── */
  --sidebar-bg:      #1e2d5a;
  --sidebar-2:       #162348;
  --sidebar-text:    #ffffff;
  --sidebar-muted:   rgba(255,255,255,0.65);
  --sidebar-hover:   rgba(255,255,255,0.08);
  --sidebar-active:  rgba(255,255,255,0.15);

  /* ── Typography ── */
  --text:            #0d1117;
  --text-2:          #2d3648;
  --text-muted:      #6b7280;

  /* ── Semantic ── */
  --success:         #0b6b42;
  --warning:         #b97a07;
  --danger:          #c0211e;
  --info:            #1a56c4;

  /* ── Elevation ── */
  --shadow-sm:       0 1px 2px rgba(15,25,60,0.04);
  --shadow-md:       0 2px 10px rgba(15,25,60,0.07);
  --shadow-lg:       0 8px 32px rgba(15,25,60,0.10);

  /* ── Shape ── */
  --radius:          10px;
  --radius-sm:       7px;
  --radius-lg:       14px;

  /* ── Motion ── */
  --transition:      140ms ease;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.01em;
}

::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-dark); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ======= アプリレイアウト ======= */
#app-layout { display: flex; height: 100vh; overflow: hidden; }

/* ======= サイドバー ======= */
#sidebar {
  width: 232px; min-width: 232px;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  height: 100vh; overflow-y: auto;
  border-right: 1px solid rgba(255,255,255,0.08);
  transition: width var(--transition), min-width var(--transition);
}
#app-layout.sidebar-collapsed #sidebar { width: 52px; min-width: 52px; }
#app-layout.sidebar-collapsed .sidebar-item { justify-content: center; padding: 8px; }
#app-layout.sidebar-collapsed .sidebar-section-label { display: none; }

.sidebar-collapse-btn {
  cursor: pointer; color: var(--sidebar-muted); font-size: 11px;
  padding: 4px 5px; border-radius: var(--radius-sm); transition: all var(--transition);
  line-height: 1;
}
.sidebar-collapse-btn:hover { background: rgba(0,0,0,0.05); color: var(--sidebar-text); }
.sidebar-profile-collapsed { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 4px; }

/* カテゴリ アコーディオン */
.sidebar-cat-node {
  margin-bottom: 3px;
  position: relative;
}

/* トップレベルカテゴリのみアクセントバー */
.sidebar-section > .sidebar-cat-node > .sidebar-cat-header {
  position: relative;
}
.sidebar-section > .sidebar-cat-node > .sidebar-cat-header::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 4px; height: 18px;
  background: var(--accent-dark);
  border-radius: 0 3px 3px 0;
  opacity: 0.75;
}

.sidebar-cat-header {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px 7px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--sidebar-text);
  font-size: 13px;
  font-weight: 700;
  background: rgba(0,0,0,0.035);
  transition: background var(--transition), color var(--transition);
}
.sidebar-cat-header:hover { background: rgba(0,0,0,0.065); }

/* ネストされた子カテゴリは少し控えめに */
.sidebar-cat-body > .sidebar-cat-node > .sidebar-cat-header {
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  color: var(--sidebar-muted);
  padding: 5px 8px 5px 10px;
}
.sidebar-cat-body > .sidebar-cat-node > .sidebar-cat-header:hover {
  background: rgba(0,0,0,0.04);
  color: var(--sidebar-text);
}
.sidebar-cat-body > .sidebar-cat-node > .sidebar-cat-header::before { display: none; }

.sidebar-cat-arrow {
  font-size: 8px; width: 10px; flex-shrink: 0;
  transition: transform var(--transition);
  color: var(--sidebar-muted);
  opacity: 0.6;
}
.sidebar-cat-arrow-placeholder { width: 10px; flex-shrink: 0; }
.sidebar-cat-header.active {
  background: rgba(255,255,255,0.13);
  color: var(--sidebar-text);
}
.sidebar-cat-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  letter-spacing: 0.01em;
}
.sidebar-cat-add {
  font-size: 14px; line-height: 1; opacity: 0;
  transition: opacity var(--transition); padding: 0 3px; flex-shrink: 0;
}
.sidebar-cat-header:hover .sidebar-cat-add { opacity: 0.6; }
.sidebar-cat-add:hover { opacity: 1 !important; }

.sidebar-cat-body { padding-left: 8px; margin-top: 1px; }
.sidebar-cat-empty { padding: 3px 10px 5px; font-size: 11px; color: var(--sidebar-muted); }

/* カテゴリ管理モーダル */
.cat-manage-group { margin-bottom: 10px; }
.cat-manage-row {
  display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; border-radius: 6px;
}
.cat-manage-top { font-weight: 700; font-size: 13px; }
.cat-manage-child { margin-left: 18px; font-size: 12px; color: var(--text-2); }
.cat-manage-actions { display: flex; gap: 4px; opacity: 0; transition: opacity .12s; }
.cat-manage-row:hover .cat-manage-actions { opacity: 1; }
.cat-manage-add { cursor: pointer; color: var(--accent-dark); font-size: 11px; }
.cat-manage-add:hover { background: var(--surface-2); }
.cat-status-section { margin: 4px 0 8px 18px; padding: 8px; background: var(--surface-2); border-radius: 6px; }
.cat-status-header { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; display: flex; align-items: center; gap: 5px; }
.cat-status-row { display: flex; align-items: center; gap: 8px; padding: 4px 4px; border-radius: 4px; }
.cat-status-row:hover .cat-manage-actions { opacity: 1; }
.cat-status-row .cat-manage-actions { opacity: 0; transition: opacity .12s; margin-left: auto; }
.cat-status-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cat-status-name { font-size: 12px; flex: 1; }

.logo-icon {
  width: 28px; height: 28px;
  background: var(--quest-navy);
  border-radius: 7px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
  color: white;
  box-shadow: 0 2px 8px rgba(26,45,90,0.28);
}

.logo-text { font-size: 15px; font-weight: 700; color: var(--sidebar-text); letter-spacing: -0.5px; }

.sidebar-section { padding: 8px 8px 2px; }

/* ===== サイドバー デザインシステム ===== */

/* --- セクション見出し ---
   役割：メニュー分類を示す非クリックのラベル
   10-11px / グレー / 太字 / 上下に十分な余白 */
.sb-label {
  font-size: 10px; font-weight: 700;
  color: var(--sidebar-muted, #94a3b8);
  letter-spacing: .08em; text-transform: uppercase;
  padding: 14px 12px 5px;
  user-select: none; pointer-events: none;
}
.sb-label:first-child { padding-top: 6px; }

/* サイドバー未読バッジ */
.sb-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--danger, #ef4444); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 16px; height: 16px; border-radius: 8px;
  padding: 0 4px; margin-left: 6px; line-height: 1;
}

/* --- 共通：折りたたみ矢印ボタン --- */
.sb-toggle-btn {
  background: none; border: none; cursor: pointer; padding: 4px 7px;
  color: var(--sidebar-muted, #94a3b8); font-size: 9px; border-radius: 5px;
  flex-shrink: 0; line-height: 1; transition: background .15s;
}
.sb-toggle-btn:hover { background: var(--sidebar-hover, rgba(255,255,255,.08)); }

/* --- 項目（ショートカット系：お気に入り・最近見た）---
   アイコン付き・クリック可能・展開矢印を右端に持つ */
.sb-shortcut-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 4px 6px 10px;
  font-size: 13px; color: var(--sidebar-text, #e2e8f0);
  border-radius: 7px; cursor: pointer; transition: background .15s;
  user-select: none;
}
.sb-shortcut-item:hover { background: var(--sidebar-hover, rgba(255,255,255,.06)); }
.sb-shortcut-icon { font-size: 13px; width: 18px; text-align: center; flex-shrink: 0; }
.sb-shortcut-label { flex: 1; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-shortcut-body { padding: 2px 4px 4px; }

/* --- 空状態 --- */
.sb-empty {
  font-size: 11px; color: var(--sidebar-muted, #94a3b8);
  padding: 5px 10px 5px 18px; line-height: 1.5;
}

/* --- プロジェクト項目（部署・ショートカット配下共通）---
   インデントあり・星アイコンはホバーで表示 */
.sb-proj-item {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  padding: 5px 6px 5px 14px;
  font-size: 12px; color: var(--sidebar-text, #e2e8f0);
  border-radius: 6px; cursor: pointer; transition: background .15s;
}
.sb-proj-item:hover { background: var(--sidebar-hover, rgba(255,255,255,.06)); }
.sb-proj-item.active { background: var(--sidebar-active, rgba(99,102,241,.18)); color: var(--primary, #6366f1); font-weight: 600; }
.sb-proj-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-fav-btn {
  opacity: 0; font-size: 10px; color: var(--sidebar-muted);
  padding: 2px 3px; border-radius: 3px; transition: opacity .15s, color .15s;
  flex-shrink: 0; cursor: pointer; line-height: 1;
}
.sb-proj-item:hover .sb-fav-btn { opacity: 1; }
.sb-fav-btn.is-fav { opacity: 1; color: #f59e0b; }
.sb-fav-btn:hover { color: #f59e0b !important; }

/* --- 部署ブロック ---
   項目より太字・部署名クリック → 部署ページ・矢印クリック → 展開 */
.sb-dept-block { margin-bottom: 1px; }
.sb-dept-header {
  display: flex; align-items: center;
  padding: 1px 4px 1px 6px;
  user-select: none;
}
.sb-dept-name-btn {
  display: flex; align-items: center; gap: 7px;
  flex: 1; padding: 7px 4px 7px 4px; border-radius: 7px; cursor: pointer;
  transition: background .15s; min-width: 0;
}
.sb-dept-name-btn:hover { background: var(--sidebar-hover, rgba(255,255,255,.08)); }
.sb-dept-icon {
  font-size: 11px; width: 16px; text-align: center; flex-shrink: 0;
  color: var(--sidebar-muted, #94a3b8);
}
.sb-dept-label {
  font-size: 13px; font-weight: 700;
  color: var(--sidebar-text, #e2e8f0);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-dept-body { padding: 2px 4px 6px; }

/* 他部署（その他）--- 通常項目と同スタイルだが chevron-right を末尾に表示 */
.sb-dept-other { font-size: 13px; }

/* お気に入りボタン（ナビバー内） */
.sb-fav-inline {
  background: none; border: none; cursor: pointer; padding: 4px 6px;
  font-size: 14px; color: var(--text-muted); border-radius: 5px;
  transition: color .15s; line-height: 1;
}
.sb-fav-inline.is-fav { color: #f59e0b; }
.sb-fav-inline:hover { color: #f59e0b; background: rgba(245,158,11,.1); }
/* お気に入りボタン（ナビバー内） */
.sb-fav-inline {
  background: none; border: none; cursor: pointer; padding: 4px 6px;
  font-size: 14px; color: var(--text-muted); border-radius: 5px;
  transition: color .15s; line-height: 1;
}
.sb-fav-inline.is-fav { color: #f59e0b; }
.sb-fav-inline:hover { color: #f59e0b; background: rgba(245,158,11,.1); }
/* 部署ページ */
.dept-page-body { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; max-width: 900px; }
@media (max-width: 640px) { .dept-page-body { grid-template-columns: 1fr; } }
.dept-page-col { display: flex; flex-direction: column; gap: 12px; }
.dept-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.dept-card-title { font-size: 12px; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.dept-members-list { display: flex; flex-direction: column; gap: 2px; }
.dept-member-row {
  display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 7px; cursor: pointer;
  transition: background .15s;
}
.dept-member-row:hover { background: var(--surface2, var(--surface-2)); }
.dept-member-row.inactive { opacity: .5; }

.sidebar-section-label {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--sidebar-muted);
  padding: 0 8px; margin-bottom: 3px;
}

.sidebar-item {
  display: flex; align-items: center; gap: 7px;
  padding: 5px 9px 5px 10px; border-radius: 6px;
  cursor: pointer; font-size: 12px;
  color: var(--sidebar-muted);
  transition: background var(--transition), color var(--transition);
  margin-bottom: 1px; position: relative;
}
.sidebar-item:hover { background: rgba(0,0,0,0.04); color: var(--sidebar-text); }
.sidebar-item.active {
  background: var(--accent-muted);
  color: var(--quest-navy);
  font-weight: 600;
}
.sidebar-item.active::before {
  content: '';
  position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 2.5px; height: 16px;
  background: var(--quest-navy);
  border-radius: 0 2px 2px 0;
}
.sidebar-item .icon {
  width: 16px; text-align: center; font-size: 13px; flex-shrink: 0;
  color: inherit; opacity: 0.75;
}
.sidebar-item.active .icon { opacity: 1; }
.sidebar-item .badge {
  margin-left: auto; font-size: 10px; font-weight: 500;
  color: #9ca3af;
  padding: 1px 4px; border-radius: 6px; min-width: 16px; text-align: center;
}

/* カテゴリヘッダー内バッジ（件数） */
.sidebar-cat-header .badge {
  font-size: 11px; font-weight: 500;
  color: #9ca3af;
  background: rgba(0,0,0,0.05);
  padding: 1px 6px; border-radius: 10px;
  min-width: 20px; text-align: center;
}

.project-dot { width: 7px; height: 7px; border-radius: 2px; flex-shrink: 0; }

.sidebar-footer {
  margin-top: auto;
  padding: 10px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--sidebar-2);
}

.sidebar-footer .avatar-clickable {
  cursor: pointer;
  transition: opacity 0.15s;
}
.sidebar-footer .avatar-clickable:hover { opacity: 0.8; }

/* ======= メインコンテンツ ======= */
#main-content { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }

/* ======= ヘッダー ======= */
#header {
  height: 96px; min-height: 96px;
  background: #1e2d5a;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex; align-items: center;
  padding: 0 48px; gap: 0;
  position: relative; z-index: 100;
}

.header-title { font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.9); flex-shrink: 0; }
.header-page-title {
  font-size: 17px; font-weight: 700;
  color: #ffffff;
  flex-shrink: 0; white-space: nowrap;
  letter-spacing: -0.3px;
  padding-right: 6px;
  border-right: 1.5px solid rgba(255,255,255,0.2);
}

.header-actions {
  display: flex; align-items: center; gap: 12px;
  margin-left: auto; flex-shrink: 0;
}

/* ヘッダー右上ブランドロゴ */
.header-brand {
  display: flex; align-items: center;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer; flex-shrink: 0;
  transition: background var(--transition);
}
.header-brand:hover { background: rgba(255,255,255,0.08); }
.header-brand-body { display: flex; flex-direction: column; line-height: 1; }
.header-brand-text {
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  font-size: 38px; font-weight: 800;
  color: #ffffff;
  letter-spacing: -2px; line-height: 1;
}
.header-brand-copy {
  font-size: 10px; font-weight: 400;
  color: rgba(255,255,255,0.6); letter-spacing: 0.1em;
  margin-top: 5px; white-space: nowrap;
  font-style: italic; text-align: right;
}

/* 通知ベル */
.notification-bell {
  position: relative; width: 34px; height: 34px;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; background: transparent; border: none;
  color: rgba(255,255,255,0.7); font-size: 18px;
  transition: all var(--transition);
}
.notification-bell:hover { background: rgba(255,255,255,0.1); color: #fff; }

/* 通知ドット（件数なし・色のみ） */
.notif-dot {
  position: absolute; top: 5px; right: 5px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--info);
  border: 1.5px solid var(--surface);
  display: none;
}
.notif-dot.urgent { background: var(--danger); }

/* ベル揺れアニメーション（3.5s静止 + 0.5s揺れ = 4sサイクル） */
@keyframes bellRing {
  0%, 100%  { transform: rotate(0deg); }
  2.5%      { transform: rotate(-7deg); }
  5%        { transform: rotate(7deg); }
  7.5%      { transform: rotate(-5deg); }
  10%       { transform: rotate(4deg); }
  12.5%     { transform: rotate(-2deg); }
  15%       { transform: rotate(0deg); }
}
.bell-ringing i {
  animation: bellRing 4s ease-in-out infinite;
  transform-origin: top center;
  display: inline-block;
}

/* サイドバー プロフィールエリア — ヘッダーと高さ統一(96px) */
.sidebar-profile {
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  min-height: 96px;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  transition: background var(--transition);
  flex-shrink: 0;
  box-sizing: border-box;
}
.sidebar-profile:hover { background: rgba(255,255,255,0.06); }
.sidebar-profile.active { background: transparent; }
.sidebar-profile.active .sidebar-profile-name { color: #fff; font-weight: 700; }
.sidebar-profile-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0;
  overflow: hidden;
}
.sidebar-profile-info { flex: 1; min-width: 0; overflow: hidden; }
.sidebar-profile-name {
  font-size: 12.5px; font-weight: 600;
  color: var(--sidebar-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  line-height: 1.3;
}
.sidebar-profile-sub {
  font-size: 10px; color: var(--sidebar-muted);
  margin-top: 1px;
}

/* 通知センター v2.0 (Drawer内) */
.nc-header {
  display: flex; align-items: center; gap: 8px; padding: 12px 16px 0;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.nc-tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nc-tab {
  padding: 6px 12px; border-radius: 6px 6px 0 0; border: none; background: transparent;
  font-size: 12px; color: var(--text-muted); cursor: pointer; white-space: nowrap;
  border-bottom: 2px solid transparent; transition: all 0.15s;
}
.nc-tab:hover { color: var(--text); background: var(--surface-2); }
.nc-tab.active { color: var(--quest-navy); border-bottom-color: var(--quest-navy); font-weight: 600; }
.nc-list { flex: 1; overflow-y: auto; }

/* 通知アイテム */
.notif-empty { padding: 48px 16px; text-align: center; color: var(--text-muted); }
.notif-empty i { font-size: 28px; margin-bottom: 10px; display: block; opacity: 0.4; }
.notif-empty p { font-size: 13px; margin: 0; }
.nc-item {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px;
  border-bottom: 1px solid var(--surface-3); cursor: pointer; transition: background .1s;
  position: relative;
}
.nc-item:hover { background: var(--surface-2); }
.nc-item.unread { background: #f0f3fc; }
.nc-item.unread.nc-prio-urgent { background: #fff1f2; }
.nc-item.unread.nc-prio-warning { background: #fffbeb; }
.nc-icon {
  width: 32px; height: 32px; border-radius: 50%; background: var(--surface-3);
  display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0;
}
.nc-icon-overdue { background: #fee2e2; color: #dc2626; }
.nc-icon-due_today { background: #fef3c7; color: #d97706; }
.nc-icon-due_tomorrow { background: #fff7ed; color: #ea580c; }
.nc-icon-assignee_added, .nc-icon-assigned { background: #e4e9f7; color: var(--quest-navy); }
.nc-icon-mention { background: #d1fae5; color: #059669; }
.nc-icon-comment { background: #ede9fe; color: #7c3aed; }
.nc-icon-completed { background: #dcfce7; color: #16a34a; }
.nc-item-body { flex: 1; min-width: 0; }
.nc-message { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.notif-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.notif-meta-project, .notif-meta-task { font-size: 11px; color: var(--text-muted); display: inline-flex; align-items: center; gap: 3px; }
.nc-time { font-size: 11px; color: var(--text-muted); margin-top: 4px; }
.nc-unread-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--quest-navy); flex-shrink: 0; margin-top: 6px; }
.nc-prio-urgent .nc-unread-dot { background: #dc2626; }
.nc-prio-warning .nc-unread-dot { background: #d97706; }

/* 通知右クリックメニュー */
.notif-ctx-menu {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: var(--shadow-lg); overflow: hidden; min-width: 140px;
}
.notif-ctx-item {
  padding: 8px 14px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.notif-ctx-item:hover { background: var(--surface-2); }

/* プロジェクトステータスバッジ（タスクステータスと名前空間を分離） */
.proj-status-badge { font-size: 10.5px; padding: 2px 8px; border-radius: 10px; font-weight: 600; white-space: nowrap; }
.proj-status-pending     { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.proj-status-in_progress { background: var(--accent-muted); color: var(--quest-navy); border: 1px solid #c4cfea; }
.proj-status-applying    { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.proj-status-lost        { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.proj-status-open        { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.proj-status-operating   { background: var(--accent-muted); color: var(--quest-navy); border: 1px solid #c4cfea; }
.project-info-select { font-weight: 600; border: 1px solid transparent; cursor: pointer; padding: 3px 8px; border-radius: 10px; font-size: 12px; width: auto; }
select.project-info-select.proj-status-pending     { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
select.project-info-select.proj-status-in_progress { background: var(--accent-muted); color: var(--quest-navy); border-color: #c4cfea; }
select.project-info-select.proj-status-applying    { background: #fffbeb; color: #b45309; border-color: #fde68a; }
select.project-info-select.proj-status-lost        { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
select.project-info-select.proj-status-open        { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
select.project-info-select.proj-status-operating   { background: var(--accent-muted); color: var(--quest-navy); border-color: #c4cfea; }

/* テンプレートカード */
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.template-card {
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface);
  transition: border-color var(--transition);
}
.template-card:hover { border-color: var(--border-dark); }
.template-card-top {
  height: 56px; display: flex; align-items: center; justify-content: center; position: relative; color: white; font-size: 20px;
}
.template-builtin-badge {
  position: absolute; top: 6px; left: 8px; font-size: 9px; font-weight: 700; color: white;
  background: rgba(0,0,0,0.25); padding: 2px 7px; border-radius: 8px;
}
.template-card-body { padding: 14px; }
.template-card-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.template-card-title:hover { color: var(--accent-dark); }
.template-card-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; line-height: 1.5; }
.template-card-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.template-stat-chip {
  font-size: 11px; padding: 2px 8px; border-radius: 8px; background: var(--surface-3); color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 4px;
}
.template-card-actions { display: flex; gap: 6px; }

/* プロジェクトノート */
.project-notes-wrap { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 8px; height: 100%; }
.project-notes-textarea {
  flex: 1; min-height: 70vh; font-size: 14px; line-height: 1.8; resize: vertical;
  font-family: inherit; padding: 18px;
}
.project-notes-save-status { font-size: 11px; color: var(--text-muted); height: 14px; text-align: right; }

/* ヘッダーアバタークリッカブル */
.header-avatar {
  cursor: pointer;
  transition: opacity 0.15s;
  border-radius: 50%;
}
.header-avatar:hover { opacity: 0.75; }

/* ======= タブバー ======= */
.tab-bar {
  display: flex; background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
.tab-btn {
  padding: 6px 14px; font-size: 12.5px; font-weight: 500;
  color: rgba(255,255,255,0.65); border: none;
  cursor: pointer; white-space: nowrap;
  display: flex; align-items: center; gap: 5px;
  transition: all var(--transition); background: none;
  border-radius: 20px;
}
.tab-btn:hover { color: #fff; background: rgba(255,255,255,0.1); }
.tab-btn.active { color: #1e2d5a; background: #fff; font-weight: 700; }

/* ======= コンテンツエリア ======= */
.content-area { flex: 1; overflow-y: auto; padding: 20px; }

/* ======= ページヘッダー / 汎用カード ======= */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.page-title { font-size: 15px; font-weight: 700; color: var(--text); letter-spacing: -0.2px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  transition: border-color var(--transition);
}
.card:hover { border-color: var(--border-dark); }

/* ======= プロジェクト一覧テーブル ======= */
.project-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
}
.project-table thead tr {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.project-table th {
  padding: 9px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  letter-spacing: 0.01em;
}
.project-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  font-size: 13px;
}
.project-table tbody tr:last-child td { border-bottom: none; }
.project-table tbody tr {
  cursor: pointer;
  transition: background var(--transition);
}
.project-table tbody tr:hover { background: var(--surface-2); }
.project-table .col-name { font-weight: 500; color: var(--text); }
.project-table .col-progress { min-width: 100px; }

/* ======= Asanaスタイル タスクテーブル ======= */
.task-table-container {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-bottom: 10px;
  overflow: visible;
}
.task-table-container.drag-over {
  border: 2px dashed var(--primary);
  background: var(--primary-soft, rgba(99,102,241,0.06));
}
.task-table-container.dragging { opacity: 0.4; }
.section-drag-handle {
  display: flex; align-items: center; justify-content: center;
  width: 18px; flex-shrink: 0;
  color: var(--text-muted); cursor: grab; font-size: 12px;
  margin-right: 2px; opacity: 0.5;
  transition: opacity 0.15s;
}
.task-table-header:hover .section-drag-handle { opacity: 1; }
.section-drag-handle:active { cursor: grabbing; }
.section-order-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 10px; padding: 2px 4px;
  border-radius: 4px; line-height: 1; opacity: 0.5;
  transition: opacity 0.15s, background 0.15s;
}
.task-table-header:hover .section-order-btn { opacity: 1; }
.section-order-btn:hover { background: var(--surface-3); color: var(--text); }
/* ヘッダーのみ角丸を適用（overflow:visibleに変えたため） */
.task-table-header:first-child { border-radius: var(--radius) var(--radius) 0 0; }
.task-table-container > .task-table-header:only-child { border-radius: var(--radius); }

.task-table-header {
  display: flex; align-items: center;
  padding: 9px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background var(--transition);
}
.task-table-header:hover { background: var(--surface-3); }

/* カラムヘッダー行 */
.task-col-header {
  display: flex; align-items: center;
  padding: 7px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  position: sticky; top: 0; z-index: 5;
}

.task-col-name   { flex: 1; min-width: 0; }
.task-col-assignee { width: 100px; flex-shrink: 0; text-align: center; position: relative; }
.task-col-due    { width: 140px; flex-shrink: 0; }
.task-col-prio   { width: 70px; flex-shrink: 0; }
.task-col-hours  { width: 70px; flex-shrink: 0; text-align: center; }
.task-col-status { width: 80px; flex-shrink: 0; }
.task-col-comment{ width: 46px; flex-shrink: 0; text-align: center; }

/* タスク行（Asana風） */
.task-row {
  display: flex; align-items: center;
  padding: 7px 14px; gap: 6px;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition); position: relative;
  min-height: 36px;
}
.task-row:hover { background: var(--surface-2); }
.task-row:last-child { border-bottom: none; }
.task-row.completed .task-title-text { text-decoration: line-through; color: var(--text-muted); }
.task-row.child-task  { padding-left: 36px; background: var(--surface); }
.task-row.grandchild-task { padding-left: 58px; background: var(--surface-2); }

/* チェックボックス */
.task-checkbox {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--border-dark);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0; transition: all 0.15s;
}
.task-checkbox:hover { border-color: var(--quest-navy); }
.task-checkbox.checked { background: var(--success); border-color: var(--success); }
.task-checkbox.checked::after { content: '✓'; color: white; font-size: 9px; font-weight: 700; }
.task-checkbox.locked { border-color: var(--border); background: var(--surface-3); cursor: not-allowed; }
.task-checkbox.locked::after { content: '🔒'; font-size: 8px; }

/* ツリー展開ボタン */
.task-expand-btn {
  width: 14px; height: 14px; display: flex; align-items: center;
  justify-content: center; font-size: 9px; color: var(--text-muted);
  cursor: pointer; flex-shrink: 0; transition: transform 0.2s;
  background: none; border: none; padding: 0;
}
.task-expand-btn.expanded { transform: rotate(90deg); }
.task-expand-btn.no-children { opacity: 0; pointer-events: none; }

.task-title-text {
  flex: 1; min-width: 0;
  font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--text); cursor: pointer; font-weight: 400;
}
.task-title-text:hover { color: var(--quest-navy); }

/* コメント数バッジ */
.comment-count-badge {
  font-size: 11px; color: var(--text-muted);
  display: inline-flex; align-items: center; gap: 2px;
  white-space: nowrap; justify-content: center; cursor: pointer;
  border: 1px solid var(--border); border-radius: 10px; padding: 2px 6px;
  background: transparent; transition: all var(--transition);
}
.comment-count-badge:hover { background: var(--surface-2); border-color: var(--border-dark); color: var(--text-2); }
.comment-count-badge.has-comments { color: var(--quest-navy); font-weight: 600; background: var(--accent-muted); border-color: #c4cfea; }

/* バッジ類 */
.priority-badge { font-size: 10.5px; padding: 2px 7px; border-radius: 4px; font-weight: 600; white-space: nowrap; }
.priority-urgent { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.priority-high   { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }
.priority-medium { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.priority-low    { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }

.status-badge { font-size: 10.5px; padding: 2px 8px; border-radius: 12px; font-weight: 500; white-space: nowrap; }
.status-pending     { background: var(--surface-2); color: var(--text-muted); border: 1px solid var(--border); }
.status-in_progress { background: var(--accent-muted); color: var(--quest-navy); border: 1px solid #c4cfea; }
.status-completed   { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.status-blocked     { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }


/* タスク行: 直接編集できるコントロール */
.task-title-wrap { flex: 1; min-width: 0; display: flex; align-items: center; gap: 5px; }
.task-rename-btn {
  flex-shrink: 0; border: none; background: none; cursor: pointer; padding: 2px 4px;
  color: var(--text-muted); font-size: 10px; opacity: 0; transition: opacity .12s;
}
.task-row:hover .task-rename-btn { opacity: 1; }
.task-rename-btn:hover { color: var(--accent-dark); }
.task-inline-rename-input { font-size: 13px; padding: 3px 6px; width: 100%; }

.task-subtask-add-btn {
  flex-shrink: 0; border: none; background: none; cursor: pointer; padding: 2px 4px;
  color: var(--text-muted); font-size: 10px; opacity: 0; transition: opacity .12s;
}
.task-row:hover .task-subtask-add-btn { opacity: 1; }
.task-subtask-add-btn:hover { color: var(--accent-dark); }

.subtask-quickadd-row { background: var(--surface-2); }
.subtask-quickadd-input { font-size: 12px; padding: 4px 8px; flex: 1; }

/* タスク移動 */
.task-move-wrap { position: relative; flex-shrink: 0; display: flex; align-items: center; gap: 1px; }
.task-move-btn {
  border: none; background: none; cursor: pointer; padding: 2px 3px;
  color: var(--text-muted); font-size: 9px; opacity: 0; transition: opacity .12s;
}
.task-row:hover .task-move-btn { opacity: 1; }
.task-move-btn:hover { color: var(--accent-dark); }
.task-drag-handle {
  display: flex; align-items: center; justify-content: center;
  width: 14px; flex-shrink: 0;
  color: var(--text-muted); cursor: grab; font-size: 10px;
  opacity: 0; transition: opacity .12s;
}
.task-row:hover .task-drag-handle { opacity: 0.6; }
.task-drag-handle:hover { opacity: 1 !important; }
.task-drag-handle:active { cursor: grabbing; }
.task-row.drag-over-before::before, .task-row.drag-over-after::after {
  content: ''; position: absolute; left: 8px; right: 8px; height: 3px;
  background: var(--primary); border-radius: 2px; z-index: 10; pointer-events: none;
}
.task-row.drag-over-before::before { top: -2px; }
.task-row.drag-over-after::after   { bottom: -2px; }
.empty-section-drop-active { background: var(--primary-soft, rgba(99,102,241,0.08)) !important; border: 2px dashed var(--primary) !important; border-radius: var(--radius); }
.task-table-container.step-drag-over { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--primary-soft, rgba(99,102,241,0.06)); }
#task-context-menu { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,0.15); min-width: 200px; padding: 4px 0; }
.task-ctx-label { padding: 6px 12px 4px; font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.task-ctx-item { padding: 8px 14px; font-size: 13px; cursor: pointer; color: var(--text); }
.task-ctx-item:hover { background: var(--bg); }
.task-ctx-sub { font-size: 12px; color: var(--text-secondary); }
.task-row.dragging { opacity: 0.4; }
.move-popover {
  position: absolute; top: 100%; left: 0; background: white; border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 6px 18px rgba(0,0,0,0.12); padding: 6px; z-index: 30; min-width: 170px;
}
.move-popover-item {
  display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 6px;
  cursor: pointer; font-size: 12px; white-space: nowrap;
}
.move-popover-item:hover { background: var(--surface-2); }
.move-popover-divider { height: 1px; background: var(--border); margin: 4px 0; }
.move-popover-label { font-size: 10px; color: var(--text-muted); padding: 2px 8px 4px; }

/* 一括選択 */
.bulk-select-checkbox { flex-shrink: 0; width: 14px; height: 14px; cursor: pointer; }
.bulk-action-bar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 8px;
  background: var(--accent-muted); border: 1px solid var(--accent-dark); border-radius: 8px;
  font-size: 13px; flex-wrap: wrap;
}
.bulk-action-count { font-weight: 700; color: var(--accent-dark); white-space: nowrap; }
.bulk-action-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.bulk-action-btn { white-space: nowrap; }
.bulk-action-esc { font-size: 11px; color: var(--text-muted); white-space: nowrap; margin-left: auto; }
.bulk-action-clear { color: var(--text-muted); }

/* 一括編集 担当者モーダル */
.bulk-assignee-modal-body { flex: 1; overflow: hidden; display: flex; flex-direction: column; gap: 10px; padding: 16px 20px; }
.bulk-assignee-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.bulk-assignee-search-wrap {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
}
.bulk-assignee-search { flex: 1; border: none; outline: none; background: transparent; font-size: 13px; color: var(--text); }
.bulk-assignee-list {
  flex: 1; overflow-y: auto; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); min-height: 0;
}
.bulk-assignee-section-label { font-size: 11px; font-weight: 600; color: var(--text-muted); padding: 8px 12px 4px; text-transform: uppercase; letter-spacing: 0.05em; }
.bulk-assignee-divider { border-bottom: 1px solid var(--border); margin: 4px 0; }
.bulk-assignee-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; transition: background 0.1s;
}
.bulk-assignee-row:hover { background: var(--surface-2); }
.bulk-assignee-row.selected { background: var(--accent-muted); }
.bulk-assignee-avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0; }
.bulk-assignee-name { flex: 1; font-size: 13px; color: var(--text); }
.bulk-assignee-check { font-size: 13px; color: var(--accent-dark); font-weight: 700; width: 16px; text-align: center; }
.bulk-assignee-mode { display: flex; flex-direction: column; gap: 6px; }
.bulk-mode-label { display: flex; align-items: baseline; gap: 8px; font-size: 13px; color: var(--text); cursor: pointer; }
.bulk-mode-label input[type="radio"] { flex-shrink: 0; }
.bulk-mode-desc { font-size: 11px; color: var(--text-muted); }
#bulk-apply-btn:disabled { opacity: 0.4; cursor: not-allowed; pointer-events: none; }

select.status-select, select.priority-select {
  border: 1px solid transparent; cursor: pointer; font-family: inherit; appearance: none;
  -webkit-appearance: none; text-align: center; width: 100%;
  border-radius: 4px; font-weight: 600;
}
select.priority-select { font-size: 10.5px; font-weight: 600; padding: 2px 4px; border-radius: 4px; }
.priority-select.priority-urgent { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.priority-select.priority-high   { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.priority-select.priority-medium { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.priority-select.priority-low    { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }

.due-date-input {
  font-size: 11px; border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 4px; width: 100%; box-sizing: border-box;
  background: white; cursor: pointer; color: var(--text);
}
.due-date-input.due-date-overdue { border-color: var(--danger); color: var(--danger); }
.due-date-input.due-date-today   { border-color: var(--warning); color: var(--warning); }

.hours-input {
  width: 52px; font-size: 11px; border: 1px solid var(--border); border-radius: 6px;
  padding: 2px 4px; text-align: center;
}

/* 担当者ポップオーバー */
.assignee-popover {
  position: absolute; top: calc(100% + 4px); left: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 4px; z-index: 400;
  min-width: 200px; max-height: 240px; overflow-y: auto;
}
.assignee-popover-item {
  display: flex; align-items: center; gap: 7px; padding: 6px 8px; border-radius: 6px;
  cursor: pointer; font-size: 12px; white-space: nowrap;
}
.assignee-popover-item:hover { background: var(--surface-2); }
.assignee-popover-item.selected { background: var(--accent-muted); }
.assignee-popover-section-label {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  padding: 4px 8px 2px; text-transform: uppercase; letter-spacing: 0.04em;
}

.avatar {
  width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: white; flex-shrink: 0;
  cursor: pointer; transition: opacity 0.15s;
}
.avatar:hover { opacity: 0.8; }
.avatar-lg { width: 32px; height: 32px; font-size: 13px; }
.avatar-sm { width: 18px; height: 18px; font-size: 9px; }

.due-date-badge { font-size: 11px; white-space: nowrap; padding: 1px 5px; border-radius: 4px; }
.due-date-overdue  { color: var(--danger); background: #fee2e2; }
.due-date-today    { color: var(--warning); background: #fef3c7; }
.due-date-upcoming { color: var(--text-muted); }

.restricted-badge { font-size: 10px; color: var(--danger); }

/* ======= ボタン ======= */
.btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 14px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; cursor: pointer;
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition), color var(--transition), box-shadow var(--transition);
  white-space: nowrap; text-decoration: none; line-height: 1.5;
  font-family: inherit; letter-spacing: -0.01em;
}
.btn-primary { background: var(--quest-navy); color: white; border-color: var(--quest-navy); }
.btn-primary:hover { background: var(--quest-navy-dark); border-color: var(--quest-navy-dark); box-shadow: 0 2px 8px rgba(26,45,90,0.22); }
.btn-secondary { background: var(--surface); color: var(--text-2); border: 1px solid var(--border-dark); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--text-muted); }
.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: #fdf1f1; color: var(--danger); border: 1px solid #f2c4c4; }
.btn-danger:hover { background: #fde2e2; }
.btn-sm  { padding: 4px 10px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-xs  { padding: 2px 7px; font-size: 11px; border-radius: 5px; }
.btn-icon{ padding: 5px 6px; }
.btn-success { background: #edfaf3; color: #0b6b42; border: 1px solid #a7e6c8; }
.btn-success:hover { background: #d8f4e8; }

/* ======= モーダル ======= */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(13,17,23,0.65);
  display: none; align-items: center; justify-content: center;
  z-index: 500; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal, .modal-dialog {
  background: var(--surface); border-radius: var(--radius-lg);
  width: 100%; max-width: 540px; max-height: 90vh;
  overflow-y: auto; box-shadow: 0 20px 60px rgba(13,17,23,0.14), 0 2px 8px rgba(13,17,23,0.06);
  animation: modalIn 0.18s ease;
  border: 1px solid var(--border);
  opacity: 1;
}
.modal-lg { max-width: 720px; }
.modal-xl { max-width: 860px; }
@keyframes modalIn { from{opacity:0;transform:translateY(10px)} to{opacity:1;transform:none} }
.modal-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; background: var(--surface); z-index: 10;
}
.modal-header h2, .modal-header h3 { font-size: 14px; font-weight: 700; color: var(--text); }
.modal-close {
  background: transparent; border: none; font-size: 14px; cursor: pointer;
  color: var(--text-muted); padding: 4px 6px; border-radius: var(--radius-sm);
  transition: all var(--transition); line-height: 1;
}
.modal-close:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 18px 20px; }
.modal-footer {
  padding: 12px 20px; border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 6px;
  position: sticky; bottom: 0; background: var(--surface);
}

/* ======= AppDrawer v2.0 ======= */
/* 思考を止めないUI: Drawerは閉じるのではなく一時収納する */

/* ── Drawer本体 ── */
#form-drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: 480px; max-width: 100vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 24px rgba(0,0,0,0.08);
  z-index: 350;
  display: flex; flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
#form-drawer.open      { transform: translateX(0); }
/* 最小化: Drawer本体を完全に画面外へ追い出す（メイン画面は全幅） */
#form-drawer.minimized { transform: translateX(100%); pointer-events: none; }
#form-drawer-inner { display: flex; flex-direction: column; height: 100%; }

/* ── 収納バー (fd-shelf) ──
   Drawerが最小化された時だけ表示される右端の細いバー
   将来の複数Drawer対応: 縦に積み上げる構造 */
#fd-shelf {
  position: fixed; right: 0; top: 50%; bottom: 0;
  transform: translateY(-50%);
  display: none;            /* JS側で表示制御 */
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  z-index: 360;
  pointer-events: auto;
  padding: 12px 0;
  max-height: 60vh;
}
/* ── 収納バー本体 ── */
.fd-shelf-bar {
  width: 28px; height: 56px;
  background: var(--quest-navy); color: #fff;
  border-radius: 8px 0 0 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: -2px 2px 12px rgba(26,45,90,0.22);
  transition: width 0.15s, background 0.12s;
  position: relative; flex-shrink: 0;
}
.fd-shelf-bar:hover { width: 34px; background: var(--quest-navy-mid); }
.fd-shelf-bar > i { font-size: 11px; }

/* Pinされた収納バー（ピン留め）: 色を変えて区別 */
.fd-shelf-pinned { background: var(--success-dark, #059669); }
.fd-shelf-pinned:hover { background: var(--success, #10b981); }

/* 未保存インジケーター */
.fd-shelf-dot {
  position: absolute; top: 7px; right: 5px;
  width: 6px; height: 6px;
  background: #fbbf24; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.2);
}
/* ピン留めインジケーター */
.fd-shelf-pin-icon {
  position: absolute; bottom: 7px; right: 7px;
  font-size: 7px !important; opacity: 0.7;
}

/* ── 一括収納ボタン（《） ── */
.fd-shelf-bulk {
  width: 28px; height: 36px;
  background: var(--surface-2); color: var(--text-muted);
  border: 1px solid var(--border); border-right: none;
  border-radius: 6px 0 0 6px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 11px; flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
  margin-bottom: 4px;
}
.fd-shelf-bulk:hover { background: var(--border); color: var(--text); }

/* ── ヘッダー ── */
.fd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; background: var(--surface);
}
.fd-title { font-size: 14px; font-weight: 700; color: var(--text); flex: 1; }
.fd-header-actions { display: flex; gap: 2px; }
.fd-icon-btn {
  background: transparent; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 13px; padding: 5px 7px;
  border-radius: var(--radius-sm); line-height: 1;
  transition: all var(--transition);
}
.fd-icon-btn:hover { background: var(--surface-2); color: var(--text); }
/* Pin ボタン アクティブ状態 */
.fd-pin-active {
  color: var(--quest-navy) !important;
  background: var(--accent-muted) !important;
}

/* ── ボディ・フッター ── */
.fd-body {
  flex: 1; overflow-y: auto;
  padding: 20px 22px;
  display: flex; flex-direction: column; gap: 16px;
}
.fd-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--border);
  flex-shrink: 0; background: var(--surface);
}
#fd-submit-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── フォームフィールド（インライン編集スタイル） ── */
.fd-field-group { display: flex; flex-direction: column; gap: 4px; }
.fd-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.fd-required { color: var(--danger); }
.fd-input {
  width: 100%; font-size: 13px; color: var(--text);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  padding: 7px 9px;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}
.fd-input:hover  { border-color: var(--border); background: var(--surface-2); }
.fd-input:focus  { border-color: var(--quest-navy); background: #fff; box-shadow: 0 0 0 3px rgba(26,45,90,0.08); }
.fd-input::placeholder { color: var(--text-muted); opacity: 0.6; }
textarea.fd-input { resize: vertical; min-height: 80px; line-height: 1.6; }
select.fd-input   { cursor: pointer; }
.fd-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.fd-check-label {
  display: flex; align-items: center; gap: 7px;
  font-size: 13px; cursor: pointer; color: var(--text-2);
}

@media (max-width: 640px) {
  #form-drawer { width: 100%; border-left: none; }
  .fd-grid-2 { grid-template-columns: 1fr; }
  #fd-shelf { top: auto; bottom: 100px; transform: none; }
}

/* ======= フォーム ======= */
.form-group { margin-bottom: 14px; }
.form-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 5px; display: block;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.form-input {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text); background: var(--surface);
  font-family: inherit; transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-input:focus {
  border-color: var(--quest-navy);
  box-shadow: 0 0 0 3px rgba(26,45,90,0.08);
}
.form-input::placeholder { color: var(--border-dark); }
select.form-input { cursor: pointer; }
textarea.form-input { min-height: 72px; resize: vertical; line-height: 1.6; }

/* 検索・フィルタバー */
.search-filter-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 18px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.search-input-wrap { position: relative; min-width: 220px; flex: 1; max-width: 360px; }
.search-input-wrap i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 12px; }
.search-input-wrap input { padding-left: 30px; }
.search-filter-bar select.form-input { width: auto; min-width: 110px; padding: 7px 10px; font-size: 12px; }
.search-filter-bar .filter-clear-btn { font-size: 12px; color: var(--text-muted); cursor: pointer; padding: 4px 8px; }
.search-filter-bar .filter-clear-btn:hover { color: var(--text); }

/* プロジェクト情報パネル */
.project-info-panel {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px;
  padding: 14px 18px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.project-info-label { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.project-info-value {
  font-size: 13px; color: var(--text); cursor: pointer; padding: 3px 6px; margin: -3px -6px;
  border-radius: 5px; min-height: 18px; transition: background .12s;
}
.project-info-value:hover { background: var(--surface-2); }
.project-info-empty { color: var(--border-dark); }
.project-info-edit-input { font-size: 13px; padding: 4px 6px; }

/* インライン編集フィールド */
.inline-edit-field {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 8px; border-radius: 6px; cursor: pointer;
  transition: background 0.12s; min-height: 32px;
}
.inline-edit-field:hover { background: var(--surface-2); }
.inline-edit-field select,
.inline-edit-field input[type="date"] {
  border: 1px solid var(--border-dark); border-radius: 5px;
  padding: 4px 7px; font-size: 12px; background: white;
  font-family: inherit; cursor: pointer;
}

/* マルチセレクト担当者 */
.assignee-multi {
  display: flex; flex-wrap: wrap; gap: 6px;
  border: 1px solid var(--border); border-radius: 7px;
  padding: 6px 10px; min-height: 40px; cursor: pointer;
  background: white; transition: border-color 0.12s;
}
.assignee-multi:focus-within { border-color: var(--quest-navy); box-shadow: 0 0 0 3px rgba(26,45,90,0.08); }
/* ── 担当者 Chip (v2.0: アバター+名前+削除) ── */
.assignee-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 4px; }
.assignee-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-muted);
  border: 1px solid rgba(26,45,90,0.18);
  border-radius: 20px; padding: 3px 8px 3px 4px;
  font-size: 12px; color: var(--text); white-space: nowrap;
}
.assignee-chip-avatar {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.assignee-chip-name { max-width: 90px; overflow: hidden; text-overflow: ellipsis; }
.assignee-chip-remove {
  cursor: pointer; color: var(--text-muted); font-size: 11px; line-height: 1; flex-shrink: 0;
  transition: color 0.1s;
}
.assignee-chip-remove:hover { color: var(--danger); }

/* Member Selector v3.1 */
.assignee-multi-wrap { position: relative; }
.assignee-add-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--text-muted); cursor: pointer;
  padding: 2px 6px; border-radius: 5px;
}
.assignee-add-btn:hover { background: var(--surface-2); color: var(--text); }
.assignee-dropdown {
  position: absolute; z-index: 500; top: calc(100% + 4px); left: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  width: 260px; max-height: 340px; overflow: hidden;
  display: flex; flex-direction: column;
}
.assignee-search-wrap {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 10px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.assignee-search-icon { color: var(--text-muted); font-size: 12px; }
.assignee-search-input {
  border: none; outline: none; font-size: 13px; flex: 1;
  background: transparent; color: var(--text);
}
/* オプションリストのみスクロール（検索・ヘッダーは固定） */
.assignee-option-list {
  overflow-y: auto; flex: 1; padding: 4px 0;
  min-height: 80px; max-height: 200px;
}
.assignee-section-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  padding: 8px 12px 4px; letter-spacing: 0.05em; text-transform: uppercase;
}
.assignee-option {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; cursor: pointer; font-size: 13px;
  transition: background 0.08s;
}
.assignee-option:hover { background: var(--surface-2); }
.assignee-option.selected { background: var(--accent-muted); }
.assignee-opt-avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.assignee-opt-name { flex: 1; }
.assignee-opt-check { color: var(--accent-dark); font-weight: 700; font-size: 12px; }
/* ドロップダウン共通フッター */
.assignee-dropdown-footer {
  display: flex; gap: 6px; padding: 8px 10px;
  border-top: 1px solid var(--border); background: var(--surface-2); flex-shrink: 0;
}

/* セクション名インライン編集 */
.section-name-text {
  cursor: pointer;
  border-radius: 4px;
  padding: 1px 4px;
  transition: background 0.1s;
}
.section-name-text:hover {
  background: var(--surface-2);
}
.section-name-input {
  font-size: 13px; font-weight: 600; color: var(--text);
  background: var(--surface); border: 1.5px solid var(--accent-dark);
  border-radius: 5px; padding: 2px 7px; outline: none;
  width: 160px; max-width: 240px;
  box-shadow: 0 0 0 3px rgba(26,45,90,0.08);
}

/* @メンション入力 */
.mention-suggestion-list {
  position: absolute; background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  z-index: 800; max-height: 160px; overflow-y: auto;
  min-width: 180px;
}
.mention-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 11px; cursor: pointer; font-size: 12px;
  transition: background 0.08s;
}
.mention-item:hover, .mention-item.active { background: var(--accent-muted); }

/* ======= Comment Platform v2.0 ======= */
.cm-input-wrap {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
  background: var(--surface); margin-top: 10px;
}
.cm-textarea {
  width: 100%; min-height: 64px; padding: 10px 12px;
  border: none; outline: none; resize: vertical;
  font-size: 13px; color: var(--text); background: transparent;
  font-family: inherit; line-height: 1.5;
}
.cm-input-footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; border-top: 1px solid var(--border);
  background: var(--surface-2);
}
.cm-empty { font-size: 12px; color: var(--text-muted); padding: 6px 0; }
.cm-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--surface-3); }
.cm-item:last-child { border-bottom: none; }
.cm-deleted { opacity: 0.6; }
.cm-deleted-msg { font-size: 12px; color: var(--text-muted); font-style: italic; padding: 6px 0; }
.cm-avatar {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff;
}
.cm-body { flex: 1; min-width: 0; }
.cm-header { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.cm-author { font-size: 12px; font-weight: 600; color: var(--text); }
.cm-time { font-size: 11px; color: var(--text-muted); }
.cm-edited { font-size: 10px; color: var(--text-muted); }
.cm-menu-btn {
  margin-left: auto; cursor: pointer; padding: 2px 6px; border-radius: 4px;
  font-size: 11px; color: var(--text-muted); opacity: 0;
  transition: opacity 0.1s;
}
.cm-item:hover .cm-menu-btn { opacity: 1; }
.cm-menu-btn:hover { background: var(--surface-2); color: var(--text); }
.cm-content { font-size: 13px; color: var(--text); line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.cm-mention { color: var(--accent-dark); font-weight: 600; }
.cm-reactions { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 6px; }
.cm-reaction {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 8px; border-radius: 12px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  cursor: pointer; transition: all 0.1s;
}
.cm-reaction:hover { background: var(--accent-muted); border-color: var(--accent-dark); }
.cm-reaction.active { background: var(--accent-muted); border-color: var(--accent-dark); color: var(--accent-dark); font-weight: 600; }
.cm-reaction-add {
  cursor: pointer; padding: 2px 6px; border-radius: 12px; font-size: 14px;
  color: var(--text-muted); opacity: 0; transition: opacity 0.1s;
}
.cm-item:hover .cm-reaction-add { opacity: 1; }
.cm-reaction-add:hover { background: var(--surface-2); }
.cm-edit-textarea { width: 100%; min-height: 60px; padding: 6px 8px; border: 1px solid var(--accent-dark); border-radius: 4px; font-size: 13px; font-family: inherit; resize: vertical; }
/* コメントメニュー */
.cm-ctx-menu {
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px;
  box-shadow: var(--shadow-lg); overflow: hidden; min-width: 130px;
}
.cm-ctx-item {
  padding: 8px 14px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px;
  color: var(--text);
}
.cm-ctx-item:hover { background: var(--surface-2); }
.cm-ctx-item.danger { color: var(--danger); }
/* リアクションピッカー */
.reaction-picker {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow-lg); padding: 6px 8px; display: flex; gap: 4px;
}
.reaction-pick-btn { font-size: 18px; cursor: pointer; padding: 3px; border-radius: 4px; line-height: 1; }
.reaction-pick-btn:hover { background: var(--surface-2); }

/* ======= 詳細パネル (旧パネル: 非推奨、互換用) ======= */
#task-detail-panel {
  width: 520px; min-width: 520px;
  background: var(--surface); border-left: 1px solid var(--border);
  display: flex; flex-direction: column;
  position: fixed; right: 0; top: 0; bottom: 0;
  z-index: 300; overflow-y: auto;
  box-shadow: -2px 0 12px rgba(0,0,0,0.06);
  transform: translateX(100%); transition: transform 0.22s ease;
}
#task-detail-panel.open { transform: translateX(0); }

/* ======= Task Detail Drawer (Platform v2.0) ======= */
/* 閲覧モード標準 + クリックで個別インライン編集 */

.td-loading { padding: 48px; text-align: center; color: var(--text-muted); }

/* タスク名 */
.td-task-title {
  font-size: 16px; font-weight: 700; color: var(--text);
  line-height: 1.4; padding: 4px 6px;
  border-radius: var(--radius);
}
.td-title-input {
  font-size: 16px !important; font-weight: 700 !important;
  padding: 4px 6px !important;
}

/* ステータス・優先度バー */
.td-badges-bar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  padding: 6px 0 12px; border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.td-picker-row { display: flex; gap: 5px; flex-wrap: wrap; }
.td-pick-item { cursor: pointer; transition: opacity 0.1s; }
.td-pick-item:hover { opacity: 0.75; }

/* 部署フィルターチップ */
.dept-filter-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 500; color: var(--primary, #3b82f6);
  background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.3);
  border-radius: 20px; padding: 4px 10px; margin: 8px 0 0;
}
.dept-chip-clear {
  cursor: pointer; font-size: 10px; color: var(--text-muted);
  padding: 1px 3px; border-radius: 50%; transition: background .15s;
}
.dept-chip-clear:hover { background: rgba(0,0,0,.1); color: var(--danger, #ef4444); }

/* クリック可能パンくず */
.page-nav-breadcrumb-nav { display: flex; align-items: center; gap: 0; flex-wrap: wrap; }
.pnb-item { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.pnb-sep { font-size: 11px; color: var(--border-dark, #cbd5e1); margin: 0 5px; }
.pnb-link { text-decoration: none; color: var(--text-muted); border-radius: 4px; padding: 1px 3px; }
.pnb-link:hover { color: var(--primary, #3b82f6); background: rgba(59,130,246,.07); text-decoration: underline; }
.pnb-current { color: var(--text, inherit); font-weight: 500; }

/* ドロワーパンくず */
.td-breadcrumb { margin-bottom: 8px; }
.td-breadcrumb-link {
  display: inline-flex; align-items: center;
  font-size: 11px; color: var(--text-muted, #888);
  text-decoration: none; padding: 3px 6px;
  border-radius: 4px; border: 1px solid var(--border, #e5e7eb);
  background: var(--surface2, rgba(0,0,0,.03));
  max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color .15s, background .15s;
}
.td-breadcrumb-link:hover { color: var(--primary, #3b82f6); background: var(--surface3, rgba(59,130,246,.07)); border-color: var(--primary, #3b82f6); }

/* フィールド行 */
.td-fields { display: flex; flex-direction: column; gap: 0; }
.td-field {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--border);
}
.td-field:last-child { border-bottom: none; }
.td-field-label {
  font-size: 11px; color: var(--text-muted); font-weight: 600;
  width: 72px; flex-shrink: 0; padding-top: 5px;
  text-transform: uppercase; letter-spacing: 0.04em;
}
.td-field-value { font-size: 13px; flex: 1; min-width: 0; }
.td-readonly { color: var(--text-2); padding: 4px 0; }

/* セクション見出し */
.td-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}
.td-section:last-child { border-bottom: none; }
.td-section-heading {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-bottom: 8px;
}

/* Activity（変更履歴）*/
.activity-list { display: flex; flex-direction: column; gap: 0; }
.activity-loading { padding: 16px; display: flex; justify-content: center; }
.act-empty { font-size: 12px; color: var(--text-muted); padding: 8px 0; }
.act-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--surface-3); }
.act-item:last-child { border-bottom: none; }
.act-avatar {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.act-body { flex: 1; min-width: 0; }
.act-actor { font-size: 12px; font-weight: 600; color: var(--text); }
.act-label { font-size: 12px; color: var(--text-muted); margin-top: 1px; }
.act-detail { font-size: 11px; color: var(--text-muted); margin-top: 3px; }
.act-change-arrow { color: var(--text); font-size: 11px; }
.act-detail-user, .act-detail-sub { color: var(--accent-dark); font-weight: 500; }
.act-time { font-size: 10px; color: var(--border-dark); margin-top: 3px; }
.act-more-btn { margin-top: 8px; width: 100%; }

/* ホバー可能フィールド（クリックで編集） */
.td-hoverable {
  cursor: pointer; border-radius: var(--radius-sm);
  transition: background 0.1s;
  display: inline-block; padding: 3px 5px; margin: -3px -5px;
}
.td-hoverable:hover { background: var(--surface-2); }

/* プレースホルダー */
.td-placeholder {
  color: var(--text-muted); font-size: 12px; font-style: italic;
}

/* 説明 */
.td-desc-view, .td-desc-content {
  font-size: 13px; line-height: 1.7; color: var(--text-2);
  padding: 5px 7px; border-radius: var(--radius-sm);
  min-height: 36px; white-space: pre-wrap; word-break: break-word;
}
.td-desc-textarea { min-height: 120px; line-height: 1.7; }

/* 前提タスク */
.td-dep-item {
  display: flex; align-items: center; gap: 7px; margin-bottom: 6px;
}
.td-link {
  font-size: 12px; color: var(--accent-dark); cursor: pointer;
}
.td-link:hover { text-decoration: underline; }

/* サブタスク */
.td-subtask-item {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 8px; margin-bottom: 4px;
  border-radius: var(--radius); border: 1px solid var(--border);
  cursor: pointer; transition: background 0.1s;
}
.td-subtask-item:hover { background: var(--surface-2); }

/* アクション行 */
.td-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 担当者ドロップダウンのフッター */
.td-asgn-footer {
  display: flex; gap: 6px; padding: 8px 10px;
  border-top: 1px solid var(--border); background: var(--surface-2);
}

/* メンバー詳細パネル */
#profile-panel {
  width: 320px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  position: fixed; right: 0; top: 0; bottom: 0;
  z-index: 300; overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
}
#profile-panel.open { transform: translateX(0); }

/* アバター変更ボタン */
.profile-avatar-edit-btn {
  position: absolute;
  bottom: 0; right: 0;
  width: 24px; height: 24px;
  background: var(--accent-dark);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  border: 2px solid var(--surface);
  transition: opacity var(--transition);
}
.profile-avatar-edit-btn:hover { opacity: 0.85; }

/* アカウント画面 トグルスイッチ */
.account-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
  cursor: pointer;
}
.account-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}
.account-toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 22px;
  transition: background 0.2s;
}
.account-toggle-slider::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.account-toggle input:checked + .account-toggle-slider {
  background: var(--accent-dark);
}
.account-toggle input:checked + .account-toggle-slider::before {
  transform: translateX(18px);
}

#member-detail-panel {
  width: min(500px, 100vw);
  background: var(--surface);
  border-left: 1px solid var(--border);
  position: fixed; right: 0; top: 0; bottom: 0;
  z-index: 300; overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.07);
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
}
#member-detail-panel.open { transform: translateX(0); }

.detail-header {
  padding: 14px 18px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  position: sticky; top: 0; background: var(--surface); z-index: 10;
}
.detail-close-btn {
  background: none; border: none; font-size: 18px; cursor: pointer;
  color: var(--text-muted); padding: 3px; line-height: 1; flex-shrink: 0;
}
.detail-close-btn:hover { color: var(--text); }
.detail-section { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.detail-section h3 {
  font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.07em; color: var(--text-muted); margin-bottom: 8px;
}
.detail-field { display: flex; align-items: flex-start; margin-bottom: 9px; gap: 8px; }
.detail-field-label { font-size: 12px; color: var(--text-muted); width: 76px; flex-shrink: 0; padding-top: 4px; }
.detail-field-value { font-size: 13px; flex: 1; min-width: 0; }

/* ======= ダッシュボード ======= */
.stat-card {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 18px;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--border-dark); }
.stat-number { font-size: 28px; font-weight: 700; line-height: 1; margin-bottom: 4px; letter-spacing: -0.5px; }
.stat-label { font-size: 12px; color: var(--text-muted); }
.progress-bar { height: 5px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }

/* 個人ダッシュ統計グリッド */
.personal-dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.personal-dash-chart-card {
  background: var(--surface);
  border-radius: 10px;
  border: 1px solid var(--border);
  padding: 18px;
  display: flex;
  flex-direction: column;
}
.personal-chart-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
  max-height: 200px;
}

/* ======= カンバンボード ======= */
.kanban-board { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; min-height: 400px; }
.kanban-col {
  background: var(--surface-2); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
  transition: background var(--transition), border-color var(--transition);
}
.kanban-col.drag-over { background: var(--accent-muted); border-color: var(--accent-dark); }
.kanban-col-header {
  padding: 9px 12px; font-size: 12px; font-weight: 600;
  color: var(--text-2); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 7px;
  background: var(--surface);
}
.kanban-col-header .col-count {
  font-size: 10px; background: var(--surface-3); border-radius: 10px;
  padding: 1px 6px; color: var(--text-muted); font-weight: 500;
}
.kanban-col-body { padding: 8px; display: flex; flex-direction: column; gap: 5px; min-height: 200px; }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 11px; cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition); font-size: 12.5px;
}
.kanban-card:hover { border-color: var(--border-dark); box-shadow: var(--shadow-sm); }
.kanban-card[draggable="true"] { cursor: grab; }
.kanban-card[draggable="true"]:active { cursor: grabbing; }
.kanban-card-title { font-weight: 500; color: var(--text); margin-bottom: 6px; line-height: 1.45; font-size: 13px; }
.kanban-card-meta { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.kanban-card-project {
  font-size: 10.5px; color: var(--text-muted);
  background: var(--surface-2); padding: 2px 6px;
  border-radius: 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 130px;
  border: 1px solid var(--border);
}

/* ======= カレンダー ======= */
.calendar-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 1px; background: var(--border); border-radius: 10px; overflow: hidden; }
.calendar-day-header { background: var(--surface-2); padding: 7px; text-align: center; font-size: 11px; font-weight: 600; color: var(--text-muted); }
.calendar-day { background: var(--surface); min-height: 90px; padding: 5px; }
.calendar-day.other-month { background: var(--surface-2); }
.calendar-day.today { background: #f4f6fc; }
.calendar-day-number { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-bottom: 3px; }
.calendar-day.today .calendar-day-number {
  background: var(--quest-navy); color: white; width: 20px; height: 20px;
  border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 10px;
}
.calendar-task-bar {
  font-size: 10px; padding: 2px 4px 2px 3px; border-radius: 3px; margin-bottom: 2px;
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: white; font-weight: 500; display: flex; align-items: center; gap: 0;
}
.calendar-task-bar:hover { opacity: 0.82; }

/* カレンダー ステータスフラグ */
.cal-status-flag {
  flex-shrink: 0; width: 5px; height: 100%; min-height: 14px;
  border-radius: 2px 0 0 2px; margin-right: 4px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 8px; font-weight: 900; color: white; line-height: 1;
  cursor: default; position: relative;
}
.cal-status-flag.sf-done   { background: #22c55e; }
.cal-status-flag.sf-ok     { background: #22c55e; }
.cal-status-flag.sf-soon   { background: #eab308; }
.cal-status-flag.sf-today  { background: #f97316; }
.cal-status-flag.sf-overdue{ background: #ef4444; }
.cal-task-label { flex: 1; overflow: hidden; text-overflow: ellipsis; }

/* ======= コンフェッティ（クールカラー専用） ======= */
.confetti-piece {
  position: absolute; border-radius: 2px;
  animation: confettiFall linear forwards;
}
@keyframes confettiFall {
  0%   { transform: translateY(-10px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(800deg); opacity: 0; }
}

/* ======= ログイン ======= */
#login-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
}
.login-card {
  background: var(--surface); border-radius: var(--radius-lg); padding: 36px;
  width: 100%; max-width: 380px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  animation: fadeIn 0.22s ease;
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-circle {
  width: 52px; height: 52px;
  background: var(--quest-navy);
  border-radius: 14px; display: flex; align-items: center; justify-content: center;
  font-size: 22px; margin: 0 auto 12px;
  box-shadow: 0 4px 16px rgba(26,45,90,0.28);
}
.login-logo h1 { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 4px; letter-spacing: -0.4px; }
.login-logo p { font-size: 13px; color: var(--text-muted); }

/* ======= ユーザー管理 ======= */
.user-card {
  display: flex; align-items: center; gap: 11px; padding: 10px 14px;
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 6px;
  cursor: pointer; transition: background var(--transition), border-color var(--transition);
}
.user-card:hover { background: var(--surface-2); border-color: var(--border-dark); }
.role-badge { font-size: 11px; padding: 2px 8px; border-radius: 6px; font-weight: 600; }
.role-admin  { background: var(--accent-muted); color: var(--quest-navy); }
.role-leader { background: #fef3c7; color: var(--warning); }
.role-member { background: #d1fae5; color: var(--success); }

/* メンバー詳細パネル内 */
.detail-section-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* KPIグリッド */
.member-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.member-kpi-item {
  padding: 10px 6px;
  text-align: center;
  border-right: 1px solid var(--border);
}
.member-kpi-item:last-child { border-right: none; }
.member-kpi-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--sidebar-text);
  line-height: 1;
  margin-bottom: 4px;
}
.member-kpi-danger { color: var(--danger); }
.member-kpi-label {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.2;
}

/* 基本情報テーブル */
.member-info-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.member-info-table tr + tr td { padding-top: 6px; }
.member-info-key {
  color: var(--text-muted);
  width: 90px;
  vertical-align: top;
  padding-right: 8px;
  white-space: nowrap;
}
.member-info-val {
  color: var(--text);
  word-break: break-all;
}

/* タスク行 */
.member-task-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}
.member-task-row:last-child { border-bottom: none; }
.member-task-row:hover { background: var(--surface-2); margin: 0 -18px; padding-left: 18px; padding-right: 18px; }
.member-task-title {
  font-size: 12.5px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-task-project {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* アクションメニュー */
.member-action-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 120px;
  z-index: 500;
  display: none;
  padding: 4px;
}
.member-action-menu.open { display: block; }
.member-action-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  color: var(--text);
  transition: background var(--transition);
}
.member-action-item:hover { background: var(--surface-2); }
.member-action-item.danger { color: var(--danger); }
.member-action-item.danger:hover { background: #fee2e2; }
.member-action-item i { width: 14px; text-align: center; }

/* 生成されたパスワード表示 */
.generated-password-box {
  background: var(--surface-2);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: monospace; font-size: 14px;
  font-weight: 700; color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}

/* ======= テンプレート管理 ======= */
.template-list-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 18px;
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
  transition: box-shadow 0.12s; cursor: default;
}
.template-list-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.06); }
.template-builtin-tag {
  font-size: 10px; background: var(--surface-3); color: var(--text-muted);
  padding: 2px 7px; border-radius: 6px;
}

/* テンプレートタスクツリー行 */
.tmpl-task-row {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--border); margin-bottom: 4px;
  background: white; font-size: 12px;
}
.tmpl-task-row.level-1 { margin-left: 16px; }
.tmpl-task-row.level-2 { margin-left: 32px; background: var(--surface-2); }

/* ======= Google Drive / ファイル管理タブ ======= */
.gdrive-panel {
  background: var(--surface); border-left: 1px solid var(--border);
  width: 280px; min-width: 280px; overflow-y: auto;
  display: flex; flex-direction: column;
  transition: width 0.25s ease;
}
.gdrive-panel.collapsed { width: 0; min-width: 0; overflow: hidden; }

.gdrive-toggle-btn {
  position: absolute; left: -18px; top: 50%;
  transform: translateY(-50%);
  width: 18px; height: 36px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-right: none;
  border-radius: 6px 0 0 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; cursor: pointer; color: var(--text-muted);
  transition: background 0.12s;
}
.gdrive-toggle-btn:hover { background: var(--surface-2); }

.gdrive-panel-header {
  padding: 12px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; gap: 7px; justify-content: space-between;
  flex-shrink: 0;
}
.gdrive-file-item {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 14px; border-bottom: 1px solid var(--surface-3);
  text-decoration: none; color: var(--text); font-size: 12px; transition: background 0.1s;
}
.gdrive-file-item:hover { background: var(--surface-2); }
.gdrive-input-row { display: flex; gap: 7px; padding: 10px 14px; border-bottom: 1px solid var(--border); }

/* ファイル管理タブ内のビュー */
.files-tab-content {
  flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

/* Google Calendar 連携エリア */
.gcal-section {
  padding: 14px; border-bottom: 1px solid var(--border);
}
.gcal-section h4 {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-muted); margin-bottom: 8px;
}
.gcal-status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; padding: 2px 8px; border-radius: 6px;
  font-weight: 600;
}
.gcal-connected { background: #d1fae5; color: var(--success); }
.gcal-disconnected { background: var(--surface-3); color: var(--text-muted); }

/* タスク詳細のGCal追加済みバッジ */
.gcal-added-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--success); font-weight: 600;
}
.gcal-add-btn { display: inline-flex; align-items: center; gap: 6px; }
.gcal-added-card {
  background: var(--bg-hover); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
}
.gcal-added-top {
  display: flex; align-items: center; justify-content: space-between;
}
.gcal-added-label {
  font-size: 12px; font-weight: 600; color: var(--text-2);
  display: flex; align-items: center; gap: 5px;
}
.gcal-remove-btn { font-size: 10px !important; opacity: 0.55; }
.gcal-remove-btn:hover { opacity: 1; }

/* ======= セクション 閲覧権限 ======= */
.sv-icon {
  font-size: 10px; color: var(--text-muted); margin-left: 5px;
  opacity: 0.7; flex-shrink: 0;
}
.sv-settings-btn {
  padding: 2px 6px !important; opacity: 0.55; transition: opacity 0.15s;
}
.sv-settings-btn:hover { opacity: 1; }
.sv-radio-group { display: flex; flex-direction: column; gap: 8px; }
.sv-radio-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; cursor: pointer; transition: border-color 0.15s, background 0.15s;
}
.sv-radio-item:hover { border-color: var(--primary); background: var(--bg-hover); }
.sv-radio-item.selected { border-color: var(--primary); background: rgba(99,102,241,0.06); }
.sv-radio-item input[type="radio"] { margin-top: 3px; accent-color: var(--primary); flex-shrink: 0; }
.sv-radio-content { display: flex; flex-direction: column; gap: 2px; }
.sv-radio-label { font-size: 13px; font-weight: 600; color: var(--text-1); }
.sv-radio-desc { font-size: 11px; color: var(--text-muted); }

/* ======= 空のステート ======= */
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon { font-size: 36px; margin-bottom: 12px; opacity: 0.4; }
.empty-state h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.empty-state p { font-size: 13px; }

/* ======= アニメーション ======= */
@keyframes fadeIn  { from{opacity:0;transform:translateY(3px)}  to{opacity:1;transform:none} }
@keyframes slideIn { from{opacity:0;transform:translateX(8px)} to{opacity:1;transform:none} }
@keyframes slideInRight { from{opacity:0;transform:translateX(-8px)} to{opacity:1;transform:none} }
.fade-in  { animation: fadeIn  0.18s ease; }
.slide-in { animation: slideIn 0.2s ease; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ======= トースト ======= */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 6px; }
.toast {
  background: var(--text); color: white;
  padding: 9px 14px; border-radius: var(--radius); font-size: 13px;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease, fadeOut 0.25s ease 2.7s forwards;
  display: flex; align-items: center; gap: 8px; max-width: 300px;
}
.toast.success { background: #1a3a2a; border-left: 3px solid var(--success); }
.toast.error   { background: #3a1a1a; border-left: 3px solid var(--danger); }
@keyframes fadeOut { to { opacity:0; transform: translateY(4px); } }

/* ======= ツールチップ ======= */
[data-tip] { position: relative; }
[data-tip]::before {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%); background: #0f172a; color: white;
  font-size: 11px; padding: 3px 8px; border-radius: 5px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity 0.12s; z-index: 999;
}
[data-tip]:hover::before { opacity: 1; }

/* ======= スピナー ======= */
.spinner {
  width: 26px; height: 26px; border: 2px solid var(--border);
  border-top-color: var(--accent-dark); border-radius: 50%;
  animation: spin 0.8s linear infinite; display: inline-block;
}

/* ======= 設定画面 ======= */
.settings-top-body {
  max-width: 720px;
  padding: 8px 0 32px;
}
.settings-group {
  margin-bottom: 32px;
}
.settings-group-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-text);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.settings-card-grid {
  display: flex;
  flex-direction: column;
  gap: 1px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: var(--border);
}
.settings-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.settings-card:hover {
  background: var(--surface-2);
}
.settings-card-disabled {
  cursor: default;
  opacity: 0.6;
}
.settings-card-disabled:hover {
  background: var(--surface);
}
.settings-card-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 15px;
  color: var(--accent-dark);
  flex-shrink: 0;
}
.settings-card-disabled .settings-card-icon {
  color: var(--text-muted);
}
.settings-card-body {
  flex: 1; min-width: 0;
}
.settings-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}
.settings-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}
.settings-card-arrow {
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
}
.settings-badge-wip {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
  letter-spacing: 0.02em;
}

/* パンくずナビ */
/* ページナビゲーションバー（戻るボタン + パンくず + タイトル） */
.page-nav-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  height: 44px;
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.page-back-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 7px;
  border-radius: 6px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition), color var(--transition);
}
.page-back-btn:hover {
  background: var(--hover);
  color: var(--sidebar-text);
}
.page-back-btn i {
  font-size: 11px;
  opacity: 0.8;
}
.page-nav-breadcrumb {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.page-nav-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--sidebar-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}

.settings-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  padding: 4px 0 0;
}
.settings-breadcrumb-link {
  cursor: pointer;
  color: var(--accent-dark);
  transition: opacity var(--transition);
}
.settings-breadcrumb-link:hover { opacity: 0.75; }

/* サブページボディ */
.settings-subpage-body {
  max-width: 680px;
  margin-top: 16px;
}

/* 準備中プレースホルダー */
.settings-placeholder {
  max-width: 360px;
  margin: 60px auto 0;
  text-align: center;
  padding: 40px 24px;
  border: 1px dashed var(--border-dark);
  border-radius: 12px;
  color: var(--text-muted);
}
.settings-placeholder-icon {
  font-size: 32px;
  margin-bottom: 14px;
  opacity: 0.35;
}
.settings-placeholder-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-2);
}
.settings-placeholder-desc {
  font-size: 13px;
}

/* ======= 外部連携画面 ======= */
.integ-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 680px;
}
.integ-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  padding: 18px 20px;
}
.integ-card-disabled {
  opacity: 0.65;
}
.integ-card-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 12px;
}
.integ-icon {
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2);
  border-radius: 8px;
  font-size: 18px;
  flex-shrink: 0;
}
.integ-card-title-wrap { flex: 1; min-width: 0; }
.integ-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--sidebar-text);
  margin-bottom: 3px;
}
.integ-card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}
.integ-features {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}
.integ-feature-tag {
  font-size: 11.5px;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 8px;
}
.integ-card-footer {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ステータスバッジ */
.integ-status-badge {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 20px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.integ-status-off     { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
.integ-status-pending { background: #fef9c3; color: #92400e; border-color: #fde68a; }
.integ-status-on      { background: #d1fae5; color: #065f46; border-color: #6ee7b7; }
.integ-status-error   { background: #fee2e2; color: #991b1b; border-color: #fca5a5; }
.integ-status-wip     { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }

/* ======= 情報バナー / 警告 ======= */
.info-banner {
  background: var(--accent-muted);
  border: 1px solid var(--accent);
  border-radius: 8px; padding: 10px 14px;
  font-size: 12px; color: var(--text-2);
  display: flex; align-items: flex-start; gap: 8px;
}

/* ======= セクション折りたたみ ======= */
.section-toggle { font-size: 10px; color: var(--text-muted); transition: transform 0.2s; flex-shrink: 0; }
.section-toggle.expanded { transform: rotate(90deg); }
.section-name { font-size: 13px; font-weight: 600; flex: 1; color: var(--text); }
.section-stats { font-size: 11px; color: var(--text-muted); }

.section-body { display: none; }
.section-body.expanded { display: block; }

/* ======= プロジェクト作成モーダル ======= */
.template-option-card {
  border: 2px solid var(--border);
  border-radius: 8px; padding: 10px 14px;
  cursor: pointer; transition: all 0.12s;
  font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.template-option-card:hover { border-color: var(--accent); background: var(--accent-muted); }
.template-option-card.selected { border-color: var(--accent-dark); background: var(--accent-muted); }
.template-option-check {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-dark);
  flex-shrink: 0; display: flex; align-items: center; justify-content: center;
  font-size: 9px;
}
.template-option-card.selected .template-option-check {
  background: var(--accent-dark); border-color: var(--accent-dark); color: white;
}

/* ======= 生成パスワード表示エリア ======= */
.new-member-result {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  margin-top: 14px;
}
.new-member-result h4 { font-size: 13px; font-weight: 700; margin-bottom: 10px; color: var(--text); }

/* ======= レスポンシブ ======= */
@media (max-width: 1100px) {
  .kanban-board { grid-template-columns: repeat(2,1fr); }
  .task-col-hours { display: none; }
}
@media (max-width: 900px) {
  .task-col-comment { display: none; }
  .personal-dash-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px) {
  #sidebar { display: none; }
  .content-area { padding: 10px; }
  #task-detail-panel { width: 100%; min-width: 100%; }
  #member-detail-panel { width: 100%; }
  .notification-dropdown { width: 290px; right: -8px; }
  .kanban-board { grid-template-columns: 1fr; }
  .task-col-assignee, .task-col-prio, .task-col-hours { display: none; }
}

/* タスク詳細パネル: 説明欄 */
.task-desc-textarea { min-height: 90px; font-size: 13px; line-height: 1.7; resize: vertical; }
.task-desc-save-status { font-size: 11px; color: var(--text-muted); height: 14px; margin-top: 4px; text-align: right; }

/* プロジェクト概要タブ */
.overview-section { margin-bottom: 22px; }
.overview-section-title { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.overview-assignee-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 13px; }
.overview-link-row { display: flex; align-items: center; gap: 8px; }
.overview-link-row input { flex: 1; }

.project-assignee-cell {
  position: relative;
  display: inline-flex; flex-direction: column; gap: 4px;
  padding: 8px 12px; border-radius: var(--radius-sm);
  border: 1px dashed var(--border-dark);
  min-width: 180px; cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}
.project-assignee-cell:hover { background: var(--surface-2); border-color: var(--accent-dark); }
.project-assignee-cell .project-info-empty { font-size: 12px; color: var(--text-muted); }

/* 参画部署 — プロジェクト概要内表示 */
.proj-dept-list { display: flex; flex-direction: column; gap: 4px; padding: 2px 0; }
.proj-dept-empty { padding: 6px 0; }
.proj-dept-row {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 4px; border-radius: 6px;
  font-size: 13px; color: var(--text-primary, var(--text));
}
.proj-dept-icon { font-size: 12px; color: var(--text-muted); width: 14px; text-align: center; flex-shrink: 0; }
.proj-dept-name { font-weight: 500; }

/* 参画部署 編集モーダル — チェックボックス行 */
.dept-chk-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; cursor: pointer;
  transition: background .12s; user-select: none;
}
.dept-chk-row:hover { background: var(--surface-2, rgba(255,255,255,.06)); }
.dept-chk-input {
  width: 16px; height: 16px; accent-color: var(--primary, #6366f1);
  flex-shrink: 0; cursor: pointer;
}
.dept-chk-label { font-size: 13px; flex: 1; }

/* 案件ライフサイクル バッジ */
.lifecycle-badge {
  display: inline-flex; align-items: center;
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em;
  padding: 2px 7px; border-radius: 10px;
  margin-left: 6px; vertical-align: middle;
}
.lifecycle-completed { background: #d1fae5; color: #065f46; }
.lifecycle-lost      { background: #fee2e2; color: #991b1b; }

/* 完了・ロスト案件の行は薄く表示 */
.project-row-inactive td { opacity: 0.65; }
.project-row-inactive:hover td { opacity: 1; }

/* プロジェクトロールバッジ */
.project-role-badge {
  display: inline-flex; align-items: center;
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  padding: 1px 6px; border-radius: 8px;
}
.pm-badge     { background: var(--accent-muted); color: var(--quest-navy); }
.member-badge { background: var(--surface-2); color: var(--text-muted); }

.btn-ghost { background: transparent; border: 1px solid var(--border-dark); color: var(--text-secondary); }
.btn-ghost:hover { background: var(--surface-2); }

/* =====================================================
   Dashboard v2.0
   ===================================================== */
:root {
  --db-red:    #dc2626;
  --db-yellow: #d97706;
  --db-blue:   var(--quest-navy);
  --db-green:  #059669;
}
/* Dashboard scope bar */
.db-scope-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 16px; margin-bottom: 20px;
}
.db-scope-title {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap;
}
.db-scope-options { display: flex; gap: 4px; }
.db-scope-radio {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px; cursor: pointer;
  font-size: 13px; font-weight: 500; color: var(--text-2);
  border: 1px solid var(--border); transition: all 0.12s;
  user-select: none;
}
.db-scope-radio:hover { background: var(--surface-2); }
.db-scope-radio.active {
  background: var(--accent-muted); border-color: var(--quest-navy);
  color: var(--quest-navy); font-weight: 700;
}
.db-scope-radio-dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: 2px solid var(--border-dark); flex-shrink: 0;
}
.db-scope-radio-dot.active { background: var(--quest-navy); border-color: var(--quest-navy); }
.db-scope-dept-row { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.db-scope-dept-label {
  font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap;
}
.db-scope-dept-select {
  padding: 4px 8px; font-size: 12px; height: 30px; min-width: 140px;
}

.db-cards-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.db-card-clickable { cursor: pointer; transition: box-shadow .15s, transform .1s; }
.db-card-clickable:hover { box-shadow: 0 4px 14px rgba(0,0,0,.12); transform: translateY(-1px); }
.db-card-danger  { border-top: 3px solid var(--db-red); }
.db-card-warning { border-top: 3px solid var(--db-yellow); }
.db-card-success { border-top: 3px solid var(--db-blue); }
.db-stat-red    { color: var(--db-red)    !important; }
.db-stat-yellow { color: var(--db-yellow) !important; }
.db-stat-blue   { color: var(--db-blue)   !important; }
.db-unit { font-size: 13px; font-weight: 400; margin-left: 2px; }
.db-section-title { font-size: 13px; font-weight: 600; margin-bottom: 14px; }
.db-empty { font-size: 12px; color: var(--text-muted); padding: 12px 0; }
.db-today-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.db-today-label { font-size: 13px; color: var(--text-2); }
.db-today-count { font-size: 22px; font-weight: 700; }
.db-rank-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.db-rank-row:last-child { border-bottom: none; }
.db-rank-num  { font-size: 12px; font-weight: 700; color: var(--text-muted); width: 16px; text-align: center; }
.db-rank-name { font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.db-rank-count { font-size: 16px; font-weight: 700; flex-shrink: 0; }
@media (max-width: 768px) {
  .db-cards-4 { grid-template-columns: repeat(2, 1fr); }
}

/* =====================================================
   Member Management v2.0
   ===================================================== */
.role-owner { background: #fef9c3; color: #854d0e; border: 1px solid #fde047; }

.mem-edit-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin-bottom: 12px;
}

/* 未保存確認ダイアログ */
.unsaved-confirm {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: var(--radius);
}
.unsaved-confirm-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px 28px;
  max-width: 320px;
  width: 100%;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  font-size: 14px;
}

/* modal に relative 追加（未保存確認の配置用） */
.modal { position: relative; }

/* ===== 設定ページタイトル prefix ===== */
.page-title-prefix {
  color: var(--text-muted);
  font-weight: 400;
}

/* ===== 閲覧者タグ ===== */
.viewer-tags-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.viewer-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--primary-light, rgba(99,102,241,.12));
  color: var(--primary);
  border-radius: 20px;
  padding: 3px 10px 3px 12px;
  font-size: 12px;
  font-weight: 500;
}
.viewer-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  padding: 0 0 0 2px;
}
.viewer-tag-remove:hover { color: var(--danger, #ef4444); }
.viewer-tag-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: 1px dashed var(--border);
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.viewer-tag-add:hover { border-color: var(--primary); color: var(--primary); }

/* ===== メンバーピッカーモーダル ===== */
.vp-member-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-light, var(--border));
}
.vp-member-row:last-child { border-bottom: none; }
.vp-member-row:hover { background: var(--hover-bg, rgba(0,0,0,.04)); border-radius: 4px; }
.vp-member-row input[type=checkbox] { flex-shrink: 0; }
.vp-member-name { font-size: 13px; font-weight: 500; flex: 1; }
.vp-member-dept { font-size: 11px; color: var(--text-muted); }

/* ===== Quest 公開範囲ラジオ ===== */
.tv-radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tv-radio-item {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 100px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.tv-radio-item input[type=radio] { display: none; }
.tv-radio-item.selected {
  border-color: var(--primary);
  background: var(--primary-light, rgba(99,102,241,.07));
}
.tv-radio-item:hover { border-color: var(--primary); }
.tv-radio-label { font-size: 13px; font-weight: 600; color: var(--text); }
.tv-radio-item.selected .tv-radio-label { color: var(--primary); }
.tv-radio-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.tv-radio-item.tv-radio-danger:hover { border-color: var(--danger); }
.tv-radio-item.tv-radio-danger.selected { border-color: var(--danger); background: rgba(239,68,68,.07); }
.tv-radio-item.tv-radio-danger.selected .tv-radio-label { color: var(--danger); }
.tv-radio-item.tv-radio-danger .tv-radio-label { color: var(--danger); }

/* ===== Google Drive 概要セクション ===== */
.gdrive-overview-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gdrive-overview-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.gdrive-overview-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.gdrive-overview-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ===== Quest 関連資料リンク ===== */
.td-drive-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
}
.td-drive-input {
  flex: 1;
  font-size: 12px;
  min-width: 0;
}
.td-drive-card {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.td-drive-btn {
  font-size: 12px;
  gap: 5px;
}
.td-drive-remove-btn {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  padding: 2px 5px;
}
.td-drive-remove-btn:hover { color: var(--danger, #ef4444); }

/* ===== My Quest 新UI（管理者向け）===== */
.mq-board-wrap {
  padding: 18px;
}
.mq-kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: start;
}
@media (max-width: 900px) {
  .mq-kanban-board { grid-template-columns: repeat(2, 1fr); }
}
.mq-kanban-col {
  background: var(--bg-secondary, #f8fafc);
  border-radius: 10px;
  min-height: 120px;
  border: 2px solid transparent;
  transition: border-color 0.15s;
}
.mq-kanban-col.drag-over { border-color: var(--primary, #3b82f6); }
.mq-kanban-col-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  border-bottom: 1px solid var(--border, #e2e8f0);
}
.mq-kanban-col-body {
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.mq-kanban-empty {
  padding: 16px;
  text-align: center;
  font-size: 11px;
  color: var(--text-muted);
}
.mq-kanban-card {
  background: var(--bg-content, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 7px;
  padding: 9px 11px;
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.1s;
}
.mq-kanban-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  transform: translateY(-1px);
}
.mq-kanban-card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.mq-kanban-card-project {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mq-kanban-card-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

/* My Quest リスト新UI */
.mq-list-wrap {
  padding: 18px;
}
.mq-list-table {
  --mq-col-name-w: 200px;
  --mq-col-project-w: 280px;
  --mq-col-priority-w: 90px;
  --mq-col-due-w: 130px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
}
.mq-list-header {
  display: flex;
  align-items: center;
  background: var(--bg-secondary, #f8fafc);
  border-bottom: 1px solid var(--border, #e2e8f0);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 8px;
}
.mq-list-row {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border, #e2e8f0);
  padding: 0 8px;
  min-height: 38px;
  transition: background 0.1s;
}
.mq-list-row:last-child { border-bottom: none; }
.mq-list-row:hover { background: var(--bg-hover, rgba(0,0,0,0.02)); }
.mq-quickadd-row { background: var(--bg-secondary, #f8fafc); }
.mq-list-check-col {
  width: 32px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mq-list-col {
  position: relative;
  padding: 6px 10px 6px 4px;
  font-size: 12px;
  overflow: hidden;
  flex-shrink: 0;
}
.mq-col-name     { width: var(--mq-col-name-w);     }
.mq-col-project  { width: var(--mq-col-project-w); }
.mq-col-priority { width: var(--mq-col-priority-w, 90px); flex-shrink: 0; }
.mq-col-due      { width: var(--mq-col-due-w);     }
.mq-col-resize {
  position: absolute;
  right: 0;
  top: 0;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 1;
}
.mq-col-resize:hover { background: var(--primary, #3b82f6); opacity: 0.3; }
.mq-sort-icon { font-size: 11px; color: var(--text-muted, #888); margin-left: 2px; pointer-events: none; }
.mq-sort-active { color: var(--primary, #3b82f6); }
.mq-list-col[data-sort]:hover { background: var(--surface2, rgba(0,0,0,.04)); }
.mq-name-cell {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.mq-name-cell::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  width: 28px;
  background: linear-gradient(to right, transparent, var(--bg-content, #fff));
  pointer-events: none;
}
.mq-list-row:hover .mq-name-cell::after {
  background: linear-gradient(to right, transparent, var(--bg-hover, #f8fafc));
}
.mq-name-text {
  cursor: pointer;
  color: var(--text-1);
  font-size: 12px;
}
.mq-name-text:hover { color: var(--primary, #3b82f6); }
.mq-name-text.completed-text { text-decoration: line-through; color: var(--text-muted); }
.mq-project-text {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.mq-list-empty {
  padding: 14px 16px;
  color: var(--text-muted);
  font-size: 12px;
}

/* ===== MyQuest ページ内 View切替 ===== */
.mq-view-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  background: var(--bg-content, #fff);
  flex-shrink: 0;
}
.mq-view-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.mq-view-btn:hover {
  background: var(--bg-secondary, #f8fafc);
  color: var(--text-1);
}
.mq-view-btn.active {
  background: var(--primary-light, #eff6ff);
  color: var(--primary, #3b82f6);
  border-color: var(--primary-border, #bfdbfe);
  font-weight: 600;
}

/* ===== マイページ タブ区切り ===== */
.mypage-tab-divider {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: var(--border, #e2e8f0);
  margin: 0 6px;
  flex-shrink: 0;
  align-self: center;
}
.tab-btn.tab-sub {
  font-size: 11px;
  opacity: 0.8;
}
.tab-btn.tab-sub.active {
  opacity: 1;
}

/* ======= ヘルプページ ======= */
.help-page-area {
  padding: 0 !important;
  height: 100%;
  overflow: hidden;
}
.help-page-layout {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* サイドバー */
.help-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.help-sidebar-header {
  padding: 16px 16px 10px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -0.2px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 7px;
}
.help-sidebar-search {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 4px;
}
.help-search-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.help-search-input:focus { border-color: var(--primary); }
.help-search-btn {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 5px 9px;
  font-size: 12px;
  cursor: pointer;
}
.help-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}
.help-nav-group { margin-bottom: 2px; }
.help-nav-cat {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
  border-radius: 0;
  transition: background 0.12s;
}
.help-nav-cat:hover { background: var(--surface-hover); color: var(--text); }
.help-nav-cat.open  { color: var(--primary); }
.help-nav-chevron { margin-left: auto; font-size: 9px; transition: transform 0.2s; }
.help-nav-cat.open .help-nav-chevron { transform: rotate(90deg); }
.help-nav-items { display: none; }
.help-nav-items.open { display: block; }
.help-nav-item {
  padding: 5px 14px 5px 32px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  border-left: 2px solid transparent;
  transition: all 0.12s;
}
.help-nav-item:hover  { background: var(--surface-hover); color: var(--text); }
.help-nav-item.active { color: var(--primary); border-left-color: var(--primary); background: var(--primary-light, rgba(99,102,241,0.07)); font-weight: 600; }

/* コンテンツエリア */
.help-content {
  flex: 1;
  overflow-y: auto;
  padding: 32px 40px 60px;
  max-width: 760px;
}
.help-article-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -0.3px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}
.help-article-body { font-size: 14px; line-height: 1.8; color: var(--text-secondary); }
.help-article-body h2 {
  font-size: 15px; font-weight: 700; color: var(--text);
  margin: 28px 0 10px;
  padding: 6px 12px;
  background: rgba(99,102,241,0.07);
  border-left: 3px solid #6366f1;
  border-radius: 0 6px 6px 0;
}
.help-article-body h3 { font-size: 14px; font-weight: 600; color: var(--text); margin: 18px 0 8px; }
.help-article-body p  { margin-bottom: 12px; }
.help-article-body ul { padding-left: 0; margin-bottom: 12px; list-style: none; }
.help-article-body ul li { margin-bottom: 6px; padding-left: 20px; position: relative; }
.help-article-body ul li::before { content: '▸'; position: absolute; left: 0; color: #6366f1; font-size: 12px; top: 2px; }
.help-article-body ol { padding-left: 0; margin-bottom: 12px; list-style: none; counter-reset: help-ol; }
.help-article-body ol li { margin-bottom: 8px; padding-left: 32px; position: relative; counter-increment: help-ol; }
.help-article-body ol li::before {
  content: counter(help-ol);
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  background: #6366f1; color: #fff;
  font-size: 12px; font-weight: 800;
  border-radius: 50%;
  text-align: center;
  line-height: 22px;
  box-shadow: 0 1px 3px rgba(99,102,241,0.4);
}

.help-body-lead { font-size: 15px; color: var(--text-secondary); margin-bottom: 20px !important; line-height: 1.7; }

.help-body-wip {
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 24px;
  color: var(--text-secondary);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ヘルプカードグリッド（トップ） */
.help-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-top: 4px;
}
.help-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.help-card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgba(99,102,241,0.12); }
.help-card-icon { font-size: 20px; color: var(--primary); margin-bottom: 8px; }
.help-card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.help-card-sub { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }

/* 検索結果 */
.help-search-result {
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  font-size: 13px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.12s;
}
.help-search-result:hover { border-color: var(--primary); }

/* ======= ツールチップ（? バッジ） ======= */
.help-q-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f59e0b;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  vertical-align: middle;
  margin-left: 4px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.15s;
  outline: none;
}
.help-q-badge:hover,
.help-q-badge:focus,
.help-q-badge.open { background: #d97706; }
.help-q-popup {
  display: none;
  position: absolute;
  right: 0;
  top: 22px;
  transform: none;
  background: #1a1b2e;
  color: #e8e9f5;
  font-size: 12px;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: 8px;
  width: 220px;
  z-index: 9999;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  white-space: normal;
  pointer-events: none;
}
.help-q-badge.open .help-q-popup { display: block; pointer-events: auto; }
.help-q-popup::before {
  content: '';
  position: absolute;
  right: 4px;
  bottom: 100%;
  border: 6px solid transparent;
  border-bottom-color: #1a1b2e;
}
.help-q-link {
  display: block;
  margin-top: 8px;
  color: #818cf8;
  font-size: 11px;
  cursor: pointer;
  text-decoration: none;
}
.help-q-link:hover { text-decoration: underline; }

/* ======= フローティングヘルプボタン ======= */
#help-fab {
  position: fixed;
  bottom: 82px;
  right: 24px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #f59e0b;
  color: #fff;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  z-index: 9990;
  box-shadow: 0 4px 16px rgba(245,158,11,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s;
}
/* ドロワーが開いているときはFABを非表示 */
#form-drawer.open ~ #help-fab,
#form-drawer.open ~ #create-fab,
#form-drawer.open ~ #create-fab-popup { display: none !important; }
#help-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(245,158,11,0.55);
}
#help-fab:active {
  transform: scale(0.95);
}

/* ======= ＋作成FABボタン ======= */
#create-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1e2d5a;
  color: #fff;
  border: none;
  font-size: 22px;
  cursor: pointer;
  z-index: 9990;
  box-shadow: 0 4px 16px rgba(30,45,90,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
}
#create-fab:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(30,45,90,0.55); }
#create-fab.open { background: #374b7a; transform: rotate(45deg); }
#create-fab:active { transform: scale(0.95); }

#create-fab-popup {
  position: fixed;
  bottom: 82px;
  right: 20px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.16);
  padding: 8px;
  z-index: 9991;
  min-width: 180px;
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: fabPopupIn 0.15s ease;
}
#create-fab-popup.open { display: flex; }
@keyframes fabPopupIn {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.fab-popup-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #1e2d5a;
  cursor: pointer;
  transition: background 0.12s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.fab-popup-item:hover { background: rgba(30,45,90,0.07); }
.fab-popup-item i { width: 18px; text-align: center; color: #6366f1; font-size: 13px; }

/* ヘルプ記事：構造図 */
.help-structure {
  background: var(--surface-2, var(--bg));
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.help-struct-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.help-struct-row i { color: var(--primary); width: 16px; text-align: center; }
.help-struct-row.lv1 { margin-left: 0px; }
.help-struct-row.lv2 { margin-left: 20px; }
.help-struct-row.lv3 { margin-left: 40px; }
.help-struct-row.lv4 { margin-left: 60px; }

/* ヘルプ記事：ステップバッジ */
.help-step-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #6366f1;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
  flex-shrink: 0;
  vertical-align: middle;
}

/* ヘルプ記事：テーブル */
.help-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 12px 0 16px;
}
.help-table th, .help-table td {
  text-align: left;
  padding: 8px 12px;
  border: 1px solid var(--border);
}
.help-table th {
  background: rgba(99,102,241,0.12);
  font-weight: 600;
  color: var(--text);
}
.help-table td { color: var(--text-secondary); }
.help-table tr:nth-child(even) td { background: rgba(99,102,241,0.05); }

/* ヘルプ記事：キーボードキー */
.help-article-body kbd {
  display: inline-block;
  padding: 1px 6px;
  font-size: 11px;
  font-family: monospace;
  background: var(--surface-2, var(--bg));
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  box-shadow: 0 1px 0 var(--border);
}

/* =====================================================
   メモ機能
   ===================================================== */
.memo-shell {
  display: flex;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* 左ペイン：一覧 */
.memo-pane-list {
  width: 240px;
  min-width: 240px;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.memo-pane-list-header {
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.memo-pane-search {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.memo-pane-items {
  flex: 1;
  overflow-y: auto;
}

/* メモアイテム */
.memo-list-item {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  position: relative;
  transition: background .12s;
}
.memo-list-item:hover { background: var(--bg); }
.memo-list-item.active {
  background: var(--primary-dim, #e0f2fe);
  border-left: 3px solid var(--primary, #0ea5e9);
}
.memo-list-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-right: 22px;
}
.memo-list-item-preview {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.5;
}
.memo-list-item-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}
.memo-list-item-date { font-size: 10px; color: var(--text-faint, #94a3b8); }
.memo-tag-chip {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--primary-dim, #e0f2fe);
  color: var(--primary, #0ea5e9);
  border: 1px solid var(--primary-border, #bae6fd);
  font-weight: 500;
}

/* ケバブボタン */
.memo-kebab-btn {
  position: absolute;
  top: 8px; right: 8px;
  width: 22px; height: 22px;
  border-radius: 4px;
  border: none; background: transparent; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint, #94a3b8); font-size: 14px; opacity: 0;
  transition: opacity .15s, background .12s;
}
.memo-list-item:hover .memo-kebab-btn { opacity: 1; }
.memo-kebab-btn:hover { background: var(--border); color: var(--text); }

.memo-kebab-menu {
  position: absolute;
  top: 30px; right: 8px;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 150px;
  padding: 4px 0;
}
.memo-kebab-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; cursor: pointer; font-size: 12.5px; color: var(--text);
  transition: background .1s;
}
.memo-kebab-item:hover { background: var(--bg); }
.memo-kebab-item.danger { color: #ef4444; }
.memo-kebab-item.danger:hover { background: #fef2f2; }
.memo-kebab-item i { width: 14px; text-align: center; font-size: 11px; }
.memo-kebab-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* 右ペイン：エディタ */
.memo-pane-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
}
.memo-editor-wrap {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}
.memo-editor-meta {
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 12px;
  flex-shrink: 0;
}
.memo-title-input {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  border: none; outline: none; background: transparent;
  width: 100%; font-family: inherit; margin-bottom: 3px;
}
.memo-title-input::placeholder { color: var(--text-faint, #94a3b8); }

/* 出力ボタン */
.memo-output-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--primary, #0ea5e9); color: #fff; border: none; border-radius: 8px;
  padding: 7px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer;
  box-shadow: 0 2px 6px rgba(14,165,233,.3); font-family: inherit; white-space: nowrap;
}
.memo-output-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  z-index: 100;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.12);
  min-width: 200px; padding: 4px 0;
}
.memo-output-item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer; font-size: 12.5px; color: var(--text);
  transition: background .1s;
}
.memo-output-item:hover { background: var(--bg); }
.memo-output-item i { width: 16px; text-align: center; font-size: 13px; }

/* ツールバー */
.memo-toolbar {
  display: flex; align-items: center; gap: 1px;
  padding: 5px 12px; background: var(--surface-2, var(--bg));
  border-bottom: 1px solid var(--border); flex-shrink: 0; flex-wrap: wrap;
}
.memo-tb-div {
  width: 1px; height: 18px; background: var(--border); margin: 0 4px; flex-shrink: 0;
}
.memo-tb-btn {
  width: 28px; height: 28px; border: none; background: transparent; border-radius: 5px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 12px; transition: background .12s, color .12s;
}
.memo-tb-btn:hover { background: var(--border); color: var(--text); }
.memo-tb-select {
  height: 28px; border: 1px solid var(--border); border-radius: 5px;
  background: transparent; color: var(--text); font-size: 11.5px;
  padding: 0 6px; cursor: pointer; font-family: inherit; outline: none;
}

/* エディタ本文 */
.memo-editor-body {
  flex: 1; overflow-y: auto;
  padding: 18px 24px 40px;
  font-size: 14px; line-height: 1.8; color: var(--text);
  outline: none; word-break: break-word;
}
.memo-editor-body h2 {
  font-size: 16px; font-weight: 700; margin: 18px 0 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.memo-editor-body h3 { font-size: 14px; font-weight: 700; margin: 14px 0 6px; }
.memo-editor-body h4 { font-size: 13px; font-weight: 700; margin: 12px 0 4px; }
.memo-editor-body p { margin-bottom: 8px; }
.memo-editor-body ul,
.memo-editor-body ul ul,
.memo-editor-body ul ol,
.memo-editor-body ol,
.memo-editor-body ol ul,
.memo-editor-body ol ol { margin: 4px 0 8px !important; padding-left: 0 !important; }
.memo-editor-body ul,
.memo-editor-body ul ul { list-style-type: disc !important; list-style-position: inside !important; }
.memo-editor-body ol,
.memo-editor-body ol ol { list-style-type: decimal !important; list-style-position: inside !important; }
.memo-editor-body li { margin-bottom: 3px; display: list-item !important; padding-left: 4px !important; }
.memo-editor-body li::marker { color: var(--text) !important; }
.memo-editor-body strong { font-weight: 700; }
.memo-editor-body em { font-style: italic; }
.memo-editor-body u { text-decoration: underline; }
.memo-editor-body s { text-decoration: line-through; }
.memo-editor-body[contenteditable]:empty::before {
  content: '殴り書きスタート... （自動保存されます）';
  color: var(--text-faint, #94a3b8); pointer-events: none;
}

/* ゴミ箱トースト */
.memo-toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; border-radius: 10px;
  padding: 10px 20px; font-size: 12.5px; display: flex; align-items: center; gap: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.25); z-index: 200; white-space: nowrap;
  animation: toastSlideUp .2s ease;
}
.memo-toast-undo {
  color: var(--primary, #0ea5e9); font-weight: 700; cursor: pointer;
  text-decoration: underline; background: none; border: none; font-family: inherit; font-size: 12.5px;
}
@keyframes toastSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
