body {
  font-family: -apple-system, "Hiragino Kaku Gothic ProN", sans-serif;
  margin: 0;
  background: #f5f5f7;
  color: #222;
}
header.app-header {
  background: #1f2937;
  color: #fff;
  padding: 12px 20px;
}
header.app-header a {
  color: #fff;
  text-decoration: none;
  margin-right: 16px;
  font-size: 14px;
}
header.app-header a.brand {
  font-weight: bold;
  font-size: 16px;
}
/* 「その他」ドロップダウン（details/summaryによるJS不要の開閉。
   スマホでもタップで開閉できる） */
header.app-header details.nav-more {
  display: inline-block;
  position: relative;
  color: #fff;
  font-size: 14px;
}
header.app-header details.nav-more summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
}
header.app-header details.nav-more summary::after {
  content: " ▼";
  font-size: 10px;
}
header.app-header details.nav-more[open] summary::after {
  content: " ▲";
}
header.app-header details.nav-more .nav-more-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #1f2937;
  border: 1px solid #4b5563;
  border-radius: 6px;
  padding: 8px 0;
  min-width: 180px;
  z-index: 20;
}
header.app-header details.nav-more .nav-more-menu a {
  display: block;
  padding: 8px 16px;
  margin-right: 0;
}
header.app-header details.nav-more .nav-more-menu a:hover {
  background: #374151;
}
main {
  max-width: 960px;
  margin: 20px auto;
  padding: 0 16px 40px;
}
h1 { font-size: 20px; }
h2 { font-size: 16px; margin-top: 28px; }
table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  margin: 12px 0;
}
th, td {
  border: 1px solid #ddd;
  padding: 8px 10px;
  text-align: left;
  font-size: 14px;
}
th { background: #eef0f3; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge-ok { background: #dcfce7; color: #166534; }
.badge-warn { background: #fee2e2; color: #991b1b; }
.badge-muted { background: #e5e7eb; color: #374151; }
.amount-plus { color: #166534; }
.amount-minus { color: #991b1b; }
form.inline { display: inline; }
.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.flash-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
}
label { display: block; margin-top: 10px; font-size: 13px; color: #444; }
input, select { padding: 6px 8px; font-size: 14px; width: 100%; max-width: 320px; box-sizing: border-box; }
button, .btn {
  display: inline-block;
  padding: 6px 14px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #1f2937;
  background: #1f2937;
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  margin-top: 12px;
}
button.secondary, .btn.secondary { background: #fff; color: #1f2937; }
button.danger, .btn.danger { background: #b91c1c; border-color: #b91c1c; }
nav.tabs { margin-bottom: 12px; }
nav.tabs a { margin-right: 12px; font-size: 14px; }
.table-scroll { overflow-x: auto; }
.table-scroll table { min-width: 480px; }
.mail-preview {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 16px;
  white-space: pre-wrap;
  font-family: monospace;
  font-size: 13px;
}
.payout-race-block { margin-bottom: 20px; }
.payout-place-row { display: flex; gap: 8px; align-items: flex-end; }
.payout-place-row label { flex: 1; }
.button-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.dropzone {
  position: relative;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 3px dashed #9ca3af;
  border-radius: 12px;
  padding: 32px 16px;
  text-align: center;
  background: #eef2f7;
  transition: border-color 0.15s, background-color 0.15s;
}
.dropzone.dragover {
  border-color: #1f2937;
  border-style: solid;
  background: #dbe4ff;
}
.dropzone-arrow {
  font-size: 22px;
  margin: 0 0 6px;
  color: #4b5563;
}
.dropzone.dragover .dropzone-arrow { color: #1f2937; }
.dropzone-title { font-size: 16px; font-weight: bold; margin: 0 0 4px; }
.dropzone-sub { margin: 10px 0 2px; color: #666; font-size: 13px; }
.dropzone-hint { margin: 10px 0 0; color: #666; font-size: 12px; }
.dropzone input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  /* ドラッグ＆ドロップ時にこのinput自身がブラウザ標準のドロップ先として
     割り込むと、input.filesの手動同期処理と競合し2件目以降の追加dropが
     失敗する原因になるため、常にヒットテスト対象から外す
     （クリックはlabel要素のfor属性経由で発火するため支障はない）。 */
  pointer-events: none;
}
#jra-file-list-wrapper { margin-top: 16px; }
.jra-file-list-scroll {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  background: #fff;
}
#jra-file-list { list-style: none; margin: 0; padding: 0; }
#jra-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
  word-break: break-all;
}
#jra-file-list li:last-child { border-bottom: none; }
.jra-file-remove {
  flex-shrink: 0;
  padding: 2px 10px;
  margin: 0;
  font-size: 14px;
  line-height: 1;
  border-radius: 6px;
  border: 1px solid #b91c1c;
  background: #fff;
  color: #b91c1c;
  cursor: pointer;
}
@media (max-width: 480px) {
  .dropzone { padding: 20px 10px; }
}

/* 集計タブ（feature/summary-dashboard） */
.amount-zero { color: #6b7280; }
.summary-ranking {
  list-style: none;
  margin: 0;
  padding: 0;
}
.summary-ranking li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 15px;
}
.summary-ranking li:last-child { border-bottom: none; }
.summary-ranking-rank {
  flex-shrink: 0;
  width: 44px;
  font-weight: bold;
  color: #444;
}
.summary-ranking-name { flex: 1; min-width: 0; }
.summary-ranking-amount {
  flex-shrink: 0;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.summary-chart-wrap { overflow-x: auto; }
.summary-chart {
  display: block;
  width: 100%;
  height: auto;
  min-width: 320px;
  max-height: 260px;
}
.summary-chart-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin: 10px 0 0;
  padding: 0;
  font-size: 13px;
}
.summary-chart-legend li { display: flex; align-items: center; gap: 6px; }
.summary-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  flex-shrink: 0;
}
.hint { color: #666; font-size: 12px; margin-top: 8px; }
.summary-total-row td { font-weight: bold; background: #f7f7f9; }
/* 開催別一覧の金額セルは折り返さない（横スクロールで読む。「円」だけが次行へ落ちるのを防ぐ） */
.summary-block-table td.amount-plus,
.summary-block-table td.amount-minus,
.summary-block-table td.amount-zero { white-space: nowrap; font-variant-numeric: tabular-nums; }
/* 過去実績(Excel集計)とシステム集計(馬券道場DB)の区切り行（feature/summary-source-visual-separation） */
.summary-section-historical td,
.summary-section-current td {
  font-size: 12px;
  font-weight: bold;
  color: #444;
  background: #f3f4f6;
  padding: 5px 10px;
  white-space: nowrap;
}
.summary-section-historical td { border-left: 4px solid #f59e0b; }
.summary-section-current td { border-left: 4px solid #3b82f6; }
@media (max-width: 480px) {
  .summary-ranking li { font-size: 14px; }
  .summary-ranking-rank { width: 38px; }
}
