/* ==========================================================================
   HIKOTA 営業ナビ（仮称）- 管理者ダッシュボード スタイル
   所有者: 管理者ビュー担当（Sonnet）
   命名規則: 全クラスに .mgr- プレフィクスを付け、他ビューと名前空間を分離する。
   デザイントークンは assets/style.css の :root 定義（--brand 等）を前提に利用する。
   カード上部・左のアクセントバー装飾はここでも使わない（社長の絶対指示）。
   ========================================================================== */

.mgr-root {
  font-family: "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", sans-serif;
  color: var(--ink);
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 56px;
  box-sizing: border-box;
}

.mgr-root,
.mgr-root *,
.mgr-root *::before,
.mgr-root *::after {
  box-sizing: border-box;
}

/* 日本語の改行事故防止（単語途中/孤立文字/意味の切れ目での改行を避ける） */
.mgr-root,
.mgr-root p,
.mgr-root li,
.mgr-root td,
.mgr-root th,
.mgr-root span,
.mgr-root div {
  word-break: auto-phrase;
  text-wrap: pretty;
}

.mgr-panel-title,
.mgr-page-title {
  font-family: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", serif;
  text-wrap: balance;
}

/* ---- タブ切替（ダッシュボード / 設定） ---- */

.mgr-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.mgr-tab {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--sub);
  cursor: pointer;
  font-size: 14px;
  padding: 10px 20px;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.mgr-tab:hover {
  color: var(--ink);
}

.mgr-tab.is-active {
  border-bottom-color: var(--brand);
  color: var(--ink);
  font-weight: 600;
}

.mgr-view[hidden] {
  display: none;
}

/* ---- KPIカード ---- */

.mgr-kpis {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 24px;
}

@media (max-width: 900px) {
  .mgr-kpis {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .mgr-kpis {
    grid-template-columns: 1fr;
  }
}

.mgr-kpi-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 18px 20px;
}

.mgr-kpi-label {
  color: var(--sub);
  font-size: 12px;
  margin-bottom: 10px;
}

.mgr-kpi-value {
  color: var(--ink);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.25;
}

.mgr-kpi-unit {
  color: var(--sub);
  font-size: 14px;
  font-weight: 400;
  margin-left: 2px;
}

.mgr-kpi-delta {
  font-size: 13px;
  font-weight: 600;
  margin-left: 8px;
}

.mgr-kpi-delta.is-up {
  color: var(--good);
}

.mgr-kpi-delta.is-down {
  color: var(--risk);
}

.mgr-kpi-delta.is-flat {
  color: var(--sub);
}

.mgr-kpi-sub {
  color: var(--sub);
  font-size: 12px;
  margin-top: 8px;
}

/* ---- 汎用パネル ---- */

.mgr-panel {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-bottom: 24px;
  padding: 20px 22px 22px;
}

.mgr-panel-title {
  font-size: 17px;
  margin: 0 0 6px;
}

.mgr-panel-desc {
  color: var(--sub);
  font-size: 13px;
  margin: 0 0 16px;
}

/* ---- 散布図 ---- */

.mgr-scatter-wrap {
  overflow-x: auto;
  width: 100%;
}

.mgr-scatter-wrap svg {
  display: block;
  height: auto;
  min-width: 480px;
  width: 100%;
}

.mgr-scatter-axis-line {
  stroke: var(--sub);
  stroke-width: 1;
}

.mgr-scatter-tick {
  stroke: var(--line);
  stroke-width: 1;
}

.mgr-scatter-tick-label {
  fill: var(--sub);
}

.mgr-scatter-axis-label {
  fill: var(--sub);
}

.mgr-scatter-guide {
  stroke: var(--line);
  stroke-dasharray: 4 4;
  stroke-width: 1;
}

.mgr-scatter-point {
  opacity: 0.78;
}

.mgr-scatter-point--a {
  fill: var(--good);
}

.mgr-scatter-point--b {
  fill: var(--accent);
}

.mgr-scatter-point--c {
  fill: var(--warn);
}

.mgr-scatter-point--highlight {
  opacity: 1;
  stroke: var(--ink);
  stroke-width: 1.5;
}

.mgr-scatter-callout-line {
  stroke: var(--ink);
  stroke-width: 1;
}

.mgr-scatter-callout-box {
  fill: var(--bg);
  stroke: var(--line);
  stroke-width: 1;
}

