/* ============================================================
   月次レポート — クロス集計テーブル スタイル
   ============================================================ */

.report-table-wrap {
  padding: 0 24px 24px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.report-cross-table {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  font-size: 12px;
  table-layout: fixed;
}

/* ===== ヘッダー ===== */
.report-cross-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 6px 10px;
  text-align: center;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #f8fafc;
}

/* 媒体グループヘッダー */
.report-cross-table .media-header {
  color: white;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: none;
}
.media-header-total  { background: #ef4444 !important; }
.media-header-google { background: #4285f4 !important; }
.media-header-yahoo     { background: #ff0033 !important; }
.media-header-microsoft { background: #00a4ef !important; }
.media-header-meta      { background: #0668e1 !important; }
.media-header-yda    { background: #7c3aed !important; }
.media-header-fb     { background: #1877f2 !important; }
.media-header-other  { background: #6b7280 !important; }

/* サブヘッダー（広告費/売上/利益/ROAS） */
.report-cross-table .sub-header {
  font-size: 10px;
  color: var(--text-secondary);
  background: #f1f5f9 !important;
  padding: 4px 8px;
}

/* 固定列（日付・ターム） */
.report-cross-table .col-date {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #f8fafc;
  min-width: 72px;
  width: 72px;
  text-align: left;
  padding-left: 10px;
}
.report-cross-table .col-term {
  position: sticky;
  left: 72px;
  z-index: 5;
  background: #f8fafc;
  min-width: 48px;
  width: 48px;
  text-align: center;
}
.report-cross-table tbody .col-date {
  font-weight: 500;
}
.report-cross-table tbody .col-term {
  font-weight: 600;
  color: var(--text-secondary);
}

/* ===== ボディセル ===== */
.report-cross-table tbody td {
  padding: 4px 8px;
  border: 1px solid var(--border);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  white-space: nowrap;
}

/* 数値カラム幅 */
.report-cross-table .col-spend,
.report-cross-table .col-revenue,
.report-cross-table .col-profit {
  min-width: 80px;
  width: 80px;
}
.report-cross-table .col-roas {
  min-width: 56px;
  width: 56px;
}

/* ===== 合計行 ===== */
.report-cross-table .row-grand-total td {
  background: #fef2f2;
  font-weight: 700;
  font-size: 12px;
  border-bottom: 2px solid #ef4444;
}
.report-cross-table .row-grand-total .col-date,
.report-cross-table .row-grand-total .col-term {
  background: #fef2f2;
}

/* ===== 月末予想行 ===== */
.report-cross-table .row-forecast td {
  background: #fffbeb;
  font-weight: 600;
  font-style: italic;
  color: #92400e;
  border-top: 2px dashed #f59e0b;
}
.report-cross-table .row-forecast .col-date,
.report-cross-table .row-forecast .col-term {
  background: #fffbeb;
}
.report-cross-table tbody .row-forecast:hover td,
.report-cross-table tbody .row-forecast:hover .col-date,
.report-cross-table tbody .row-forecast:hover .col-term {
  background: #fef3c7;
}

/* ===== ターム小計行 ===== */
.report-cross-table .row-term-total td {
  background: #eff6ff;
  font-weight: 600;
  border-bottom: 1px solid #93c5fd;
}
.report-cross-table .row-term-total .col-date,
.report-cross-table .row-term-total .col-term {
  background: #eff6ff;
}

/* ===== 日別行 ===== */
.report-cross-table tbody tr:hover td {
  background: #f8fafc;
}
.report-cross-table tbody tr:hover .col-date,
.report-cross-table tbody tr:hover .col-term {
  background: #f0f4ff;
}
.report-cross-table tbody .row-grand-total:hover td,
.report-cross-table tbody .row-grand-total:hover .col-date,
.report-cross-table tbody .row-grand-total:hover .col-term {
  background: #fde8e8;
}
.report-cross-table tbody .row-term-total:hover td,
.report-cross-table tbody .row-term-total:hover .col-date,
.report-cross-table tbody .row-term-total:hover .col-term {
  background: #dbeafe;
}

/* ===== 曜日カラー（日付セル） ===== */
.report-cross-table .col-date.day-sat { color: #2563eb; }
.report-cross-table .col-date.day-sun { color: #dc2626; }

/* ===== ゼロ値を薄く ===== */
.val-zero {
  color: #d1d5db;
}

/* ===== 利益の色分け ===== */
.val-positive { color: var(--success); }
.val-negative { color: var(--danger); }

/* ===== セパレーター行（合計とターム小計の間） ===== */
.report-cross-table .row-separator td {
  padding: 0;
  height: 4px;
  background: var(--bg);
  border-left: none;
  border-right: none;
}

/* ===== レスポンシブ ===== */
@media (max-width: 768px) {
  .report-table-wrap { padding: 0 8px 16px; }
  .report-cross-table { font-size: 10px; }
  .report-cross-table thead th { padding: 4px 6px; font-size: 9px; }
  .report-cross-table tbody td { padding: 3px 6px; font-size: 10px; }
  .report-cross-table .col-date { min-width: 60px; width: 60px; }
  .report-cross-table .col-term { min-width: 36px; width: 36px; left: 60px; }
  .report-cross-table .col-spend,
  .report-cross-table .col-revenue,
  .report-cross-table .col-profit { min-width: 64px; width: 64px; }
  .report-cross-table .col-roas { min-width: 48px; width: 48px; }
}
