/* =========================================================
   KPI / Monthly Strip / Yearly / Ranking (home & acquire/detail)
   ========================================================= */

:root {
  /* ----- Base (背景/文字/罫線) ----- */
  --kpi-bg: var(--card-bg, #ffffff);
  --kpi-fg: var(--body-color, #222);
  --kpi-muted: #6c757d;
  --kpi-line: rgba(0, 0, 0, .06);

  /* ----- Strip (ETカード) ----- */
  --strip-bg: #f7f7fb;
  --strip-border: rgba(0, 0, 0, .06);

  /* ----- Theme Colors（意味で統一） ----- */
  --tone-et: #474f97;
  /* ET */
  --tone-install: #427292;
  /* OK */
  --tone-ok: #2f7a6a;
  /* 設置（確定） */
  --tone-cxl: #aab3b9;
  /* CXL */

  /* 年間テーブル用（設置済/設置予定） */
  --tone-delivery-done: #7a5a9e;
  /* 設置済 */
  --tone-delivery-plan: #89799c;
  /* 設置予定 */
  --tone-diff: #8765c7;
  /* 差分 */

  /* ----- Head Colors（ヘッダー/アイコン/チップ共通） ----- */
  --head-et: var(--tone-et);
  --head-current: var(--tone-install);
  /* 設置 */
  --head-closed: var(--tone-ok);
  /* 設置 */

  /* KPI compare header border */
  --kpi-head-border: #eef1f8;

  /* ----- Chip Colors ----- */
  --chip-et: var(--head-et);
  --chip-current: var(--head-current);
  --chip-ok: var(--head-closed);
  --chip-diff: var(--tone-diff);

  /* ----- Table Header Tokens（ランキング/年間表で共有） ----- */
  --th-et: var(--tone-et);
  --th-install: var(--tone-install);
  --th-install-rate: #7897ac;
  /* 設置率 */
  --th-install-ave: #7897ac;
  /* 設置Ave */
  --th-ok: var(--tone-ok);
  --th-cxl: var(--tone-cxl);

  --th-delivery-done: var(--tone-delivery-done);
  --th-delivery-plan: var(--tone-delivery-plan);

  /* breakdown th */
  --th-break-bg: #f3f3f3;
  --th-break-fg: #313131;
}

/* 内訳 */
th.is-breakdown {
  font-size: .78rem;
  letter-spacing: .01em;
  opacity: .9;
}

/* =========================================================
  Layout
   ========================================================= */
.monthly-wrap {
  padding-top: 6px;
}

/* =========================================================
  共通：丸背景アイコン
   ========================================================= */
.ui-ico {
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  flex: 0 0 auto;
}

.ui-ico i {
  opacity: .95;
}

.ui-ico.-et {
  background: color-mix(in srgb, var(--head-et) 16%, transparent);
  color: var(--head-et);
}

.ui-ico.-current {
  background: color-mix(in srgb, var(--head-current) 16%, transparent);
  color: var(--head-current);
}

.ui-ico.-closed {
  background: color-mix(in srgb, var(--head-closed) 16%, transparent);
  color: var(--head-closed);
}


/* =========================================================
  Monthly Strip (ET)
   ========================================================= */
.monthly-strip {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--strip-border);
  background: var(--strip-bg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
  margin: 8px 0 10px;
}

.monthly-strip.-et {
  border-color: color-mix(in srgb, var(--head-et) 7%, var(--strip-border));
}

.monthly-strip .strip-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.monthly-strip .strip-title {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  font-weight: 900;
  letter-spacing: .01em;
  white-space: nowrap;
  color: var(--kpi-fg);
}

.monthly-strip .strip-row {
  gap: 5px;
}

.monthly-strip .strip-main {
  display: flex;
  align-items: baseline;
  gap: .3rem;
  flex-wrap: wrap;
}

.monthly-strip .strip-num {
  font-size: clamp(1.55rem, 3.2vw, 2.2rem);
  font-weight: 900;
  line-height: 1.05;
  color: var(--kpi-fg);
}

.monthly-strip .strip-unit {
  font-size: .9rem;
  font-weight: 800;
  color: var(--kpi-muted);
  margin-right: .55rem;
}

.monthly-strip .strip-inline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px 12px;
  min-width: 0;
}

.monthly-strip .strip-meta {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  flex-wrap: wrap;
}

.monthly-strip .meta-label {
  color: var(--kpi-muted);
  font-size: .85rem;
}

.monthly-strip .meta-val {
  font-weight: 900;
  font-size: 1.12rem;
  color: var(--kpi-fg);
}

.monthly-strip .meta-sep {
  color: var(--kpi-muted);
  font-weight: 900;
  margin: 0 .1rem;
}

.monthly-strip .strip-ave {
  display: inline-flex;
  align-items: baseline;
  gap: .45rem;
  flex-wrap: nowrap;
  margin-left: auto;
  justify-content: flex-end;
  white-space: nowrap;
}

.monthly-strip .strip-ave .meta-val {
  font-weight: 900;
  font-size: 1.12rem;
}

.monthly-strip .meta-unit {
  font-size: .72em;
  font-weight: 800;
  color: var(--kpi-muted);
  margin-left: .15rem;
  letter-spacing: .02em;
  white-space: nowrap;
}

/* =========================================================
  KPI 外側カード
   ========================================================= */
.kpi {
  background: var(--kpi-bg);
  border: 1px solid var(--kpi-line);
  border-radius: 7px;
  padding: 12px 12px 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .06);
  min-width: 0;
}

