/* ========================================
   forecast-print.css (v1.8.83)
   着地予測 印刷オーバーレイ + 集計対象モーダル
   ----------------------------------------
   3デザイン（A/B/C）切替対応
   ======================================== */

/* ============================================================
   印刷オーバーレイ：画面表示時のレイアウト
   ============================================================ */
#forecast-print-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9000;
  background: rgba(20, 20, 28, 0.6);
  overflow: auto;
  padding: 24px;
  align-items: flex-start;
  justify-content: center;
}
#forecast-print-overlay.open {
  display: flex;
}
.fp-controls {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 10;
  display: flex;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 8px 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.fp-design-toggle {
  display: flex;
  gap: 6px;
  align-items: center;
}
.fp-design-toggle button {
  font-size: 11px;
  padding: 4px 10px;
  border: 1px solid #ccc;
  background: #f4f4f6;
  color: #555;
  border-radius: 6px;
  cursor: pointer;
}
.fp-design-toggle button.active {
  background: #1db97a;
  color: #fff;
  border-color: #1db97a;
}
.fp-print-btn,
.fp-close-btn {
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid #aaa;
  background: #fff;
  color: #333;
  border-radius: 6px;
  cursor: pointer;
}
.fp-print-btn {
  background: #1db97a;
  color: #fff;
  border-color: #1db97a;
  font-weight: 600;
}
.fp-pdf-btn {
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid #378ADD;
  background: #378ADD;
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
}
.fp-sheet-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}
.fp-sheet {
  width: 210mm;
  /* v1.8.89: A4 1枚（297mm）に収まる max-height 設定。実際の中身に合わせて自動高 */
  min-height: 297mm;
  max-height: 297mm;
  overflow: hidden;
  background: #fff;
  color: #222;
  padding: 12mm 12mm;
  box-sizing: border-box;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  font-family: "Yu Gothic", "Hiragino Sans", sans-serif;
}

/* ============================================================
   シート共通スタイル
   ============================================================ */
.fp-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 10px;
  padding-bottom: 6px;
}
.fp-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  line-height: 1;
}
.fp-title-month {
  font-size: 28px;
}
.fp-title-period {
  font-size: 20px;
  margin-left: 8px;
}
.fp-date {
  font-size: 12px;
  color: #666;
}

.fp-cars-block {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}
.fp-cars-block:has(.fp-cars-col:only-child) {
  grid-template-columns: 1fr;
}
.fp-cars-col {
  border: 1px solid #ddd;
  padding: 8px 12px;
}
.fp-cars-head {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #ccc;
}
.fp-car-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.fp-car-list li {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 3px 0;
  border-bottom: 1px dotted #eee;
}
.fp-car-list li.fp-car-empty {
  color: transparent;
}
.fp-car-name {
  flex: 1;
}
.fp-car-price {
  font-variant-numeric: tabular-nums;
  color: #333;
}
.fp-cars-sum {
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 2px solid #333;
}

.fp-section-title {
  font-size: 16px;
  font-weight: 700;
  text-align: center;
  background: #e8e8eb;
  padding: 5px 0;
  margin: 10px 0 8px;
}

