/* =========================================================
   impact.css (FULL REPLACE)
   only /impact
   目的:
   - 左カラム: カード内スクロールを発生させない（全部表示）
   - 右カラム: 入力しやすい/結果が分かる（凡例・列ヒント・ヘッダー固定）
   - SP: テーブルは隠してカード表示に統一
========================================================= */

/* scope */
.impact-page{
  --impact-gap: 18px;
}

/* =========================================================
   1) レイアウト: PCは2カラム / SPは1カラム
========================================================= */
@media (min-width: 1024px){
  .impact-page .tp-local-grid{
    display: grid;
    grid-template-columns: 440px 1fr;
    gap: 20px;
    align-items: start;
  }

  /* 左カラム: 内部スクロールを絶対に作らない */
  .impact-page .tp-local-grid > .tp-card:first-child{
    position: static !important;
    top: auto !important;
    max-height: none !important;
    overflow: visible !important;
  }

  /* 右カラム: 見やすさを少し強調 */
  .impact-page .tp-local-grid > .tp-card:last-child{
    box-shadow: 0 14px 34px rgba(2,6,23,.12);
  }
}

/* =========================================================
   2) 入力: 押しやすさUP
========================================================= */
.impact-page .tp-input,
.impact-page .tp-select,
.impact-page .tp-textarea{
  min-height: 44px;
  font-size: 14px;
  line-height: 1.6;
}

.impact-page .tp-textarea{
  padding-top: 10px;
  padding-bottom: 10px;
}

.impact-page .tp-btn{
  min-height: 42px;
}

@media (max-width: 720px){
  /* ボタンは縦積み（誤タップ防止） */
  .impact-page .tp-actions{
    display: grid;
    gap: 10px;
  }
  .impact-page .tp-actions .tp-btn{
    width: 100%;
    min-height: 46px;
  }
  /* 一括貼り付けは広め */
  .impact-page #bulk{ min-height: 220px; }
}

/* =========================================================
   3) 左カラム: details を見やすく
========================================================= */
.impact-page .tp-details{
  margin-top: 12px;
}

/* warn */
.impact-page .tp-warn{
  border: 1px solid rgba(245,158,11,.35);
  background: rgba(245,158,11,.08);
  color: #7c2d12;
  border-radius: 14px;
  padding: 10px 12px;
  font-weight: 800;
}

/* KPI（右側カード上部の指標） */
.impact-page .tp-local-kpi{
  display: grid;
  grid-template-columns: repeat(4, minmax(0,1fr));
  gap: 10px;
}
@media (max-width: 720px){
  .impact-page .tp-local-kpi{
    grid-template-columns: repeat(2, minmax(0,1fr));
  }
}

/* =========================================================
   4) 結果: “結果の見方”を追従表示
========================================================= */
.impact-page .impact-legend{
  position: sticky;
  top: 78px;          /* sticky summary がある前提 */
  z-index: 20;
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 16px;
  box-shadow: 0 10px 22px rgba(2,6,23,.08);
  padding: 10px 12px;
  margin: 14px 0 10px;
}
.impact-page .impact-legend__title{
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 900;
}
.impact-page .impact-legend__list{
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.55;
  color: #334155;
}
@media (max-width: 720px){
  .impact-page .impact-legend{
    top: 8px;
    margin: 10px 0;
  }
}

/* =========================================================
   5) 結果テーブル: ヘッダー固定 + 行の視認性
   ※ common.css の sticky-head を使う
========================================================= */
.impact-page .tp-tableWrap.sticky-head .tp-th{
  position: sticky;
  top: 0;
  z-index: 2;
}

/* zebra + hover */
.impact-page .tp-table tbody tr:nth-child(even) .tp-td{
  background: rgba(2,6,23,.02);
}
.impact-page .tp-table tbody tr:hover .tp-td{
  background: rgba(16,185,129,.07);
}

/* 列ヒント（th下の小文字） */
.impact-page .tp-th__hint{
  display:block;
  margin-top: 4px;
  font-size: 11px;
  color: #64748b;
  font-weight: 700;
  white-space: nowrap;
}

/* =========================================================
   6) SP: テーブルは非表示、カード表示に統一
========================================================= */
@media (max-width: 900px){
  .impact-page .tp-tableWrap{ display:none; }
  .impact-page #cards{ display:grid; }
}
@media (min-width: 901px){
  .impact-page #cards{ display:none; }
}

/* =========================================================
   7) SPカード（JS生成）を読みやすく
========================================================= */
.impact-page #cards{
  display: grid;
  gap: 10px;
}

.impact-page .tp-local-cardRow,
.impact-page .tp-rowCard,
.impact-page .tp-cardItem{
  border: 1px solid rgba(15,23,42,.10);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 22px rgba(2,6,23,.08);
  padding: 14px;
}

.impact-page .tp-local-cardRow__title{
  font-weight: 900;
  font-size: 15px;
  line-height: 1.35;
  margin-bottom: 10px;
}

.impact-page .tp-local-kv{
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px dashed rgba(15,23,42,.12);
}
.impact-page .tp-local-kv:first-of-type{
  border-top: 0;
  padding-top: 0;
}
.impact-page .tp-local-kv__label{
  font-size: 12px;
  font-weight: 900;
  color: #64748b;
}
.impact-page .tp-local-kv__val{
  font-size: 13px;
  color: #0f172a;
  overflow-wrap: anywhere;
}

/* =========================================================
   8) ちょい足し: 数字の見やすさ
========================================================= */
.impact-page .mono{
  font-variant-numeric: tabular-nums;
}
.tp-impact-lead{
  font-size:15px;
  line-height:1.8;
  color:#334155;
}

