/* styles/is_dashboard.css
 * ISダッシュボード・IS管理画面専用スタイル。
 * 既存の base.css / home.css / transfer.css / master.css には触れない。
 */

/* ===== 共通レイアウト ===== */
.is-wrap {
  padding: 24px 28px 40px;
  max-width: 1280px;
  margin: 0 auto;
}
.is-head {
  margin-bottom: 24px;
}
.is-breadcrumb {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.is-breadcrumb span { white-space: nowrap; }
.is-breadcrumb .sep { color: var(--border-strong); }
.is-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.is-head-left h1 {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 4px;
}
.is-head-left .is-sub {
  font-size: 13px;
  color: var(--text-sub);
  margin: 0;
}
.is-head-meta {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 6px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.is-head-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* ===== KPI サマリーカード ===== */
.is-section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  margin: 0 0 14px;
  letter-spacing: 0.03em;
}
.is-kpi-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.is-kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.is-kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  border-radius: 12px 12px 0 0;
}
.is-kpi-card.green::before { background: #22c55e; }
.is-kpi-card.yellow::before { background: #eab308; }
.is-kpi-card.red::before { background: #ef4444; }
.is-kpi-card.gray::before { background: #9ca3af; }
.is-kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
  margin-bottom: 8px;
  letter-spacing: 0.03em;
}
.is-kpi-value {
  font-size: 36px;
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 4px;
}
.is-kpi-unit {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-sub);
  margin-left: 2px;
}
.is-kpi-target {
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 10px;
}
.is-kpi-progress {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 8px;
}
.is-kpi-progress-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.is-kpi-card.green .is-kpi-progress-bar { background: #22c55e; }
.is-kpi-card.yellow .is-kpi-progress-bar { background: #eab308; }
.is-kpi-card.red .is-kpi-progress-bar { background: #ef4444; }
.is-kpi-card.gray .is-kpi-progress-bar { background: #9ca3af; }
.is-kpi-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.is-kpi-rate { font-weight: 700; }
.is-kpi-card.green .is-kpi-rate { color: #16a34a; }
.is-kpi-card.yellow .is-kpi-rate { color: #a16207; }
.is-kpi-card.red .is-kpi-rate { color: #dc2626; }
.is-kpi-delta { color: var(--text-sub); }
.is-kpi-delta.up { color: #16a34a; }
.is-kpi-delta.down { color: #dc2626; }

/* ===== メンバーテーブル ===== */
.is-member-section {
  margin-bottom: 32px;
}
.is-member-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.is-period-select {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
}
.is-table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
}
.is-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.is-table th {
  background: var(--bg);
  color: var(--text-sub);
  padding: 10px 12px;
  text-align: center;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: 12px;
}
.is-table th.text-left { text-align: left; }
.is-table td {
  padding: 10px 12px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.is-table td.text-left { text-align: left; }
.is-table tbody tr {
  cursor: pointer;
  transition: background 0.1s;
}
.is-table tbody tr:hover { background: var(--accent-soft); }
.is-table tbody tr:last-child td { border-bottom: none; }
.is-member-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.is-role-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}
.is-role-badge.mgr {
  background: rgba(79, 110, 247, 0.12);
  color: var(--accent);
}
.is-cell-kpi {
  white-space: nowrap;
}
.is-cell-rate {
  font-size: 11px;
  font-weight: 600;
  margin-left: 4px;
}
.is-cell-rate.green { color: #16a34a; }
.is-cell-rate.yellow { color: #a16207; }
.is-cell-rate.red { color: #dc2626; }
.is-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.is-status-badge.excellent { background: rgba(34,197,94,0.12); color: #16a34a; }
.is-status-badge.good { background: rgba(34,197,94,0.08); color: #16a34a; }
.is-status-badge.warning { background: rgba(234,179,8,0.15); color: #a16207; }
.is-status-badge.danger { background: rgba(239,68,68,0.12); color: #dc2626; }
.is-status-badge.off { background: rgba(156,163,175,0.15); color: var(--text-sub); }

/* ===== チャートセクション ===== */
.is-chart-section {
  margin-bottom: 32px;
}
.is-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}
.is-chart-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.is-chart-canvas {
  width: 100%;
  max-height: 320px;
}

/* ===== 累計プログレス ===== */
.is-cumulative-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.is-cum-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 20px;
  box-shadow: var(--shadow);
}
.is-cum-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
}
.is-cum-values {
  font-size: 12px;
  color: var(--text-sub);
}
.is-cum-progress {
  width: 100%;
  height: 12px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.is-cum-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}
.is-cum-bar.green { background: #22c55e; }
.is-cum-bar.yellow { background: #eab308; }
.is-cum-bar.red { background: #ef4444; }

/* ===== メンバー詳細モーダル ===== */
.is-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 20px;
  overflow-y: auto;
}
.is-modal-overlay.active { display: flex; }
.is-modal {
  background: var(--surface);
  border-radius: 14px;
  width: 100%;
  max-width: 860px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  max-height: calc(100vh - 80px);
  overflow-y: auto;
}
.is-modal-head {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
  border-radius: 14px 14px 0 0;
}
.is-modal-head h2 { margin: 0; font-size: 17px; font-weight: 700; }
.is-modal-body { padding: 20px 24px; }
.is-modal-section { margin-bottom: 24px; }
.is-modal-section:last-child { margin-bottom: 0; }
.is-modal-section h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-sub);
  margin: 0 0 10px;
}
.is-modal-chart { max-height: 240px; }
.is-modal-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.is-modal-list-item {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.is-modal-list-item:last-child { border-bottom: none; }

/* ===== Admin タブ ===== */
.is-admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.is-admin-tab {
  padding: 10px 18px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-sub);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}
.is-admin-tab:hover { color: var(--text); }
.is-admin-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.is-admin-content { min-height: 300px; }

/* Admin フォーム共通 */
.is-form-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.is-form-label {
  width: 140px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  padding-top: 8px;
  color: var(--text);
}
.is-form-label .req {
  color: #dc2626;
  font-size: 11px;
  margin-left: 2px;
}
.is-form-input {
  flex: 1;
}
.is-form-input input,
.is-form-input select,
.is-form-input textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.is-form-input input:focus,
.is-form-input select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* Admin テーブル */
.is-admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.is-admin-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
.is-admin-table th {
  background: var(--bg);
  color: var(--text-sub);
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
  font-size: 12px;
}
.is-admin-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.is-admin-table tbody tr:last-child td { border-bottom: none; }

/* Sync log */
.is-sync-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.is-sync-badge.success { background: rgba(34,197,94,0.12); color: #16a34a; }
.is-sync-badge.failure { background: rgba(239,68,68,0.12); color: #dc2626; }
.is-sync-badge.partial { background: rgba(234,179,8,0.15); color: #a16207; }

/* ===== ローディング・空・エラー ===== */
.is-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-sub);
  font-size: 14px;
}
.is-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-sub);
  font-size: 14px;
}
.is-error {
  text-align: center;
  padding: 40px 20px;
  color: #dc2626;
  font-size: 14px;
  background: #fef2f2;
  border-radius: 10px;
  border: 1px solid #fecaca;
}

/* ===== ダークモード ===== */
[data-theme="dark"] .is-kpi-card.green .is-kpi-rate { color: #4ade80; }
[data-theme="dark"] .is-kpi-card.yellow .is-kpi-rate { color: #facc15; }
[data-theme="dark"] .is-kpi-card.red .is-kpi-rate { color: #f87171; }
[data-theme="dark"] .is-cell-rate.green { color: #4ade80; }
[data-theme="dark"] .is-cell-rate.yellow { color: #facc15; }
[data-theme="dark"] .is-cell-rate.red { color: #f87171; }
[data-theme="dark"] .is-status-badge.excellent { background: rgba(34,197,94,0.2); color: #4ade80; }
[data-theme="dark"] .is-status-badge.good { background: rgba(34,197,94,0.15); color: #4ade80; }
[data-theme="dark"] .is-status-badge.warning { background: rgba(234,179,8,0.2); color: #facc15; }
[data-theme="dark"] .is-status-badge.danger { background: rgba(239,68,68,0.2); color: #f87171; }
[data-theme="dark"] .is-error { background: rgba(239,68,68,0.1); border-color: rgba(239,68,68,0.3); }

/* ===== レスポンシブ ===== */
@media (max-width: 900px) {
  .is-kpi-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .is-wrap { padding: 16px 14px 30px; }
  .is-head-left h1 { font-size: 18px; }
  .is-kpi-grid { grid-template-columns: 1fr; }
  .is-kpi-value { font-size: 28px; }
  .is-head-row { flex-direction: column; }
  .is-head-actions { width: 100%; }
  .is-form-row { flex-direction: column; }
  .is-form-label { width: auto; padding-top: 0; }
  .is-admin-tabs { overflow-x: auto; }
}
@media (max-width: 480px) {
  .is-kpi-value { font-size: 24px; }
}
