/* ============================================================
   product-hub main stylesheet
   GOGEN Inc. internal product dashboard
   ============================================================ */

/* View As バナー。main.css を読み込まない roulette.html からも
   直接 <link> できるよう別ファイルに切り出してある（@import は先頭必須） */
@import url('view-as.css');

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Light mode */
  --bg:           #f4f5f7;
  --bg-card:      #ffffff;
  --bg-card-alt:  #f9f9fb;
  --bg-hover:     #f0f0f5;
  --border:       rgba(0,0,0,0.10);
  --border-hover: rgba(0,0,0,0.20);
  --text:         #111827;
  --text-muted:   #6b7280;
  --text-dim:     #9ca3af;
  --accent:       #7c3aed;
  --accent-light: #6d28d9;
  --accent-glow:  rgba(124, 58, 237, 0.12);
  --offense:      #ea6c0a;
  --offense-bg:   rgba(234, 108, 10, 0.08);
  --defense:      #2563eb;
  --defense-bg:   rgba(37, 99, 235, 0.08);
  --success:      #16a34a;
  --danger:       #dc2626;
  --warning:      #d97706;
  --radius:       8px;
  --radius-sm:    4px;
  --radius-lg:    12px;
  --shadow:       0 1px 4px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg:    0 4px 24px rgba(0,0,0,0.12);
  --font:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-jp:      'Noto Sans JP', 'Hiragino Sans', 'Yu Gothic UI', sans-serif;
  --transition:   160ms ease;

  /* Header stays dark */
  --header-bg:    #0a0a0a;
  --header-text:  #f0f0f0;
  --header-muted: #888888;
  --header-border: rgba(255,255,255,0.08);
}

html {
  font-size: 14px;
  line-height: 1.5;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-jp), var(--font);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

button {
  cursor: pointer;
  font-family: inherit;
  font-size: inherit;
}

/* ============================================================
   PAGE LOADER OVERLAY
   ============================================================ */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  background: rgba(244, 245, 247, 0.96);
  opacity: 0;
  animation: loader-fadein 200ms ease forwards;
  transition: opacity 300ms ease;
}

@keyframes loader-fadein {
  to { opacity: 1; }
}

.page-loader-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.page-loader-msg {
  font-size: 11px;
  font-weight: 600;
  color: #566873;
  letter-spacing: 0.08em;
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic', sans-serif;
}

/* ============================================================
   LAYOUT
   ============================================================ */

.page-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 52px;
  color: var(--header-text);
}

.page-header .logo {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.page-header .header-logo {
  height: 28px;
  width: auto;
  display: block;
}

.page-header .header-divider {
  width: 1px;
  height: 20px;
  background: rgba(255,255,255,0.2);
  flex-shrink: 0;
}

/* VIEW AS バナーのスタイルは css/view-as.css（先頭で @import） */

.page-header .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--header-muted);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.page-header .spacer {
  flex: 1;
}

/* Portal-style nav tabs */
.page-header .portal-nav {
  display: flex;
  align-items: stretch;
  height: 52px;
  gap: 0;
  margin-left: 8px;
}

.page-header .portal-nav a {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--header-muted);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  position: relative;
  white-space: nowrap;
  opacity: 0.6;
}

.page-header .portal-nav a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
}

.page-header .portal-nav a:hover {
  opacity: 0.85;
  color: var(--header-text);
}

/* 全体非表示中のタブ（管理者にだけ 🚧 付きで見せる。リンクではないのでクリック不可） */
.page-header .portal-nav .nav-hidden-tab {
  display: flex;
  align-items: center;
  padding: 0 16px;
  color: var(--header-muted);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  opacity: 0.3;
  cursor: default;
  user-select: none;
}

.page-header .portal-nav a.active {
  color: var(--header-text);
  opacity: 1;
}

.page-header .portal-nav a.active::after {
  background: linear-gradient(to right, #60c8f0, #b48ee8, #f0868a, #f0a060, #f0d060, #a0d878);
}

/* ---- User menu ---- */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
  color: var(--header-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}
.user-menu-trigger:hover {
  background: rgba(255,255,255,0.14);
}

.user-avatar-sm {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,0.2);
}

.user-role-chip {
  font-size: 10px;
  font-weight: 600;
  background: rgba(124,58,237,0.35);
  color: #c4b5fd;
  padding: 1px 7px;
  border-radius: 100px;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 240px;
  background: #1c1c24;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 200;
  overflow: hidden;
}
.user-dropdown.open {
  display: block;
}

.user-dropdown-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.user-avatar-lg {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.user-dropdown-name {
  font-size: 14px;
  font-weight: 600;
  color: #f0f0f0;
}
.user-dropdown-email {
  font-size: 12px;
  color: #888899;
  margin-top: 2px;
}
.user-dropdown-role {
  font-size: 11px;
  font-weight: 600;
  color: #a78bfa;
  margin-top: 4px;
}

.user-dropdown-divider {
  height: 1px;
  background: rgba(255,255,255,0.08);
  margin: 0 12px;
}

.user-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: #e0e0e0;
  font-size: 13px;
  text-decoration: none;
  cursor: pointer;
  transition: background var(--transition);
}
.user-dropdown-btn:hover {
  background: rgba(255,255,255,0.07);
  color: #fff;
}

/* ---- Notification bell ---- */
/* ヘッダーはダークスコープなので .user-menu-trigger の配色を踏襲する */
.notif-menu {
  position: relative;
}

.notif-trigger {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(255,255,255,0.07);
  color: var(--header-text);
  cursor: pointer;
  transition: background var(--transition);
}
.notif-trigger:hover {
  background: rgba(255,255,255,0.14);
}

.notif-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 100px;
  border: 2px solid var(--header-bg);
  background: var(--danger);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}
.notif-badge[hidden] {
  display: none;
}

.notif-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 360px;
  max-height: 420px;
  overflow-y: auto;
  background: #1c1c24;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  z-index: 200;
}
.notif-dropdown.open {
  display: block;
}

.notif-head {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1c1c24;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  font-size: 13px;
  font-weight: 600;
  color: #f0f0f0;
}
.notif-head a {
  font-size: 12px;
  font-weight: 500;
  color: #a78bfa;
  text-decoration: none;
}
.notif-head a:hover {
  text-decoration: underline;
}

.notif-empty {
  padding: 28px 16px;
  text-align: center;
  font-size: 13px;
  color: #888899;
}

.notif-item {
  display: block;
  position: relative;
  padding: 12px 16px 12px 19px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  color: #b8b8c0;
  text-decoration: none;
  transition: background var(--transition);
}
.notif-item:last-child {
  border-bottom: none;
}
.notif-item:hover {
  background: rgba(255,255,255,0.05);
}
.notif-item.unread {
  background: rgba(124,58,237,0.08);
  color: #e0e0e0;
}
.notif-item.unread::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}

.notif-item-title {
  font-size: 13px;
  font-weight: 600;
  color: #f0f0f0;
}
.notif-item.unread .notif-item-title {
  color: #fff;
}
.notif-item-body {
  margin-top: 3px;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}
.notif-item-time {
  margin-top: 4px;
  font-size: 11px;
  color: #888899;
}

/* ============================================================
   TOOLBAR
   ============================================================ */

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  flex-wrap: wrap;
}

.tab-group {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}

/* スプリント範囲セレクタ（ボードのツールバー） */
.sprint-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sprint-range-sep {
  color: var(--text-muted);
  font-size: 12px;
}

.tab-btn {
  padding: 5px 14px;
  border-radius: calc(var(--radius) - 2px);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: all var(--transition);
}

.tab-btn:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.tab-btn.active {
  background: var(--accent);
  color: #fff;
}

.tab-btn.tab-offense.active {
  background: var(--offense);
  color: #fff;
}

.tab-btn.tab-defense.active {
  background: var(--defense);
  color: #fff;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  line-height: 1.4;
}