.tp-impact-introBox{
  padding:14px 16px;
  border:1px solid rgba(0,0,0,.08);
  border-radius:14px;
  background:#f8faf8;
}

.tp-impact-introBox__title{
  margin:0 0 8px;
  font-size:14px;
  font-weight:700;
}

.tp-impact-introBox__list{
  margin:0;
  padding-left:1.2em;
}

.tp-impact-introBox__list li + li{
  margin-top:6px;
}

.tp-impact-note{
  margin-top:10px;
  padding:10px 12px;
  border-radius:12px;
  background:#f6f7f8;
  font-size:13px;
  line-height:1.7;
  color:#444;
}

.tp-impact-sampleGuide{
  padding:14px 16px;
  border:1px dashed rgba(0,0,0,.16);
  border-radius:14px;
  background:#fffdf5;
}

.tp-impact-sampleGuide__title{
  margin:0 0 6px;
  font-size:14px;
  font-weight:700;
}

.tp-impact-sampleGuide__text{
  margin:0;
  font-size:14px;
  line-height:1.7;
}

.tp-impact-empty{
  padding:24px 18px;
  border:1px dashed rgba(0,0,0,.14);
  border-radius:14px;
  background:#fafafa;
}

.tp-impact-empty__title{
  margin:0 0 6px;
  font-size:15px;
  font-weight:700;
}

.tp-impact-empty__text{
  margin:0;
  color:#555;
  line-height:1.7;
}

.impact-sectionHead{
  gap:12px;
  align-items:flex-start;
}

.impact-kpiGrid{
  display:grid;
  grid-template-columns:repeat(2, minmax(0, 1fr));
  gap:12px;
}

.impact-kpiGrid .tp-kpi{
  min-height:88px;
}

.tp-inlineHelp{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  width:18px;
  height:18px;
  margin-left:6px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.18);
  font-size:11px;
  font-weight:700;
  line-height:1;
  color:#444;
  background:#fff;
  cursor:help;
  vertical-align:middle;
}

.tp-btn--sm{
  min-width:96px;
  padding:.55em .95em;
  font-size:13px;
  white-space:nowrap;
}

@media (min-width: 720px){
  .impact-kpiGrid{
    grid-template-columns:repeat(4, minmax(0, 1fr));
    gap:14px;
  }
}
.tp-label{
  display:flex;
  align-items:center;
  gap:6px;
  flex-wrap:wrap;
  font-size:13px;
  line-height:1.5;
}

.tp-inlineHelp{
  flex:0 0 auto;
  width:18px;
  height:18px;
  margin-left:2px;
  border-radius:999px;
  border:1px solid rgba(0,0,0,.16);
  font-size:11px;
  font-weight:700;
  line-height:1;
  color:#475569;
  background:#fff;
  cursor:help;
}

.tp-help{
  line-height:1.75;
}

.tp-local-row{
  gap:18px;
}

.tp-local-row .tp-help{
  margin-top:6px;
}

#assumptions .tp-label,
#keywords .tp-label{
  margin-bottom:6px;
}

#assumptions .tp-input,
#assumptions .tp-select,
#keywords .tp-input,
#keywords .tp-select{
  min-height:44px;
}

@media (max-width: 720px){
  .tp-label{
    font-size:12px;
    gap:5px;
  }

  .tp-inlineHelp{
    width:17px;
    height:17px;
    font-size:10px;
  }
}
#tableWrap{
  overflow-x:auto;
}

#tbl{
  table-layout:fixed;
  width:100%;
  min-width:1100px;
}

#tbl .tp-th,
#tbl .tp-td{
  vertical-align:middle;
}

#tbl .tp-th{
  white-space:normal;
  line-height:1.45;
  font-size:13px;
  padding-top:12px;
  padding-bottom:12px;
}

#tbl .tp-th__hint{
  display:block;
  margin-top:4px;
  font-size:11px;
  line-height:1.45;
  color:#64748b;
  white-space:normal;
}

#tbl .tp-td{
  padding-top:10px;
  padding-bottom:10px;
}

#tbl .tp-input--sm{
  min-width:0;
  width:100%;
}

#tbl th:nth-child(1),
#tbl td:nth-child(1){
  width:13%;
}

#tbl th:nth-child(2),
#tbl td:nth-child(2){
  width:13%;
}

#tbl th:nth-child(3),
#tbl td:nth-child(3){
  width:10%;
}

#tbl th:nth-child(4),
#tbl td:nth-child(4){
  width:10%;
}

#tbl th:nth-child(5),
#tbl td:nth-child(5){
  width:10%;
}

#tbl th:nth-child(6),
#tbl td:nth-child(6){
  width:10%;
}

#tbl th:nth-child(7),
#tbl td:nth-child(7){
  width:10%;
}

#tbl th:nth-child(8),
#tbl td:nth-child(8){
  width:11%;
}

#tbl th:nth-child(9),
#tbl td:nth-child(9){
  width:8%;
}

#tbl th:nth-child(10),
#tbl td:nth-child(10){
  width:5%;
}

#tbl .del{
  min-width:64px;
  white-space:nowrap;
}

@media (max-width: 1200px){
  #tbl{
    min-width:1040px;
  }
}
.tp-local-grid{
  align-items:start;
}

.tp-local-grid > .tp-card{
  min-width:0;
}

#keywords{
  min-width:0;
}

#tableWrap{
  min-width:0;
  width:100%;
  overflow-x:auto;
  overflow-y:hidden;
  -webkit-overflow-scrolling:touch;
}

#tableWrap .tp-table{
  min-width:1100px;
}

#cards{
  min-width:0;
}

.tp-tableWrap{
  max-width:100%;
}