/* OK（current） */
.kpi-accent {
  border-color: color-mix(in srgb, var(--head-current) 28%, var(--kpi-line));
  border-top: 3px solid color-mix(in srgb, var(--head-current) 70%, #fff);
}

/* 設置（確定OK（closed）） */
.kpi-olive {
  border-color: color-mix(in srgb, var(--head-closed) 28%, var(--kpi-line));
  border-top: 3px solid color-mix(in srgb, var(--head-closed) 70%, #fff);
}

/* =========================================================
  KPI 比較カード（kpi-compare）
   ========================================================= */
.kpi.kpi-compare {
  background: #ffffff;
  border: 1px solid #e3e7f2;
  overflow: hidden;
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
}

.kpi.kpi-compare .kpi-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--kpi-head-border);
  background: transparent;
}

.kpi.kpi-compare .kpi-title {
  font-weight: 900;
  color: var(--kpi-fg);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
}

.kpi.kpi-compare .kpi-title>span {
  min-width: 0;
  overflow: hidden;
}

.kpi-title .kpi-sub-text {
  font-size: .9rem;
  font-weight: 700;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .kpi-title .kpi-sub-text {
    font-size: .72rem;
  }
}

.kpi.kpi-compare .kpi-head-right {
  display: inline-flex;
  align-items: baseline;
  gap: .45rem;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: 0;
}

.kpi.kpi-compare .kpi-head-ave {
  font-weight: 900;
  color: var(--kpi-fg);
  white-space: nowrap;
  font-size: clamp(1.06rem, 2.8vw, 1.18rem);
  line-height: 1.1;
}

.kpi.kpi-compare .kpi-head-ave .meta-unit {
  font-size: .72em;
  font-weight: 800;
  color: var(--kpi-muted);
  margin-left: .15rem;
  letter-spacing: .02em;
  white-space: nowrap;
}

.kpi-closed-date {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .82rem;
  font-weight: 800;
  white-space: nowrap;
}

.kpi-closed-date i {
  opacity: .9;
}

.kpi-head-row.kpi-diff {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  white-space: nowrap;
}

/* =========================================================
  KPI metric（件数/率 と クレカ率）
   ========================================================= */
.kpi.kpi-compare .kpi-compare-top {
  padding: 9px 7px;
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 12px;
}

@media (max-width: 359.98px) {
  .kpi.kpi-compare .kpi-compare-top {
    grid-template-columns: 1fr;
  }
}

.kpi-compare .metric {
  border: 1px solid var(--kpi-line);
  border-radius: 7px;
  padding: 10px 10px 8px;
  background: #fff;
  min-width: 0;
}