.mgr-scatter-callout-title {
  fill: var(--ink);
  font-weight: 700;
}

.mgr-scatter-callout-sub {
  fill: var(--sub);
}

.mgr-legend {
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px 20px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.mgr-legend-item {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
}

.mgr-legend-dot {
  border-radius: 50%;
  display: inline-block;
  height: 10px;
  margin-right: 6px;
  width: 10px;
}

.mgr-legend-dot--a {
  background: var(--good);
}

.mgr-legend-dot--b {
  background: var(--accent);
}

.mgr-legend-dot--c {
  background: var(--warn);
}

/* ---- アラートリスト ---- */

.mgr-alerts-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 24px;
}

@media (max-width: 860px) {
  .mgr-alerts-grid {
    grid-template-columns: 1fr;
  }
}

.mgr-alert-list {
  counter-reset: mgr-alert;
  list-style: none;
  margin: 0;
  padding: 0;
}

.mgr-alert-item {
  align-items: baseline;
  border-bottom: 1px solid var(--line);
  counter-increment: mgr-alert;
  display: flex;
  flex-wrap: wrap;
  font-size: 13.5px;
  gap: 4px 10px;
  padding: 11px 0;
}

.mgr-alert-item:last-child {
  border-bottom: none;
  padding-bottom: 2px;
}

.mgr-alert-item::before {
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--sub);
  content: counter(mgr-alert);
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 11px;
  height: 20px;
  justify-content: center;
  width: 20px;
}

.mgr-alert-name {
  color: var(--ink);
  flex: 1 1 160px;
  font-weight: 600;
  min-width: 0;
}

.mgr-alert-rep {
  color: var(--sub);
  flex: 0 0 auto;
}

.mgr-alert-metric {
  flex: 1 1 100%;
  font-size: 13px;
}

.mgr-alert-list--churn .mgr-alert-metric {
  color: var(--risk);
}

.mgr-alert-list--unvisited .mgr-alert-metric {
  color: var(--warn);
}

.mgr-alert-empty {
  color: var(--sub);
  font-size: 13px;
  padding: 10px 0;
}

/* ---- 担当者テーブル ---- */

.mgr-rep-table-wrap {
  overflow-x: auto;
}

.mgr-rep-table {
  border-collapse: collapse;
  font-size: 13.5px;
  width: 100%;
}

.mgr-rep-table th,
.mgr-rep-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 12px;
  text-align: right;
  white-space: nowrap;
}

.mgr-rep-table th:nth-child(1),
.mgr-rep-table td:nth-child(1),
.mgr-rep-table th:nth-child(2),
.mgr-rep-table td:nth-child(2) {
  text-align: left;
}

.mgr-rep-table thead th {
  border-bottom: 1px solid var(--ink);
  color: var(--sub);
  font-size: 12px;
  font-weight: 500;
}

.mgr-rep-table tbody tr:hover {
  background: rgba(0, 0, 0, 0.02);
}

.mgr-eff-high {
  background: var(--bg);
  background: color-mix(in srgb, var(--good) 14%, var(--bg));
}

.mgr-eff-low {
  background: var(--bg);
  background: color-mix(in srgb, var(--warn) 14%, var(--bg));
}

.mgr-table-caption {
  color: var(--sub);
  font-size: 12px;
  margin-top: 12px;
}

/* ---- 設定ビュー ---- */

.mgr-settings-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 860px) {
  .mgr-settings-grid {
    grid-template-columns: 1fr;
  }
}

.mgr-simple-table {
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 6px;
  width: 100%;
}

.mgr-simple-table th,
.mgr-simple-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 10px;
  text-align: left;
}

.mgr-simple-table thead th {
  color: var(--sub);
  font-size: 12px;
  font-weight: 500;
}

.mgr-weight-bar-cell {
  width: 45%;
}

.mgr-weight-bar-track {
  background: var(--line);
  border-radius: 3px;
  height: 8px;
  overflow: hidden;
  width: 100%;
}

.mgr-weight-bar-fill {
  background: var(--accent);
  height: 100%;
}

.mgr-note {
  color: var(--sub);
  font-size: 12.5px;
  margin: 10px 0 0;
}

.mgr-fallback {
  color: var(--sub);
  font-size: 13px;
  padding: 24px 4px;
}