.fp-kpi-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  margin-bottom: 10px;
}
.fp-kpi-row td {
  border: 1px solid #ccc;
  padding: 7px 10px;
  vertical-align: middle;
}
.fp-kpi-label {
  width: 38%;
  font-size: 15px;
  font-weight: 700;
}
.fp-kpi-actual {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.fp-kpi-unit {
  font-size: 12px;
  color: #666;
  font-weight: 400;
}
.fp-kpi-diff {
  width: 14%;
  font-size: 15px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.fp-kpi-diff.pos {
  color: #1db97a;
  font-weight: 700;
}
.fp-kpi-diff.neg {
  color: #d72c2c;
  font-weight: 700;
}
.fp-kpi-pct {
  width: 14%;
  font-size: 15px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* 着地予想ブロック（v1.8.86：台数バー＋売上バーの2本表示） */
.fp-landing-block {
  margin: 8px 0 10px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: #fafafa;
}
.fp-landing-title {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
  color: #444;
}
.fp-bar-row {
  display: grid;
  grid-template-columns: 36px 1fr 140px;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}
.fp-bar-label {
  font-size: 11px;
  font-weight: 700;
  color: #555;
  text-align: right;
}
.fp-bar-value {
  font-size: 11px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: #333;
  white-space: nowrap;
}
.fp-landing-bar {
  display: flex;
  height: 18px;
  border: 1px solid #888;
  border-radius: 3px;
  overflow: hidden;
  background: #eee;
}
.fp-landing-bar > div {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
}
.fp-land-fixed    { background: #1db97a; }
.fp-land-likely   { background: #378ADD; }
.fp-land-possible { background: #f59e0b; }
.fp-land-remain   { background: #b8b8b8; color: #fff; }
.fp-landing-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 11px;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px dotted #ccc;
}
.fp-landing-legend i.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}
.fp-landing-legend i.dot-fixed    { background: #1db97a; }
.fp-landing-legend i.dot-likely   { background: #378ADD; }
.fp-landing-legend i.dot-possible { background: #f59e0b; }

.fp-sheet[data-design="B"] .fp-landing-block {
  border: 1px solid #1db97a;
  border-radius: 6px;
  background: #fcfffd;
}
.fp-sheet[data-design="C"] .fp-landing-block {
  border: none;
  border-top: 2px solid #222;
  border-bottom: 1px solid #888;
  border-radius: 0;
  background: transparent;
  padding: 6px 0;
}

/* v1.8.89: .fp-sheet-pdf による縮小モードは撤去。シート本来のレイアウト自体を A4 に収める設計に */

.fp-tentative-block {
  margin-top: 10px;
}
.fp-kpi-row-emph td {
  background: #f7f9f7;
  font-weight: 700;
}

.fp-footer {
  margin-top: 8px;
  font-size: 10px;
  color: #888;
  text-align: right;
}

/* ============================================================
   デザインA：クラシック（現行PDF踏襲）
   罫線テーブル中心、見出しグレー
   ============================================================ */
.fp-sheet[data-design="A"] .fp-title {
  font-family: "Yu Gothic", serif;
}
.fp-sheet[data-design="A"] .fp-section-title {
  background: #d3d3d3;
  color: #222;
  border: 1px solid #aaa;
}
.fp-sheet[data-design="A"] .fp-kpi-row td {
  border: 1px solid #888;
}
.fp-sheet[data-design="A"] .fp-cars-col {
  border: 1px solid #888;
}

/* ============================================================
   デザインB：CarFlow色味モダン
   角丸、緑アクセント
   ============================================================ */
.fp-sheet[data-design="B"] {
  background: #fff;
}
.fp-sheet[data-design="B"] .fp-title {
  color: #1db97a;
}
.fp-sheet[data-design="B"] .fp-section-title {
  background: #e8f5ee;
  color: #0f5d3c;
  border: 1px solid #1db97a;
  border-radius: 6px;
}
.fp-sheet[data-design="B"] .fp-cars-col {
  border: 1px solid #1db97a;
  border-radius: 6px;
}
.fp-sheet[data-design="B"] .fp-cars-head {
  color: #0f5d3c;
}
.fp-sheet[data-design="B"] .fp-kpi-table {
  border-collapse: separate;
  border-spacing: 0;
}
.fp-sheet[data-design="B"] .fp-kpi-row td {
  border: 1px solid #b9e1cc;
}
.fp-sheet[data-design="B"] .fp-kpi-row-emph td {
  background: #e8f5ee;
}

/* ============================================================
   デザインC：ミニマル
   罫線最小、テキスト中心、大きな数字
   ============================================================ */
.fp-sheet[data-design="C"] .fp-section-title {
  background: transparent;
  border-bottom: 2px solid #222;
  text-align: left;
  padding: 4px 0;
  font-size: 16px;
}
.fp-sheet[data-design="C"] .fp-cars-col {
  border: none;
  border-top: 2px solid #222;
  border-bottom: 1px solid #888;
  padding: 6px 0;
}
.fp-sheet[data-design="C"] .fp-cars-head {
  border-bottom: none;
}
.fp-sheet[data-design="C"] .fp-kpi-row td {
  border: none;
  border-bottom: 1px solid #ccc;
  padding: 14px 8px;
}
.fp-sheet[data-design="C"] .fp-kpi-actual {
  font-size: 26px;
}
.fp-sheet[data-design="C"] .fp-kpi-row-emph td {
  background: transparent;
  border-bottom: 2px solid #222;
}

/* ============================================================
   印刷時のスタイル：オーバーレイ以外を隠す
   ============================================================ */
@media print {
  body.fp-open > *:not(#forecast-print-overlay) {
    display: none !important;
  }
  #forecast-print-overlay {
    position: static !important;
    background: transparent !important;
    padding: 0 !important;
    display: block !important;
    overflow: visible !important;
  }
  .fp-controls,
  [data-no-print="1"] {
    display: none !important;
  }
  .fp-sheet-wrap {
    display: block !important;
  }
  .fp-sheet {
    box-shadow: none !important;
    width: 100% !important;
    min-height: auto !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  @page {
    size: A4 portrait;
    margin: 14mm 12mm;
  }
}

/* ============================================================
   集計対象モーダル
   ============================================================ */
#forecast-targets-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9100;
}
#forecast-targets-modal.open {
  display: block;
}
.ft-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.5);
}
.ft-dialog {
  position: relative;
  margin: 5vh auto;
  max-width: 720px;
  width: calc(100% - 40px);
  max-height: 88vh;
  background: var(--bg2, #fff);
  color: var(--text, #222);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ft-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border, #444);
  background: var(--bg3, #2a2a30);
}
.ft-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.ft-close-btn {
  background: transparent;
  border: 0;
  color: var(--text, #fff);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
}
.ft-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}
.ft-range-info {
  font-size: 12px;
  color: var(--text3, #999);
  margin-bottom: 12px;
}
.ft-section {
  margin-bottom: 18px;
}
.ft-section-title {
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border, #444);
}
.ft-section-count {
  font-size: 12px;
  color: var(--text2, #aaa);
  font-weight: 400;
  margin-left: 6px;
}
.ft-section-hint {
  font-size: 11px;
  color: var(--text3, #888);
  margin-bottom: 4px;
}
.ft-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ft-row {
  display: grid;
  grid-template-columns: 90px 1fr 100px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  padding: 4px 0;
  border-bottom: 1px dotted var(--border, #333);
}
.ft-row-date {
  font-size: 12px;
  color: var(--text3, #888);
  font-variant-numeric: tabular-nums;
}
.ft-row-name {
  color: var(--text, #fff);
}
.ft-row-price {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text2, #ccc);
}
.ft-empty {
  font-size: 12px;
  color: var(--text3, #888);
  padding: 6px 0;
  font-style: italic;
}

/* ============================================================
   着地予測パネル内のコントロール
   ============================================================ */
.landing-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
}
.landing-controls select {
  font-size: 12px;
  padding: 4px 6px;
  background: var(--bg3, #2a2a30);
  color: var(--text, #fff);
  border: 1px solid var(--border, #444);
  border-radius: 6px;
}
.landing-print-btn {
  font-size: 11px;
  padding: 4px 8px;
  background: var(--bg3, #2a2a30);
  color: var(--text, #fff);
  border: 1px solid var(--border, #444);
  border-radius: 6px;
  cursor: pointer;
}
.landing-print-btn:hover {
  background: var(--accent, #1db97a);
  color: #fff;
  border-color: var(--accent, #1db97a);
}
@media (max-width: 768px) {
  .landing-controls {
    margin-left: 0;
    margin-top: 6px;
    flex-wrap: wrap;
  }
}

/* 販売実績ビューの月見出し横の印刷ボタン */
.arc-print-btn {
  margin-left: 6px;
  font-size: 12px;
  padding: 2px 8px;
  background: transparent;
  color: var(--text2, #aaa);
  border: 1px solid var(--border, #555);
  border-radius: 5px;
  cursor: pointer;
}
.arc-print-btn:hover {
  background: var(--accent, #1db97a);
  color: #fff;
  border-color: var(--accent, #1db97a);
}
