/* ベースレイアウト */
body { font-size: 0.9rem; }

/* ナビゲーション */
.nav-item-btn {
  color: #6c757d;
  padding: 0.3rem 0.5rem;
  min-width: 56px;
  text-align: center;
  transition: color 0.15s;
}
.nav-item-btn.active,
.nav-item-btn:hover { color: #0d6efd; }

/* タイプ選択グリッド */
.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.type-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 18px 8px;
  border: 2px solid #dee2e6;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 500;
  color: #495057;
  gap: 8px;
  transition: all 0.15s;
}
.type-card i { font-size: 1.7rem; color: #0d6efd; }
.type-card.active { background: #0d6efd; border-color: #0d6efd; color: #fff; }
.type-card.active i { color: #fff; }

/* アップロードグリッド（旧） */
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.upload-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 22px 8px;
  border: 2px solid #dee2e6;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  color: #0d6efd;
  font-size: 0.88rem;
  font-weight: 500;
  gap: 8px;
  transition: border-color 0.15s;
}
.upload-card i { font-size: 1.7rem; }
.upload-card:hover { border-color: #0d6efd; }

/* 領収書アップロードエリア（白カード） */
.receipt-upload-card {
  background: #fff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 1px 6px rgba(0,0,0,0.08);
}

/* コンパクトアップロードボタン */
.upload-card-sm {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border: 1.5px solid #dee2e6;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  color: #0d6efd;
  font-size: 0.85rem;
  font-weight: 500;
  gap: 6px;
  transition: border-color 0.15s;
}
.upload-card-sm i { font-size: 1.1rem; }
.upload-card-sm:hover { border-color: #0d6efd; }

/* 履歴カード */
.history-card {
  background: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.history-card .h-place { font-weight: 700; font-size: 0.95rem; }
.history-card .h-amount { font-weight: 700; font-size: 0.95rem; }
.history-card .h-meta { font-size: 0.78rem; color: #6c757d; }
.badge-pending   { background: #e67e22; color: #fff; font-weight: 600; }  /* 申請済：オレンジ */
.badge-confirmed { background: #2980b9; color: #fff; font-weight: 600; }  /* 登録済：ブルー */
.badge-duplicate { background: #e74c3c; color: #fff; font-weight: 600; }

/* カード */
.expense-card {
  border-left: 4px solid #0d6efd;
  border-radius: 8px;
  transition: box-shadow 0.15s;
}
.expense-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.expense-card.confirmed { border-left-color: #198754; }
.expense-card.edit-mode { border-left-color: #ffc107; }

/* バッジ（print用上書き不要 — 上の定義で統一） */

/* ファイルプレビュー */
.file-preview-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #dee2e6;
  flex-shrink: 0;
}
.file-preview-item img,
.file-preview-item .file-icon {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.file-preview-item .remove-btn {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(220,53,69,0.85);
  color: #fff;
  font-size: 10px;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  line-height: 1;
}

/* 分割行 */
.split-row { border-top: 1px dashed #dee2e6; }
.split-row:first-child { border-top: none; }

/* 一覧テーブル */
.list-table th { font-size: 0.75rem; white-space: nowrap; }
.list-table td { font-size: 0.8rem; vertical-align: middle; }
.list-amount { font-weight: 600; white-space: nowrap; }
.list-date  { white-space: nowrap; }
.list-cat   { white-space: nowrap; }
.list-note-cell { font-size: 0.75rem; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }

/* PC：セルをゆったり */
@media (min-width: 768px) {
  .list-table th, .list-table td { font-size: 0.875rem; padding: 0.6rem 0.8rem; }
  .list-note-cell { max-width: 400px; }
}

/* 列リサイズハンドル */
.col-resizer {
  position: absolute;
  right: 0;
  top: 0;
  width: 12px;
  height: 100%;
  cursor: col-resize;
  user-select: none;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
/* グリップ記号（|| 二本線） */
.col-resizer::before {
  content: '';
  display: block;
  height: 52%;
  min-height: 12px;
  width: 4px;
  border-left: 2px solid #c0ccd8;
  border-right: 2px solid #c0ccd8;
  border-radius: 1px;
  transition: border-color 0.12s;
}
.col-resizer:hover::before { border-color: #6c9fc8; }
.col-resizer.dragging::before { border-color: #0d6efd; }

/* 集計 */
.summary-total {
  font-size: 1.8rem;
  font-weight: 700;
  color: #0d6efd;
}
.summary-card { border-radius: 12px; }

/* ピボットテーブル */
.pivot-table {
  white-space: nowrap;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.pivot-table thead tr th {
  background: #3a5f82;
  color: #fff;
  font-weight: 600;
  padding: 6px 10px;
  border: none;
}
/* 1列目（行ラベル）：全3テーブルで固定幅に揃え、長いテキストは省略 */
.pivot-table th:first-child,
.pivot-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 100px;
  min-width: 100px;
  max-width: 100px;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pivot-table thead tr th:first-child { z-index: 2; background: #3a5f82; }
.pivot-table tbody td:first-child { background: #fff; }
.pivot-table tfoot td:first-child { background: #dde8f0; }
.pivot-table tbody td {
  padding: 5px 10px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.pivot-table tbody tr:hover td { background: #f5f8ff; }
.pivot-table tbody tr:hover td:first-child { background: #f5f8ff; }
.pivot-table .pivot-cell:hover { text-decoration: underline; color: #0a58ca; }
.pivot-table tfoot td {
  background: #dde8f0;
  font-weight: 700;
  padding: 6px 10px;
  border-top: 2px solid #3a5f82;
  border-bottom: none;
}
.pivot-title { font-size: 0.95rem; }

/* ローディングオーバーレイ */
#loadingOverlay { display: flex !important; }
#loadingOverlay.d-none { display: none !important; }

/* トースト */
.toast-item {
  border-radius: 8px;
  font-size: 0.85rem;
  max-width: 360px;
  margin: 0 auto 0.5rem;
}

/* 編集モードバナー */
.edit-banner {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-radius: 6px;
  padding: 0.4rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
}

/* 設定画面 */
.master-item-name {
  font-size: 1rem;
  font-weight: 600;
}

/* メンバー/勘定科目/支払元リストの項目名サイズを強制上書き */
#memberList .fw-semibold,
#categoryList .flex-grow-1,
#paySourceList .flex-grow-1 {
  font-size: 0.95rem !important;
  font-weight: 600 !important;
}

.settings-section-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #212529;
  padding: 0.4rem 0 0.3rem;
  border-bottom: 2px solid #4582B5;
  margin-bottom: 0.75rem;
}

/* 初期設定アコーディオン内の①〜④ステップ見出し */
.settings-step-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #212529;
  padding: 0.6rem 0 0.3rem;
  border-bottom: 2px solid #4582B5;
  margin-bottom: 0.6rem;
  margin-top: 0.75rem;
}
.settings-step-title:first-child {
  margin-top: 0;
}
.settings-step-hint {
  font-size: 0.75rem;
  color: #6c757d;
  margin-top: -0.35rem;
  margin-bottom: 0.6rem;
}

/* 電帳法バッジ */
.badge-denchou {
  background: linear-gradient(135deg, #0d6efd, #6610f2);
  color: #fff;
  font-size: 0.65rem;
  padding: 0.2em 0.5em;
  border-radius: 4px;
}

/* 印刷対応 */
@media print {
  .navbar, .fixed-bottom, #toastContainer, .btn, .no-print { display: none !important; }
  body { background: #fff; }
  .card { border: 1px solid #ccc; box-shadow: none; }
}

/* スマホ最適化 */
@media (max-width: 480px) {
  .container-fluid { padding-left: 0.75rem; padding-right: 0.75rem; }
}

/* 集計ビュー */
.summary-chart-wrap {
  max-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.summary-grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}
.cross-table th, .cross-table td {
  font-size: 0.78rem;
  padding: 0.35rem 0.5rem;
}

/* スマホ一覧カード */
.list-sp-card {
  background: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.list-sp-date  { font-size: 0.72rem; color: #6c757d; white-space: nowrap; }
.list-sp-place { font-size: 0.88rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-sp-name  { font-size: 0.7rem; color: #6c757d; }
.list-sp-amount { font-size: 0.9rem; font-weight: 700; color: #0d6efd; white-space: nowrap; }
.list-sp-amount.expandable { cursor: pointer; user-select: none; }
.list-sp-amount.expandable .chevron { font-size: 0.6rem; opacity: 0.55; vertical-align: middle; margin-left: 2px; transition: transform 0.15s; }
.list-sp-amount.expandable.open .chevron { transform: rotate(180deg); }
.list-sp-cat   { font-size: 0.72rem; color: #6c757d; }
.list-sp-note  { font-size: 0.7rem; color: #adb5bd; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; display: inline-block; vertical-align: middle; }
/* 金額タップで展開される詳細エリア */
.list-sp-extra {
  margin-top: 0.45rem;
  padding-top: 0.4rem;
  border-top: 1px solid #f0f0f0;
}
.list-sp-extra-note {
  font-size: 0.78rem;
  color: #495057;
  margin-bottom: 0.35rem;
  white-space: pre-wrap;
  word-break: break-all;
}
/* PCテーブル：金額クリックで展開される詳細行 */
.list-detail-row td { background: #f8f9fa; border-top: none !important; font-size: 0.8rem; }
.list-amount-toggle { cursor: pointer; }
.list-amount-toggle:hover { text-decoration: underline; }

/* PC/タブレット：集計ビュー全幅レイアウト */
@media (min-width: 768px) {
  /* appMainの幅制限はrouter.jsとsummary.jsのbindEventsでJSから制御 */
  .summary-grid-2 {
    grid-template-columns: 1fr 1fr;
  }
  .summary-chart-wrap {
    max-height: 260px;
  }
}

@media print {
  .no-print-col { display: none; }
}

/* ロールバッジ ツールチップ：小さいフォント・半透過背景 */
.tooltip {
  --bs-tooltip-bg: rgba(33, 37, 41, 0.82);
  --bs-tooltip-font-size: 0.68rem;
}
