/* =============================================================================
   home.css — ホーム画面 / 取引先一覧（§02 / §3-1）
   エン・CP のゲート画面。担当先を俯瞰し「どこで何が止まっているか」を3秒で把握。
   ============================================================================= */

/* ---- アプリヘッダー（紺） ---- */
.home-header {
  background: var(--navy);
  color: #fff;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.home-brand { display: flex; align-items: center; gap: 14px; }
.home-logo {
  width: 32px; height: 32px;
  background: var(--gold);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.02em;
}
.home-brand-name { font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.home-brand-sub { font-size: 10.5px; color: #A8B5C9; margin-top: 1px; font-family: var(--font-mono); letter-spacing: 0.03em; }

.home-header-right { display: flex; align-items: center; gap: 18px; }
.home-search-btn {
  background: transparent;
  border: 1px solid #4A5B7E;
  color: #E8EDF5;
  padding: 7px 12px;
  font-size: 11.5px;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.home-search-btn:hover { background: rgba(255, 255, 255, 0.06); }
.home-search-btn svg { width: 12px; height: 12px; }
.home-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid #4A5B7E;
  font-size: 12px;
}
.home-user-avatar {
  width: 28px; height: 28px;
  background: var(--gold);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.home-user-name { font-weight: 500; }
.home-user-role { font-size: 10px; color: #A8B5C9; }

/* ---- スタッツストリップ（5項目） ---- */
.stats-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.stat { padding: 18px 24px; border-right: 1px solid var(--border); }
.stat:last-child { border-right: none; }
.stat-label { font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.08em; font-weight: 500; margin-bottom: 4px; }
.stat-figure { display: flex; align-items: baseline; gap: 8px; }
.stat-val { font-family: var(--font-mono); font-size: 24px; font-weight: 600; color: var(--navy); }
.stat-val.is-alert { color: var(--alert-fg); }
.stat-unit { font-size: 11px; color: var(--text-muted); }

/* ---- 横断アラート（3カード） ---- */
.home-alerts { padding: 20px 32px 8px; background: var(--surface); }
.home-alerts-label { font-size: 10.5px; color: var(--text-faint); letter-spacing: 0.1em; font-weight: 600; margin-bottom: 12px; }
.home-alerts-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: var(--space-1_5); }
.home-alert {
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
  text-align: left;
  transition: transform var(--transition-card), box-shadow var(--transition-card);
}
a.home-alert { text-decoration: none; }
a.home-alert:hover { transform: translateY(-1px); box-shadow: var(--shadow-hover); text-decoration: none; }
.home-alert .home-alert-icon { flex-shrink: 0; margin-top: 1px; }
.home-alert .home-alert-icon svg { width: 18px; height: 18px; }
.home-alert-title { font-size: 12.5px; font-weight: 600; margin-bottom: 2px; }
.home-alert-desc { font-size: 11.5px; color: #6B5048; line-height: 1.6; }

.home-alert.is-alert   { background: var(--alert-bg);      border: 1px solid #F0CCC4; }
.home-alert.is-alert   .home-alert-icon, .home-alert.is-alert   .home-alert-title { color: var(--alert-fg); }
.home-alert.is-caution { background: var(--caution-bg);    border: 1px solid #E8D5B0; }
.home-alert.is-caution .home-alert-icon, .home-alert.is-caution .home-alert-title { color: var(--caution-fg); }
.home-alert.is-info    { background: var(--status-dev-bg); border: 1px solid #C9D9E8; }
.home-alert.is-info    .home-alert-icon, .home-alert.is-info    .home-alert-title { color: var(--status-dev-fg); }

/* ---- フィルタバー ---- */
.home-filter {
  padding: 16px 32px;
  background: var(--surface);
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--border);
}
.home-search { position: relative; flex: 1; max-width: 340px; }
.home-search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--text-faint); width: 14px; height: 14px; }
.home-search input {
  width: 100%;
  padding: 8px 12px 8px 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 12.5px;
  background: var(--surface-alt);
}
/* セグメント切替（自分の担当／全社／要対応のみ） */
.seg {
  display: flex;
  gap: 2px;
  background: var(--paper);
  padding: 3px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.seg button {
  background: transparent;
  color: var(--text-muted);
  padding: 6px 14px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--radius-sm);
}
.seg button.is-active { background: var(--navy); color: #fff; }
.home-sort { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--text-muted); }
.home-sort select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 11.5px;
  color: var(--navy);
  background: var(--surface);
}

/* ---- クライアント一覧テーブル ---- */
.client-table { background: var(--surface); }
.ct-cols {
  display: grid;
  grid-template-columns: 280px 110px 1fr 130px 100px 60px;
}
.ct-head {
  padding: 12px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-faint);
  letter-spacing: 0.08em;
}
.ct-head .ta-right { text-align: right; }

.ct-row {
  padding: 18px 32px;
  border-bottom: 1px solid var(--border-soft);
  align-items: center;
  background: var(--surface);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-card);
}
.ct-row:hover { background: var(--surface-alt); text-decoration: none; }
.ct-row.is-attention { background: #FDF8F6; }   /* 要対応のある行（視線誘導の最小量・§02 NOTE2） */
.ct-row.is-attention:hover { background: #FBF1ED; }

/* 会社セル */
.ct-company { display: flex; align-items: center; gap: 10px; }
.ct-avatar {
  width: 36px; height: 36px;
  color: #fff;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}
.ct-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ct-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }

/* 契約フェーズ */
.ct-phase-month { font-size: 11px; font-weight: 500; color: var(--navy); }
.ct-phase-month.is-final { color: var(--status-improve-dot); }   /* 最終月（⚐） */
.ct-phase-left { font-size: 10px; color: var(--text-faint); margin-top: 2px; font-family: var(--font-mono); }

/* 3ヶ月ロードマップ（ミニガント） */
.ct-roadmap { padding-right: 24px; }
.mini-gantt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; font-size: 9.5px; }
.mini-col { display: flex; gap: 3px; flex-wrap: wrap; }
.mini-col.is-current { padding: 1px 4px; background: var(--gold-tint-soft); border-radius: var(--radius-sm); }
.mini-pill {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
}
.mini-pill.s-plan     { background: var(--status-plan-dot); }
.mini-pill.s-dev      { background: var(--status-dev-dot); }
.mini-pill.s-deliver1 { background: var(--status-deliver1-dot); }
.mini-pill.s-improve  { background: var(--status-improve-dot); }
.mini-pill.s-done     { background: var(--status-done-dot); }
.mini-pill.is-planned {
  background: transparent;
  color: var(--text-muted);
  border: 1px dashed var(--status-nogo-dot);
  padding: 1px 5px;
}
.ct-roadmap-sum { font-size: 10px; color: var(--text-muted); margin-top: 6px; }
.ct-roadmap-sum .nogo { text-decoration: line-through; color: var(--status-nogo-dot); }

/* 次回定例 */
.ct-meeting { font-size: 11.5px; color: var(--text); font-weight: 500; }
.ct-meeting.is-soon { color: var(--alert-fg); }
.ct-meeting .time { font-size: 10px; color: var(--text-muted); font-weight: 400; }

/* 要対応カウントバッジ */
.ct-attn { text-align: right; }
.attn-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 10px;
  font-family: var(--font-mono);
}
.attn-badge.is-alert   { background: var(--alert-fg);  color: #fff; }
.attn-badge.is-caution { background: var(--caution-bg); color: var(--caution-fg); }
.attn-badge.is-overdue {
  background: var(--alert-fg);
  color: #fff;
  font-size: 10.5px;
  padding: 3px 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.attn-badge.is-overdue svg { width: 9px; height: 9px; }
.attn-none { color: var(--text-faint); font-size: 11px; font-family: var(--font-mono); }

.ct-chevron { text-align: right; color: var(--text-faint); }
.ct-chevron svg { width: 16px; height: 16px; }

/* ---- フッター（新規追加＋同期） ---- */
.home-footer {
  padding: 14px 32px;
  background: var(--surface-alt);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.home-add-btn {
  background: transparent;
  border: 1px dashed var(--gold);
  color: var(--caution-fg);
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.home-add-btn:hover { background: var(--gold-tint-soft); }
.home-add-btn svg { width: 13px; height: 13px; }
.home-sync { font-size: 10.5px; color: var(--text-faint); font-family: var(--font-mono); }

/* レスポンシブ：狭い画面ではスタッツ・アラートを畳む（§6-6） */
@media (max-width: 1023px) {
  .stats-strip { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(odd) { border-right: 1px solid var(--border); }
  .home-alerts-grid { grid-template-columns: 1fr; }
}

/* ===== 新規クライアント作成モーダル ===== */
.cc-overlay { position: fixed; inset: 0; background: rgba(31,56,100,.42); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.cc-modal { background: var(--surface); width: 100%; max-width: 560px; border-radius: var(--radius-lg, 14px); box-shadow: 0 20px 60px rgba(0,0,0,.25); overflow: hidden; max-height: 90vh; display: flex; flex-direction: column; }
.cc-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.cc-title { font-size: 16px; font-weight: 700; color: var(--navy); }
.cc-x { border: none; background: none; font-size: 22px; line-height: 1; color: var(--text-faint); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.cc-x:hover { background: var(--paper); color: var(--navy); }
.cc-body { padding: 20px 22px; overflow-y: auto; }
.cc-note { font-size: 12px; color: var(--text-muted); line-height: 1.7; margin-bottom: 14px; }
.cc-field { display: block; margin-bottom: 12px; }
.cc-label { display: block; font-size: 12px; font-weight: 600; color: var(--navy); margin-bottom: 5px; }
.cc-label i { color: var(--alert-fg); font-style: normal; }
.cc-input { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--border); border-radius: var(--radius-md, 8px); font-size: 13px; color: var(--text); background: var(--surface); }
.cc-input:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31,56,100,.12); }
.cc-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cc-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 22px; border-top: 1px solid var(--border); background: var(--paper); }
.cc-cancel { padding: 9px 16px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius-md, 8px); font-size: 13px; color: var(--text-muted); cursor: pointer; }
.cc-save { padding: 9px 20px; border: none; background: var(--navy); color: #fff; border-radius: var(--radius-md, 8px); font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.cc-save:disabled { opacity: .7; cursor: default; }
.cc-err { background: var(--alert-bg, #fbeaea); color: var(--alert-fg); font-size: 12.5px; padding: 9px 12px; border-radius: var(--radius-md, 8px); margin-bottom: 12px; }
.cc-done-ttl { font-size: 15px; font-weight: 700; color: var(--success-fg); margin-bottom: 12px; }
.cc-done-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 7px 0; border-bottom: 1px dashed var(--border); }
.cc-done-row span { color: var(--text-muted); }
.cc-done-row a { color: var(--navy); font-weight: 600; text-decoration: none; }
.spinner { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; display: inline-block; animation: cc-spin .7s linear infinite; }
@keyframes cc-spin { to { transform: rotate(360deg); } }
@media (max-width: 560px) { .cc-row2 { grid-template-columns: 1fr; } }

/* ===== ホーム一覧：ミニ・ロードマップ帯（月別） ===== */
.rm-strip { display: flex; gap: 4px; align-items: stretch; margin-bottom: 7px; }
.rm-cell { flex: 1 1 0; min-width: 54px; min-height: 30px; border-radius: 6px; padding: 5px 8px 6px; display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--border); background: var(--paper); }
.rm-cell.is-past    { background: color-mix(in srgb, var(--navy) 8%, #fff); border-color: color-mix(in srgb, var(--navy) 14%, #fff); }
.rm-cell.is-current { flex: 3 1 0; background: var(--surface); border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.rm-cell.is-future  { border-style: dashed; background: transparent; }
.rm-bandwrap { display: flex; flex-wrap: wrap; gap: 4px; }
.rm-num { font-size: 9.5px; font-weight: 700; color: var(--text-faint); font-family: var(--font-mono); line-height: 1.2; white-space: nowrap; }
.rm-cell.is-current .rm-num { color: var(--gold-strong, var(--gold)); }
.rm-cell.is-past .rm-num { color: var(--navy); opacity: .55; }
.rm-band { display: inline-block; font-size: 9.5px; font-weight: 700; color: #fff; border-radius: 5px; padding: 2px 7px; line-height: 1.5; white-space: nowrap; }
.rm-band.s-plan     { background: var(--status-plan-dot); }
.rm-band.s-dev      { background: var(--status-dev-dot); }
.rm-band.s-deliver1 { background: var(--status-deliver1-dot); }
.rm-band.s-improve  { background: var(--status-improve-dot); }
.rm-band.s-done     { background: var(--status-done-dot); }
.rm-more { font-size: 9px; font-weight: 700; color: var(--text-muted); }
.rm-plan { font-size: 9px; color: var(--text-faint); }