/* Priority */
.badge-priority-urgent  { background: #fee2e2; color: #b91c1c; }
.badge-priority-high    { background: #ffedd5; color: #c2410c; }
.badge-priority-medium  { background: #fef9c3; color: #a16207; }
.badge-priority-low     { background: #f3f4f6; color: #6b7280; }

/* Status */
.badge-status-qa        { background: #f3e8ff; color: #7e22ce; }
.badge-status-dev       { background: #dcfce7; color: #15803d; }
.badge-status-blocked   { background: #fee2e2; color: #b91c1c; }
.badge-status-done      { background: #dbeafe; color: #1d4ed8; }
.badge-status-notstarted{ background: #f3f4f6; color: #6b7280; }

/* Side */
.badge-offense { background: #ffedd5; color: #c2410c; }
.badge-defense { background: #dbeafe; color: #1d4ed8; }
.badge-org     { background: #e5e7eb; color: #4b5563; }

/* プロダクト軸タグ */
.badge-product-pf      { background: rgba(124,58,237,0.15); color: #a78bfa; }
.badge-product-connect { background: rgba(20,184,166,0.15); color: #2dd4bf; }
.badge-product-common  { background: rgba(148,163,184,0.15); color: #94a3b8; }

/* Sprint header badges */
.sprint-badge-current { background: #ede9fe; color: #6d28d9; border: 1px solid #c4b5fd; }
.sprint-badge-halted  { background: #fee2e2; color: #b91c1c; border: 1px solid #fca5a5; }
.sprint-badge-done    { background: #dcfce7; color: #15803d; border: 1px solid #86efac; }
.period-badge         { background: rgba(239,68,68,0.12); color: #f87171; border: 1px solid rgba(239,68,68,0.4); }

/* 期の変わり目: 該当スプリント列の左端に赤線 */
.board-table th.period-start,
.board-table td.sprint-cell.period-start {
  border-left: 3px solid rgba(239,68,68,0.75);
}

/* ============================================================
   BOARD TABLE
   ============================================================ */

.board-wrapper {
  overflow: auto;
  max-height: calc(100vh - 108px);   /* header + toolbar */
  position: relative;
}

.board-table {
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  min-width: max-content;
}

/* ---- Header row ---- */
.board-table thead th {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  padding: 0;
  white-space: nowrap;
  vertical-align: top;
}

.board-table thead th:first-child {
  left: 0;
  z-index: 60;
  width: 260px;
  min-width: 260px;
}

/* Sprint header cell */
.sprint-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 10px 12px;
  width: 360px;
  min-width: 360px;
  border-left: 1px solid var(--border);
}

.sprint-header .sprint-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.sprint-header .sprint-dates {
  font-size: 11px;
  color: var(--text-muted);
}

.sprint-header .sprint-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.sprint-header .release-link {
  font-size: 11px;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 3px;
}

/* ---- Interval sprint (S42-S43 等) ---- */
/* インターバル期間の列は淡いストライプで通常スプリントと視覚的に区別する */
.sprint-header.interval-sprint-header {
  background: repeating-linear-gradient(
    135deg,
    rgba(148, 163, 184, 0.10),
    rgba(148, 163, 184, 0.10) 6px,
    transparent 6px,
    transparent 12px
  );
}

.sprint-header.interval-sprint-header .sprint-label {
  color: var(--text-muted);
}

.board-table td.sprint-cell.interval-sprint {
  background: repeating-linear-gradient(
    135deg,
    rgba(148, 163, 184, 0.06),
    rgba(148, 163, 184, 0.06) 6px,
    transparent 6px,
    transparent 12px
  );
}

/* ---- Left column (project card) ---- */
.board-table td.project-col {
  position: sticky;
  left: 0;
  z-index: 40;  /* スクロールしてもプロジェクト列が常に最前面（ヘッダーの 60/70 よりは下） */
  width: 260px;
  min-width: 260px;
  max-width: 260px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0;
  vertical-align: top;
}

/* Section header row */
.board-table tr.section-header td {
  position: sticky;
  left: 0;
  z-index: 15;
  background: var(--bg-card-alt);
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.section-header.offense td { color: var(--offense); border-left: 3px solid var(--offense); }
.section-header.defense td { color: var(--defense); border-left: 3px solid var(--defense); }

/* 組織セクション（開発とは別軸・デフォルト折りたたみ） */
.section-header.org td {
  color: var(--text-muted);
  border-left: 3px solid var(--text-dim);
  cursor: pointer;
  user-select: none;
}

.section-header.org td:hover { background: var(--bg-hover); }

.org-section-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.org-chevron {
  display: inline-block;
  transition: transform var(--transition);
}

.org-chevron.open { transform: rotate(90deg); }

.org-count {
  font-size: 10px;
  padding: 0 6px;
  border-radius: 8px;
  background: var(--bg-hover);
  color: var(--text-muted);
}

.org-hint {
  font-size: 10px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-dim);
}

tr.org-collapsed { display: none; }

.project-row.org-row td.project-col {
  border-left: 3px solid var(--text-dim);
}

/* ---- サブプロジェクト（parent_id による階層） ---- */
/* 親行はグループの「枠」— 通常行の半分程度に薄くする
   （sticky な左列なので透過色は不透明の下地に重ねる。横スクロールで裏のセルが透けないように） */
.project-row.group-parent td.project-col {
  background:
    linear-gradient(rgba(124,58,237,0.05), rgba(124,58,237,0.05)),
    var(--bg-card);
}

.project-row.group-parent .cell-inner {
  min-height: 34px;
}

.project-row.group-parent .project-card {
  padding: 5px 12px;
}

.project-row.group-parent .project-card .card-top {
  margin-bottom: 2px;
}

.project-row.group-parent .project-card .card-title {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.project-row.sub td.project-col {
  background:
    linear-gradient(rgba(255,255,255,0.015), rgba(255,255,255,0.015)),
    var(--bg-card);
}

.project-card.sub-card {
  padding: 7px 10px 7px 20px;
}

.project-card.sub-card .card-title {
  font-size: 12px;
  font-weight: 600;
}

.sub-marker {
  color: var(--text-dim);
  font-weight: 400;
}

.sub-count {
  font-size: 10px;
  padding: 1px 7px;
  border-radius: 8px;
  background: var(--bg-hover);
  color: var(--text-muted);
  white-space: nowrap;
}

/* 完了スプリントの旗 */
.cell-done-flag {
  display: inline-block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 700;
  color: #60a5fa;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 4px;
  padding: 1px 6px;
}

/* プロジェクトカードの編集ボタン（ホバーで表示） */
.project-card { position: relative; }

.board-table td.project-col:hover .card-edit-btn { display: flex; }

/* プロジェクトモーダル: メンバー選択チップ */
.pm-members {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pm-member-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 6px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  user-select: none;
  transition: background var(--transition), border-color var(--transition);
}

.pm-member-chip:hover { background: var(--bg-hover); }

.pm-member-chip:has(input:checked) {
  background: rgba(124,58,237,0.12);
  border-color: rgba(124,58,237,0.5);
}

.pm-member-chip input { accent-color: #7c3aed; }

/* メンバーチップの主担当トグル（チェック時のみ表示） */
.pm-primary-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  margin-left: 2px;
  padding: 1px 6px;
  font-size: 10px;
  line-height: 1.4;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), color var(--transition);
}

.pm-member-chip:has(input:checked) .pm-primary-toggle { display: inline-flex; }

.pm-primary-toggle:hover {
  border-color: rgba(124,58,237,0.5);
  color: #a78bfa;
}

.pm-primary-toggle.on {
  background: #7c3aed;
  border-color: #7c3aed;
  color: #fff;
}

/* メンバーチップの参画スプリント選択（チェック時のみ表示） */
.pm-join-select {
  display: none;
  margin-left: 2px;
  padding: 1px 2px;
  max-width: 82px;
  font-size: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text-muted);
}

.pm-member-chip:has(input:checked) .pm-join-select { display: inline-block; }

/* ---- スプリントゴール行 ---- */
.goal-row .project-col {
  border-left: 3px solid #f59e0b;
}

.goal-label {
  font-size: 11px;
  font-weight: 700;
  color: #fbbf24;
  padding: 8px 12px;
  letter-spacing: 0.04em;
}

.goal-cell {
  padding: 7px 8px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  color: #fcd34d;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 30px;
}

.goal-cell.goal-empty {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 10.5px;
}

td.goal-cell-td {
  background: rgba(245,158,11,0.04);
}

td.goal-cell-td.goal-editable { cursor: pointer; }

td.goal-cell-td.goal-editable:hover {
  background: rgba(245,158,11,0.1);
}

/* ---- 調子（パワプロ風5段階・アニメGIF） ---- */
/* 16x16 のドット絵なので拡大してもにじまないように */
.cond-gif {
  image-rendering: pixelated;
  vertical-align: middle;
}

/* セル内アイコン: セル右上に固定。＋や鉛筆は左へずらして重ならないように */
.cell-condition {
  position: absolute;
  top: 4px;
  right: 4px;
  line-height: 0;
  z-index: 2;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.35));
}

.cell-inner.has-cond .cell-content { padding-right: 30px; }
.cell-inner.has-cond .cell-edit-btn { right: 30px; }

/* モーダルのピッカー */
.condition-picker {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.cond-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 52px;
  padding: 7px 8px 5px;
  font-size: 10px;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.cond-btn .cond-none {
  display: flex;
  align-items: center;
  height: 24px;
}

.cond-btn:hover { background: var(--bg-hover); }

.cond-btn.active {
  background: rgba(124,58,237,0.12);
  border-color: rgba(124,58,237,0.6);
  color: var(--text);
}

/* ツールバーの凡例 */
.cond-legend {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  color: var(--text-dim);
}

.cond-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--text-dim);
  font-size: 10px;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.cond-legend-item:hover {
  background: var(--bg-hover);
  color: var(--text-muted);
}

.cond-legend-item.active {
  background: rgba(124,58,237,0.15);
  border-color: rgba(124,58,237,0.5);
  color: var(--text);
}

/* ---- Project card ---- */
.project-card {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  border-right: 1px solid var(--border);
  cursor: default;
  transition: background var(--transition);
  min-height: 80px;
}

.project-card:hover {
  background: var(--bg-hover);
}

.project-card .card-top {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.project-card .card-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  word-break: break-all;
}

.project-card .card-goal {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.project-card .card-bottom {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.project-card .block-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  color: #f87171;
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.25);
  border-radius: 4px;
  padding: 1px 5px;
}

.project-card .done-badge {
  font-size: 10px;
  color: #60a5fa;
  background: rgba(59,130,246,0.12);
  border: 1px solid rgba(59,130,246,0.25);
  border-radius: 4px;
  padding: 1px 5px;
}

/* ---- Sprint cells ---- */
.board-table td.sprint-cell {
  width: 360px;
  min-width: 360px;
  max-width: 360px;
  border-left: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 0;
  vertical-align: top;
  background: var(--bg);
  position: relative;
  transition: background var(--transition);
}

.board-table td.sprint-cell:hover {
  background: var(--bg-hover);
}

.board-table td.sprint-cell.current-sprint {
  background: rgba(124,58,237,0.04);
}

.board-table td.sprint-cell.current-sprint:hover {
  background: rgba(124,58,237,0.08);
}

/* Cell inner */
.cell-inner {
  position: relative;
  min-height: 72px;
  display: flex;
  flex-direction: column;
}

/* Schedule spans at top of cell */
.cell-spans {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px 0 0;
}

.span-bar {
  display: flex;
  align-items: center;
  height: 16px;
  margin: 0 6px;
  padding: 0 5px;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border-radius: 8px;
  opacity: 0.92;
}

/* 前後のスプリント枠に続くスパンはセル端まで伸ばし、隣のセルのバーと視覚的につなげる */
.span-bar.span-cont-left {
  margin-left: -1px;   /* セル境界線の上まで伸ばす */
  padding-left: 6px;
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.span-bar.span-cont-right {
  margin-right: 0;
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

/* レーン合わせ用スペーサー（スパンが重ならない段の高さを確保） */
.span-spacer { height: 16px; }

.span-bar.span-approx { opacity: 0.7; }

/* 定点イベント: 期間バーではなく、スプリント内のその日の位置に置く小さな丸ピル */
.span-bar.span-point {
  align-self: flex-start;
  width: auto;
  max-width: calc(100% - 6px);
  border-radius: 999px;
  justify-content: flex-start;
  gap: 3px;
}

.span-point-date {
  flex-shrink: 0;
  font-weight: 700;
}

/* Cell content */
.cell-content {
  flex: 1;
  padding: 5px 8px 6px;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

/* やらない（対象外）: 濃く塗って「ここは何もない」と一目で分かるように
   （.board-table 付きで current-sprint の背景指定より優先させる） */
.board-table td.sprint-cell.skip-cell-td,
.board-table td.sprint-cell.current-sprint.skip-cell-td {
  background: repeating-linear-gradient(
    45deg,
    rgba(0,0,0,0.4),
    rgba(0,0,0,0.4) 8px,
    rgba(0,0,0,0.6) 8px,
    rgba(0,0,0,0.6) 16px
  );
}

.board-table td.sprint-cell.skip-cell-td:hover,
.board-table td.sprint-cell.current-sprint.skip-cell-td:hover {
  background: rgba(0,0,0,0.55);
}

.cell-content.skip-cell {
  color: var(--text-muted);
  font-style: italic;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cell-content.empty-cell {
  color: var(--text-dim);
  font-size: 11px;
}

/* UAT・ブロック中（相手ボール）の「やることなし」セル
   開発中のセルと見分けがつくよう、濃いブロック風の青で塗る
   （現在スプリント列でも同じに見えるよう current-sprint より優先させる） */
.board-table td.sprint-cell.waiting-cell-td,
.board-table td.sprint-cell.current-sprint.waiting-cell-td {
  background: repeating-linear-gradient(
    45deg,
    rgba(30,58,138,0.45),
    rgba(30,58,138,0.45) 8px,
    rgba(37,99,235,0.35) 8px,
    rgba(37,99,235,0.35) 16px
  );
}

.board-table td.sprint-cell.waiting-cell-td:hover,
.board-table td.sprint-cell.current-sprint.waiting-cell-td:hover {
  background: rgba(37,99,235,0.4);
}

.cell-content.waiting-cell {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* セルのステータスチップ（このスプリントの状態） */
.cell-status-chip {
  display: inline-block;
  margin-bottom: 3px;
  padding: 1px 7px;
  font-size: 9.5px;
  font-weight: 700;
  border-radius: 4px;
  white-space: nowrap;
}

.cellst-plan    { background: rgba(148,163,184,0.18); color: #94a3b8; }
.cellst-finish  { background: rgba(34,197,94,0.15);  color: #4ade80; }
.cellst-uat     { background: rgba(168,85,247,0.15); color: #c084fc; }
.cellst-waiting { background: rgba(239,68,68,0.15);  color: #f87171; }

/* チェックボックス付きラベルの折り返し崩れ対策 */
label.checkbox-label {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text);
}

/* やることなしのラベルチップ（範囲の最初の可視セルにだけ表示） */
.waiting-chip {
  display: inline-block;
  padding: 2px 9px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: rgba(30,58,138,0.92);
  border: 1px solid rgba(147,197,253,0.45);
  border-radius: 10px;
  white-space: nowrap;
}

/* 終了予定より後のセル: プロジェクトがもう存在しない（ブロックとは別）
   ベタ塗りで「ここには何もない」を表現 */
.board-table td.sprint-cell.void-cell-td,
.board-table td.sprint-cell.current-sprint.void-cell-td {
  background: rgba(0,0,0,0.55);
}

.board-table td.sprint-cell.void-cell-td:hover,
.board-table td.sprint-cell.current-sprint.void-cell-td:hover {
  background: rgba(0,0,0,0.62);
}

.board-table td.sprint-cell.void-cell-td .cell-edit-btn { display: none !important; }

/* Edit button（編集可能なセルに常時薄く表示。hoverで明瞭に） */
.cell-edit-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: none;
  background: rgba(124,58,237,0.25);
  color: #a78bfa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--transition), background var(--transition);
}

.board-table td.sprint-cell:hover .cell-edit-btn {
  opacity: 1;
}

.cell-edit-btn:hover {
  background: rgba(124,58,237,0.5);
}

/* Updated by */
.cell-updated-by {
  font-size: 9.5px;
  color: var(--text-dim);
  padding: 0 8px 5px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ---- Calendar / Duties rows ---- */
.calendar-row td,
.duties-row td {
  padding: 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  background: var(--bg-card-alt);
}

.calendar-row .calendar-label,
.duties-row .duties-label {
  padding: 4px 12px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-right: 1px solid var(--border);
  height: 100%;
  display: flex;
  align-items: flex-start;
  padding-top: 6px;
}

.calendar-cell {
  /* 横 padding はバー側の margin で持つ（枠をまたぐバーをセル端までつなげるため） */
  padding: 4px 0;
  min-height: 28px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-left: 1px solid var(--border);
}

.duties-cell {
  padding: 4px 8px;
  min-height: 28px;
  border-left: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* 当番1件 = 「アイコン＋正式名称」「アバター＋名前」の縦2行（省略しない） */
.duty-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.duty-title {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.duty-person {
  display: flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  padding-left: 2px;
}

/* ============================================================
   MODAL (cell editor)
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 120ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  animation: slideUp 160ms ease;
  /* 画面より高い内容でも操作不能にならないよう、本文だけスクロールさせる */
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.modal-header {
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.modal-header h3 {
  font-size: 14px;
  font-weight: 700;
  flex: 1;
}

.modal-close {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition);
}

.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.modal-body {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  min-height: 0;
}

.modal-field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.modal-field textarea,
.modal-field input,
.modal-field select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-jp), var(--font);
  font-size: 13px;
  padding: 10px 12px;
  transition: border-color var(--transition);
  outline: none;
}

.modal-field textarea:focus,
.modal-field input:focus,
.modal-field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.modal-field textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.modal-field .hint {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* ------------------------------------------------------------
   Markdown ミニエディタ（セルの内容・取り組みのゴール）
   ------------------------------------------------------------ */
.md-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.md-head label { margin-bottom: 0; }

.md-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-bottom: 4px;
}

.md-btn {
  width: 26px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

.md-btn:hover {
  background: var(--bg);
  border-color: var(--border);
  color: var(--text);
}

.md-divider {
  width: 1px;
  height: 16px;
  background: var(--border);
  margin: 0 6px;
}

.md-tab {
  padding: 3px 10px;
  font-size: 11px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 999px;
  margin-left: 4px;
}

.md-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.md-preview {
  min-height: 160px;
  padding: 10px 12px;
  border: 1px dashed var(--border-hover);
  border-radius: var(--radius);
  background: var(--bg);
  font-size: 13px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.md-preview-sm { min-height: 64px; }

.md-preview-empty {
  color: var(--text-dim);
  font-size: 12px;
}

/* ------------------------------------------------------------
   このスプリントの状態ピッカー（セルのチップと同じ色で選択状態を表現）
   ------------------------------------------------------------ */
.cellst-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
  gap: 6px;
}

.cellst-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 8px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
}

.cellst-option:hover { border-color: var(--border-hover); }

.cellst-opt-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}

.cellst-opt-desc {
  font-size: 10px;
  color: var(--text-muted);
}

.cellst-option.active::after {
  content: '✓';
  position: absolute;
  top: 5px;
  right: 8px;
  font-size: 11px;
  font-weight: 700;
}

.cellst-option.opt-normal.active  { border-color: #7c3aed; background: rgba(124,58,237,0.07); }
.cellst-option.opt-normal.active::after  { color: #7c3aed; }
.cellst-option.opt-finish.active  { border-color: #22c55e; background: rgba(34,197,94,0.08); }
.cellst-option.opt-finish.active::after  { color: #16a34a; }
.cellst-option.opt-uat.active     { border-color: #a855f7; background: rgba(168,85,247,0.08); }
.cellst-option.opt-uat.active::after     { color: #9333ea; }
.cellst-option.opt-waiting.active { border-color: #ef4444; background: rgba(239,68,68,0.08); }
.cellst-option.opt-waiting.active::after { color: #dc2626; }
.cellst-option.opt-skip.active    { border-color: #94a3b8; background: rgba(148,163,184,0.15); }
.cellst-option.opt-skip.active::after    { color: #64748b; }

/* ------------------------------------------------------------
   renderMarkdown の箇条書き（セル・ゴール・プレビュー共通）
   折り返し行がぶら下げインデントで揃う
   ------------------------------------------------------------ */
.md-li {
  display: block;
  position: relative;
  padding-left: 1.1em;
  white-space: pre-wrap;
}

.md-li::before {
  content: '・';
  position: absolute;
  left: 0;
}

.md-li-num { padding-left: 1.5em; }
.md-li-num::before { content: attr(data-marker); }

.modal-footer {
  padding: 12px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: none;
  font-size: 13px;
  font-weight: 600;
  transition: all var(--transition);
  white-space: nowrap;
}

/* 無効時は押せないことが見て分かるようにする。
   :disabled の指定が無いと配色も cursor も有効時と同じで、押せるように見える */
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: #6d28d9;
}

.btn-secondary {
  background: var(--bg-hover);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: var(--bg-card-alt);
  border-color: var(--border-hover);
}

.btn-danger {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.25);
}
.btn-danger:hover {
  background: rgba(239,68,68,0.25);
}

.btn-success {
  background: rgba(34,197,94,0.15);
  color: #4ade80;
  border: 1px solid rgba(34,197,94,0.25);
}
.btn-success:hover {
  background: rgba(34,197,94,0.25);
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  width: 32px;
  height: 32px;
  justify-content: center;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */

.login-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0a0a12 0%, #0f0a1f 40%, #0a1229 100%);
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
}

.login-logo {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6b7280;
  margin-bottom: 8px;
}

.login-title {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, #7c3aed, #4f46e5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 36px;
  line-height: 1.5;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 20px;
  border-radius: var(--radius);
  border: 1px solid #dadce0;
  background: #ffffff;
  color: #3c4043;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

.btn-google:hover {
  background: #f8f9fa;
  border-color: #c0c4c9;
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  transform: translateY(-1px);
}

.btn-google:active {
  transform: translateY(0);
  background: #f1f3f4;
}

.btn-google svg {
  flex-shrink: 0;
}

.login-footer {
  margin-top: 24px;
  font-size: 11px;
  color: #9ca3af;
}

/* ============================================================
   PENDING PAGE
   ============================================================ */

.pending-page {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

.pending-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 440px;
  text-align: center;
}

.pending-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.pending-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.pending-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.pending-email {
  display: inline-block;
  padding: 6px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-family: monospace;
}

/* ============================================================
   ADMIN PAGE
   ============================================================ */

.admin-layout {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 28px 20px;
}

/* ============================================================
   PAGE FOOTER
   ============================================================ */

.page-footer {
  flex-shrink: 0;
  text-align: center;
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  font-size: 11px;
}

.page-footer a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.page-footer a:hover {
  color: var(--text-muted);
}

.admin-section {
  margin-bottom: 36px;
}

.admin-section h2 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.user-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  transition: border-color var(--transition);
}

.user-row:hover {
  border-color: var(--border-hover);
}

.user-row.pending-user {
  border-color: rgba(249,115,22,0.3);
  background: rgba(249,115,22,0.04);
}

.user-email {
  flex: 1;
  font-size: 13px;
  color: var(--text);
  min-width: 200px;
}

.user-identity {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-identity-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-email small {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* 最終アクティビティ（オンライン / 3分前 / 昨日 14:30） */
.user-activity {
  font-variant-numeric: tabular-nums;
}

.user-activity.is-online {
  color: #16a34a;
  font-weight: 600;
}

.user-activity.is-stale {
  color: var(--text-muted);
  opacity: 0.7;
}

.user-role-select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 12px;
  padding: 4px 8px;
  outline: none;
  cursor: pointer;
}

/* ページ別管理者権限（ユーザー管理の行内エディタ） */
.page-admin-toggle.has-pages {
  border-color: rgba(167,139,250,0.5);
  color: #a78bfa;
}

.page-admin-panel {
  flex-basis: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.page-admin-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
}

.page-admin-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
}

.page-admin-option input {
  accent-color: #7c3aed;
}

.page-admin-option input:disabled + *,
.page-admin-option:has(input:disabled) {
  color: var(--text-muted);
  cursor: default;
}

.user-role-select:focus {
  border-color: var(--accent);
}

.person-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.person-group-header {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding-bottom: 6px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.person-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

/* カードは「上段: アバター＋名前/役割＋操作」「下段: 稼働・部署」の縦2段。
   下段を全幅にすることでチップや役職の中折れ（プロダク/ト部）を防ぐ */
.person-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.person-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.person-card .person-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-card .person-role {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person-working-days {
  font-size: 11px;
  color: var(--text-dim);
  white-space: nowrap;
}

.person-working-days.reduced {
  color: var(--text-muted);
}

.person-working-days.suspended {
  color: #f87171;
  font-weight: 600;
}

.person-card-info {
  flex: 1;
  min-width: 0;
}

/* 下段メタ行（稼働日数＋部署チップ）。カード全幅を使って横に並べる */
.person-card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  margin-top: auto; /* 行内でカード高さが揃ったとき、メタ行を下端に寄せる */
}

.person-dept-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.person-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* 眼アイコンのみの正方形ボタン（視点で見る）。高さは横並びの「編集」に stretch で揃う */
.person-card .person-view-as {
  justify-content: center;
  padding: 4px 0;
  width: 26px;
}

/* 部署の複数選択ウィジェット（モーダル内） */
.dept-selector {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dept-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  min-height: 22px;
}
.dept-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 6px 3px 10px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent);
  border: 1px solid rgba(124, 58, 237, 0.25);
  font-size: 12px;
  font-weight: 600;
}
.dept-chip button {
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}
.dept-input-row {
  display: flex;
  gap: 8px;
}
.dept-input-row .dept-input {
  flex: 1;
}

/* ============================================================
   LOADING STATES
   ============================================================ */

.loading-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: var(--text-muted);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.empty-state {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* ============================================================
   TOAST
   ============================================================ */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 250ms, transform 250ms;
  pointer-events: none;
  max-width: 360px;
}

.toast-info    { background: var(--accent);  color: #fff; }
.toast-success { background: #16a34a;        color: #fff; }
.toast-error   { background: #dc2626;        color: #fff; }

/* ============================================================
   UTILS
   ============================================================ */

.text-muted  { color: var(--text-muted); }
.text-dim    { color: var(--text-dim); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.font-bold   { font-weight: 700; }
.d-flex      { display: flex; }
.gap-8       { gap: 8px; }
.align-center{ align-items: center; }
.flex-1      { flex: 1; }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}

/* Avatar */
.avatar {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-weight: 700;
  flex-shrink: 0;
  font-size: 11px;
  width: 22px;
  height: 22px;
  color: #fff;
  overflow: hidden;
}

/* アイコン画像（Google/GitHub/カスタム）。読み込み失敗時は onerror で消えてイニシャルに戻る */
.avatar-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.avatars {
  display: flex;
  flex-direction: row;
  gap: 2px;
  flex-wrap: wrap;
}

/* ============================================================
   ANALYTICS (開発生産性)
   ============================================================ */
.analytics-layout {
  flex: 1;
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}

/* 顧客タブは列が多く、1160px では利用サービスのチップが折り返されて行が縦に伸びる。
   一覧を1行ずつ読ませたいのでここだけ画面幅いっぱいまで広げる（1680px で全社1行） */
.analytics-layout-wide {
  max-width: 1680px;
}

.analytics-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

/* Findy Team+ 他社ベンチマークへの外部リンク（ロゴ + 競合比較 + 外部アイコン） */
.findy-link {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: opacity var(--transition);
}

.findy-link:hover {
  opacity: 0.7;
}

.findy-logo {
  height: 17px;
  width: auto;
  display: block;
}

.analytics-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0;
}

.analytics-select {
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 13px;
  font-family: var(--font-jp);
  color: var(--text);
}

/* ビュー切替（サマリ / レビュー分析 / メンバー比較） */
.view-switcher {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: #eceef1;
  padding: 4px;
  border-radius: 999px;
  width: fit-content;
}

.view-tab {
  padding: 6px 18px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-jp);
  cursor: pointer;
  transition: all var(--transition);
}

.view-tab:hover { color: var(--text); }

.view-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow);
}

/* レビュー相関マトリクス */
.matrix-wrapper {
  overflow-x: auto;
}

.review-matrix {
  border-collapse: collapse;
  font-size: 12.5px;
}

.review-matrix th,
.review-matrix td {
  border: 1px solid #eef0f3;
  padding: 6px 10px;
  text-align: center;
  white-space: nowrap;
}

.review-matrix .matrix-corner {
  text-align: left;
  color: var(--text-muted);
  font-size: 11px;
  background: var(--bg-card-alt);
}

.review-matrix .matrix-col {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  background: var(--bg-card-alt);
}

.review-matrix .matrix-row {
  text-align: left;
  font-weight: 600;
  background: var(--bg-card-alt);
  position: sticky;
  left: 0;
}

.review-matrix .matrix-cell {
  font-variant-numeric: tabular-nums;
  color: var(--text);
  min-width: 40px;
}

.review-matrix .matrix-total {
  font-weight: 700;
  background: #f9fafb;
}

/* デリバリー: リポジトリ絞り込み（セグメント）*/
.delivery-repo-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}

.delivery-repo-btn {
  --rc: #6b7280;
  padding: 5px 14px;
  border: 1px solid #d8dce2;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-jp);
  cursor: pointer;
  transition: all var(--transition);
}

.delivery-repo-btn:hover {
  border-color: var(--rc);
  color: var(--rc);
}

.delivery-repo-btn.active {
  background: var(--rc);
  border-color: var(--rc);
  color: #fff;
}

/* デプロイ分類の手動選択 */
.deploy-label-select {
  padding: 3px 6px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 11.5px;
  font-family: var(--font-jp);
  color: var(--text);
}

/* リポジトリ判別バッジ（デリバリー一覧） */
.repo-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

/* テーブルセル用の小さな前期比 */
.mini-delta {
  font-size: 10px;
  font-weight: 600;
  margin-left: 4px;
}

.mini-delta.good { color: var(--success); }
.mini-delta.bad  { color: var(--danger); }

/* KPI カード */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.2;
}

.kpi-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  min-height: 18px;
}

.kpi-note {
  font-size: 11px;
  color: var(--text-dim);
}

.kpi-delta {
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.kpi-delta small {
  font-size: 10px;
  font-weight: 400;
  color: var(--text-dim);
}

.kpi-delta.good    { color: var(--success); }
.kpi-delta.bad     { color: var(--danger); }
.kpi-delta.neutral { color: var(--text-dim); }

/* チャートカード */
.chart-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  margin-bottom: 16px;
}

.chart-card h2 {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 12px;
}

.chart-card-note {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 8px;
}

.chart-wrapper {
  position: relative;
  height: 260px;
}

/* サイクルタイム区間カード */
.cycle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.cycle-card {
  background: var(--bg-card-alt);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  position: relative;
}

.cycle-card-total {
  border: 1px solid #e5e7eb;
  background: var(--bg-card);
}

.cycle-dot {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.cycle-label {
  font-size: 11px;
  color: var(--text-muted);
}

.cycle-value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

/* タブ（pill 型） */
.tab-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.tab-pill {
  flex: 0 0 auto;
  white-space: nowrap;
  padding: 6px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  font-family: var(--font-jp);
  cursor: pointer;
  transition: all var(--transition);
}

.tab-pill:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.tab-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.admin-tab-row {
  margin-bottom: 20px;
}

/* PR テーブル */
.pr-table-wrapper {
  overflow: auto;
  max-height: 560px;      /* 長い一覧はテーブル内スクロール（ページ全体を伸ばさない） */
  border: 1px solid #eef0f3;
  border-radius: var(--radius-sm);
}

.pr-table-count {
  margin-left: auto;
  align-self: center;
}

.pr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}

.pr-table thead th {
  position: sticky;       /* スクロールしてもヘッダーは固定 */
  top: 0;
  z-index: 1;
  background: var(--bg-card);
  box-shadow: inset 0 -1px 0 #e5e7eb;
}

.pr-table th {
  text-align: left;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 8px 10px;
  white-space: nowrap;
}

.pr-table th.sortable {
  cursor: pointer;
  user-select: none;
}

.pr-table th.sortable:hover {
  color: var(--accent);
}

.pr-table th.sorted {
  color: var(--accent);
}

.pr-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: top;
}

.pr-table th.num,
.pr-table td.num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pr-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.pr-link:hover {
  color: var(--accent);
}

.pr-number {
  color: var(--accent);
  font-weight: 700;
}

.pr-repo {
  font-size: 10.5px;
  color: var(--text-dim);
  margin-top: 2px;
}

.pr-author {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.pr-author-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============================================================
   ADMIN — GitHub 連携
   ============================================================ */
.admin-section-note {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
  margin-left: 8px;
}

/* 設定ページの行（ラベル + 説明 + トグル） */
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.settings-row-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.settings-row-desc {
  margin-top: 3px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Modal form fields (sprint editor 等) */
.form-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-field .form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

/* スプリント一覧の行: 名前と期間を横並び・期間をしっかり見せる */
.sprint-row-main {
  flex: 1;
  min-width: 200px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.sprint-row-label {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.sprint-row-period {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.sprint-row-badges {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.sprint-row-badges .badge {
  white-space: nowrap;
}

/* 過去 / 現在 / 未来 をラベルではなく行のデザインで示す */
.user-row.sprint-past {
  opacity: 0.55;
  box-shadow: inset 3px 0 0 var(--border);
}

.user-row.sprint-past .sprint-row-label {
  color: var(--text-muted);
}

.user-row.sprint-current {
  border-color: var(--accent);
  background: var(--accent-glow);
  box-shadow: inset 3px 0 0 var(--accent);
}

.user-row.sprint-future {
  box-shadow: inset 3px 0 0 #93c5fd;
}

/* 未来スプリントの「予定」バッジ */
.sprint-badge-future {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
}

/* リポジトリ管理: 有効なものだけチップ表示 + モーダルで全件管理 */
.gh-repo-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.gh-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gh-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(124, 58, 237, 0.1);
  color: var(--accent);
  border: 1px solid rgba(124, 58, 237, 0.25);
  font-size: 12px;
  font-weight: 600;
}

.gh-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-jp);
}

.gh-repo-modal-list {
  max-height: 46vh;
  overflow-y: auto;
  margin-top: 6px;
  border-top: 1px solid var(--border);
}

.gh-repo-modal-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px;
  border-bottom: 1px solid #f3f4f6;
}

.gh-repo-modal-name {
  font-size: 13px;
  font-weight: 600;
  min-width: 0;
}

.gh-repo-modal-name small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-dim);
}

/* メンバー管理モーダルの行（アバター+名前 / 紐付け+トグル） */
.gh-member-modal-info {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.gh-member-modal-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.gh-sync-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.gh-mask-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  cursor: pointer;
}

/* トグルスイッチ */
.switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  cursor: pointer;
  transition: background var(--transition);
}

.switch-slider::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform var(--transition);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.switch input:checked + .switch-slider {
  background: var(--success);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(16px);
}

/* ============================================================
   Home dashboard (index.html)
   ============================================================ */
.home-layout {
  flex: 1;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 24px 40px;
}

.home-greeting { margin-bottom: 18px; }
.home-greeting-hello {
  font-family: var(--font-jp);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.home-greeting-date {
  font-size: 12px;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 18px;
  align-items: start;
}
.home-main { display: flex; flex-direction: column; gap: 18px; }
.home-side { display: flex; flex-direction: column; gap: 18px; }

.home-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.home-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.home-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-jp);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin: 0;
}
.home-card-title svg { color: var(--accent); }
.home-card-body { padding: 8px 10px; }

.home-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.home-empty {
  color: var(--text-dim);
  font-size: 13px;
  text-align: center;
  padding: 22px 10px;
  margin: 0;
}

/* やること行 */
.home-todo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
}
.home-todo-row:hover { background: var(--bg-hover); }
.home-todo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-glow);
  color: var(--accent);
  flex-shrink: 0;
}
.home-todo-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.home-todo-title { font-size: 13px; font-weight: 600; color: var(--text); }
.home-todo-sub {
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.home-todo-cta { font-size: 12px; font-weight: 600; color: var(--accent); white-space: nowrap; flex-shrink: 0; }

/* カードヘッダー右の遷移リンク（「当番一覧へ →」など） */
.home-card-more {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
}
.home-card-more:hover { text-decoration: underline; }

/* あなたの当番: 対象スプリントを当番名の横に添えるインラインタグ */
.home-duty-sprint-inline {
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 20px;
  background: var(--bg-card-alt);
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
  vertical-align: middle;
}
/* 当番アイコンは絵文字。accent の着色は効かないのでサイズだけ調整する */
.home-duty-icon { font-size: 17px; }

/* ---- やること: レビューキュー ---- */
/* セクション見出し（1stレビュー担当 / サブとして把握 / マージへ / ラベル付与） */
.review-section-head {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 10px 12px 4px;
  border-top: 1px solid var(--border);
}
.review-section-head:first-child { border-top: none; padding-top: 4px; }
.review-section-head.is-dim { color: var(--text-dim); }

/* サブの把握枠は一段トーンを落とす（優先度の違いを見た目で示す） */
.review-row.is-dim { opacity: 0.62; }
.review-row.is-dim:hover { opacity: 1; }

/* 領域バッジ（色は JS が review_domains.color / 名前ハッシュで指定） */
.review-domain {
  flex-shrink: 0;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 3px 9px;
  border: 1px solid;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.review-domain.is-neutral {
  color: var(--text-muted);
  background: var(--bg-card-alt);
  border-color: var(--border);
}

/* 役割バッジ（タイトル横）。オーナー/サブ→1st は濃色、サブは淡色 */
.review-role {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
}
.review-role.is-owner   { background: var(--accent); color: #fff; }
.review-role.is-sub     { background: var(--bg-card-alt); color: var(--text-muted); }
.review-role.is-ok      { background: rgba(5, 150, 105, 0.14); color: #059669; }
.review-role.is-consult { background: rgba(217, 119, 6, 0.14); color: #d97706; }
.review-role.is-triage  { background: rgba(220, 38, 38, 0.12); color: #dc2626; }

/* 滞留時間（SLA: 24h 超え = 黄、48h 超え = 赤） */
.review-wait {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-dim);
  white-space: nowrap;
}
.review-wait.is-amber { color: #d97706; }
.review-wait.is-red   { color: #dc2626; }

/* やることカードのヘッダー右側（鮮度 + 担当マトリクスリンク） */
.todo-head-right { display: flex; align-items: center; gap: 10px; }
.todo-freshness { font-size: 11px; color: var(--text-dim); white-space: nowrap; }

/* ---- 分析: 領域別タブ ---- */
.pr-table .review-domain { display: inline-block; }
.review-domain.is-small { font-size: 10px; padding: 1px 7px; max-width: 110px; display: inline-block; vertical-align: middle; }
.domain-owner-sep { margin: 0 6px; color: var(--text-dim); font-size: 11px; }
.domain-notion { text-decoration: none; font-size: 12px; }
.domain-notion:hover { opacity: 0.7; }
tr.domain-row { cursor: pointer; }
tr.domain-row:hover td { background: var(--bg-hover); }
tr.domain-row.selected td { background: var(--accent-glow); }
.domain-drill-owners { font-size: 12px; font-weight: 400; color: var(--text-muted); margin-left: 8px; }

/* 設定: コードレビュー担当マトリクス */
.rd-policy, .rd-notion {
  font-size: 12px;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  color: var(--text);
}
.rd-policy:disabled { color: var(--text-muted); background: var(--bg-card-alt); }
.rd-notion { width: 200px; }
.rd-policy:focus, .rd-notion:focus { outline: none; border-color: var(--accent); }

/* 設定: SLA 閾値・不在管理 */
.sla-settings {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: var(--text);
}
.sla-settings .settings-row-label { margin-right: 4px; }
.sla-input { width: 70px; }
.sla-input:disabled { color: var(--text-muted); background: var(--bg-card-alt); }
.absence-add {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}
tr.absence-active td { background: var(--accent-glow); }

/* 管理: Slack レビュー通知 */
.reminder-url-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.reminder-url-input { flex: 1; width: auto; max-width: 520px; }
.reminder-preview-bubble {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text);
  white-space: normal;
}
.reminder-preview-bubble a { color: var(--accent); text-decoration: none; }
.reminder-preview-bubble a:hover { text-decoration: underline; }
.reminder-preview-bubble strong { font-weight: 700; }
/* Slack のメンション（<@Uxxxx>）を実名の chip 風表示に置換（実際の Slack UI に似せる） */
.reminder-preview-mention {
  display: inline-block;
  background: var(--accent-glow);
  color: var(--accent);
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
}

/* 通知行 */
.home-notif-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition);
}
.home-notif-row:hover { background: var(--bg-hover); }
.home-notif-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
  margin-top: 5px;
  flex-shrink: 0;
}
.home-notif-main { display: flex; flex-direction: column; gap: 2px; }
.home-notif-title { font-size: 13px; font-weight: 600; color: var(--text); }
.home-notif-sub { font-size: 11px; color: var(--text-muted); }

/* ---- カレンダー ---- */
.cal-nav { display: flex; align-items: center; gap: 6px; }
.cal-nav-btn {
  width: 26px; height: 26px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: all var(--transition);
}
.cal-nav-btn:hover { background: var(--bg-hover); border-color: var(--border-hover); color: var(--text); }
.cal-title {
  font-family: var(--font-jp);
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  min-width: 96px;
  text-align: center;
}
.cal-today-btn {
  margin-left: 4px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
}
.cal-today-btn:hover { background: var(--bg-hover); color: var(--text); }

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 6px 8px 12px;
}
.cal-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}
.cal-legend-swatch { width: 12px; height: 12px; border-radius: 3px; }
.lg-sprint { background: rgba(124,58,237,0.16); border: 1px solid rgba(124,58,237,0.4); }
.lg-off    { background: rgba(17,24,39,0.06);   border: 1px solid rgba(17,24,39,0.14); }
.lg-work   { background: rgba(217,119,6,0.14);  border: 1px solid rgba(217,119,6,0.45); }

.cal-grid {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.cal-weekhead { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--bg-card-alt); }
.cal-weekhead-cell {
  padding: 6px 0;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.cal-weekhead-cell.is-sun { color: var(--danger); }
.cal-weekhead-cell.is-sat { color: var(--defense); }

.cal-week { position: relative; border-bottom: 1px solid var(--border); }
.cal-week:last-child { border-bottom: none; }
.cal-days { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day {
  min-height: 84px;
  padding: 5px 5px 9px;
  border-right: 1px solid var(--border);
}
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.is-out { background: var(--bg-card-alt); }
.cal-day.is-out .cal-daynum { color: var(--text-dim); }
.cal-day-head { display: flex; align-items: center; gap: 5px; }
.cal-daynum { font-size: 12px; font-weight: 600; color: var(--text); }
.cal-day.is-sun .cal-daynum { color: var(--danger); }
.cal-day.is-sat .cal-daynum { color: var(--defense); }
.cal-day.is-today .cal-daynum {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
}
/* 稼働日か休みかがぱっと分かればよい。休み = グレーの陰影のみ（祝日名は出さない） */
.cal-day.is-off { background: rgba(17,24,39,0.05); }
.cal-day.is-off.is-out { background: rgba(17,24,39,0.07); }

/* 祝日だが出勤の日だけ「出勤」を明示（日付の右） */
.cal-workpill {
  padding: 0 5px;
  border-radius: 3px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  background: var(--warning);
  line-height: 15px;
}

/* 日付イベント（スプリントプランニング / スプリントレビュー / リリース）を
   スプリントバーの一段下に置く。ラベルが長いので 1 列（約 110px）に収まるサイズにする */
.cal-eventcell {
  position: relative;
  justify-self: start;
  margin-left: 2px;
  display: inline-flex;
  gap: 3px;
}
.cal-eventpill {
  height: 16px;
  display: inline-flex;
  align-items: center;
  padding: 0 3px;
  border-radius: 4px;
  border: 1px solid;
  font-size: 8px;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: auto;
}
.cal-eventpill.is-planning {
  color: #0f766e;
  background: rgba(13, 148, 136, 0.1);
  border-color: rgba(13, 148, 136, 0.35);
}
.cal-eventpill.is-review {
  color: #1d4ed8;
  background: rgba(29, 78, 216, 0.1);
  border-color: rgba(29, 78, 216, 0.35);
}
.cal-eventpill.is-release {
  color: #be185d;
  background: rgba(219, 39, 119, 0.1);
  border-color: rgba(219, 39, 119, 0.4);
}

/* カレンダーのビュー切替タブ（月表示 / レリーズ予定） */
.cal-tabs { display: inline-flex; gap: 6px; }
.cal-tab {
  padding: 5px 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-family: var(--font-jp);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.cal-tab:hover { background: var(--bg-hover); color: var(--text); }
.cal-tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.release-embed {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}

/* バー層: スプリント期間バー（上段）＋リリース（下段）を日付の下に重ねる */
.cal-bars {
  position: absolute;
  left: 0; right: 0; top: 26px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  pointer-events: none;
}
.cal-bar {
  position: relative;
  height: 16px;
  margin: 0 3px;
  border-radius: 4px;
  border: 1px solid;
  display: flex;
  align-items: center;
  pointer-events: auto;
}
.cal-bar-label {
  font-size: 10px;
  font-weight: 700;
  padding: 0 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 880px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-side { order: -1; }
}

/* ============================================================
   開発サポート依頼キュー（dev-support.html）
   設計: docs/design/dev-support-tracking.md §6
   ============================================================ */

/* 状態バッジ配色（select にも同じクラスを当てる） */
.ds-badge { border: 1px solid transparent; }
.ds-st-untriaged  { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.ds-st-inprogress { background: #dcfce7; color: #15803d; border-color: #86efac; }
.ds-st-waiting    { background: #f3e8ff; color: #7e22ce; border-color: #d8b4fe; }
.ds-st-blocked    { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.ds-st-resolved   { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }

/* カテゴリー（フォームの4値）のバッジ色。dev-support-queue.js の categoryBadge と対 */
.ds-cat-bug     { background: #fee2e2; color: #b91c1c; }
.ds-cat-spec    { background: #dbeafe; color: #1d4ed8; }
.ds-cat-ops     { background: #fef9c3; color: #a16207; }
.ds-cat-consult { background: #f3e8ff; color: #7e22ce; }
.ds-cat-other   { background: #f3f4f6; color: #6b7280; }

/* テーブル末尾の「もっと見る」行（固定枠スクロールの代わりに展開する） */
.pr-table td.detail-show-more {
  text-align: center;
  padding: 10px;
}

/* テーブル内の編集セレクト（状態・担当・ボール） */
.ds-inline-select {
  padding: 3px 6px;
  border: 1px solid #e5e7eb;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 12px;
  font-family: var(--font-jp);
  color: inherit;
  max-width: 110px;
  cursor: pointer;
}

/* 担当ピッカー: ボタン押下でチェックボックスのポップオーバーを開く（複数選択可） */
.ds-assignee-picker { position: relative; display: inline-block; }

.ds-assignee-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  text-align: left;
  white-space: normal;
  max-width: 140px;
}

/* 担当チップ（アイコン+名前）。名前だけの一覧は視認性が悪いためアイコンを添える */
.ds-assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ds-assignee-popover {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  min-width: 160px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid #e5e7eb;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 50;
  padding: 6px;
}
.ds-assignee-popover.open { display: block; }

.ds-assignee-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 6px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: var(--font-jp);
  cursor: pointer;
  white-space: nowrap;
}
.ds-assignee-option:hover { background: rgba(0,0,0,0.04); }

.ds-cell-request { min-width: 260px; max-width: 420px; }

/* 顧客列: 顧客詳細への外部リンク。長い社名は折り返さず省略 */
.ds-cell-org { max-width: 180px; }
.ds-org-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  font-size: 12px;
  text-decoration: none;
}
.ds-org-link:hover { text-decoration: underline; }
.ds-org-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ds-org-pending {
  font-size: 11px;
  color: var(--amber-700, #b45309);
  background: var(--amber-50, #fffbeb);
  border: 1px solid var(--amber-200, #fde68a);
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
  cursor: pointer;  /* クリックでピークを開いて対象事業者を設定できる */
}
.ds-org-none { color: var(--text-dim); }

/* ピーク内の対象事業者の設定ブロック。未設定の依頼は「やること」の
   「事業者を設定 →」で飛んでくるので、メタの1行に埋もれさせず目立たせる */
.ds-org-callout {
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--amber-50, #fffbeb);
  border: 1px solid var(--amber-200, #fde68a);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ds-org-callout-head { font-size: 12.5px; font-weight: 700; color: var(--amber-700, #b45309); }
.ds-org-callout-note { font-size: 11.5px; color: var(--amber-700, #b45309); }
.ds-org-callout-hint { font-size: 11px; color: var(--text-dim); }

.ds-expected {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

.ds-blocker {
  margin-top: 2px;
  font-size: 11px;
  color: #b45309;
}

.ds-note-btn {
  border: none;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 11px;
  padding: 0 2px;
  visibility: hidden;
}

tr:hover .ds-note-btn,
.ds-blocker:not(.is-empty) .ds-note-btn { visibility: visible; }

.ds-due { white-space: nowrap; font-weight: 600; }
.ds-due.is-amber { color: #d97706; }
.ds-due.is-red   { color: #dc2626; }
.ds-due.is-dim   { color: var(--text-dim); font-weight: 400; }

.ds-row-resolved td { opacity: 0.55; }

.kpi-value.is-red   { color: #dc2626; }
.kpi-value.is-amber { color: #d97706; }

/* 依頼セル内のメタ行（受付日・依頼者）と AI 現況 */
.ds-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-dim);
}

.ds-ai {
  margin-top: 2px;
  font-size: 11px;
  color: #6d28d9;
}

/* 固定枠スクロールにせず全件表示する一覧（開発サポートのキュー、顧客の事業者一覧）。
   見切れによる対応漏れ・全体像の見失い防止。ヘッダー行はページヘッダー(52px)の下に追従 */
.pr-table-wrapper.ds-no-scroll {
  max-height: none;
  overflow: visible;
}

.ds-no-scroll .pr-table thead th {
  top: 52px;
}

/* ============================================================
   開発サポート — サイドピーク（Slack に飛ばずにやりとりを確認）
   ============================================================ */
.ds-peek-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 900;
  animation: fadeIn 120ms ease;
}

.ds-peek {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(760px, 92vw);
  background: var(--bg-card);
  border-left: 1px solid var(--border-hover);
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
  z-index: 901;
  display: flex;
  flex-direction: column;
  animation: peekIn 160ms ease;
}

@keyframes peekIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

.ds-peek-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.ds-peek-head h3 {
  flex: 1;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.ds-peek-head-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.ds-peek-meta {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.ds-peek-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.ds-peek-meta-sub { font-size: 11.5px; }

.ds-peek-thread {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.ds-msg {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
}

.ds-msg.is-bot {
  background: rgba(124,58,237,0.05);
  border-color: rgba(124,58,237,0.2);
}

.ds-msg-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 3px;
}

.ds-msg-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
}

.ds-msg-time {
  font-size: 10.5px;
  color: var(--text-dim);
}

.ds-msg-text {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text);
  word-break: break-word;
}

.ds-msg-text a { color: #a78bfa; }

.ds-mention {
  color: #a78bfa;
  background: rgba(124,58,237,0.12);
  border-radius: 3px;
  padding: 0 3px;
  font-weight: 600;
}

/* ピーク内リンクで別スレッドを開いたときの戻るバー */
.ds-peek-backbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0 8px;
  border-bottom: 1px dashed var(--border);
}

.ds-msg-text a.ds-slack-link {
  color: #c4b5fd;
  background: rgba(124,58,237,0.1);
  border: 1px solid rgba(124,58,237,0.3);
  border-radius: 5px;
  padding: 0 6px;
  text-decoration: none;
  white-space: nowrap;
}

.ds-msg-text a.ds-slack-link:hover {
  background: rgba(124,58,237,0.2);
}

/* ============================================================
   ボードセル内のマークダウン（リンク・コード・太字）
   ============================================================ */
/* リンクは本文と同じ色＋紫の破線下線で示す（薄紫文字は視認性が悪い） */
.cell-content a,
.goal-cell a,
.card-goal a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dashed rgba(124,58,237,0.5);
  word-break: break-all;
}

.cell-content a:hover,
.goal-cell a:hover,
.card-goal a:hover {
  color: #7c3aed;
  border-bottom: 1px solid #7c3aed;
  background: rgba(124,58,237,0.07);
}

.cell-content code,
.goal-cell code {
  background: rgba(255,255,255,0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 4px;
  font-size: 10.5px;
}

/* ---- セルの「＋」（編集可能なセルに常時薄く表示。hoverで明瞭に） ---- */
.cell-add-btn {
  width: 22px;
  height: 22px;
  margin: 4px 0;
  border: 1px dashed var(--border-hover);
  border-radius: 6px;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity var(--transition), background var(--transition);
}

.board-table td.sprint-cell:hover .cell-add-btn { opacity: 1; }

.cell-add-btn:hover {
  background: rgba(124,58,237,0.15);
  color: #a78bfa;
  border-color: rgba(124,58,237,0.5);
}

/* ---- オーナーの区別表示（👑） ---- */
.owner-wrap {
  position: relative;
  display: inline-flex;
}

.owner-crown {
  position: absolute;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  line-height: 1;
  pointer-events: none;
}

.owner-avatar {
  box-shadow: 0 0 0 1.5px #fbbf24;
}

/* ---- 主要プレイヤーの区別表示（「主」バッジ） ---- */
.primary-wrap {
  position: relative;
  display: inline-flex;
}

.primary-mark {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 1px 3px;
  font-size: 8px;
  line-height: 1;
  border-radius: 4px;
  background: #7c3aed;
  color: #fff;
  pointer-events: none;
}

.primary-avatar {
  box-shadow: 0 0 0 1.5px #a78bfa;
}

/* ---- パーティの隊列（DQ風に一列でぽこぽこ歩く） ---- */
@keyframes party-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2.5px); }
}

.card-bottom .avatars > * { animation: party-bob 1.1s ease-in-out infinite; }
.card-bottom .avatars > :nth-child(2) { animation-delay: 0.15s; }
.card-bottom .avatars > :nth-child(3) { animation-delay: 0.30s; }
.card-bottom .avatars > :nth-child(4) { animation-delay: 0.45s; }
.card-bottom .avatars > :nth-child(5) { animation-delay: 0.60s; }
.card-bottom .avatars > :nth-child(6) { animation-delay: 0.75s; }
.card-bottom .avatars > :nth-child(7) { animation-delay: 0.90s; }
.card-bottom .avatars > :nth-child(n+8) { animation-delay: 1.05s; }

/* ---- 参画マス（ここから仲間が合流するすごろくのマス） ---- */
.cell-join {
  display: flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  max-width: 100%;
  margin-top: 4px;
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 600;
  border-radius: 8px;
}

.cell-join-text { white-space: nowrap; }

/* まだ先のスプリント: 予告（点線枠でそわそわ待っている） */
.cell-join:not(.joined) {
  border: 1px dashed rgba(124,58,237,0.6);
  background: rgba(124,58,237,0.08);
  color: #a78bfa;
}

.cell-join:not(.joined) .join-avatar {
  animation: join-hop 1.4s ease-in-out infinite;
}

/* 差し掛かった: 「なかまに くわわった！」 */
.cell-join.joined {
  border: 1px solid rgba(251,191,36,0.5);
  background: rgba(251,191,36,0.10);
  color: #d97706;
}

.cell-join.joined .join-avatar {
  box-shadow: 0 0 0 1.5px #fbbf24;
}

@keyframes join-hop {
  0%, 55%, 100% { transform: translateY(0); }
  25%           { transform: translateY(-3px); }
}

@media (prefers-reduced-motion: reduce) {
  .card-bottom .avatars > *,
  .cell-join .join-avatar { animation: none; }
}

/* ---- 設定: プロフィール編集 ---- */
.profile-editor {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}

#profile-preview { margin-top: 4px; }

.profile-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  max-width: 460px;
  flex: 1;
}

.profile-avatar-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.profile-avatar-option {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 5px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.profile-avatar-option:hover { background: var(--bg-hover); }

.profile-avatar-option.on {
  background: rgba(124,58,237,0.12);
  border-color: rgba(124,58,237,0.5);
}

/* ---- 人フィルタ（ツールバー: クリックでその人の取り組みに絞り込み） ---- */
.person-filter {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  flex-wrap: wrap;
  margin-left: 4px;
}

.person-filter-btn {
  padding: 2px;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: pointer;
  line-height: 0;
  opacity: 0.85;
  transition: transform var(--transition), opacity var(--transition), box-shadow var(--transition);
}

.person-filter-btn:hover { transform: scale(1.15); opacity: 1; }

.person-filter-btn.active {
  opacity: 1;
  box-shadow: 0 0 0 2px #7c3aed;
}

/* 誰か選択中は他の人を控えめに */
.person-filter:has(.active) .person-filter-btn:not(.active) {
  opacity: 0.35;
  filter: grayscale(0.7);
}

/* ============================================================
   顧客CRM（/customers）
   ============================================================ */

/* フィルタバーの検索欄。.gh-search は width:100% なので幅を与える */
.crm-search {
  width: 220px;
  font-size: 12px;
  padding: 6px 10px;
}

.crm-org-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* organization_id など、レリーズ側のシステムID。コピペして使うので等幅 */
.crm-id {
  display: inline-block;
  margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: -0.2px;
  user-select: all;
}

/* 詳細ビューの definition list 内は読む場面なので、さらに一段はっきりさせる */
.detail-dl .crm-id {
  font-size: 12px;
  color: var(--text);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  margin-top: 0;
}

/* 幅で切らず、契約中のサービスを全部見せる。折り返しありの flex は max-content 幅が
   「全チップを1行に並べた幅」になるので、列は内容に合わせて広がり、テーブルが
   窮屈なときは折り返す */
.crm-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

/* 契約中のサービス。契約フラグが ON でも実績が 0 の組織は多いため、
   「利用中」と「契約ONだが未利用」を色で分けて棚卸し対象を見つけられるようにする */
.crm-service-chip {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.crm-service-chip.is-active {
  background: rgba(22, 163, 74, 0.10);
  border-color: rgba(22, 163, 74, 0.30);
  color: #15803d;
}

.crm-service-chip.is-unused {
  background: rgba(217, 119, 6, 0.10);
  border-color: rgba(217, 119, 6, 0.30);
  color: #b45309;
}

/* 実績を表す列が無いサービス。契約 ON までは言えるが利用状況は分からない */
.crm-service-chip.is-unknown {
  background: var(--bg-card-alt);
  border-color: var(--border);
  color: var(--text-muted);
}

/* 契約状態タブ（事業者一覧の絞り込み。件数付き） */
.crm-status-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 16px;
}

.tab-pill .crm-tab-count {
  margin-left: 2px;
  font-weight: 700;
  opacity: 0.65;
  font-variant-numeric: tabular-nums;
}

/* 同名組織の識別用の補足名（customer_manual_master.name_suffix） */
.crm-name-suffix {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  white-space: nowrap;
}

/* 顧客のグループ列（合計・会員・未会員）。2段ヘッダのまとめ側と、
   薄い背景＋左右の罫線で「この3列でひとかたまり（合計=会員+未会員）」を見せる */
.pr-table th.th-group {
  text-align: center;
  font-weight: 700;
}

.crm-col-customer { background: rgba(109, 91, 208, 0.045); }
.crm-group-start  { border-left: 1px solid var(--border); }
.crm-group-end    { border-right: 1px solid var(--border); }

/* KPIカード・列ヘッダの説明ツールチップ（?マーク）。
   ブラウザ標準の title は表示までに約1秒かかるため、data-tip 属性を
   CSS 疑似要素で出す即時ツールチップにしている */
.kpi-info,
.th-info {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 13px;
  height: 13px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  vertical-align: 1px;
  user-select: none;
}

.kpi-info::after,
.th-info::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  width: max-content;
  max-width: 300px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.94);
  color: #fff;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.65;
  text-align: left;
  white-space: normal;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.06s ease;
}

.kpi-info:hover::after,
.th-info:hover::after {
  opacity: 1;
  visibility: visible;
}

/* 右端の列（最終活動など）でツールチップが画面外へ出ないよう、
   ヘッダ最終列だけ右寄せで出す */
.pr-table th:last-child .th-info::after {
  left: auto;
  right: -6px;
  transform: none;
}

/* th は position: sticky で行内の各セルがスタッキングコンテキストを持つため、
   後続の th がツールチップの上に重なる。ホバー中の th を持ち上げて最前面に出す */
.pr-table thead th:hover {
  z-index: 70;
}

/* ============================================================
   プロダクト数値タブ（product-metrics.js）
   ============================================================ */
.pm-chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 980px) {
  .pm-chart-grid { grid-template-columns: 1fr; }
}

/* 事業者別テーブルは2段ヘッダ + 表内スクロール。sticky の2段目は
   1段目の高さぶん下で止める（重なり防止） */
#pm-org-head tr:nth-child(2) th { top: 33px; }

/* ============================================================
   事業者詳細ビュー（customer-detail.js）
   ============================================================ */

/* 一覧の行クリックで詳細へ */
.crm-row-link { cursor: pointer; }
.crm-row-link:hover td { background: #f8f9fc; }

.org-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.org-detail-title {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}

.org-detail-sub {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

/* カードの2カラムグリッド。狭い画面では1カラムに落とす。
   行単位の grid だと短いカードの下と奇数枚目の隣に大きな空白ができるため、
   各カラム（.org-detail-col）が独立してカードを詰める */
.org-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
  align-items: start;
}

.org-detail-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

@media (max-width: 980px) {
  .org-detail-grid { grid-template-columns: 1fr; }
}

/* ラベル + 値 の definition list */
.detail-dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  column-gap: 16px;
  row-gap: 7px;
  margin: 0;
  font-size: 12.5px;
}

.detail-dl dt { color: var(--text-muted); white-space: nowrap; }
.detail-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.detail-input-wrap { display: flex; align-items: center; gap: 6px; }

.detail-input {
  width: 100%;
  max-width: 340px;
  padding: 4px 8px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 12.5px;
  font-family: var(--font-jp);
  color: var(--text);
}

.detail-textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 12.5px;
  font-family: var(--font-jp);
  color: var(--text);
  line-height: 1.7;
  resize: vertical;
}

.detail-notes-view {
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-card-actions {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}

.detail-link {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.detail-link-open { font-size: 11px; white-space: nowrap; }

/* 関連リンク（customer_links）の行と追加フォーム */
.detail-link-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}

.detail-link-row:last-child { border-bottom: none; }

.detail-link-label {
  font-weight: 600;
  white-space: nowrap;
}

/* 関連リンク: ラベル自体がリンク。↗ で外部リンクと分かるようにする */
.detail-link-anchor {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.detail-link-anchor:hover { text-decoration: underline; }

.ext-link-icon {
  flex-shrink: 0;
  opacity: 0.55;
}

/* 行末の「編集」。普段は目立たせず、押すと行がインライン編集フォームになる */
.detail-link-edit {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
  white-space: nowrap;
}

.detail-link-edit:hover { color: var(--accent); text-decoration: underline; }

/* ============================================================
   すごろく: ウェイティングリスト（ロードマップ未反映の候補）
   ============================================================ */
.waiting-count {
  display: inline-block;
  min-width: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.waiting-count:empty { display: none; }

.waiting-group { margin-bottom: 16px; }
.waiting-group:last-child { margin-bottom: 0; }

.waiting-group-title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}
.waiting-group-title .crm-tab-count {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 12px;
}

.waiting-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 0;
}
.waiting-row + .waiting-row { border-top: 1px dashed var(--border); }
.waiting-row-main { flex: 1; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; }
.waiting-name { font-size: 13px; }

.waiting-add {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.waiting-add .detail-input { flex: 1; min-width: 140px; }

.detail-link-row.is-editing {
  gap: 6px;
  align-items: center;
  padding: 8px 0;
}

/* 編集フォーム内の「削除」。保存・キャンセルと混ざらないよう右端に離す */
.detail-link-delete {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
  padding: 2px 4px;
}

.detail-link-delete:hover { color: #b91c1c; text-decoration: underline; }

.detail-link-add {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  align-items: center;
}

/* ============================================================
   ナレッジ（customer_notes）— 投稿ごとに畳まれたスレッド表示
   ============================================================ */
.note-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  background: var(--bg-card);
}

.note-entry summary {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
}

.note-entry summary::before {
  content: '▸';
  color: var(--text-dim);
  font-size: 11px;
  flex-shrink: 0;
}

.note-entry[open] summary::before { content: '▾'; }
.note-entry summary::-webkit-details-marker { display: none; }

.note-excerpt {
  font-size: 12.5px;
  font-weight: 600;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-meta {
  margin-left: auto;
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.note-body {
  padding: 2px 12px 10px 26px;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 返信・追記はスレッド内で左に線を引いてぶら下げる */
.note-reply {
  margin: 0 12px 8px 26px;
  padding: 6px 10px;
  border-left: 2px solid var(--border);
  background: var(--bg-card-alt);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.note-reply .note-meta { margin-left: 0; display: block; margin-bottom: 2px; }
.note-reply .note-body { padding: 0; }

.note-reply-compose {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  margin: 0 12px 10px 26px;
}

.note-reply-compose .detail-textarea { margin: 0; }

.note-thread-actions {
  display: flex;
  justify-content: flex-end;
  padding: 0 12px 8px;
}

.note-del {
  border: none;
  background: none;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
}

.note-del:hover { color: #b91c1c; }

.note-compose { margin-top: 12px; }

/* 設定・連携のセクション */
.detail-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px 28px;
}

.detail-settings-section h3 {
  margin: 0 0 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 4px;
}

.detail-chip {
  display: inline-block;
  padding: 1px 7px;
  margin: 1px 0;
  border-radius: 999px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  font-size: 10.5px;
  white-space: nowrap;
}

.detail-bool-on { color: #15803d; font-weight: 700; }

/* 契約ステータスの変更セレクト（顧客ページ管理者のみに描画される）。
   バッジの下に小さく置き、その場で自動判定への上書きを切り替える */
.crm-status-select {
  display: block;
  margin-top: 4px;
  max-width: 132px;
  padding: 2px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 11px;
  font-family: var(--font-jp);
  color: var(--text-muted);
}

/* 注意を引く小バッジ。/admin のスナップショット一覧（ID正規化）で使う */
.crm-warn-badge {
  display: inline-block;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 5px;
  border-radius: var(--radius-sm);
  background: rgba(217, 119, 6, 0.12);
  color: #b45309;
  font-size: 10px;
  font-weight: 700;
}

/* 最終活動の相対ラベルは列幅で折り返させない */
.crm-activity {
  white-space: nowrap;
}

/* 90日超えて活動が無い事業者。休眠として目に留まるようにする */
.crm-stale {
  color: #b45309;
  font-weight: 600;
}

/* 利用サービスチップの凡例。3状態の色の意味を一覧の上に置く */
.crm-legend {
  float: right;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
}

/* ============================================================
   顧客CRM の取り込み（管理者設定 → 顧客タブ）
   ============================================================ */

/* 実行時の注意書き。読み飛ばされると本番プライマリで流されうるので目立たせる */
.crm-callout {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  background: rgba(217, 119, 6, 0.06);
  font-size: 12px;
  line-height: 1.7;
}

/* 抽出クエリ（折りたたみ） */
.crm-query {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--bg-card-alt);
}

.crm-query > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  cursor: pointer;
  font-size: 12px;
}

.crm-query > summary > code { font-weight: 700; }
.crm-query > summary > .btn { margin-left: auto; }

.crm-sql {
  max-height: 340px;
  margin: 0;
  padding: 10px 12px;
  overflow: auto;
  border-top: 1px solid var(--border);
  background: #fbfbfd;
  font-size: 11px;
  line-height: 1.6;
  white-space: pre;
}

/* CSV の選択欄 */
.crm-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid #eef0f3;
  font-size: 12px;
}

.crm-picker:last-child { border-bottom: none; }

.crm-picker-label {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 220px;
}

.crm-picker-label > code { font-weight: 700; }
.crm-picker .crm-file { flex: 1; font-size: 11px; }
.crm-picker-state { min-width: 150px; text-align: right; }

.crm-import-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.crm-import-actions .spacer { flex: 1; }
.crm-note-input { width: 260px; font-size: 12px; padding: 6px 10px; }

.crm-check {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

/* 取り込みの進捗・結果 */
.crm-import-status:empty { display: none; }

.crm-import-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.7;
}

.crm-import-status.is-success {
  background: rgba(22, 163, 74, 0.06);
  border-color: rgba(22, 163, 74, 0.30);
}

.crm-import-status.is-error {
  background: rgba(220, 38, 38, 0.06);
  border-color: rgba(220, 38, 38, 0.30);
}

.crm-note-line { color: var(--text-muted); }

.crm-progress {
  height: 5px;
  margin: 8px 0 4px;
  border-radius: 999px;
  background: #e6e8ec;
  overflow: hidden;
}

.crm-progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 160ms ease;
}

/* ============================================================
   本番アラート対応トラッキング（alerts.html）
   設計: docs/design/alert-tracking.md §6
   状態バッジ（未対応/調査中/解決済み/対応不要）は既存の .ds-st-* を流用する
   ============================================================ */

/* サービスバッジ */
.alert-svc-release { background: #dbeafe; color: #1d4ed8; }
.alert-svc-kyc      { background: #f3e8ff; color: #7e22ce; }
.alert-svc-other    { background: #f3f4f6; color: #6b7280; }

/* 発報元バッジ */
.alert-src-datadog    { background: #ede9fe; color: #6d28d9; }
.alert-src-cloudwatch { background: #ffedd5; color: #c2410c; }
.alert-src-other      { background: #f3f4f6; color: #6b7280; }

/* クロスポストによる重複行（duplicate_of_ts あり）は薄く表示 */
.alert-row-duplicate td { opacity: 0.6; }
.alert-badge-dup { background: #f3f4f6; color: #6b7280; }

/* 同一 fingerprint の集約行（クリックで配下の個別行を展開） */
.alert-group-header td { background: var(--bg-card-alt); cursor: default; }
.alert-group-toggle { cursor: pointer; user-select: none; }
.alert-group-toggle:hover { color: var(--accent); }
.alert-row-nested td:first-child { padding-left: 28px; color: var(--text-muted); }
.alert-row-nested td { background: var(--bg-card); }

/* 未復旧バッジ */
.alert-badge-unrecovered { background: #fee2e2; color: #b91c1c; }