.kpi-accent.kpi-compare .metric {
  background: color-mix(in srgb, var(--head-current) 4%, #fff);
}

.kpi-olive.kpi-compare .metric {
  background: color-mix(in srgb, var(--head-closed) 4%, #fff);
}

.kpi.kpi-compare .metric-label {
  color: var(--kpi-fg);
  font-weight: 800;
  margin-bottom: 6px;
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  white-space: nowrap;
  font-size: clamp(.84rem, 2.3vw, .95rem);
}

.kpi.kpi-compare .metric-value {
  display: flex;
  align-items: baseline;
  gap: .25rem;
  flex-wrap: wrap;
}

.kpi-compare .metric-num {
  font-size: clamp(1.35rem, 2.8vw, 2.0rem);
  font-weight: 900;
  line-height: 1.1;
  color: var(--kpi-fg);
}

.kpi-compare .metric-rate {
  font-size: clamp(1.10rem, 2.3vw, 1.6rem);
  font-weight: 900;
  color: var(--kpi-fg);
}

.kpi-compare .metric-card-rate {
  font-size: clamp(1.35rem, 2.8vw, 2.0rem);
  font-weight: 900;
  line-height: 1.1;
}

.kpi-compare .metric-unit,
.kpi-compare .metric-sep {
  color: var(--kpi-muted);
  font-weight: 800;
  font-size: .92em;
}

.kpi-compare .metric-sep {
  font-weight: 900;
  margin: 0 .15rem;
}

.kpi-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}

.kpi-meta li {
  display: inline-flex;
  align-items: baseline;
  gap: .35rem;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

.kpi-meta .meta-label {
  color: var(--kpi-muted);
  font-size: clamp(.82rem, 2.2vw, .92rem);
}

.kpi-meta .meta-val {
  font-weight: 900;
  font-size: clamp(.92rem, 2.6vw, 1.12rem);
  color: var(--kpi-fg);
}

/* アイコン色 */
.metric-ico.-et {
  color: var(--head-et);
}

.metric-ico.-current {
  color: var(--head-current);
}

.metric-ico.-closed {
  color: var(--head-closed);
}

/* =========================================================
  Chip（Ave）
   ========================================================= */
.meta-chip {
  display: inline-flex;
  align-items: center;
  padding: .3rem .7rem;
  border-radius: 999px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .02em;
  white-space: nowrap;
  border: 1px solid var(--kpi-line);
  background: #f6f7fb;
  color: var(--kpi-fg);
  font-size: clamp(.75rem, 2.2vw, .88rem);
}

.meta-chip.-et {
  background: color-mix(in srgb, var(--chip-et) 10%, #fff);
  color: var(--chip-et);
  border-color: color-mix(in srgb, var(--chip-et) 25%, var(--kpi-line));
}

.meta-chip.-current {
  background: color-mix(in srgb, var(--chip-current) 10%, #fff);
  color: var(--chip-current);
  border-color: color-mix(in srgb, var(--chip-current) 25%, var(--kpi-line));
}

.meta-chip.-ok {
  background: color-mix(in srgb, var(--chip-ok) 10%, #fff);
  color: var(--chip-ok);
  border-color: color-mix(in srgb, var(--chip-ok) 25%, var(--kpi-line));
}

/* =========================================================
   KPI head-right：OKAve / 差分（右上）
   ========================================================= */

/* 差分行（全体） */
.kpi.kpi-compare .kpi-head-row.kpi-diff {
  display: inline-flex;
  align-items: baseline;
  white-space: nowrap;

  gap: .22rem;
}

.kpi.kpi-compare .kpi-head-row.kpi-diff .kpi-diff-label {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .7rem;
  border-radius: 999px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: .02em;
  white-space: nowrap;
  background: color-mix(in srgb, var(--chip-diff) 16%, #fff);
  color: var(--chip-diff);
  border: 1px solid color-mix(in srgb, var(--chip-diff) 28%, var(--kpi-line));
  font-size: clamp(.75rem, 2.2vw, .88rem);
}


.kpi.kpi-compare .kpi-head-row.kpi-diff .kpi-diff-val,
.kpi.kpi-compare .kpi-head-row.kpi-diff .kpi-diff-rate {
  font-weight: 900;
  color: var(--kpi-fg);
  font-size: clamp(1.06rem, 2.8vw, 1.18rem);
  line-height: 1.1;
}

.kpi.kpi-compare .kpi-head-row.kpi-diff .kpi-diff-unit {
  font-size: .8em;
  font-weight: 800;
  color: var(--kpi-muted);
  letter-spacing: .02em;
  white-space: nowrap;
}

.kpi.kpi-compare .kpi-head-row.kpi-diff .kpi-diff-sep {
  color: var(--kpi-muted);
  font-weight: 900;
  margin: 0 .04rem;
}

@media (max-width: 991.98px) {
  .kpi.kpi-compare .kpi-head-right {
    flex-wrap: wrap;
    /* 折り返し許可 */
    justify-content: flex-end;
    column-gap: .45rem;
    row-gap: .25rem;
  }

  .kpi.kpi-compare .kpi-head-right .meta-chip.-ok,
  .kpi.kpi-compare .kpi-head-right .kpi-head-ave {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  /* 差分だけ2行目へ */
  .kpi.kpi-compare .kpi-head-row.kpi-diff {
    flex-basis: 100%;
    justify-content: flex-end;
  }
}


/* =========================================================
  設置（確定OK）セクション
   ========================================================= */
.kpi.is-pending {
  opacity: 0.7;
}

.closed-date {
  font-weight: 600;
}

.closed-status.is-closed-text {
  color: var(--succ-600, #28a745);
  font-weight: 600;
}

/* =========================================================
  KPI Compare Grid（設置/OK）
   ========================================================= */
.kpi-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

@media (max-width: 575.98px) {
  .kpi-compare-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
  Yearly tables（年間データ表）
   ========================================================= */
#total_count_list tbody th.acquired {
  background: var(--th-et);
  color: #ffffff;
}

#total_count_list tbody th.ok {
  background: var(--th-install);
  color: #ffffff;
}

#total_count_list tbody th.cancel {
  background: var(--th-cxl);
  color: #ffffff;
}

#total_count_list tbody th.ok_rate {
  background: var(--th-install-rate);
  color: #ffffff;
}

#total_count_list tbody th.ok_ave {
  background: var(--th-install-ave);
  color: #ffffff;
}

#total_count_list tbody th.delivery {
  background: var(--th-delivery-done);
  color: #ffffff;
}

#total_count_list tbody th.first_delivery {
  background: var(--th-delivery-plan);
  color: #ffffff;
}

/* 内訳（年間表） */
#total_count_list tbody th.credit.is-breakdown,
#total_count_list tbody th.other.is-breakdown {
  background: var(--th-break-bg);
  color: var(--th-break-fg);
}

/* =========================================================
   Ranking Table
   ========================================================= */
#ranking_list {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: #ffffff;
  overflow: hidden;
}

