/**
 * events-public/app.css
 * Phase 0: 最低限の見た目。Phase 1 以降でブラッシュアップ。
 */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: #1a2538;
  background: #f5f7fb;
  line-height: 1.6;
}

.site-header {
  background: linear-gradient(135deg, #1E73D8 0%, #0a4a9e 100%);
  color: #fff;
  padding: 24px 20px;
  text-align: center;
  position: relative;
}

.site-header h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 800;
}

.site-header .tagline {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.9;
}

.container {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 16px;
}

.state {
  background: #fff;
  border-radius: 12px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e0e8f0;
  border-top-color: #1E73D8;
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.btn {
  display: inline-block;
  padding: 10px 20px;
  border-radius: 8px;
  background: #fff;
  color: #1E73D8;
  border: 1px solid #1E73D8;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn:hover { opacity: 0.85; }

.btn-primary {
  background: #1E73D8;
  color: #fff;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 12px;
}

.toolbar h2 {
  margin: 0;
  font-size: 18px;
}

.badge {
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: #1E73D8;
  color: #fff;
}

.tournament-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 10px;
}

.tournament-card {
  background: #fff;
  border-radius: 10px;
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  border-left: 4px solid #1E73D8;
}

.t-name {
  font-size: 15px;
  font-weight: 700;
}

.t-meta {
  font-size: 12px;
  color: #6B7A99;
  margin-top: 4px;
}

/* ===== Phase A-1 拡張② バルク取込 ===== */
.files-list, .progress-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.file-card {
  padding: 8px 12px;
  background: #f5f7fb;
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.file-name { font-weight: 600; }
.file-size { color: #8a96b0; font-size: 11px; }

.progress-bar {
  height: 26px;
  background: #e6e8ec;
  border-radius: 13px;
  overflow: hidden;
  position: relative;
  margin: 12px 0 16px;
}
#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #1E73D8, #2eaf5d);
  transition: width 0.3s ease-out;
}
#progress-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  text-shadow: 0 0 3px rgba(0, 0, 0, 0.4);
  white-space: nowrap;
}

.progress-list li {
  padding: 7px 10px;
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.progress-list li .detail { color: #6B7A99; font-size: 11px; }
.progress-list li .detail.err { color: #B42318; font-weight: 700; }

.status-pending    { background: #f5f7fb; color: #8a96b0; }
.status-processing { background: #eef4ff; color: #0F4C9A; font-weight: 700; }
.status-done       { background: #e8f7ed; color: #0A7A2F; }
.status-error      { background: #fff0f0; color: #B42318; }

/* ===== Phase A-2a Step 7: ダッシュボード大会一覧 ===== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 10px;
}
.section-header h2 {
  margin: 0;
  font-size: 18px;
}

.quick-links {
  background: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  font-size: 13px;
}
.quick-links a {
  color: #1E73D8;
  text-decoration: none;
  font-weight: 600;
}
.quick-links a:hover { text-decoration: underline; }

.tournaments-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.tournaments-table th,
.tournaments-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #e6e8ec;
  text-align: left;
  font-size: 13px;
}
.tournaments-table th {
  background: #f5f7fb;
  font-weight: 700;
  color: #6B7A99;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tournaments-table td.num,
.tournaments-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.tournaments-table tbody tr:hover {
  background: #fafbfd;
}
.tournaments-table tbody tr:last-child td {
  border-bottom: none;
}

/* status badges (大会ライフサイクル: draft / open / closed / archived) */
.status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.status-draft    { background: #fff3d6; color: #6B5300; }
.status-open     { background: #e8f7ed; color: #0A7A2F; }
.status-closed   { background: #f0f3f8; color: #6B7A99; }
.status-archived { background: #e6e8ec; color: #8a96b0; }

.btn-small {
  display: inline-block;
  padding: 6px 12px;
  background: #1E73D8;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  transition: opacity 0.15s;
}
.btn-small:hover { opacity: 0.85; }

.empty-state {
  text-align: center;
  padding: 20px;
  color: #6B7A99;
  font-size: 14px;
  line-height: 1.6;
}

/* ===== Phase A-2c: クラブ運営資格チェック ===== */
.caption {
  color: #6B7A99;
  font-size: 12px;
  line-height: 1.6;
  margin: 4px 0 12px;
}

.summary-stats {
  margin-bottom: 12px;
}
.summary-stats p {
  margin: 4px 0;
  font-size: 13px;
}

.qualifications-table tr.row-qualified {
  background: #f4faf6;
}
.qualifications-table tr.row-qualified:hover {
  background: #ebf5ee;
}
.qualifications-table tr.row-not-qualified {
  background: #fff8f8;
}
.qualifications-table tr.row-not-qualified:hover {
  background: #fff0f0;
}

.badge-ok {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #2eaf5d;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}
.badge-ng {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #E63946;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

/* 県内/県外/不明 内訳の小さな注記 */
.prefecture-breakdown {
  display: block;
  color: #8a96b0;
  font-size: 11px;
  margin-top: 2px;
  line-height: 1.3;
}

/* ===== Phase B-1: 共通ナビゲーション ===== */
.main-nav {
  background: #0F4C9A;
  padding: 0;
  display: flex;
  gap: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12);
  overflow-x: auto;
  white-space: nowrap;
}
.main-nav a {
  padding: 12px 22px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.02em;
  transition: background 0.18s;
  border-bottom: 3px solid transparent;
}
.main-nav a:hover {
  background: rgba(255,255,255,0.08);
}
.main-nav a.active {
  background: rgba(255,255,255,0.16);
  border-bottom-color: #fff;
}

/* ===== Phase B-1: ダッシュボードサマリ ===== */
#summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 16px 0 24px;
}
.summary-card {
  background: #fff;
  padding: 20px 22px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  border-left: 4px solid #1E73D8;
}
.summary-card h2 {
  font-size: 12px;
  color: #6B7A99;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.summary-card .big-number {
  font-size: 32px;
  font-weight: 800;
  color: #0F4C9A;
  margin: 0;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.summary-card .sub {
  margin: 8px 0 0;
  font-size: 12px;
  color: #6B7A99;
  line-height: 1.5;
}
.summary-card .sub span { color: #1a2538; font-weight: 700; }

.quick-actions {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  margin-bottom: 18px;
}
.quick-actions h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: #0F4C9A;
}
.quick-actions .btn,
.quick-actions .btn-primary {
  margin-right: 8px;
  margin-bottom: 4px;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0 0 16px;
}
.page-header h2 { margin: 0; font-size: 18px; }
.page-header .caption { margin: 4px 0 0; font-size: 12px; color: #6B7A99; }

.info-box {
  background: #fff;
  border-left: 4px solid #1E73D8;
  padding: 16px 20px;
  border-radius: 8px;
  font-size: 13px;
  color: #1a2538;
  line-height: 1.7;
}
.info-box ul { margin: 8px 0 0; padding-left: 22px; }
.info-box li { margin: 3px 0; }

/* ===== Phase C-1 rev2: タイムテーブル（種目別グループ表示） ===== */
.timetable-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  font-size: 13px;
  margin-top: 12px;
}
.timetable-table thead th {
  background: #0F4C9A;
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.timetable-table thead th.num { text-align: right; }
.timetable-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #eef0f3;
}
.timetable-table tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.timetable-table tbody tr:last-child td { border-bottom: none; }
.timetable-table tbody tr.field-event { background: #f0fdf4; }
.timetable-table tbody tr.field-event:hover { background: #e8f5e8; }
.timetable-table tbody tr.track-event { background: #eff6ff; }
.timetable-table tbody tr.track-event:hover { background: #e0eaff; }

/* ===== Phase C-1: タイムテーブル ===== */
.timetable {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  font-size: 13px;
}
.timetable thead th {
  background: #0F4C9A;
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.timetable thead th.num { text-align: right; }
.timetable tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid #eef0f3;
}
.timetable tbody td.num { text-align: right; font-variant-numeric: tabular-nums; }
.timetable tbody tr:last-child td { border-bottom: none; }
.timetable tbody tr.row-track:hover { background: #f5f9ff; }

.timetable tbody tr.row-ceremony {
  background: #e3f2fd;
  font-size: 14px;
}
.timetable tbody tr.row-ceremony td { padding: 12px; }

.timetable tbody tr.row-lunch {
  background: #fff8e6;
}

.timetable tbody tr.row-field {
  background: #f4faf6;
}
.timetable tbody tr.row-field:hover { background: #eaf5ee; }

.loc-track {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef4ff;
  color: #0F4C9A;
  font-size: 11px;
  font-weight: 700;
}
.loc-field {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #e8f5e8;
  color: #265c26;
  font-size: 11px;
  font-weight: 700;
}

/* ===== Phase B-4: 組編成ルール ===== */
.program-rules {
  background: #fff;
  border: 1px solid #e6e8ec;
  border-radius: 10px;
  padding: 12px 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.program-rules > summary {
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  color: #0F4C9A;
  padding: 6px 0;
}
.program-rules[open] > summary {
  border-bottom: 1px solid #e6e8ec;
  margin-bottom: 12px;
  padding-bottom: 8px;
}

.rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.rules-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
}
.rules-field > span {
  font-weight: 700;
  color: #6B7A99;
  font-size: 11px;
  letter-spacing: 0.04em;
}
.rules-field select,
.rules-field input[type="number"] {
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  background: #f7f9fc;
  font-family: inherit;
}
.rules-field select:focus,
.rules-field input:focus {
  outline: none;
  border-color: #1E73D8;
  box-shadow: 0 0 0 3px rgba(30,115,216,0.1);
  background: #fff;
}
.rules-field small {
  color: #8a96b0;
  font-size: 10px;
}

.rules-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== Phase B-3: 未登録選手セクション ===== */
.unmatched-section {
  background: #fff8e6;
  border: 1px solid #ffe69c;
  border-left: 4px solid #f0a500;
  border-radius: 8px;
  padding: 14px 18px;
  margin: 14px 0;
}
.unmatched-section h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: #7a5a00;
}

.unmatched-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  margin: 10px 0 14px;
}
.action-radio {
  display: block;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid #e6e8ec;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-size: 13px;
}
.action-radio:hover {
  border-color: #1E73D8;
  background: #f7faff;
}
.action-radio input[type="radio"] {
  margin-right: 6px;
  cursor: pointer;
}
.action-radio span {
  font-weight: 700;
  display: inline-block;
}
.action-radio small {
  display: block;
  font-size: 10px;
  color: #6B7A99;
  margin-top: 4px;
  margin-left: 22px;
  line-height: 1.4;
}
.action-radio code {
  background: #f0f3f8;
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 9px;
  color: #1a2538;
}
.action-radio input[type="radio"]:checked ~ span {
  color: #0F4C9A;
}
.action-radio:has(input:checked) {
  border-color: #1E73D8;
  background: #eef4ff;
  box-shadow: 0 0 0 2px rgba(30,115,216,0.15);
}

.unmatched-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  background: #fff;
  border-radius: 6px;
  overflow: hidden;
}
.unmatched-table th,
.unmatched-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #f0e9d0;
  text-align: left;
}
.unmatched-table th {
  background: #fff3d6;
  color: #7a5a00;
  font-weight: 700;
}

/* ===== Phase B-2: モーダル + 危険ボタン ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(7, 29, 63, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  animation: slideUp 0.22s ease;
}
@keyframes slideUp { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.modal-title {
  margin: 0 0 18px;
  font-size: 18px;
  color: #0F4C9A;
  border-bottom: 2px solid #e6e8ec;
  padding-bottom: 10px;
}

.modal-field {
  display: block;
  margin-bottom: 14px;
}
.modal-field-label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: #6B7A99;
  margin-bottom: 5px;
}
.modal-field-label .req { color: #E63946; }
.modal-field-hint {
  display: block;
  font-size: 10px;
  color: #8a96b0;
  margin-top: 3px;
}
.modal input[type="text"],
.modal input[type="date"],
.modal input[type="number"],
.modal select,
.modal textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
  background: #f7f9fc;
  transition: border-color 0.18s, box-shadow 0.18s;
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none;
  border-color: #1E73D8;
  box-shadow: 0 0 0 3px rgba(30, 115, 216, 0.12);
  background: #fff;
}

.modal-err {
  background: #fff0f0;
  border-left: 4px solid #E63946;
  padding: 10px 14px;
  border-radius: 6px;
  color: #B42318;
  font-size: 13px;
  margin: 6px 0 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #e6e8ec;
}

/* 危険ボタン */
.btn-danger {
  background: #fff;
  color: #B42318;
  border: 1px solid #E63946;
}
.btn-danger:hover {
  background: #fff0f0;
  color: #B42318;
}
.btn-small.btn-danger {
  background: #fff;
  color: #B42318;
  border: 1px solid #E63946;
}
.btn-small.btn-danger:hover {
  background: #fff0f0;
  color: #B42318;
}

/* ===== Phase A-3a recurring: 年間固定大会カード ===== */
.recurring-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin: 12px 0 0;
}
.recurring-card {
  background: #fff;
  border: 2px solid #1E73D8;
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transition: box-shadow 0.18s, transform 0.18s;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.recurring-card:hover {
  box-shadow: 0 6px 18px rgba(30,115,216,0.18);
  transform: translateY(-1px);
}
.recurring-card.pending {
  border-color: #ddd;
  background: #fafbfd;
  opacity: 0.78;
}
.recurring-card.pending:hover {
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  transform: none;
}
.recurring-card h3 {
  margin: 0;
  color: #0F4C9A;
  font-size: 16px;
  font-weight: 800;
}
.recurring-card .tournament-name {
  font-size: 12px;
  color: #6B7A99;
  margin: 0;
  line-height: 1.4;
}
.recurring-card .meta {
  font-size: 12px;
  color: #6B7A99;
  margin: 0;
  line-height: 1.6;
}
.recurring-card .stats {
  font-size: 12px;
  color: #1a2538;
  margin: 4px 0 0;
}
.recurring-card .stats strong {
  color: #0F4C9A;
  font-variant-numeric: tabular-nums;
}
.recurring-card .actions {
  margin-top: 6px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.badge-pending {
  display: inline-block;
  padding: 4px 10px;
  background: #fff3cd;
  color: #856404;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid #ffe69c;
}

/* ===== Phase A-3a: 大会プログラム ===== */
.btn-small-secondary {
  background: #fff;
  color: #1E73D8;
  border: 1px solid #1E73D8;
  margin-left: 4px;
}
.btn-small-secondary:hover { background: #f0f7ff; }
.ops-cell { white-space: nowrap; }

.action-msg {
  margin-left: 10px;
  font-size: 13px;
  display: inline-block;
  vertical-align: middle;
}
.action-msg.ok  { color: #0A7A2F; font-weight: 700; }
.action-msg.err { color: #B42318; font-weight: 700; }

.event-section {
  background: #fff;
  border: 1px solid #e6e8ec;
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.event-section h2 {
  color: #0F4C9A;
  border-bottom: 2px solid #0F4C9A;
  padding-bottom: 6px;
  margin: 0 0 12px;
  font-size: 16px;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}
.event-meta {
  font-size: 11px;
  color: #8a96b0;
  font-weight: 400;
  margin-left: auto;
}

.heat-block {
  margin: 12px 0;
}
.heat-block.is-final {
  background: #fff8e6;
  padding: 8px 12px;
  border-left: 4px solid #f0a500;
  border-radius: 6px;
}
/* [finals] 予選通過者プレースホルダ（選手未割当の決勝組） */
.heat-block-final-virtual {
  margin: 12px 0;
  padding: 10px 14px;
  background: #fff4e0;
  border: 2px dashed #f0a500;
  border-radius: 6px;
}
.heat-block-final-virtual h3 {
  font-size: 13px;
  color: #8a5a00;
  margin: 0 0 6px;
  font-weight: 700;
}
.heat-block-final-virtual .heat-meta {
  font-weight: 400;
  color: #8a5a00;
  font-size: 11px;
}
.heat-block-final-virtual .heat-final-placeholder {
  margin: 4px 0 0;
  font-size: 12px;
  color: #6b4500;
  font-style: italic;
}
.heat-block h3 {
  font-size: 13px;
  color: #1a2538;
  margin: 0 0 6px;
  font-weight: 700;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.final-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f0a500;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.heat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.heat-table th,
.heat-table td {
  padding: 5px 8px;
  border-bottom: 1px solid #eef0f3;
  text-align: left;
}
.heat-table th {
  background: #f5f7fb;
  font-weight: 700;
  color: #6B7A99;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.heat-table td.num,
.heat-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.heat-table tbody tr:hover { background: #fafbfd; }
.heat-table tbody tr:last-child td { border-bottom: none; }

@media print {
  body { background: #fff; }
  .no-print, .site-header.no-print, .no-print { display: none !important; }
  .container { max-width: none; padding: 0; margin: 0; }
  .event-section {
    page-break-inside: avoid;
    box-shadow: none;
    border: 1px solid #888;
  }
  .heat-block.is-final { background: #fff; border-left: 4px solid #888; }
  .heat-table th { background: #eee !important; color: #000; }
}

/* ===== Phase C-2: PDF 出力用 本番品質印刷 CSS ===== */
.print-only-header { display: none; }

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm 10mm 12mm 10mm;
  }

  body {
    background: #fff !important;
    font-family: 'Yu Gothic', 'Hiragino Sans', 'Meiryo', sans-serif !important;
    font-size: 9pt;
    line-height: 1.3;
  }

  /* 非表示要素 */
  header, .site-header, .main-nav, .actions, .no-print,
  .program-rules, .nav-bar, .quick-links, footer, .site-footer,
  .tournament-banner, #program-actions, #timetable-actions,
  #generate-btn, #print-btn, #download-pdf-btn, .pdf-hint {
    display: none !important;
  }

  main, .container {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* === 印刷専用ヘッダー === */
  .print-only-header {
    display: block !important;
    text-align: center;
    margin-bottom: 6mm;
    border-bottom: 2px solid #000;
    padding-bottom: 2mm;
  }
  .print-only-header h1 {
    font-size: 16pt;
    font-weight: bold;
    margin: 0;
    color: #000;
  }
  .print-only-header .subtitle {
    font-size: 10pt;
    color: #555;
    margin-top: 2mm;
  }

  /* === プログラム種目セクション === */
  .event-section {
    page-break-inside: avoid;
    page-break-after: auto;
    margin-bottom: 6mm;
    border: none;
    padding: 0;
    background: transparent !important;
    box-shadow: none;
  }
  .event-section h2 {
    font-size: 12pt;
    font-weight: bold;
    margin: 4mm 0 2mm 0;
    padding: 1mm 2mm;
    background: #f0f0f0 !important;
    color: #000 !important;
    border: 1px solid #888;
    border-bottom: 2px solid #000;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .event-meta { font-size: 8pt; color: #555 !important; }

  /* === 組ブロック === */
  .heat-block {
    page-break-inside: avoid;
    margin: 2mm 0;
    background: transparent !important;
    border-left: none !important;
    padding: 0 !important;
  }
  .heat-block h3 {
    font-size: 10pt;
    font-weight: bold;
    margin: 2mm 0 1mm 0;
    padding: 0.5mm 2mm;
    background: #fff !important;
    border-bottom: 1px dashed #555;
    color: #000;
  }
  .heat-block.is-final h3::after {
    content: ' (＋・−  m)';
    font-size: 8pt;
    font-weight: normal;
    color: #555;
  }
  .final-badge {
    background: #fff !important;
    color: #000 !important;
    border: 1px solid #555;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* === 組内テーブル === */
  .heat-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 9pt;
  }
  .heat-table th { display: none; }
  .heat-table td {
    padding: 0.8mm 1.5mm;
    border: none;
    border-bottom: 1px dotted #ccc;
    vertical-align: middle;
    background: transparent !important;
  }
  /* 1: レーン / 試技順 */
  .heat-table td:first-child {
    width: 8mm;
    text-align: center;
    font-weight: bold;
    font-size: 10pt;
  }
  /* 2: 氏名 */
  .heat-table td:nth-child(2) { font-size: 10pt; font-weight: bold; }
  /* 3: カナ */
  .heat-table td:nth-child(3) { font-size: 8pt; color: #555 !important; width: 30mm; }
  /* 4: クラブ */
  .heat-table td:nth-child(4) { font-size: 8pt; width: 35mm; }
  /* 5: 学年 */
  .heat-table td:nth-child(5) { width: 8mm; text-align: center; }
  /* 6: 資格記録 + 結果記入欄 */
  .heat-table td:nth-child(6) { font-size: 8pt; color: #888 !important; width: 36mm; text-align: right; }
  .heat-table td:nth-child(6)::after {
    content: '   (    )   ″';
    font-size: 8pt;
    color: #888;
    margin-left: 4mm;
  }
  /* フィールド種目（jump/throw）はメートル単位の結果欄 */
  .event-section.field-event-section .heat-table td:nth-child(6)::after {
    content: '   (        )   m';
  }

  /* === タイムテーブル === */
  .timetable-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 10pt;
    box-shadow: none;
  }
  .timetable-table thead th {
    background: #333 !important;
    color: #fff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .timetable-table tbody tr.field-event {
    background: #f0f8f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .timetable-table tbody tr.track-event {
    background: #f0f4f8 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .timetable-table tbody tr.row-ceremony {
    background: #e3f2fd !important;
    -webkit-print-color-adjust: exact;
  }
  .timetable-table tbody tr.row-lunch {
    background: #fff8e6 !important;
    -webkit-print-color-adjust: exact;
  }
}

/* ===== Phase C-2: PDF 保存案内モーダル ===== */
.pdf-hint {
  position: fixed;
  inset: 0;
  background: rgba(7, 29, 63, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1100;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
.pdf-hint-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px;
  max-width: 460px;
  width: 100%;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.32);
  animation: slideUp 0.22s ease;
}
.pdf-hint-box h3 {
  margin: 0 0 12px;
  font-size: 16px;
  color: #0F4C9A;
  border-bottom: 2px solid #e6e8ec;
  padding-bottom: 8px;
}
.pdf-hint-box ol {
  margin: 12px 0;
  padding-left: 22px;
  font-size: 13px;
  line-height: 1.8;
}
.pdf-hint-box ol li { margin: 4px 0; }
.pdf-hint-box .pdf-hint-tip {
  background: #f7faff;
  border-left: 3px solid #1E73D8;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: #6B7A99;
  margin: 12px 0;
}
.pdf-hint-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #e6e8ec;
}

.site-footer {
  text-align: center;
  padding: 24px 0;
  color: #8a96b0;
  font-size: 11px;
}

/* ============================================================
 * [Phase E-1] タイムテーブル設定フォーム + トラック/フィールドセクション
 * ============================================================ */
.timetable-rules {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 12px 16px;
  margin: 12px 0 16px;
}
.timetable-rules > summary {
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  list-style: revert;
  color: #1a2538;
}
.timetable-rules[open] > summary {
  margin-bottom: 8px;
}
.timetable-rules .rules-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin: 8px 0 12px;
}
.timetable-rules .rules-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: #4a5566;
}
.timetable-rules .rules-grid input,
.timetable-rules .rules-grid select {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
}
.timetable-rules .rules-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.timetable-rules .rules-msg {
  font-size: 12px;
  color: #4a5566;
}
.timetable-rules .rules-msg.ok  { color: #047857; }
.timetable-rules .rules-msg.err { color: #B42318; }

#track-section,
#field-section {
  background: #fff;
  padding: 14px 18px;
  border-radius: 8px;
  margin-bottom: 14px;
  border: 1px solid #e2e8f0;
}
#track-section h2 {
  color: #1e40af;
  border-bottom: 2px solid #1e40af;
  padding-bottom: 6px;
  margin: 0 0 10px;
  font-size: 16px;
}
#field-section h2 {
  color: #059669;
  border-bottom: 2px solid #059669;
  padding-bottom: 6px;
  margin: 0 0 10px;
  font-size: 16px;
}

/* タイムテーブル表の 3 時刻列を等幅・中央寄せ */
.timetable-table th:nth-child(1),
.timetable-table th:nth-child(2),
.timetable-table th:nth-child(3),
.timetable-table td:nth-child(1),
.timetable-table td:nth-child(2),
.timetable-table td:nth-child(3) {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, monospace;
  text-align: center;
}
.timetable-table td:nth-child(3) strong {
  font-size: 1.05em;
  color: #1e40af;
}

/* ============================================================
 * [Phase F-2] タイムテーブル時刻調整: D&D + 編集ボタン
 * ============================================================ */
.timetable-table tbody tr[draggable="true"] {
  cursor: move;
  transition: background-color 0.15s, opacity 0.15s;
}
.timetable-table tbody tr.dragging {
  opacity: 0.4;
  background: #fef3c7 !important;
}
.timetable-table tbody tr.drop-target {
  background: #dbeafe !important;
  outline: 2px dashed #1e40af;
  outline-offset: -2px;
}
.btn-tiny {
  padding: 2px 6px;
  font-size: 12px;
  line-height: 1.2;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  cursor: pointer;
  color: #1a2538;
}
.btn-tiny:hover {
  background: #e2e8f0;
}

@media print {
  .btn-tiny { display: none; }
  .timetable-table tbody tr[draggable="true"] { cursor: default; }
}

/* ============================================================
 * [Phase F-1] 大会役員ページ
 * ============================================================ */
.role-category {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.role-category h2 {
  margin: 0 0 10px;
  font-size: 16px;
  color: #1a2538;
  border-bottom: 2px solid #1E73D8;
  padding-bottom: 6px;
}
.officials-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.officials-table th,
.officials-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 8px 10px;
  vertical-align: top;
  text-align: left;
}
.officials-table th {
  background: #f5f7fb;
  font-weight: 600;
  color: #4a5566;
}
.officials-table tr.shortage td {
  background: #fef2f2;
}
.officials-table .badge-shortage {
  display: inline-block;
  font-size: 11px;
  color: #B42318;
  background: #fee2e2;
  border-radius: 3px;
  padding: 1px 6px;
  font-weight: 600;
}
.officials-table .caption {
  color: #8a96b0;
  font-size: 11px;
}
.officials-table .assignment {
  display: block;
  padding: 1px 0;
}
.officials-table .assignment.unassigned {
  color: #8a96b0;
  font-style: italic;
}

@media print {
  .role-category { box-shadow: none; border-color: #888; }
  .officials-table tr.shortage td { background: #fff; }
  .officials-table .badge-shortage {
    color: #000;
    background: #fff;
    border: 1px solid #000;
  }
}

/* ============================================================
 * [Phase H] クラブ別選手一覧ページ
 *  - .btn-tiny は Phase F-2 で既定義 → ここでは .btn-tiny.btn-danger のみ追加
 * ============================================================ */
.club-banner {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  padding: 1.2em 1.4em;
  border-radius: 8px;
  margin-bottom: 1em;
  border: 1px solid #c7d2fe;
}
.club-banner h2 {
  margin: 0 0 6px 0;
  color: #1e40af;
  font-size: 18px;
}
.club-banner h2 small {
  font-size: 0.65em;
  color: #64748b;
  font-weight: 500;
}
.club-banner .meta {
  color: #475569;
  font-size: 13px;
  margin: 0;
}
.club-banner .summary-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.club-banner .summary-row .stat {
  background: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 13px;
}
.club-banner .summary-row .stat.tentative {
  background: #fef3c7;
  color: #78350f;
  border-color: #fcd34d;
}

.filters {
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 12px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  border: 1px solid #e2e8f0;
}
.filters label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #4a5566;
}
.filters select,
.filters input {
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 13px;
  font-family: inherit;
}
.filters #filter-search {
  flex: 1;
  min-width: 220px;
}

.athletes-table {
  width: 100%;
  background: #fff;
  border-collapse: collapse;
  font-size: 13px;
}
.athletes-table th,
.athletes-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
}
.athletes-table th {
  background: #1e40af;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
}
.athletes-table tbody tr:hover {
  background: #f8fafc;
}
.athletes-table tbody tr.tentative-row {
  background: #fffbeb;
}
.athletes-table tbody tr.tentative-row:hover {
  background: #fef3c7;
}

.badge-tentative,
.badge-external,
.badge-paid,
.badge-member {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  white-space: nowrap;
}
.badge-tentative { background: #fef3c7; color: #78350f; }
.badge-external  { background: #dbeafe; color: #1e40af; }
.badge-paid      { background: #dcfce7; color: #14532d; }
.badge-member    { background: #f1f5f9; color: #475569; }

.actions-cell {
  white-space: nowrap;
}
.btn-tiny.btn-danger {
  border-color: #fca5a5;
  color: #b91c1c;
}
.btn-tiny.btn-danger:hover {
  background: #fee2e2;
}

@media print {
  .filters { display: none; }
  .athletes-table th { background: #555; }
}

/* ============================================================
 * [Phase I-1] クラブアカウント招待セクション
 * ============================================================ */
.invitation-section {
  background: #fff;
  padding: 14px 18px;
  border-radius: 8px;
  margin: 14px 0;
  border-left: 4px solid #1e40af;
  border-top: 1px solid #e2e8f0;
  border-right: 1px solid #e2e8f0;
  border-bottom: 1px solid #e2e8f0;
}
.invitation-section .invitation-actions {
  display: flex;
  gap: 10px;
  margin: 10px 0 12px;
  flex-wrap: wrap;
}
.invitation-section .invitation-actions .btn {
  font-size: 14px;
}

.invitation-table {
  width: 100%;
  background: #fff;
  border-collapse: collapse;
  font-size: 13px;
}
.invitation-table th,
.invitation-table td {
  padding: 6px 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: top;
}
.invitation-table th {
  background: #1e40af;
  color: #fff;
  font-weight: 600;
  font-size: 12px;
}
.invitation-table tbody tr:hover {
  background: #f8fafc;
}

.status-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.status-badge.gray   { background: #f1f5f9; color: #64748b; }
.status-badge.yellow { background: #fef3c7; color: #78350f; }
.status-badge.green  { background: #dcfce7; color: #14532d; }

@media print {
  .invitation-section .invitation-actions { display: none; }
}

/* ============================================================
 * [Phase I-2b] club_coach 専用ダッシュボード — 友好的 UI
 * ============================================================ */
.app-header.friendly {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: white;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.app-header.friendly h1 {
  color: white;
  margin: 0;
  font-size: 22px;
  flex: 1;
}
.app-header.friendly .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.app-header.friendly .btn-link {
  color: white;
  text-decoration: underline;
}

.friendly-container {
  max-width: 1100px;
  margin: 2em auto;
  padding: 0 1em;
}

.section-title {
  font-size: 1.5em;
  margin: 2em 0 1em;
  color: #1e40af;
}

.banner-warn {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 1em 1.5em;
  border-radius: 6px;
  margin-bottom: 1.5em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.club-card-big {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  padding: 2em;
  border-radius: 12px;
  margin-bottom: 2em;
}
.club-card-big h2 {
  color: #1e40af;
  margin: 0 0 1em;
  font-size: 1.6em;
}
.club-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1em;
  margin-bottom: 1.5em;
}
.club-stats {
  display: flex;
  gap: 0.7em;
  flex-wrap: wrap;
}
.stat-pill {
  background: white;
  padding: 0.5em 1.2em;
  border-radius: 24px;
  border: 1px solid #cbd5e1;
}
.stat-pill.tentative { background: #fef3c7; }

.main-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.5em;
  margin-bottom: 2em;
}
.action-card {
  background: white;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 2em 1.5em;
  text-decoration: none;
  color: #1e293b;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}
.action-card:hover {
  border-color: #1e40af;
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(30,64,175,0.15);
}
.action-icon {
  font-size: 3em;
  margin-bottom: 0.3em;
}
.action-title {
  font-size: 1.3em;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 0.3em;
}
.action-desc {
  font-size: 0.9em;
  color: #64748b;
}

.tournament-row {
  background: white;
  padding: 1.5em;
  border-radius: 8px;
  margin-bottom: 1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-left: 4px solid #cbd5e1;
  gap: 12px;
  flex-wrap: wrap;
}
.tournament-row.open { border-left-color: #16a34a; }
.tournament-row.closed { border-left-color: #dc2626; opacity: 0.6; }
.tournament-info { flex: 1; min-width: 200px; }
.tournament-info h3 {
  margin: 0 0 0.3em 0;
  color: #1e40af;
}
.tournament-info .meta {
  font-size: 0.9em;
  color: #64748b;
  margin: 0;
}
.my-entries-info {
  background: #dcfce7;
  color: #14532d;
  padding: 0.4em 0.8em;
  border-radius: 4px;
  display: inline-block;
  margin-top: 0.5em;
  font-size: 0.9em;
}
.btn.btn-large {
  padding: 0.9em 1.5em;
  font-size: 1.05em;
}
.badge-closed {
  background: #fee2e2;
  color: #7f1d1d;
  padding: 0.5em 1em;
  border-radius: 4px;
}

.empty {
  color: #8a96b0;
  text-align: center;
  padding: 2em;
  font-size: 14px;
}

/* ============================================================
 * [Phase I-2b logout] 統一ヘッダーログアウトボタン
 * ============================================================ */
.header-actions {
  display: flex;
  align-items: center;
  gap: 1em;
}

/* Phase J で grid layout に移行 → 絶対配置は不要（grid justify-self: end で配置） */

.user-display {
  color: #475569;
  font-size: 0.9em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}
.user-display small {
  color: #94a3b8;
  margin-left: 0.3em;
}

.btn-logout {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 0.5em 1em;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9em;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}
.btn-logout:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* friendly ヘッダー（club-dashboard：青グラデ背景）の場合 */
.app-header.friendly .btn-logout {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
  color: white;
}
.app-header.friendly .btn-logout:hover {
  background: rgba(220,38,38,0.8);
  border-color: rgba(220,38,38,1);
}
.app-header.friendly .user-display {
  color: rgba(255,255,255,0.95);
  max-width: none;
}
.app-header.friendly .user-display small {
  color: rgba(255,255,255,0.7);
}

/* 印刷時は非表示 */
@media print {
  .header-actions { display: none !important; }
}

/* ============================================================
 * [Phase J] 統一ヘッダー（grid layout）+ ダッシュボードカテゴリ
 *
 * 既存の .site-header / .app-header は flexbox ベースのスタイルが
 * 上部 (line 16-31 / 1648-1670 等) に定義されているが、
 * ここでは grid layout を後勝ちで上書きする。
 * 既存 .header-actions / .btn-logout / .user-display は維持（Phase I-1 で追加）。
 * ============================================================ */
.site-header,
.app-header {
  display: grid;
  grid-template-columns: minmax(180px, auto) 1fr minmax(280px, auto);
  align-items: center;
  gap: 1em;
  padding: 1em 1.5em;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: relative;
  text-align: initial;          /* 旧 .site-header の text-align:center 上書き */
  color: #1a2538;
  background-image: none;       /* 旧グラデを打消し（friendly は再上書きで戻す） */
}
.site-header h1,
.app-header h1 {
  /* 旧 .site-header h1 (フォント 24 / 中央 / 白) を打消し（個別子に任せる） */
  font-size: inherit;
  color: inherit;
  margin: 0;
  font-weight: inherit;
}
.site-header .tagline,
.app-header .tagline { display: none; }

.header-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  min-width: 0;
}
.header-brand .brand-emoji {
  font-size: 22px;
  line-height: 1;
}
.header-brand .brand-name {
  font-size: 13px;
  color: #64748b;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-title {
  text-align: center;
  justify-self: center;
  min-width: 0;
}
.header-title .system-name {
  font-size: 22px;
  margin: 0;
  color: #1e40af;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.15;
  white-space: nowrap;
}
.header-title .page-title {
  font-size: 14px;
  margin: 2px 0 0;
  color: #64748b;
  font-weight: 500;
}

.header-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.8em;
  justify-self: end;
  flex-wrap: nowrap;
  white-space: nowrap;
  min-width: 0;
}

/* friendly variant（club-dashboard）はグラデを復活 */
.app-header.friendly {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  background-image: linear-gradient(135deg, #1e40af, #3b82f6);
  border-bottom: 0;
  color: #fff;
}
.app-header.friendly .header-title .system-name { color: #fff; }
.app-header.friendly .header-title .page-title { color: rgba(255,255,255,0.85); }
.app-header.friendly .header-brand .brand-name  { color: rgba(255,255,255,0.85); }

@media print {
  .site-header .header-actions,
  .app-header .header-actions { display: none; }
}

@media (max-width: 768px) {
  .site-header,
  .app-header {
    grid-template-columns: 1fr;
    gap: 6px;
    text-align: center;
  }
  .header-brand   { justify-self: center; }
  .header-actions { justify-self: center; }
  .header-title .system-name { font-size: 18px; }
}

/* ============================================================
 * [Phase J] ダッシュボード カテゴリブロック + クイックアクション
 * ============================================================ */
.section-title {
  font-size: 18px;
  color: #1e40af;
  margin: 24px 0 12px;
  font-weight: 700;
}

.category-block {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.category-title {
  font-size: 17px;
  color: #1e40af;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid #dbeafe;
}

.stat-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
}
.stat-card {
  padding: 18px 14px;
  border-radius: 8px;
  text-align: center;
  border-left: 4px solid #1e40af;
  background: #f8fafc;
}
.stat-card-primary { border-left-color: #1e40af; }
.stat-card-success { border-left-color: #16a34a; }
.stat-card-warning { border-left-color: #f59e0b; }
.stat-card-info    { border-left-color: #06b6d4; }

/* [Phase P / fee] 合計参加費カード */
.stat-card-fee {
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-left-color: #d97706;
}
.stat-card-fee .stat-number {
  color: #92400e;
  font-weight: 700;
}

.stat-card .stat-number {
  font-size: 34px;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  margin-bottom: 4px;
}
.stat-card .stat-label {
  color: #64748b;
  font-size: 13px;
}

.quick-actions-section {
  margin-top: 28px;
}
.quick-actions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}
.quick-action-card {
  background: #fff;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  padding: 22px 16px;
  text-decoration: none;
  color: #1e293b;
  text-align: center;
  transition: all 0.2s;
  display: block;
}
.quick-action-card:hover {
  border-color: #1e40af;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(30,64,175,0.12);
}
.quick-action-card .qa-icon {
  font-size: 36px;
  margin-bottom: 4px;
}
.quick-action-card .qa-title {
  font-size: 15px;
  font-weight: 700;
  color: #1e40af;
  margin-bottom: 4px;
}
.quick-action-card .qa-desc {
  font-size: 12px;
  color: #64748b;
}

/* ============================================================
 * [Phase J-2] カテゴリ説明文 + クリッカブル統計カード
 * ============================================================ */
.category-header {
  margin-bottom: 1em;
  padding-bottom: 0.5em;
  border-bottom: 2px solid #dbeafe;
}
.category-title {
  font-size: 1.3em;
  margin: 0;
}
.category-link {
  color: #1e40af;
  text-decoration: none;
  transition: color 0.15s;
}
.category-link:hover {
  color: #3b82f6;
  text-decoration: underline;
}
.category-description {
  margin: 0.3em 0 0 0;
  color: #64748b;
  font-size: 0.9em;
}

.stat-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30,64,175,0.1);
}

/* ============================================================
 * [Phase K] 固定大会の 3 セクション化（recurring-tournaments 内）
 * ============================================================ */
.tournament-section {
  background: #fff;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 14px;
  border: 1px solid #e2e8f0;
}
.tournament-section-header {
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 2px solid #dbeafe;
}
.tournament-section-title {
  font-size: 15px;
  color: #1e40af;
  margin: 0 0 2px;
  font-weight: 700;
}
.tournament-section-desc {
  margin: 0;
  color: #64748b;
  font-size: 12px;
}
/* 既存 .recurring-cards をそのまま使用（renderRecurringCard 共通） */

/* ============================================================
 * [Phase K-2] カスタム大会カード（固定大会カードと統一）
 * ============================================================ */
.recurring-card.custom-card {
  border-left: 4px solid #f59e0b;
  background: #fffbeb;
}
.recurring-card.custom-card .tc-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 6px;
}
.recurring-card.custom-card .tc-header h3 {
  margin: 0;
  font-size: 15px;
  color: #1e40af;
  line-height: 1.3;
}
.custom-badge {
  background: #fef3c7;
  color: #78350f;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  white-space: nowrap;
  font-weight: 600;
}

/* カスタム大会のステータスバッジ */
.status-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 4px;
  font-size: 11px;
  margin-right: 4px;
  white-space: nowrap;
}
.status-badge.draft     { background: #fef3c7; color: #78350f; }
.status-badge.open      { background: #dcfce7; color: #14532d; }
.status-badge.closed    { background: #fee2e2; color: #7f1d1d; }
.status-badge.completed { background: #e0e7ff; color: #312e81; }

/* 件数バッジ（セクションタイトル横） */
.badge-count {
  background: #1e40af;
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  margin-left: 6px;
  vertical-align: middle;
}

/* ============================================================
 * [Phase K-3] 指導者一覧テーブル
 * ============================================================ */
.coaches-table {
  width: 100%;
  background: #fff;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 18px;
}
.coaches-table th {
  background: #1e40af;
  color: #fff;
  padding: 8px 10px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
}
.coaches-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #e2e8f0;
  vertical-align: top;
}
.coaches-table tbody tr:hover {
  background: #f8fafc;
}
.coaches-table code {
  background: #f1f5f9;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.qual-badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.qual-badge.coach   { background: #dbeafe; color: #1e40af; }
.qual-badge.referee { background: #d1fae5; color: #14532d; }

.missing {
  color: #94a3b8;
  font-style: italic;
  font-size: 11px;
}

/* ============================================================
 * [Phase L-a] 種目別 組編成設定モーダル
 * ============================================================ */
.btn-cfg-event {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 8px;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  color: #475569;
  font-size: 13px;
  cursor: pointer;
  vertical-align: middle;
  line-height: 1.2;
}
.btn-cfg-event:hover {
  background: #f1f5f9;
  border-color: #1e40af;
  color: #1e40af;
}

.event-config-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.event-config-modal-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}
.event-config-modal-card .cfg-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 12px 0;
}
.event-config-modal-card .cfg-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.event-config-modal-card .cfg-label {
  font-size: 12px;
  color: #475569;
  font-weight: 600;
}
.event-config-modal-card .cfg-hint {
  color: #8a96b0;
  font-size: 11px;
}
.event-config-modal-card select,
.event-config-modal-card input[type="number"] {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  font-size: 14px;
  font-family: inherit;
}
.event-config-modal-card .cfg-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.event-config-modal-card .cfg-msg {
  font-size: 12px;
  min-height: 14px;
  color: #4a5566;
}
.event-config-modal-card .cfg-msg.ok  { color: #047857; }
.event-config-modal-card .cfg-msg.err { color: #B42318; }

@media print {
  .event-config-overlay,
  .btn-cfg-event { display: none !important; }
}

/* ============================================================
 * [Phase J-4] system-name 二段構造（さいたまアスレティック + SAITAMA ATHLETIC SYSTEM）
 *  既存 .header-title .system-name の font-size/color/letter-spacing は
 *  内側の span に移譲するため、ここで上書きする。
 * ============================================================ */
.header-title .system-name {
  margin: 0;
  display: flex;
  flex-direction: column;
  text-align: center;
  line-height: 1.1;
  white-space: normal;        /* 二段折り返しを許可 */
  font-size: inherit;         /* 子 span 側で個別指定 */
  color: inherit;
  font-weight: inherit;
  letter-spacing: 0;
}
.system-name-jp {
  font-size: 22px;
  color: #1e40af;
  font-weight: 800;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.system-name-en {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 600;
  letter-spacing: 0.18em;
  margin-top: 2px;
  font-family: 'Helvetica Neue', 'Segoe UI', Arial, sans-serif;
  white-space: nowrap;
}

/* friendly variant（club-dashboard 用） */
.app-header.friendly .system-name-jp { color: #fff; }
.app-header.friendly .system-name-en { color: rgba(255,255,255,0.75); }

/* スマホ */
@media (max-width: 768px) {
  .system-name-jp { font-size: 18px; }
  .system-name-en { font-size: 9px; letter-spacing: 0.15em; }
}

/* ============================================================
 * [Phase J-4r] クラブ 0 件時の大きなアップローダー
 * ============================================================ */
.big-uploader-section {
  margin: 32px 0;
}
.big-uploader-card {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 2px dashed #1e40af;
  border-radius: 16px;
  padding: 36px 24px;
  text-align: center;
  max-width: 720px;
  margin: 0 auto;
}
.big-uploader-icon {
  font-size: 56px;
  line-height: 1;
  margin-bottom: 6px;
}
.big-uploader-title {
  color: #1e40af;
  font-size: 22px;
  margin: 8px 0 4px;
  font-weight: 800;
}
.big-uploader-desc {
  color: #475569;
  font-size: 14px;
  margin: 6px 0 18px;
}
.btn.btn-huge {
  font-size: 16px;
  padding: 14px 28px;
  border-radius: 8px;
  font-weight: 700;
}
.big-uploader-hint {
  color: #64748b;
  font-size: 12px;
  margin-top: 16px;
}

@media (max-width: 640px) {
  .big-uploader-card { padding: 24px 14px; }
  .big-uploader-icon { font-size: 44px; }
  .big-uploader-title { font-size: 18px; }
  .big-uploader-desc { font-size: 13px; }
  .btn.btn-huge { font-size: 14px; padding: 12px 18px; }
}

/* ============================================================
 * [Phase O] 大カード直接 D&D アップロード
 * ============================================================ */
.big-uploader-card {
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s;
}
.big-uploader-card.drag-over {
  border-color: #1d4ed8;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  transform: scale(1.015);
  box-shadow: 0 12px 28px rgba(30, 64, 175, 0.22);
}
.big-uploader-advanced {
  margin-top: 14px;
  font-size: 12px;
}
.big-uploader-advanced a {
  color: #64748b;
  text-decoration: none;
}
.big-uploader-advanced a:hover {
  color: #1e40af;
  text-decoration: underline;
}

/* アップロード進行中 */
.spinning {
  display: inline-block;
  animation: bigDndSpin 1.5s linear infinite;
}
@keyframes bigDndSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.upload-progress-text {
  font-size: 15px;
  color: #1e40af;
  font-weight: 700;
  margin: 14px 0 6px;
}
.upload-progress-bar {
  width: 100%;
  max-width: 480px;
  height: 14px;
  background: #e2e8f0;
  border-radius: 8px;
  overflow: hidden;
  margin: 10px auto;
}
.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1e40af);
  width: 0%;
  transition: width 0.25s ease-out;
}
.upload-progress-detail {
  color: #64748b;
  font-size: 12px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  margin-top: 6px;
  word-break: break-all;
}
.upload-progress-hint {
  color: #64748b;
  font-size: 12px;
  margin-top: 14px;
  font-style: italic;
}

/* 完了状態 */
.upload-result-list {
  list-style: none;
  padding: 0;
  max-width: 420px;
  margin: 16px auto 18px;
  text-align: left;
}
.upload-result-list li {
  background: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  margin: 6px 0;
  border-left: 4px solid #16a34a;
  font-size: 14px;
  color: #1f2937;
}
.upload-result-list li.upload-result-err {
  border-left-color: #dc2626;
  color: #7f1d1d;
}
.upload-result-list li small {
  color: #6b7280;
  font-size: 11px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  line-height: 1.6;
}

/* ============================================================
 * [Phase M] 県大会 未登録選手ブロック専用 UI
 * ============================================================ */
.blocked-modal-card {
  background: #fff;
  border-radius: 12px;
  border: 1px solid #fca5a5;
  box-shadow: 0 4px 16px rgba(220,38,38,0.12);
  max-width: 720px;
  margin: 0 auto;
  overflow: hidden;
}
.modal-header-error {
  background: linear-gradient(135deg, #fef2f2, #fee2e2);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 3px solid #dc2626;
}
.modal-header-error .error-icon {
  font-size: 36px;
  line-height: 1;
}
.modal-header-error h2 {
  color: #991b1b;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}
.blocked-modal-card .modal-body {
  padding: 18px 22px;
}
.blocked-modal-card .error-message {
  background: #fef2f2;
  border-left: 4px solid #dc2626;
  padding: 12px 14px;
  border-radius: 4px;
  color: #7f1d1d;
  margin: 0 0 16px;
  line-height: 1.6;
}
.blocked-modal-card .blocked-list {
  background: #f8fafc;
  padding: 14px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
}
.blocked-modal-card .list-title {
  color: #475569;
  margin: 0 0 10px;
  font-size: 13px;
}
.blocked-modal-card .blocked-athletes {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}
.blocked-modal-card .blocked-athletes li {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
  background: #fff;
  font-size: 13px;
}
.blocked-modal-card .blocked-athletes li:last-child {
  border-bottom: none;
}
.blocked-modal-card .blocked-athletes small {
  color: #94a3b8;
  margin-left: 6px;
}
.blocked-modal-card .action-guide {
  background: #fffbeb;
  border-left: 4px solid #f59e0b;
  padding: 12px 14px;
  border-radius: 4px;
}
.blocked-modal-card .action-guide ol {
  margin: 6px 0 0 18px;
  padding: 0;
  font-size: 13px;
}
.blocked-modal-card .action-guide li {
  margin: 4px 0;
}
.blocked-modal-card .actions {
  padding: 14px 22px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  border-top: 1px solid #e2e8f0;
  flex-wrap: wrap;
}

/* ================================================================
   [Phase N] Danger Zone — Events 登録データ一括リセット (admin 専用)
   ================================================================ */
.danger-section {
  margin-top: 28px;
}
.danger-card {
  background: #fff;
  border: 2px solid #E63946;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(230, 57, 70, 0.10);
}
.danger-header {
  background: linear-gradient(135deg, #E63946 0%, #B42318 100%);
  color: #fff;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.danger-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.danger-header .danger-icon {
  font-size: 20px;
}
.danger-body {
  padding: 18px 22px;
}
.danger-title {
  margin: 0 0 8px;
  font-size: 15px;
  font-weight: 700;
  color: #B42318;
}
.danger-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: #4a5568;
  line-height: 1.6;
}
.danger-targets {
  margin: 0 0 14px;
  padding-left: 22px;
  font-size: 13px;
  color: #4a5568;
  line-height: 1.7;
}
.danger-targets li.ok {
  color: #1F7A4A;
  font-weight: 600;
}
.danger-warning {
  background: #fff0f0;
  border-left: 4px solid #E63946;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 0 0 14px;
  font-size: 12px;
  color: #B42318;
  font-weight: 600;
}
.btn-danger {
  background: #E63946;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 22px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(230, 57, 70, 0.25);
  transition: background-color 0.15s, transform 0.05s;
}
.btn-danger:hover:not(:disabled) {
  background: #B42318;
}
.btn-danger:active:not(:disabled) {
  transform: translateY(1px);
}
.btn-danger:disabled {
  background: #c8c8c8;
  cursor: not-allowed;
  box-shadow: none;
}
.reset-result {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.reset-result.reset-ok {
  background: #f0fff5;
  border: 1px solid #2eaf5d;
  color: #1F7A4A;
}
.reset-result.reset-err {
  background: #fff0f0;
  border: 1px solid #E63946;
  color: #B42318;
}

/* ============================================================
 * [scroll-pulse] 完了/ブロック表示時のアテンション誘導
 *   - .result-highlight: 2 秒の glow
 *   - .btn-pulse:        主要アクションボタンのパルス強調（×3）
 * ============================================================ */
.result-highlight {
  animation: resultGlow 2.2s ease-out;
  border-radius: 12px;
}
@keyframes resultGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.55);
    background-color: rgba(219, 234, 254, 0.55);
  }
  60% {
    box-shadow: 0 0 0 22px rgba(59, 130, 246, 0);
    background-color: rgba(219, 234, 254, 0.25);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    background-color: transparent;
  }
}

.btn-pulse {
  animation: btnPulse 1.5s ease-in-out 3;
  position: relative;
}
@keyframes btnPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(30, 115, 216, 0.7);
  }
  50% {
    transform: scale(1.045);
    box-shadow: 0 0 0 14px rgba(30, 115, 216, 0);
  }
}
/* 県大会ブロック画面用の赤系パルス */
.blocked-modal-card .btn-pulse {
  animation-name: btnPulseDanger;
}
@keyframes btnPulseDanger {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7);
  }
  50% {
    transform: scale(1.045);
    box-shadow: 0 0 0 14px rgba(220, 38, 38, 0);
  }
}

/* ============================================================
 * [Phase M-2] 3 年生自動仮登録の情報メッセージ
 * ============================================================ */
.blocked-modal-card .info-message {
  background: #ecfdf5;
  border-left: 4px solid #10b981;
  padding: 10px 14px;
  border-radius: 6px;
  margin: 10px 0 14px;
  font-size: 13px;
  color: #065f46;
  font-weight: 500;
}
.blocked-modal-card .info-message strong {
  color: #047857;
  font-weight: 700;
}

/* ============================================================
 * [sticky] files-section の長尺対策
 *   - file-list-container: 内部スクロールで高さ固定
 *   - files-action-bar:    section 内 sticky で常に画面下に表示
 * ============================================================ */
.file-list-container {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 12px;
  background: #f8fafc;
}
.file-list-container .files-list,
.file-list-container #files-list {
  margin: 0;
  padding: 0;
  list-style: none;
}
.file-list-container::-webkit-scrollbar {
  width: 8px;
}
.file-list-container::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
.file-list-container::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* sticky アクションバー（files-section 内のみ適用するため .actions と複合） */
.actions.files-action-bar {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 12px 14px;
  border-top: 2px solid #e2e8f0;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  z-index: 10;
  margin-top: 12px;
  border-radius: 0 0 8px 8px;
}

.btn-start-upload {
  font-size: 15px;
  padding: 12px 24px;
  min-width: 220px;
}

@media (max-width: 768px) {
  .file-list-container { max-height: 240px; }
  .actions.files-action-bar {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .btn-start-upload { width: 100%; min-width: 0; }
}

/* ============================================================
 * [Phase Q] 大会×クラブ一覧 / 詳細
 * ============================================================ */
.breadcrumb {
  margin: 12px 0 14px;
  font-size: 12px;
  color: #6B7A99;
}
.breadcrumb a { color: #1E73D8; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; color: #B8C2D1; }

.q-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}
.q-stat-card {
  background: #fff;
  border-radius: 10px;
  padding: 14px 18px;
  text-align: center;
  border: 1px solid #e6e8ec;
}
.q-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #0F4C9A;
  line-height: 1.1;
}
.q-stat-label {
  font-size: 12px;
  color: #6B7A99;
  margin-top: 4px;
}
.q-stat-card.q-stat-success { border-color: #d4f4dd; background: #f0fff5; }
.q-stat-card.q-stat-success .q-stat-value { color: #1F7A4A; }
.q-stat-card.q-stat-tentative { border-color: #fcd34d; background: #fffbeb; }
.q-stat-card.q-stat-tentative .q-stat-value { color: #b45309; }
.q-stat-card.q-stat-skipped { border-color: #fecaca; background: #fef2f2; }
.q-stat-card.q-stat-skipped .q-stat-value { color: #b91c1c; }
.q-stat-card.q-stat-fee { border-color: #dbeafe; background: #eff6ff; }
.q-stat-card.q-stat-fee .q-stat-value { color: #1e40af; }

.q-summary-bits {
  margin: 4px 0 14px;
  font-size: 12px;
}
.q-summary-bits .bit {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  margin-right: 8px;
  font-weight: 600;
}
.q-summary-bits .bit-skipped { background: #fee2e2; color: #b91c1c; }
.q-summary-bits .bit-tent    { background: #fef3c7; color: #92400e; }
.q-summary-bits .bit-mm      { background: #fef3c7; color: #92400e; }
.q-summary-bits .bit-err     { background: #fecaca; color: #7f1d1d; }

.club-list { display: grid; gap: 10px; }
.q-club-card {
  display: block;
  background: #fff;
  border: 1px solid #e6e8ec;
  border-radius: 10px;
  padding: 14px 18px;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.q-club-card:hover {
  border-color: #1E73D8;
  box-shadow: 0 4px 12px rgba(30, 115, 216, 0.08);
}
.q-club-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  font-size: 15px;
}
.q-club-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: #475569;
  font-size: 13px;
}
.q-club-card-stats .skipped { color: #b91c1c; font-weight: 600; }
.q-club-card-stats .tent    { color: #b45309; font-weight: 600; }
.q-club-card-stats .mm      { color: #b45309; font-weight: 600; }
.q-club-card-stats .err     { color: #7f1d1d; font-weight: 700; }

.q-issue-badge {
  background: #fee2e2;
  color: #991b1b;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.q-ok-badge {
  background: #dcfce7;
  color: #14532d;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.q-alert {
  padding: 16px 20px;
  border-radius: 10px;
  margin: 14px 0;
  border-left: 4px solid;
  background: #fff;
}
.q-alert h3 { margin: 0 0 8px; font-size: 15px; }
.q-alert p  { margin: 0 0 10px; font-size: 13px; color: #475569; }
.q-alert-danger  { background: #fef2f2; border-color: #dc2626; color: #7f1d1d; }
.q-alert-warning { background: #fffbeb; border-color: #f59e0b; color: #78350f; }
.q-alert-info    { background: #ecfdf5; border-color: #10b981; color: #065f46; }
.q-alert-success { background: #f0fff5; border-color: #2eaf5d; color: #14532d; }

.q-issue-list {
  list-style: none;
  padding: 12px 14px;
  margin: 8px 0 0;
  max-height: 300px;
  overflow-y: auto;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #f1f5f9;
  font-size: 13px;
}
.q-issue-list li {
  padding: 6px 4px;
  border-bottom: 1px solid #f1f5f9;
}
.q-issue-list li:last-child { border-bottom: none; }
.q-issue-list small {
  color: #94a3b8;
  margin-left: 8px;
  font-size: 11px;
}
.q-issue-list code {
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: #475569;
}

.q-entries-wrap {
  overflow-x: auto;
  background: #fff;
  border-radius: 10px;
  border: 1px solid #e6e8ec;
}
.q-entries-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.q-entries-table th {
  background: #1e40af;
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 700;
  position: sticky;
  top: 0;
}
.q-entries-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #e2e8f0;
}
.q-entries-table tr:last-child td { border-bottom: none; }
.q-entries-table tr.q-tentative-row { background: #fffbeb; }
.q-tent-tag { color: #b45309; font-size: 11px; font-weight: 700; }

/* クラブ詳細サマリの下のアクションボタン */
.club-detail-actions {
  text-align: center;
  margin: 22px 0 8px;
}
.btn.btn-large {
  font-size: 15px;
  padding: 12px 28px;
  border-radius: 8px;
  font-weight: 700;
}

/* 参加クラブ一覧カードの請求書クイックアクション */
.q-club-card-wrap {
  position: relative;
}
.q-club-quick-actions {
  position: absolute;
  top: 12px;
  right: 16px;
  display: flex;
  gap: 6px;
  z-index: 2;
}
.q-btn-invoice {
  display: inline-block;
  background: #f59e0b;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
}
.q-btn-invoice:hover { background: #d97706; }

/* ============================================================
 * [Phase R-1] 参加費請求書ページ（印刷 / PDF 保存対応）
 * ============================================================ */
.invoice-body {
  background: #f3f4f6;
  margin: 0;
  padding: 0;
  min-height: 100vh;
}
.invoice-toolbar {
  background: #1e40af;
  color: #fff;
  padding: 12px 24px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.invoice-toolbar .btn {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
}
.invoice-toolbar .btn-primary {
  background: #f59e0b;
  border-color: #f59e0b;
}
.invoice-toolbar .btn-primary:hover { background: #d97706; }

.invoice-page {
  background: #fff;
  max-width: 800px;
  margin: 24px auto 60px;
  padding: 40px 50px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  color: #1f2937;
}
.invoice-header {
  text-align: center;
  border-bottom: 3px double #1e40af;
  padding-bottom: 20px;
  margin-bottom: 24px;
  position: relative;
}
.invoice-title {
  font-size: 28px;
  letter-spacing: 0.4em;
  color: #1e40af;
  margin: 0 0 8px;
  font-weight: 800;
}
.invoice-meta {
  font-size: 12px;
  color: #64748b;
  text-align: right;
  margin: 0;
  position: absolute;
  right: 0;
  bottom: 8px;
}
.invoice-to {
  margin-bottom: 26px;
}
.invoice-to h2 {
  font-size: 20px;
  margin: 0 0 4px;
  border-bottom: 1px solid #1e40af;
  padding-bottom: 6px;
  display: inline-block;
  min-width: 60%;
}
.invoice-to-meta {
  font-size: 12px;
  color: #4b5563;
  margin: 6px 0 0;
}
.invoice-tournament {
  margin-bottom: 22px;
}
.invoice-tournament table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.invoice-tournament th {
  width: 80px;
  background: #f3f4f6;
  text-align: left;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  font-weight: 700;
  color: #475569;
}
.invoice-tournament td {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
}
.invoice-total-box {
  background: #fef3c7;
  border: 2px solid #d97706;
  border-radius: 8px;
  padding: 18px 22px;
  margin: 18px 0 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.invoice-total-box .label {
  font-size: 14px;
  color: #92400e;
  font-weight: 700;
}
.invoice-total-box .amount {
  font-size: 28px;
  font-weight: 800;
  color: #92400e;
}
.invoice-breakdown h3,
.invoice-entries h3 {
  font-size: 14px;
  color: #1e40af;
  margin: 22px 0 8px;
  font-weight: 700;
}
.invoice-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.invoice-breakdown-table th,
.invoice-breakdown-table td {
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
}
.invoice-breakdown-table thead th {
  background: #1e40af;
  color: #fff;
  font-weight: 700;
}
.invoice-breakdown-table tfoot th {
  background: #f3f4f6;
  font-weight: 800;
  color: #1e40af;
}
.invoice-breakdown-table .num   { text-align: right; font-variant-numeric: tabular-nums; }
.invoice-breakdown-table .right { text-align: right; }
.invoice-entries-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}
.invoice-entries-table th,
.invoice-entries-table td {
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
}
.invoice-entries-table thead th {
  background: #1e40af;
  color: #fff;
  font-weight: 700;
}
.invoice-entries-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.invoice-entries-table .empty { text-align: center; color: #94a3b8; padding: 18px; }
.invoice-footer {
  margin-top: 32px;
  border-top: 1px solid #e2e8f0;
  padding-top: 12px;
  text-align: center;
  font-size: 10px;
  color: #94a3b8;
}

/* 印刷時: 操作 UI を隠して紙のみに */
@media print {
  body, .invoice-body { background: #fff !important; }
  .no-print { display: none !important; }
  .invoice-page {
    margin: 0 auto !important;
    box-shadow: none !important;
    padding: 12mm 14mm !important;
    max-width: none !important;
  }
  .invoice-entries-table { font-size: 9.5px; }
  .invoice-entries-table th,
  .invoice-entries-table td { padding: 3px 6px; }
  @page { size: A4; margin: 10mm; }
}

/* ============================================================
 * [Phase R-2] エントリー票 PDF
 * ============================================================ */
.btn.btn-secondary {
  background: #475569;
  color: #fff;
  border: none;
}
.btn.btn-secondary:hover { background: #334155; }

.q-club-quick-actions .q-btn-sheet {
  display: inline-block;
  background: #475569;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  margin-left: 4px;
}
.q-club-quick-actions .q-btn-sheet:hover { background: #334155; }

.entry-sheet-page {
  background: #f3f4f6;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}
.entry-sheet {
  background: #fff;
  max-width: 820px;
  margin: 24px auto 60px;
  padding: 38px 46px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  color: #1f2937;
}
.entry-sheet-header {
  text-align: center;
  border-bottom: 3px double #1e40af;
  padding-bottom: 16px;
  margin-bottom: 22px;
}
.es-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.32em;
  color: #1e3a8a;
}
.es-meta {
  font-size: 12px;
  color: #64748b;
  margin-top: 6px;
}
.es-tournament, .es-club, .es-entries, .es-relay, .es-summary, .es-signature {
  margin-bottom: 22px;
}
.es-tournament h2 {
  text-align: center;
  font-size: 18px;
  color: #1e40af;
  margin: 0 0 12px;
}
.es-club h3, .es-entries h3, .es-relay h3, .es-signature h3 {
  font-size: 14px;
  color: #1e40af;
  margin: 18px 0 8px;
  font-weight: 700;
}
.es-info-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid #cbd5e1;
  font-size: 13px;
}
.es-info-table th {
  background: #f1f5f9;
  text-align: left;
  padding: 7px 10px;
  width: 28%;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  color: #475569;
}
.es-info-table td {
  padding: 7px 10px;
  border: 1px solid #cbd5e1;
}
.es-summary {
  display: flex;
  gap: 12px;
}
.es-summary-card {
  flex: 1;
  text-align: center;
  background: #eff6ff;
  border: 1px solid #1e40af;
  padding: 12px 6px;
  border-radius: 8px;
}
.es-summary-value {
  font-size: 24px;
  font-weight: 800;
  color: #1e3a8a;
  line-height: 1.1;
}
.es-summary-label {
  font-size: 11px;
  color: #475569;
  margin-top: 4px;
}
.es-summary-fee { background: #fef3c7; border-color: #d97706; }
.es-summary-fee .es-summary-value { color: #92400e; }

.es-group { margin-bottom: 14px; }
.es-group h4 {
  background: #1e40af;
  color: #fff;
  padding: 7px 14px;
  margin: 0;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 6px 6px 0 0;
}
.es-group .es-count {
  background: rgba(255, 255, 255, 0.22);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
}
.es-entries-table, .es-relay-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.es-entries-table th, .es-relay-table th {
  background: #e0e7ff;
  padding: 5px 7px;
  border: 1px solid #cbd5e1;
  text-align: left;
  font-weight: 700;
}
.es-entries-table td, .es-relay-table td {
  padding: 5px 7px;
  border: 1px solid #e2e8f0;
}
.es-tentative { background: #fffbeb; }
.es-tent-tag { color: #b45309; font-size: 10px; font-weight: 700; }

.es-signature-table {
  width: 100%;
  border-collapse: collapse;
}
.es-signature-table td {
  border: 1px solid #1e293b;
  padding: 7px 10px;
  vertical-align: top;
}
.es-sig-label {
  width: 16%;
  background: #f1f5f9;
  font-weight: 700;
  text-align: center;
  font-size: 12px;
}
.es-sig-box {
  height: 70px;
  background: #fff;
}
.es-footer {
  text-align: center;
  color: #94a3b8;
  font-size: 10px;
  margin-top: 22px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

@media print {
  body, .entry-sheet-page { background: #fff !important; }
  .entry-sheet {
    box-shadow: none !important;
    margin: 0 auto !important;
    padding: 10mm 12mm !important;
    max-width: none !important;
  }
  .es-group { page-break-inside: avoid; }
  .es-entries-table, .es-relay-table { font-size: 9.5px; }
  .es-entries-table th, .es-entries-table td,
  .es-relay-table th,   .es-relay-table td { padding: 3px 5px; }
  .es-signature { page-break-inside: avoid; }
  @page { size: A4; margin: 10mm; }
}

/* ============================================================
 * [Phase R-3] プログラム冊子 PDF
 * ============================================================ */
.program-book-page {
  background: #f3f4f6;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}
.program-book {
  background: #fff;
  max-width: 820px;
  margin: 24px auto 60px;
  padding: 38px 46px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
  color: #1f2937;
}

/* 表紙 */
.pb-cover {
  text-align: center;
  padding: 64px 0 48px;
}
.pb-cover-title {
  font-size: 12px;
  letter-spacing: 0.42em;
  color: #94a3b8;
  margin-bottom: 18px;
  font-weight: 700;
}
.pb-cover-name {
  font-size: 36px;
  color: #1e3a8a;
  margin: 12px 0;
  font-weight: 800;
  line-height: 1.25;
}
.pb-cover-meta {
  margin: 28px 0 32px;
  color: #475569;
}
.pb-cover-meta p {
  font-size: 15px;
  margin: 4px 0;
}
.pb-cover-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin: 38px 0 32px;
  flex-wrap: wrap;
}
.pb-stat {
  text-align: center;
  background: #eff6ff;
  border: 2px solid #1e40af;
  padding: 18px 28px;
  border-radius: 12px;
  min-width: 130px;
}
.pb-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: #1e3a8a;
  line-height: 1;
}
.pb-stat-label {
  font-size: 12px;
  color: #475569;
  margin-top: 6px;
}
.pb-cover-footer {
  margin-top: 36px;
  color: #94a3b8;
  font-size: 11px;
}

/* 目次 */
.pb-toc {
  padding: 24px 0;
}
.pb-section-title {
  font-size: 18px;
  color: #1e40af;
  border-bottom: 2px solid #1e40af;
  padding-bottom: 6px;
  margin: 0 0 16px;
}
.pb-toc-list {
  list-style: none;
  padding: 0;
  counter-reset: pb-toc-counter;
  margin: 0;
}
.pb-toc-list li {
  counter-increment: pb-toc-counter;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dotted #cbd5e1;
  font-size: 13px;
}
.pb-toc-list li::before {
  content: counter(pb-toc-counter) ".";
  color: #94a3b8;
  margin-right: 10px;
  min-width: 28px;
  font-weight: 700;
}
.pb-toc-name { flex: 1; }
.pb-toc-count {
  color: #475569;
  font-size: 11px;
  background: #f1f5f9;
  padding: 2px 10px;
  border-radius: 12px;
  white-space: nowrap;
}

/* 種目ページ */
.pb-event {
  margin-bottom: 20px;
}
.pb-event-header {
  background: #1e40af;
  color: #fff;
  padding: 8px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 6px 6px 0 0;
}
.pb-event-name { margin: 0; font-size: 15px; font-weight: 700; }
.pb-event-meta { font-size: 11.5px; opacity: 0.92; }

.pb-heat { margin: 8px 0 16px; }
.pb-heat-title {
  background: #f1f5f9;
  padding: 6px 12px;
  margin: 0;
  font-size: 13px;
  border-left: 4px solid #1e40af;
  font-weight: 700;
}
.pb-heat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.pb-heat-table th {
  background: #e0e7ff;
  padding: 5px 7px;
  text-align: left;
  border: 1px solid #cbd5e1;
  font-weight: 700;
}
.pb-heat-table td {
  padding: 5px 7px;
  border: 1px solid #e2e8f0;
}
.pb-lane {
  text-align: center;
  font-weight: 700;
  background: #fafafa;
}
.pb-club { color: #475569; font-size: 11px; }
.pb-record { text-align: right; font-variant-numeric: tabular-nums; }

.pb-no-data {
  padding: 10px;
  text-align: center;
  color: #94a3b8;
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 6px;
  font-size: 12px;
}

.pb-footer {
  text-align: center;
  color: #94a3b8;
  font-size: 10px;
  margin-top: 26px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
}

@media print {
  body, .program-book-page { background: #fff !important; }
  .program-book {
    box-shadow: none !important;
    margin: 0 auto !important;
    padding: 10mm 12mm !important;
    max-width: none !important;
  }
  .pb-cover { page-break-after: always; }
  .pb-toc   { page-break-after: always; }
  .pb-event { page-break-inside: avoid; }
  .pb-heat  { page-break-inside: avoid; }
  .pb-heat-table { font-size: 9.5px; }
  .pb-heat-table th, .pb-heat-table td { padding: 3px 5px; }
  @page { size: A4; margin: 10mm; }
}

/* ============================================================
 * [Phase R-4] ナンバーカード（ゼッケン） PDF — A5 用紙 1 ページに 4 枚
 *   * 印刷時のみ正確な A5 サイズが適用される
 *   * 画面では縮小プレビュー（A5 実寸）
 * ============================================================ */
.btn.btn-tertiary {
  background: #0ea5e9;
  color: #fff;
  border: none;
}
.btn.btn-tertiary:hover { background: #0284c7; }

.q-club-quick-actions .q-btn-bibs {
  display: inline-block;
  background: #0ea5e9;
  color: #fff;
  padding: 5px 10px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  margin-left: 4px;
}
.q-club-quick-actions .q-btn-bibs:hover { background: #0284c7; }

.bibs-page {
  background: #e2e8f0;
  margin: 0;
  padding: 0;
  min-height: 100vh;
  font-family: "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}
.bibs-info {
  display: inline-flex;
  gap: 14px;
  margin-left: 18px;
  color: #e2e8f0;
  font-size: 12px;
  align-items: center;
}
.bibs-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  gap: 14px;
}

/* [Phase R-5] A5 横向き・5桁番号中心・氏名なし・性別色分け
   旧 [bib-a5-1page] の縦向きデザインから刷新。
   .bib-header / .bib-name / .bib-meta / .bib-grade のルールは CLAUDE.md §1 準拠で
   削除せず残置（新 DOM では出力されないため見た目に影響なし）。 */
.bib-page {
  width: 210mm;      /* 横向き */
  height: 148mm;     /* 横向き */
  background: #fff;
  padding: 8mm;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.bib-card {
  border: 3px solid currentColor;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 6mm 8mm;
  background: #fff;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}
.bib-card.bib-empty { display: none; }
/* [Phase R-5] 性別色分け: bib-male=黒 / bib-female=赤 */
.bib-card.bib-male   { color: #000000; }
.bib-card.bib-female { color: #cc0000; }
/* 旧ヘッダ（DOM 出力されない） */
.bib-header {
  font-size: 14pt;
  color: #475569;
  text-align: center;
  margin-bottom: 6mm;
  padding-bottom: 3mm;
  font-weight: 700;
  letter-spacing: 0.05em;
  border-bottom: 2px solid #1e1b4b;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* [Phase R-5] 5 桁番号 — 横向き A5 で最大化 */
.bib-number {
  font-size: 320pt;
  font-weight: 900;
  color: inherit;            /* 親 .bib-card の性別色を継承 */
  line-height: 0.9;
  margin: 0;
  font-family: "Arial Black", "Helvetica", sans-serif;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* 旧氏名（DOM 出力されない） */
.bib-name {
  font-size: 32pt;
  font-weight: 700;
  color: #1e3a8a;
  margin-top: 4mm;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
/* 旧メタ行（DOM 出力されない） */
.bib-meta {
  display: flex;
  gap: 2em;
  margin-top: 6mm;
  font-size: 16pt;
  color: #475569;
  white-space: nowrap;
}
/* [Phase R-5] クラブ名（下部・大きく） */
.bib-club  {
  font-size: 60pt;
  font-weight: 800;
  color: inherit;            /* 性別色を継承 */
  margin-top: 6mm;
  text-align: center;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.bib-grade { color: #64748b; }

@media print {
  body, .bibs-page { background: #fff !important; }
  .invoice-toolbar, .no-print { display: none !important; }
  .bibs-container { padding: 0; gap: 0; }
  .bib-page {
    box-shadow: none !important;
    margin: 0 !important;
    padding: 8mm !important;
    width: 210mm !important;
    height: 148mm !important;
    page-break-after: always;
  }
  .bib-page:last-child { page-break-after: auto; }
  @page { size: A5 landscape; margin: 0; }
}

/* ============================================================
 * [Phase S-1] 組み合わせ生成（heats）UI
 * ============================================================ */
.ph-action-section {
  background: #f0f7ff;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 16px 20px;
  margin: 14px 0 20px;
}
.ph-action-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.ph-action-row .btn-large {
  min-width: 240px;
}
.ph-action-note {
  margin: 10px 0 0;
  font-size: 12px;
  color: #475569;
}
.ph-action-row .btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.ph-progress {
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 18px;
}
.ph-progress p { margin: 4px 0; }
#progress-text { font-size: 14px; font-weight: 700; color: #1e40af; }
.ph-progress-bar {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  margin: 8px 0;
}
.ph-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #1e40af);
  width: 0%;
  transition: width 0.25s ease-out;
}
.ph-progress-detail {
  font-size: 12px;
  color: #475569;
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

.ph-progress-line {
  margin: 12px 0 6px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.ph-progress-line-bar {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.ph-progress-line-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #047857);
  transition: width 0.3s ease-out;
}
.ph-progress-line-label {
  font-size: 12px;
  color: #475569;
  white-space: nowrap;
  font-weight: 600;
}

.ph-event-list {
  display: grid;
  gap: 6px;
}
.ph-event-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e6e8ec;
  border-radius: 8px;
  font-size: 13px;
}
.ph-event-row-done    { border-left: 4px solid #10b981; }
.ph-event-row-pending { border-left: 4px solid #f59e0b; }
.ph-event-row-noentries {
  border-left: 4px solid #cbd5e1;
  background: #fafafa;
  color: #94a3b8;
}
.ph-event-info { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ph-event-info small { color: #6B7A99; font-size: 11.5px; }
.ph-event-status { white-space: nowrap; }
.ph-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.ph-badge-done    { background: #d1fae5; color: #065f46; }
.ph-badge-pending { background: #fef3c7; color: #92400e; }
.ph-badge-empty   { background: #f1f5f9; color: #64748b; }
.ph-layout-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: #e0e7ff;
  color: #3730a3;
  font-size: 10px;
  font-weight: 700;
}

/* [Phase T-1] 混合リレー出場メンバー表示 */
.relay-section {
  margin: 2em 0;
}
.relay-teams {
  display: flex;
  flex-direction: column;
  gap: 1em;
}
.relay-team-card {
  background: white;
  border: 2px solid #ef4444;
  border-radius: 12px;
  overflow: hidden;
}
.relay-team-header {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  padding: 0.8em 1.2em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.relay-team-name {
  font-weight: 700;
  color: #991b1b;
  font-size: 1.1em;
}
.relay-team-count {
  background: #ef4444;
  color: white;
  padding: 0.2em 0.8em;
  border-radius: 12px;
  font-size: 0.85em;
}
.relay-runners {
  display: flex;
  align-items: center;
  padding: 1.5em 1em;
  gap: 0.5em;
  flex-wrap: wrap;
  justify-content: center;
}
.relay-runner {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 100px;
}
.relay-order-badge {
  background: #ef4444;
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85em;
  margin-bottom: 0.5em;
}
.relay-runner-info {
  text-align: center;
}
.relay-runner-name {
  font-weight: 600;
  color: #1e293b;
}
.relay-runner-meta {
  font-size: 0.8em;
  color: #64748b;
}
.relay-arrow {
  font-size: 1.5em;
  color: #cbd5e1;
  align-self: flex-start;
  margin-top: 0.5em;
}

@media (max-width: 600px) {
  .relay-runners { flex-direction: column; }
  .relay-arrow { transform: rotate(90deg); }
}

/* ============================================================
 * [Phase T-2] ダッシュボード「要対応アラート」ウィジェット
 * ============================================================ */
.dashboard-alerts {
  background: #fffbeb;
  border: 2px solid #f59e0b;
  border-radius: 12px;
  padding: 18px 22px;
  margin: 16px 0 24px;
}
.alert-widget-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.alert-widget-header h2 {
  margin: 0;
  color: #92400e;
  font-size: 18px;
  font-weight: 800;
}
.alert-total-badge {
  background: #dc2626;
  color: #fff;
  padding: 3px 14px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 14px;
  min-width: 32px;
  text-align: center;
}
.alert-type-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.alert-type-card {
  background: #fff;
  border-radius: 8px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-left: 4px solid;
  min-width: 200px;
  flex: 1 1 240px;
}
.alert-type-card.alert-danger  { border-left-color: #dc2626; }
.alert-type-card.alert-warning { border-left-color: #f59e0b; }
.alert-type-card.alert-gray    { border-left-color: #94a3b8; }
.alert-type-icon  { font-size: 20px; line-height: 1; }
.alert-type-count {
  font-size: 22px;
  font-weight: 800;
  color: #1e293b;
  font-variant-numeric: tabular-nums;
}
.alert-type-label {
  font-size: 12.5px;
  color: #475569;
}
.alert-details {
  background: #fff;
  border-radius: 8px;
  padding: 12px 18px;
}
.alert-details h3 {
  margin: 0 0 8px;
  font-size: 13px;
  color: #475569;
  font-weight: 700;
}
.alert-details ul {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 280px;
  overflow-y: auto;
  font-size: 13px;
}
.alert-details li {
  padding: 6px 0;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 8px;
}
.alert-details li:last-child { border-bottom: none; }
.alert-details li a {
  color: inherit;
  text-decoration: none;
  flex: 1;
}
.alert-details li a:hover { color: #1e40af; }
.alert-count {
  margin-left: auto;
  background: #fef3c7;
  color: #92400e;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  white-space: nowrap;
}

/* ============================================================
 * [Phase T-3] 重複エントリー検出 UI
 * ============================================================ */
.duplicate-alert {
  margin-top: 1.5em;
}
.dup-list {
  list-style: none;
  padding: 0;
  margin-top: 1em;
  max-height: 240px;
  overflow-y: auto;
  background: white;
  padding: 1em;
  border-radius: 6px;
}
.dup-list li {
  padding: 0.5em 0;
  border-bottom: 1px solid #f1f5f9;
}
.dup-list li:last-child { border-bottom: none; }

.dup-table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  margin: 1em 0;
}
.dup-table th {
  background: #fef3c7;
  padding: 0.6em;
  text-align: left;
  border: 1px solid #fde68a;
}
.dup-table td {
  padding: 0.5em 0.6em;
  border: 1px solid #f1f5f9;
}
.dup-count-badge {
  background: #fee2e2;
  color: #991b1b;
  padding: 0.2em 0.7em;
  border-radius: 12px;
  font-size: 0.85em;
  font-weight: 700;
}

/* ============================================================
 * [Phase V-2.6] 大会カードのシリーズバッジ（h3 タイトルの下に出る種別タグ）
 * ============================================================ */
.recurring-card .tournament-series-badge {
  margin: 4px 0 8px;
  padding: 0;
}
.recurring-card .series-badge {
  display: inline-block;
  background: #eef4ff;
  color: #1e40af;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

/* ============================================================
 * [deletehover] 削除ボタン (.btn-danger) ホバー時の可読性修正
 * ------------------------------------------------------------
 *   旧構成: btn-small.btn-danger は通常 白背景+赤文字、hover で薄ピンク+赤文字。
 *   Phase N で追加された .btn-danger:hover:not(:disabled) が同 specificity で
 *   背景を濃赤 (#B42318) に上書きしてしまい、文字色は赤のままで読めなくなる。
 *   ここでホバー時の文字色を白に揃えることで濃赤背景でも可読に。
 *   (CLAUDE.md §1 準拠: 既存のルールは削除せず、後段で挙動を上書き)
 * ============================================================ */
.btn-danger:hover,
.btn-danger:hover:not(:disabled),
.btn-small.btn-danger:hover,
.btn-tiny.btn-danger:hover {
  color: #ffffff;
}

/* ============================================================
 * [kubun] 選手一覧「区分」列 — 県内 / 県外 / 不明 バッジ
 *   バックエンド athletes_in_pref / out_pref / unknown_pref 集計と整合
 *   (address_prefecture === '埼玉県' を県内)
 * ============================================================ */
.badge-pref-inside {
  display: inline-block;
  background: #dcfce7;
  color: #14532d;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-pref-outside {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.badge-pref-unknown {
  display: inline-block;
  background: #f1f5f9;
  color: #64748b;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}


/* ===========================================================
   [seeding] 組編成オプション モーダル
   =========================================================== */
.seeding-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 16px;
}
.seeding-modal {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.25);
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  /* [modalscroll] flex child の min-height: auto を上書き → body の overflow-y を効かせる */
  min-height: 0;
  overflow: hidden;
}
.seeding-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid #e2e8f0;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  color: #fff;
  border-radius: 10px 10px 0 0;
  /* [modalscroll] ヘッダは縮まない */
  flex-shrink: 0;
}
.seeding-modal-header h3 { margin: 0; font-size: 16px; }
.seeding-modal-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
}
.seeding-modal-body {
  padding: 18px;
  overflow-y: auto;
  flex: 1 1 auto;
  /* [modalscroll] flex child の min-height: auto を上書き → 中身が多くてもスクロール可能に */
  min-height: 0;
  -webkit-overflow-scrolling: touch;
}
.seeding-field { margin-bottom: 14px; }
.seeding-field-label {
  display: block;
  font-size: 12px;
  color: #64748b;
  margin-bottom: 4px;
}
.seeding-target-display {
  padding: 6px 10px;
  background: #f1f5f9;
  border-radius: 6px;
  font-weight: 600;
  color: #1e293b;
  font-size: 13px;
}
.seeding-fieldset {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 14px 12px;
  margin: 12px 0;
}
.seeding-fieldset legend {
  font-weight: 700;
  color: #1e293b;
  font-size: 13px;
  padding: 0 6px;
}
.seeding-fieldset label {
  display: block;
  font-size: 13px;
  padding: 4px 0;
  cursor: pointer;
}
.seeding-fieldset input[type="radio"] {
  margin-right: 6px;
  vertical-align: middle;
}
.seeding-suboptions {
  background: #fef9c3;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 8px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.seeding-suboptions label {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #713f12;
}
.seeding-suboptions input[type="number"] {
  padding: 3px 6px;
  border: 1px solid #d6d3d1;
  border-radius: 4px;
  font-size: 12px;
}
.seeding-msg { padding: 8px 10px; border-radius: 6px; font-size: 12px; }
.seeding-msg.ok  { background: #dcfce7; color: #166534; }
.seeding-msg.err { background: #fee2e2; color: #991b1b; }
.seeding-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 18px;
  border-top: 1px solid #e2e8f0;
  background: #f8fafc;
  border-radius: 0 0 10px 10px;
  /* [modalscroll] フッタは縮まずに常に下部表示 */
  flex-shrink: 0;
}
.seeding-modal-footer .btn { min-width: 110px; }

/* === [officialstyles] 役員配置ボード（カンバン） ===========================
 * 出典: tournament-officials.html の <style> タグ内インライン定義をコピー。
 *   tournament-detail.html から officials モジュールを注入する経路では
 *   officials.html を経由しないため、共通 CSS にも同じルールを置く。
 *   officials.html 側のインライン定義はそのまま残置（重複しても無害）。
 * 対象クラス: .official-board / .board-column (+.board-standby/.count) /
 *           .column-cards / .official-card (+:active/:hover/.sortable-ghost/.official-name/.official-club)
 * ========================================================================= */
.official-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.board-column {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 10px;
  min-height: 180px;
}
.board-column.board-standby {
  background: #fef3c7;
  border-color: #fcd34d;
}
.board-column h3 {
  margin: 0 0 8px 0;
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.board-column .count {
  font-size: 11px;
  font-weight: 600;
  color: #64748b;
  background: #fff;
  border-radius: 4px;
  padding: 2px 6px;
}
.board-column .count.short { color: #c2410c; background: #ffedd5; }
.board-column .count.full  { color: #15803d; background: #dcfce7; }
.column-cards {
  min-height: 100px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.official-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 6px 8px;
  cursor: grab;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  transition: box-shadow 0.15s;
}
.official-card:active { cursor: grabbing; }
.official-card:hover  { box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.official-card.sortable-ghost { opacity: 0.3; background: #fef9c3; }
.official-card .official-name { font-weight: 700; color: #1e293b; }
.official-card .official-club { font-size: 10px; color: #64748b; }