#ranking_list th,
#ranking_list td {
  border: 1px solid #e0e6ed;
  vertical-align: middle;
}

#ranking_list td {
  padding: 10px;
  line-height: 1.2;
}

#ranking_list thead th {
  padding: .4rem .5rem;
  font-size: .82rem;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#ranking_list .rank-col {
  width: 12%;
  text-align: center;
}

#ranking_list .name-col {
  width: 24%;
  text-align: left;
}

#ranking_list .workdays-col,
#ranking_list .et-col,
#ranking_list .ok-col {
  width: 10%;
}

#ranking_list .okave-col {
  width: 16%;
}

#ranking_list .okrate-col {
  width: 15%;
  text-align: right;
}

#ranking_list th.name-col,
#ranking_list th.okrate-col {
  text-align: center;
}

#ranking_list th.rank-col {
  background: #bdbcbc;
}

#ranking_list th.name-col {
  background: #bdbcbc;
}

#ranking_list th.workdays-col {
  background: #268917;
}

#ranking_list th.et-col {
  background: var(--th-et);
}

#ranking_list th.ok-col {
  background: var(--th-install);
}

#ranking_list th.okrate-col {
  background: var(--th-install-rate);
}

#ranking_list th.okave-col {
  background: var(--th-install-ave);
}

#ranking_list tbody td {
  font-size: .92rem;
}

#ranking_list tbody td.et-col,
#ranking_list tbody td.ok-col,
#ranking_list tbody td.workdays-col,
#ranking_list tbody td.okrate-col,
#ranking_list tbody td.okave-col {
  font-size: 1rem;
}

#ranking_list tbody td.etave-col {
  color: var(--tone-et);
}

#ranking_list tbody td.okave-col {
  color: var(--tone-install);
  font-weight: 900;
  text-align: right;
}

#ranking_list tbody td.okrate-col {
  color: var(--tone-install-rate);
  font-weight: 900;
  text-align: right;
}

#ranking_list tbody td.et-col,
#ranking_list tbody td.ok-col,
#ranking_list tbody td.workdays-col {
  text-align: right;
}

#ranking_list tbody td.name-col,
#ranking_list tbody td.name-col a {
  font-weight: 600;
  /* font-size: .95rem; */
  text-decoration: none;
}

#ranking_list tbody td.name-col a:hover,
#ranking_list tbody td.name-col:hover {
  text-decoration: underline;
  text-decoration-color: currentColor;
}

.ranking-icon {
  vertical-align: middle;
}

#ranking_list tbody tr:nth-child(1) .ranking-icon,
#ranking_list tbody tr:nth-child(2) .ranking-icon,
#ranking_list tbody tr:nth-child(3) .ranking-icon {
  width: 35px;
  height: 35px;
}

#ranking_list tbody tr:nth-child(n+4) .ranking-icon {
  width: 25px;
  height: 25px;
}

#ranking_list tbody tr:nth-child(1) td,
#ranking_list tbody tr:nth-child(2) td,
#ranking_list tbody tr:nth-child(3) td {
  height: 40px;
}

#ranking_list tbody td:first-child {
  padding: 3px 5px;
}

@media (max-width: 991.98px) {
  #ranking_list thead th {
    font-size: clamp(.74rem, 1.9vw, .82rem);
    padding: .35rem .4rem;
  }

  #ranking_list td {
    padding: 8px;
    font-size: clamp(.84rem, 2.0vw, .95rem);
  }

  #ranking_list td.name-col,
  #ranking_list td.name-col a {
    font-size: clamp(.86rem, 2.0vw, .98rem);
  }
}

@media (max-width: 575.98px) {
  #ranking_list thead th {
    font-size: clamp(.66rem, 2.6vw, .78rem);
    padding: .3rem .35rem;
  }

  #ranking_list td {
    padding: 7px 6px;
    font-size: clamp(.80rem, 2.9vw, .92rem);
  }

  #ranking_list td.name-col,
  #ranking_list td.name-col a {
    font-size: clamp(.82rem, 2.9vw, .94rem);
  }
}

/* =========================================================
  Commission Table（ランキング寄せ）
   ========================================================= */

.commission-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: #ffffff;
  overflow: hidden;
}

.commission-table th,
.commission-table td {
  border: 1px solid #e0e6ed;
  vertical-align: middle;
}

.commission-table td {
  padding: 10px;
  line-height: 1.2;
  font-size: .92rem;
}

.commission-table thead th {
  padding: .4rem .5rem;
  font-size: .82rem;
  font-weight: 700;
  color: #ffffff;
  /* ←白文字 */
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 列ごとのヘッダ色（お好みで微調整OK） */
.commission-table thead th:nth-child(1) {
  background: #bdbcbc;
}

/* 氏名 */
.commission-table thead th:nth-child(2) {
  background: var(--th-install);
}

/* 確定OK */
.commission-table thead th:nth-child(3) {
  background: var(--th-et);
}

/* 現在OK（色は仮。OKなら --th-install でも） */
.commission-table thead th:nth-child(4) {
  background: var(--th-cxl);
}

/* 減少数 */
.commission-table thead th:nth-child(5) {
  background: var(--th-install-rate);
}

/* 減少率 */

/* 名前列の見た目をランキング寄せ */
.commission-table td.name-col {
  font-weight: 600;
  text-align: left;
}

/* 数値列は右寄せ、強調 */
.commission-table td.text-right {
  font-size: 1rem;
  font-weight: 900;
}

/* 全体行を分かりやすく（任意） */
.commission-table tbody tr:last-child {
  background: color-mix(in srgb, var(--pri-500, #6f42c1) 6%, #fff);
  font-weight: 900;
}