/* ============================================================
   原田学園 サッカー部ポータル - スタイルシート
   カラーパレット: 白・青・紺
   ============================================================ */

:root {
  --navy:        #0D1B4B;
  --navy-mid:    #1a237e;
  --blue-dark:   #1565C0;
  --blue:        #1976D2;
  --blue-light:  #42A5F5;
  --blue-pale:   #E3F2FD;
  --white:       #FFFFFF;
  --gray-50:     #F8FAFC;
  --gray-100:    #F1F5F9;
  --gray-200:    #E2E8F0;
  --gray-300:    #CBD5E1;
  --gray-400:    #94A3B8;
  --gray-500:    #64748B;
  --gray-600:    #475569;
  --gray-700:    #334155;
  --gray-800:    #1E293B;
  --red:         #EF4444;
  --green:       #22C55E;
  --green-income: #0F9D58;
  --orange:      #F97316;
  --purple:      #A855F7;

  /* 本文用ミュート色（WCAG AA: 4.5:1 を満たす）
     - body-muted: 本文に併記する控えめテキスト
     - faint:      意味の弱い補助テキスト（凡例・空状態など）。装飾的用途のみ */
  --text-body:   var(--gray-800);
  --text-muted:  var(--gray-600);   /* 4.5:1 を満たす */
  --text-faint:  var(--gray-500);   /* 大きめ・装飾文字のみで使用 */

  /* Spacing scale (8px ベース) */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  24px;
  --space-6:  32px;

  /* Radius scale */
  --radius-sm: 6px;
  --radius:    10px;
  --radius-lg: 14px;

  --sidebar-w:   240px;
  --shadow:      0 4px 20px rgba(13,27,75,0.10);
  --shadow-sm:   0 2px 8px rgba(13,27,75,0.07);
  --transition:  0.2s ease;

  /* ── テーマ用セマンティックトークン（既定 = 現状の紺テーマ） ──
     body.theme-soft / .theme-warm / .theme-light で上書きする。
     アプリ本体フォントは --app-font で切替（暖色案は丸ゴシック）。 */
  --app-bg:             var(--gray-50);
  --sidebar-bg:         var(--navy);
  --sidebar-fg:         rgba(255,255,255,0.88);
  --sidebar-fg-strong:  #ffffff;
  --sidebar-fg-muted:   rgba(255,255,255,0.75);
  --sidebar-section:    rgba(255,255,255,0.45);
  --sidebar-hover-bg:   rgba(255,255,255,0.08);
  --sidebar-border:     rgba(255,255,255,0.08);
  --sidebar-active-bg:  var(--blue-dark);
  --sidebar-active-fg:  #ffffff;
  --sidebar-active-bar: var(--blue-light);
  --sidebar-scroll:     rgba(255,255,255,0.18);
  --avatar-bg:          var(--blue-dark);
  --nav-mx:             0px;
  --nav-radius:         0px;
  --accent:             var(--blue-dark);
  --accent-hover:       var(--blue);
  --focus-ring:         rgba(21,101,192,0.35);
  --focus-glow:         var(--focus-glow);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body {
  /* システムフォント優先 — OS 標準の x-height が高いフォント
     (San Francisco / Segoe UI / Roboto) を Latin に使い、
     日本語は Hiragino / メイリオ にフォールバック (#10, #11) */
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto,
               'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Meiryo',
               sans-serif;
  background: var(--app-bg);
  color: var(--text-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* リンクは色＋下線で意味を二重に示す（#9 色だけに依存しない） */
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }
svg { fill: currentColor; }

/* タイポグラフィ: 太さは 400 と 700 の 2 種に統一（#13） */
strong, b { font-weight: 700; }

/* ============================================================
   Layout
   ============================================================ */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ============================================================
   Mobile Topbar & Drawer Backdrop  (desktop では非表示)
   ============================================================ */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 110;
  height: calc(56px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 8px 0;
  background: var(--sidebar-bg);
  color: var(--sidebar-fg-strong);
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(13,27,75,0.18);
}
.topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: rgba(255,255,255,0.95);
  background: transparent;
  transition: background var(--transition);
  flex-shrink: 0;
}
.topbar-btn:hover,
.topbar-btn:active { background: rgba(255,255,255,0.12); }
.topbar-btn:focus-visible { outline: 2px solid rgba(255,255,255,0.7); outline-offset: -2px; }
.topbar-btn svg { fill: currentColor; }
#notificationBellBtnMobile.active { color: #ffd54f; }
#notificationBellBtnMobile.active:hover { background: rgba(255,213,79,0.18); }
.topbar-brand {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.2px;
  overflow: hidden;
  white-space: nowrap;
}
.topbar-brand .brand-icon { font-size: 22px; flex-shrink: 0; }
.topbar-brand-text {
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,27,75,0.48);
  z-index: 105;
  animation: fadeIn 0.15s ease;
}
.sidebar-backdrop.is-open { display: block; }
body.sidebar-open { overflow: hidden; }

/* ============================================================
   Sidebar
   3 段構成: brand (固定) / menu (内部スクロール) / user (固定)
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  height: 100vh;
  height: 100dvh;        /* iOS Safari の URL バー対応 */
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
  overflow: hidden;      /* スクロールは sidebar-menu のみで担当 */
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.brand-icon { font-size: 28px; }
.brand-text {
  color: var(--sidebar-fg-strong);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.3px;
}

.sidebar-menu {
  list-style: none;
  flex: 1 1 auto;
  min-height: 0;                  /* flex 子のスクロール許可 */
  padding: 12px 0;
  overflow-y: auto;
  overscroll-behavior: contain;   /* スクロール連鎖防止 */
  -webkit-overflow-scrolling: touch;
}
.sidebar-menu::-webkit-scrollbar { width: 6px; }
.sidebar-menu::-webkit-scrollbar-thumb {
  background: var(--sidebar-scroll);
  border-radius: 3px;
}
.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px calc(20px - var(--nav-mx));
  margin: 2px var(--nav-mx);
  color: var(--sidebar-fg);
  font-size: 14px;
  font-weight: 400;                /* 500 → 400 (#13 weights 2 種化) */
  border-radius: var(--nav-radius);
  transition: var(--transition);
}

/* セクションラベル: グループ見出し */
.sidebar-section-label {
  padding: 14px 20px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--sidebar-section);
  letter-spacing: 0.2px;
  line-height: 1.4;
  user-select: none;
  pointer-events: none;
}
.sidebar-section-label:first-child { padding-top: 4px; }
.sidebar-menu li a svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
}
.sidebar-menu li a:hover {
  background: var(--sidebar-hover-bg);
  color: var(--sidebar-fg-strong);
}
.sidebar-menu li.active a {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-fg);
  font-weight: 700;
  box-shadow: inset 3px 0 0 var(--sidebar-active-bar);  /* レイアウトを動かさない左帯 */
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px;
  border-top: 1px solid var(--sidebar-border);
  flex-shrink: 0;        /* スクロール領域に巻き込まれない */
}
.user-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--avatar-bg);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-avatar span { color: var(--sidebar-fg-strong); font-weight: 700; font-size: 15px; }
.user-info { flex: 1; min-width: 0; }
.user-name {
  color: var(--sidebar-fg-strong);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.user-role {
  color: var(--sidebar-fg-muted);
  font-size: 11.5px;
}
.sidebar-user-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.sidebar-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-fg-muted);
  background: transparent;
  transition: var(--transition);
}
.sidebar-action-btn:hover {
  color: var(--sidebar-fg-strong);
  background: var(--sidebar-hover-bg);
}
.sidebar-action-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,0.6);
  outline-offset: 2px;
}
.sidebar-action-btn svg { width: 18px; height: 18px; }
#notificationBellBtn.active { color: #ffd54f; }
#notificationBellBtn.active:hover { color: #fff176; background: rgba(255,213,79,0.16); }


/* ============================================================
   Main Content
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.page-header h2 {
  font-size: 26px;          /* 22 → 26 (#4 階層強化) */
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.page-header-sub { margin: 0; font-size: 1.1rem; font-weight: 700; color: var(--navy); }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;       /* 600 → 700 (#13) */
  line-height: 1.2;
  transition: var(--transition);
  cursor: pointer;
  border: 1px solid transparent;  /* レイアウトずれ防止 */
  white-space: nowrap;            /* 「編集」等のラベルが縦書きに折り返さないように */
}
.btn svg { width: 16px; height: 16px; }
.btn:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 1px; }

.btn-primary {
  background: var(--accent);
  color: var(--white);
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-800);
  border: 1px solid var(--gray-200);
}
.btn-secondary:hover { background: var(--gray-200); }

.btn-danger {
  background: #FEE2E2;
  color: #B91C1C;             /* #8 4.5:1 のため少し濃く */
  border-color: #FECACA;
}
.btn-danger:hover { background: #FECACA; }

.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-lg { padding: 11px 24px; font-size: 15px; }
.btn-block { width: 100%; justify-content: center; }

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: var(--gray-600);
  transition: var(--transition);
}
.btn-icon:hover { background: var(--gray-200); }
.btn-icon svg { width: 20px; height: 20px; }
.today-btn {
  width: auto !important;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--blue-dark);
}

/* ============================================================
   Team Filter Bar
   ============================================================ */
.team-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.filter-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gray-600);
  margin-right: 4px;
}
.team-checkbox { display: inline-flex; align-items: center; gap: 0; }
.team-checkbox input[type="checkbox"] { display: none; }
.team-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: var(--gray-200);
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}
.team-checkbox input:checked + .team-badge {
  background: var(--team-color, var(--blue-dark));
  color: var(--white);
}

/* ============================================================
   Calendar Nav
   ============================================================ */
.calendar-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.calendar-nav h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  min-width: 160px;
  text-align: center;
}
.view-toggle {
  display: flex;
  gap: 2px;
  background: var(--gray-100);
  border-radius: 6px;
  padding: 2px;
  margin-left: 8px;
}
.view-btn {
  padding: 4px 14px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  color: var(--gray-500);
  cursor: pointer;
  border: none;
  transition: background 0.15s, color 0.15s;
}
.view-btn.active {
  background: var(--white);
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* ============================================================
   Calendar Grid
   ============================================================ */
.calendar-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-header {
  background: var(--navy-mid);
  color: var(--white);
  text-align: center;
  padding: 10px 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.2px;  /* 1px → 0.2px (#12 擬似 ALL CAPS 解除) */
}

.cal-cell {
  min-height: 110px;
  border-right: 1px solid var(--gray-200);
  border-bottom: 1px solid var(--gray-200);
  padding: 6px;
  cursor: pointer;
  transition: background var(--transition);
  position: relative;
}
.cal-cell:hover { background: var(--blue-pale); }
.cal-cell.other-month { background: var(--gray-50); }
.cal-cell.other-month .cal-day-num { color: var(--gray-400); }
.cal-cell.today .cal-day-num {
  background: var(--blue-dark);
  color: var(--white);
  width: 26px; height: 26px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.cal-cell:nth-child(7n+1) .cal-day-num { color: #E53935; }  /* 日曜 */
.cal-cell:nth-child(7n)   .cal-day-num { color: #1565C0; }  /* 土曜 */
.cal-day-num {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
  display: inline-flex;
  width: 26px; height: 26px;
  align-items: center; justify-content: center;
}
.cal-events { display: flex; flex-direction: column; gap: 2px; }
.cal-event {
  display: block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;        /* 500 → 700 (#13) */
}
/* ============================================================
   Week Time Grid View
   ============================================================ */
.week-view-header {
  display: grid;
  grid-template-columns: 48px repeat(7, 1fr);
  background: var(--navy-mid);
  border-bottom: 2px solid rgba(0,0,0,0.1);
}
.week-time-gutter-head {
  border-right: 1px solid rgba(255,255,255,0.15);
}
.week-day-head {
  text-align: center;
  padding: 8px 4px 10px;
  border-right: 1px solid rgba(255,255,255,0.15);
}
.week-day-head-name {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  font-weight: 600;
  letter-spacing: 0.05em;
}
.week-day-head-num {
  font-size: 20px;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  margin: 4px auto 0;
}
.week-day-head-num.today {
  background: var(--white);
  color: var(--navy-dark);
}
.week-day-head.sun .week-day-head-name { color: #ffcdd2; }
.week-day-head.sun .week-day-head-num  { color: #ffcdd2; }
.week-day-head.sun .week-day-head-num.today { background: #E53935; color: #fff; }
.week-day-head.sat .week-day-head-name { color: #bbdefb; }
.week-day-head.sat .week-day-head-num  { color: #bbdefb; }
.week-day-head.sat .week-day-head-num.today { background: #1565C0; color: #fff; }

.week-view-body {
  display: flex;
  overflow-y: visible;
}
.week-time-gutter {
  width: 48px;
  flex-shrink: 0;
  position: relative;
  border-right: 1px solid var(--gray-200);
  background: var(--white);
}
.week-hour-label {
  position: absolute;
  right: 6px;
  font-size: 10px;
  color: var(--gray-400);
  line-height: 1;
  transform: translateY(-50%);
  user-select: none;
  white-space: nowrap;
}
.week-cols {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  min-width: 0;
}
.week-day-col {
  border-right: 1px solid var(--gray-200);
  position: relative;
  cursor: pointer;
}
.week-day-col:hover { background: rgba(59,130,246,0.02); }
.week-day-col.today { background: rgba(59,130,246,0.04); }
.week-day-col.sun   { background: rgba(229,57,53,0.02); }
.week-day-col.sat   { background: rgba(21,101,192,0.02); }
.week-hour-line {
  position: absolute;
  left: 0; right: 0;
  border-top: 1px solid var(--gray-200);
  pointer-events: none;
}
.week-hour-line.half {
  border-top: 1px dashed var(--gray-100);
}
.week-now-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: #E53935;
  z-index: 3;
  pointer-events: none;
}
.week-now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #E53935;
}
.week-event {
  position: absolute;
  left: 2px;
  right: 2px;
  border-radius: 4px;
  color: var(--white);
  font-size: 11px;
  padding: 3px 5px;
  overflow: hidden;
  cursor: pointer;
  z-index: 1;
  transition: opacity 0.1s, box-shadow 0.1s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.week-event:hover {
  opacity: 0.88;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
}
.week-event-time {
  display: block;
  font-size: 10px;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
}
.week-event-title {
  display: block;
  font-weight: 700;
  line-height: 1.4;
  word-break: break-all;
}

.cal-event-more {
  font-size: 11px;
  color: var(--gray-600);
  padding: 1px 4px;
}

/* Category colors */
.cat-match          { background: #EF4444; }
.cat-practice_match { background: #F97316; }
.cat-practice       { background: #22C55E; }
.cat-cheer          { background: #A855F7; }
.cat-meeting        { background: #3B82F6; }
.cat-other          { background: #64748B; }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(13,27,75,0.48);
  z-index: 500;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.open,
.modal-overlay.active {
  display: flex;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--white);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(13,27,75,0.22);
  max-width: 94vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.2s ease;
}
@keyframes slideUp {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.day-modal     { width: 360px; }
.detail-modal  { width: 560px; }
.schedule-form-modal { width: 640px; }
.result-modal  { width: 580px; }
.member-modal  { width: 500px; }
.user-form-modal { width: 600px; }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h4 {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}
.modal-title-area { display: flex; flex-direction: column; gap: 6px; }

.modal-close {
  font-size: 22px;
  color: var(--gray-400);
  line-height: 1;
  padding: 0 4px;
  transition: var(--transition);
}
.modal-close:hover { color: var(--gray-800); }

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
}
.modal-footer--spread { justify-content: space-between; }

/* ============================================================
   Schedule list in day modal
   ============================================================ */
.schedule-list { display: flex; flex-direction: column; gap: 6px; }
.schedule-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--gray-200);
  cursor: pointer;
  transition: var(--transition);
}
.schedule-item:hover { border-color: var(--blue-dark); background: var(--blue-pale); }
.schedule-item-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.schedule-item-body { flex: 1; min-width: 0; }
.schedule-item-title {
  font-weight: 600; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.schedule-item-time { font-size: 11px; color: var(--gray-600); }
.schedule-empty {
  color: var(--text-faint); text-align: center; padding: 20px 0; font-size: 14px;
}

/* ============================================================
   Schedule Detail
   ============================================================ */
.category-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--white);
}
.detail-section { margin-bottom: 16px; }
/* .detail-row はファイル後半で grid 定義に統一（重複削除） */
.detail-label {
  color: var(--text-muted);
  width: 80px;
  flex-shrink: 0;
  font-weight: 700;
}
.detail-value { color: var(--text-body); flex: 1; }

.file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--gray-50);
  border-radius: 6px;
  margin-bottom: 4px;
  font-size: 13px;
}
.file-item a { color: var(--blue-dark); flex: 1; text-decoration: underline; text-underline-offset: 2px; }
.file-item a:hover { text-decoration-thickness: 2px; }

.survey-section {
  background: var(--blue-pale);
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 12px;
}
.survey-title {
  font-weight: 700; font-size: 13px; color: var(--blue-dark);
  margin-bottom: 8px;
}
.survey-btns { display: flex; gap: 8px; }
.survey-btn {
  flex: 1;
  padding: 8px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  border: 2px solid transparent;
  transition: var(--transition);
}
.survey-btn.yes { background: #DCFCE7; color: #16A34A; border-color: #86EFAC; }
.survey-btn.no  { background: #FEE2E2; color: #DC2626; border-color: #FCA5A5; }
.survey-btn.yes.active { background: #16A34A; color: white; }
.survey-btn.no.active  { background: #DC2626; color: white; }

/* ============================================================
   Form Elements
   ============================================================ */
.form-group {
  margin-bottom: 16px;     /* #1 グループ間スペース確保 */
}
.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 700;        /* #13: weight 統一 */
  color: var(--text-muted);
  margin-bottom: 6px;
}
.required { color: var(--red); }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="tel"],
.form-group input[type="date"],
.form-group input[type="datetime-local"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);   /* 1.5 → 1px (#5 ノイズ削減) */
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-body);
  background: var(--white);
  transition: border var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 3px var(--focus-glow);
}

/* .form-group の外でも標準サイズのテキスト入力にできる汎用クラス */
input.form-control,
select.form-control,
textarea.form-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  color: var(--text-body);
  background: var(--white);
  transition: border var(--transition), box-shadow var(--transition);
  outline: none;
}
input.form-control:focus,
select.form-control:focus,
textarea.form-control:focus {
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 3px var(--focus-glow);
}
/* .form-row は後方の grid 定義に統一（flex 版は削除） */

.checkbox-label {
  display: flex !important;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13.5px !important;
  color: var(--gray-800) !important;
}
.checkbox-label input[type="checkbox"] {
  width: 16px; height: 16px;
  cursor: pointer;
}

.team-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  min-height: 42px;
}
.team-checkboxes .team-checkbox-item {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--gray-100);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.team-checkboxes .team-checkbox-item.selected {
  background: var(--blue-dark);
  color: var(--white);
}

/* ============================================================
   Alert
   ============================================================ */
.alert {
  padding: 10px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: 13px;
}
/* コントラスト確保 (淡背景上で WCAG AA 4.5:1 を満たす濃さ) */
.alert-error { background: #FEE2E2; color: #B91C1C; }
.alert-success { background: #DCFCE7; color: #15803D; }

/* ============================================================
   Login Page
   ============================================================ */
.login-page {
  background: linear-gradient(135deg, var(--navy) 0%, var(--blue-dark) 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-container { width: 100%; max-width: 400px; padding: 20px; }
.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
}
.login-header {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo {
  font-size: 52px;
  margin-bottom: 12px;
}
.login-header h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.5;
}
.login-form .form-group { margin-bottom: 16px; }

/* ============================================================
   Page Toolbar
   ============================================================ */
.page-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  background: var(--white);
  border-radius: var(--radius-sm);
  border: 1px solid var(--gray-300);   /* 1.5 → 1px (#5) */
  flex: 1;
  max-width: 360px;
  transition: border var(--transition), box-shadow var(--transition);
}
.search-box:focus-within {
  border-color: var(--blue-dark);
  box-shadow: 0 0 0 3px var(--focus-glow);
}
.search-box svg { width: 18px; height: 18px; color: var(--text-faint); flex-shrink: 0; }
.search-box input {
  border: none !important;
  outline: none !important;
  background: transparent;
  font-size: 13.5px;
  width: 100%;
  box-shadow: none !important;
  padding: 0 !important;
}
.page-toolbar select {
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13.5px;
  background: var(--white);
  outline: none;
  cursor: pointer;
}

/* ============================================================
   Results List
   ============================================================ */
.results-list { display: flex; flex-direction: column; gap: 10px; }
.result-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  transition: box-shadow var(--transition), transform var(--transition);
  border: 1.5px solid transparent;
}
.result-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: var(--blue-pale);
}
.result-card-cat {
  width: 8px; min-height: 60px;
  border-radius: 4px;
  flex-shrink: 0;
}
.result-card-body { flex: 1; min-width: 0; }
.result-card-title {
  font-weight: 700; font-size: 14.5px; color: var(--navy);
  margin-bottom: 3px;
}
.result-card-meta { font-size: 12.5px; color: var(--gray-600); }
.result-card-score {
  font-size: 24px;
  font-weight: 700;          /* 800 → 700 (#13) */
  color: var(--navy);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.result-card-score .no-result { font-size: 13px; color: var(--gray-400); font-weight: 400; }
.result-win  { color: #16A34A; }
.result-lose { color: #DC2626; }
.result-draw { color: #D97706; }

/* ============================================================
   Teams Grid
   ============================================================ */
.teams-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.team-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.team-card:hover { box-shadow: var(--shadow); }
.team-card-header {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.team-color-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
}
.team-card-name { font-size: 16px; font-weight: 700; color: var(--white); flex: 1; }
.team-card-actions { display: flex; gap: 4px; }
.team-card-actions button {
  color: rgba(255,255,255,0.8);
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.team-card-actions button:hover { color: var(--white); background: rgba(255,255,255,0.2); }
.team-card-actions svg { width: 16px; height: 16px; }

.team-card-body { padding: 14px 20px; }
.team-card-desc {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 12px;
  min-height: 20px;
}
.team-member-count {
  font-size: 12.5px;
  color: var(--gray-600);
  font-weight: 600;
}
.team-card-footer {
  padding: 10px 20px;
  border-top: 1px solid var(--gray-200);
  display: flex;
  gap: 8px;
}

/* ============================================================
   Member List
   ============================================================ */
.member-add-area {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}
.member-add-area select {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13.5px;
  outline: none;
}
.member-list { display: flex; flex-direction: column; gap: 6px; }
.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--gray-50);
  border-radius: 8px;
}
.member-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue-dark);
  display: flex; align-items: center; justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  overflow: hidden;
}
.member-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-info { flex: 1; }
.member-name { font-weight: 600; font-size: 13.5px; }
.member-role { font-size: 11.5px; color: var(--gray-600); }
.member-remove {
  color: var(--gray-400);
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}
.member-remove:hover { color: var(--red); background: #FEE2E2; }
.member-remove svg { width: 16px; height: 16px; }

/* ============================================================
   Users Table
   ============================================================ */
.users-table-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  background: var(--navy-mid);
  color: var(--white);
  padding: 12px 16px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 13.5px;
}
.data-table tbody tr:hover { background: var(--blue-pale); }
.data-table tbody tr:last-child td { border-bottom: none; }

.role-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}
.role-teacher  { background: #DBEAFE; color: #1D4ED8; }
.role-manager  { background: #EDE9FE; color: #7C3AED; }
.role-staff    { background: #FEF3C7; color: #D97706; }
.role-parent   { background: #DCFCE7; color: #16A34A; }
.role-player   { background: #FFE4E6; color: #E11D48; }
.admin-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 20px;
  font-size: 10.5px;
  font-weight: 600;
  background: #FEF9C3;
  color: #854D0E;
  border: 1px solid #FDE047;
  vertical-align: middle;
}

.user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-cell-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--blue-dark);
  color: var(--white);
  font-weight: 700;
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; flex-shrink: 0;
}
.user-cell-avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ============================================================
   Photo Preview
   ============================================================ */
.photo-preview-row {
  display: flex; align-items: center; gap: 12px; margin-top: 8px;
}
.photo-preview {
  flex-shrink: 0;
}
.photo-preview img {
  width: 80px; height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gray-200);
}

/* ============================================================
   Color picker
   ============================================================ */
.color-picker-row {
  display: flex; align-items: center; gap: 10px;
}
.color-preview {
  width: 32px; height: 32px;
  border-radius: 6px;
  border: 2px solid var(--gray-200);
}

/* ============================================================
   Score Row
   ============================================================ */
.score-row {
  display: flex;
  align-items: flex-end;
  gap: 0;
}
.score-row .form-group { flex: 1; }
.score-separator {
  font-size: 24px;
  font-weight: 700;
  color: var(--gray-400);
  padding: 0 12px 8px;
  flex-shrink: 0;
}

/* ============================================================
   Loading / Empty
   ============================================================ */
.loading {
  text-align: center;
  padding: 40px 0;
  color: var(--text-faint);
  font-size: 14px;
}
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);     /* #8 4.5:1 改善 */
}
.empty-state svg { width: 52px; height: 52px; margin-bottom: 12px; opacity: .5; }
.empty-state p { font-size: 15px; }

/* ============================================================
   Team Drag & Drop（Pointer Events 実装）
   ============================================================ */

/* ドラッグ中: ページ全体のカーソルを grabbing に固定 */
body.is-dragging,
body.is-dragging * {
  cursor: grabbing !important;
  user-select: none;
}

/* ドラッグ中にカードが元あった場所を示すプレースホルダー */
.drag-placeholder {
  border-radius: var(--radius);
  background: var(--blue-pale);
  border: 2px dashed var(--blue-dark);
  opacity: 0.7;
  /* height は JS で動的にセット */
}

/* ドラッグハンドルアイコン */
.drag-handle {
  display: flex;
  align-items: center;
  color: rgba(255, 255, 255, 0.50);
  cursor: grab;
  flex-shrink: 0;
  transition: color var(--transition);
  touch-action: none; /* タッチ操作でスクロールより優先 */
}
.drag-handle:hover { color: rgba(255, 255, 255, 0.95); }
.drag-handle svg { width: 16px; height: 16px; }

/* ============================================================
   Player Profile
   ============================================================ */
.player-profile-card {
  display: flex;
  align-items: center;
  gap: 24px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  margin-bottom: 24px;
}
.player-photo {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--blue-pale);
  flex-shrink: 0;
}
.player-photo-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 36px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.player-photo-wrap { flex-shrink: 0; }
.player-info { flex: 1; }
.player-name-block { margin-bottom: 6px; }
.player-name { font-size: 22px; font-weight: 700; color: var(--navy); display: inline; }
.player-furigana { font-size: 12px; color: var(--text-faint); margin-left: 10px; }
.player-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.player-position {
  background: var(--blue-pale);
  color: var(--blue-dark);
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
}
.player-age { font-size: 13px; color: var(--gray-600); }
.player-role-badge {
  background: var(--navy);
  color: #fff;
  border-radius: 4px;
  padding: 2px 10px;
  font-size: 11px;
}
.player-teams { display: flex; gap: 6px; flex-wrap: wrap; }
.team-tag {
  color: #fff;
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
}

.player-body-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}
.player-section {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}
.player-section:last-child { margin-bottom: 0; }
.section-title {
  font-size: 16px;        /* 14 → 16 (#4) */
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 16px;    /* #1 グループ間スペース */
  line-height: 1.4;
}
.section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-header-row .section-title { margin-bottom: 0; }

/* 通知詳細 */
.notif-detail-card {
  background: var(--white);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 24px 28px;
  box-shadow: var(--shadow-sm);
  max-width: 720px;
}
.notif-detail-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 12px;
  line-height: 1.4;
}
.notif-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-bottom: 14px;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--text-muted);
  font-size: 13px;
}
.notif-detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.notif-detail-meta-item svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  opacity: 0.7;
}
.notif-detail-body {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text-body);
  white-space: pre-wrap;
  word-break: break-word;
}
.notif-detail-body .notif-link {
  color: var(--blue-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
}
.notif-detail-body .notif-link:hover { text-decoration-thickness: 2px; }
.notif-detail-empty {
  color: var(--text-faint);
  font-style: italic;
}

/* 通知一覧の各項目をクリック可能に */
.notif-item.is-clickable,
.history-row.is-clickable {
  cursor: pointer;
  transition: background var(--transition);
}
.notif-item.is-clickable:hover {
  background: var(--blue-pale);
}
.history-row.is-clickable:hover td { background: var(--blue-pale); }

/* 成長曲線タブ: 横断/縦断の 2 列レイアウト */
.growth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 12px;
}
@media (max-width: 900px) {
  .growth-grid { grid-template-columns: 1fr; }
}
.growth-card {
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
}
.growth-card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.growth-zoom-hint {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
  text-align: center;
}
/* ============================================================
   flatpickr カレンダー — 大きめ・読みやすいテーマ
   ============================================================ */
.flatpickr-calendar {
  width: 340px !important;
  font-size: 14px !important;
  border-radius: 10px !important;
  box-shadow: 0 12px 32px rgba(13,27,75,0.18) !important;
  padding: 6px !important;
}
.flatpickr-calendar.open { z-index: 600 !important; }
.flatpickr-months {
  padding: 6px 4px 8px;
  border-bottom: 1px solid var(--gray-100);
  margin-bottom: 6px;
}
.flatpickr-current-month {
  font-size: 15px !important;
  font-weight: 700 !important;
  padding: 4px 0 !important;
}
.flatpickr-current-month input.cur-year {
  font-size: 15px !important;
  font-weight: 700 !important;
  width: 60px;
}
/* 年プルダウン (上下ボタンの代替) — 月ドロップダウンと同じフォント・枠線なし */
.flatpickr-current-month .fp-year-select {
  font-size: 15px !important;
  font-weight: 300 !important;
  font-family: inherit;
  padding: 2px 4px;
  margin-left: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: inherit;
  appearance: menulist;
}

/* datetime-split の時/分プルダウン — 年月日と同じ高さ・等幅で横並び */
.datetime-split > .dt-hour-part,
.datetime-split > .dt-min-part {
  padding: 0 8px;
  width: 90px;
  flex: 0 0 90px;
  cursor: pointer;
  appearance: menulist;
}
.flatpickr-weekdays { background: var(--gray-50); }
.flatpickr-weekday {
  font-size: 12px !important;
  font-weight: 700 !important;
  color: var(--text-muted) !important;
  padding: 6px 0;
}
.dayContainer { width: 100% !important; min-width: unset !important; max-width: unset !important; }
.flatpickr-day {
  height: 40px !important;
  line-height: 40px !important;
  font-size: 14px !important;
  max-width: 14.2857% !important;
  flex-basis: 14.2857% !important;
}
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
  background: var(--blue-dark) !important;
  border-color: var(--blue-dark) !important;
}
.flatpickr-day:hover {
  background: var(--blue-pale) !important;
  border-color: var(--blue-pale) !important;
}
.flatpickr-day.today {
  border-color: var(--blue) !important;
}
.flatpickr-time {
  border-top: 1px solid var(--gray-100);
  padding-top: 4px;
}
.flatpickr-time input {
  font-size: 16px !important;
}

/* monthSelect プラグイン: 月ボタンの大きさ */
.flatpickr-monthSelect-months {
  padding: 10px;
}
.flatpickr-monthSelect-month {
  font-size: 14px !important;
  padding: 10px 6px !important;
}

/* datetime-local 分割欄 */
.datetime-split {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.datetime-split > input,
.datetime-split > select {
  box-sizing: border-box;
  height: 40px;
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--white);
  line-height: 1.2;
}
.datetime-split > input {
  padding: 0 12px;
  flex: 1 1 200px;
  min-width: 160px;
}

/* 選手検索: 自前ドロップダウン */
.player-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  z-index: 50;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(13,27,75,0.16);
  max-height: 280px;
  overflow-y: auto;
}
.player-search-dropdown.open { display: block; }
.player-search-item {
  padding: 8px 12px;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-100);
}
.player-search-item:last-child { border-bottom: none; }
.player-search-item:hover,
.player-search-item.active { background: var(--blue-pale); }
.player-search-item-name { font-weight: 700; }
.player-search-item-sub  { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.player-search-empty { padding: 10px 12px; font-size: 12px; color: var(--text-faint); text-align: center; }

.growth-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  background: #fff;
}
.growth-group-toggle input { margin: 0; cursor: pointer; }
.growth-group-toggle:has(input:checked) {
  background: var(--blue-pale);
  border-color: var(--blue-dark);
  color: var(--blue-dark);
}
.growth-canvas-wrap {
  position: relative;
  flex: 1;
  /* 縦長 (height > width) */
  aspect-ratio: 4 / 5;
  min-height: 520px;
}
.growth-canvas-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
}

/* マイページ: 運動ログ入力 */
.exlog-missing-msg {
  color: #DC2626;
  font-weight: 700;
  font-size: 13px;
}
.exlog-mypage-row { margin-bottom: 14px; }
.intensity-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.exlog-save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.exlog-save-feedback {
  font-size: 13px;
  font-weight: 700;
}
.exlog-save-feedback.ok  { color: var(--green-income); }
.exlog-save-feedback.err { color: var(--red); }

/* Condition buttons */
.condition-buttons {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.cond-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 4px;
  border-radius: var(--radius);
  border: 2px solid var(--gray-200);
  background: var(--gray-50);
  transition: var(--transition);
  font-size: 11px;
  color: var(--gray-600);
}
.cond-btn:hover:not(:disabled) { border-color: var(--blue); background: var(--blue-pale); }
.cond-btn.active { border-color: var(--blue); background: var(--blue-pale); color: var(--blue-dark); font-weight: 700; }
.cond-btn:disabled { opacity: 0.5; cursor: default; }
.cond-icon { line-height: 1; }
.cond-label { font-size: 10px; }
.cond-face { display: block; width: 36px; height: 36px; }
.cond-badge .cond-face { width: 100%; height: 100%; }

/* Diary */
.diary-list { display: flex; flex-direction: column; gap: 12px; }
.diary-card {
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  padding: 12px 14px;
}
.diary-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.diary-date { font-size: 12.5px; font-weight: 700; color: var(--text-muted); }
.diary-actions { display: flex; gap: 8px; }
.btn-text { font-size: 12px; color: var(--blue); background: none; border: none; cursor: pointer; padding: 0; }
.btn-text:hover { text-decoration: underline; }
.btn-text.btn-danger { color: var(--red); }
.diary-body { font-size: 13px; color: var(--gray-600); line-height: 1.6; white-space: pre-line; }
.empty-msg { font-size: 13px; color: var(--text-faint); text-align: center; padding: 20px 0; }
.diary-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}
#diaryPageInfo { font-size: 12px; color: var(--gray-600); min-width: 40px; text-align: center; }
.diary-modal { width: 480px; max-width: 95vw; }

/* Body map */
.pain-hint { font-size: 11.5px; color: var(--text-faint); }
.pain-legend {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pain-legend-item {
  font-size: 11px;
  padding: 2px 10px;
  border-radius: 10px;
  border: 1.5px solid;
}
.pain-legend-item.pain-0 { background: #dde8f4; border-color: #90aec8; color: #455a70; }
.pain-legend-item.pain-1 { background: #ffcdd2; border-color: #e57373; color: #b71c1c; }
.pain-legend-item.pain-2 { background: #ef9a9a; border-color: #c62828; color: #7f0000; }
.pain-legend-item.pain-3 { background: #e53935; border-color: #b71c1c; color: #fff; }

.body-map-container { display: flex; justify-content: center; }
.body-map-wrap {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 480px;
  user-select: none;
  -webkit-user-select: none;
}
.body-map-img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}
.pain-overlay-svg {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  cursor: crosshair;
}

.pain-save-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
}
.pain-tooltip { font-size: 12px; color: var(--blue-dark); }
.btn.btn-sm { padding: 5px 14px; font-size: 12px; }

.pos-checkboxes { display: flex; gap: 8px; flex-wrap: wrap; }
.pos-cb-label {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: var(--transition);
}
.pos-cb-label:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-pale);
  color: var(--blue-dark);
}
.pos-cb-label input { display: none; }

.user-name-link { color: var(--blue-dark); text-decoration: underline; text-underline-offset: 2px; font-weight: 700; }
.user-name-link:hover { text-decoration-thickness: 2px; }
.user-furigana-small { font-size: 11px; color: var(--text-faint); }

/* ============================================================
   Players List
   ============================================================ */
.players-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.players-toolbar .search-box { flex: 1; min-width: 160px; }
.players-toolbar select { height: 38px; }
.age-range-filter {
  display: flex;
  align-items: center;
  gap: 4px;
}
.age-range-filter input {
  width: 80px;
  height: 38px;
  padding: 0 8px;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 13px;
}
.sort-controls { display: flex; gap: 6px; align-items: center; }
.sort-dir-btn { width: 36px; height: 36px; border: 1px solid var(--gray-200); border-radius: 8px; }

/* Team chips */
.team-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.team-chip {
  padding: 4px 14px;
  border-radius: 16px;
  border: 2px solid var(--chip-color, #aaa);
  background: transparent;
  color: var(--gray-800);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.team-chip.active {
  background: var(--chip-color, #aaa);
  color: #fff;
}

/* Player grid */
.players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px;
}
.player-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 12px 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  position: relative;
  transition: box-shadow var(--transition), transform var(--transition);
  user-select: none;
  -webkit-user-select: none;
}
.player-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.player-card.selected {
  outline: 2.5px solid var(--blue);
  background: var(--blue-pale);
}

/* Selection check */
.player-card-check {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  align-items: center;
  justify-content: center;
}
.selection-mode .player-card-check { display: flex; opacity: 0.3; }
.selection-mode .player-card.selected .player-card-check { opacity: 1; }

/* Photo */
.player-card-photo-wrap {
  position: relative;
  width: 72px;
  height: 72px;
}
.card-photo-img {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--gray-200);
}
.card-photo-initial {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 26px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.cond-badge {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white);
  overflow: hidden;
}

/* Card info */
.player-card-info { width: 100%; text-align: center; }
.player-card-name { font-size: 13px; font-weight: 700; color: var(--gray-800); }
.player-card-furigana { font-size: 11px; color: var(--text-faint); }
.player-card-meta {
  display: flex;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
  margin-top: 4px;
}
.position-tag {
  background: var(--blue-pale);
  color: var(--blue-dark);
  border-radius: 4px;
  padding: 1px 7px;
  font-size: 10px;
  font-weight: 700;
}
.age-text { font-size: 11px; color: var(--gray-600); }
.player-card-teams {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  justify-content: center;
  margin-top: 6px;
}
.player-card-teams .team-tag { font-size: 9px; padding: 1px 6px; border-radius: 8px; }

/* Floating action bar */
.floating-action-bar {
  position: fixed;
  top: 20px;
  right: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(13,27,75,0.20);
  padding: 10px 16px;
  z-index: 200;
}
.floating-action-bar[hidden] { display: none; }
#selectedCountLabel { font-size: 13px; font-weight: 600; color: var(--navy); }

/* Team change modal */
.team-change-modal { width: 420px; max-width: 95vw; }
.team-change-desc { font-size: 13px; color: var(--gray-600); margin-bottom: 14px; }
.team-radio-list { display: flex; flex-direction: column; gap: 8px; }
.team-radio-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1.5px solid var(--gray-200);
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
}
.team-radio-item:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-pale);
}
/* .team-color-dot は team-card 側で 14px に統一済（重複削除） */
.radio-group { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.radio-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

/* ============================================================
   Responsive — Mobile / Tablet  (≤ 768px)
   サイドバー → ドロワー化、トップバー表示
   ============================================================ */
@media (max-width: 1024px) and (orientation: portrait), (max-width: 768px) {
  /* ---- Top bar 表示 ---- */
  .mobile-topbar { display: flex; }

  /* ---- ドロワー内の操作ボタン(ベル/ログアウト)を 44px に ---- */
  .sidebar-action-btn { width: 44px; height: 44px; }
  .sidebar-action-btn svg { width: 22px; height: 22px; }

  /* ---- Sidebar をドロワーに ---- */
  .sidebar {
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 200;
    box-shadow: 4px 0 24px rgba(13,27,75,0.20);
    /* overflow / 3 段スクロール構造はベース定義に従う */
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-menu { padding: 8px 0; }
  .sidebar-menu li a { padding: 14px 20px; font-size: 15px; min-height: 48px; }
  .sidebar-menu li a svg { width: 22px; height: 22px; }
  .sidebar-section-label { padding: 14px 20px 4px; font-size: 11.5px; }
  .sidebar-section-label:first-child { padding-top: 6px; }
  .sidebar-user {
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }

  /* ---- Main content: 左マージン解除、上に topbar 分のパディング ---- */
  .main-content {
    margin-left: 0 !important;
    padding: calc(72px + env(safe-area-inset-top)) 16px 24px;
  }

  /* ---- Modal: 95vw + 底に貼り付くスライドアップ ---- */
  .modal { width: 95vw !important; }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 92vh !important;
    border-radius: 16px 16px 0 0 !important;
    margin: 0;
    animation: slideUpMobile 0.25s ease !important;
  }
  @keyframes slideUpMobile {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
  }
  .modal-header { padding: 14px 16px 12px; }
  .modal-body   { padding: 14px 16px; }
  .modal-footer { padding: 12px 16px; gap: 8px; }
  .modal-footer .btn { flex: 1; justify-content: center; }

  /* ---- Form/グリッド ---- */
  .form-row { grid-template-columns: 1fr; }
  .player-body-grid { grid-template-columns: 1fr; }
  .player-profile-card { flex-direction: column; text-align: center; gap: 12px; }
  .player-meta, .player-teams { justify-content: center; }

  /* ---- Page header ---- */
  .page-header {
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
  }
  .page-header h2 { font-size: 22px; }
  .header-actions {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }
  .header-actions .btn { flex: 1; justify-content: center; }

  /* ---- iOS 自動ズーム防止 ---- */
  input, select, textarea { font-size: 16px !important; }
  .search-box input { font-size: 16px !important; }

  /* ---- Tables ---- */
  .users-table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .data-table { min-width: 560px; font-size: 13px; }
  .data-table th, .data-table td { padding: 10px 12px; white-space: nowrap; }

  /* ---- Toolbar / search ---- */
  .page-toolbar { flex-wrap: wrap; }
  .search-box { max-width: 100%; }

  /* ---- Teams grid ---- */
  .teams-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

  /* ---- Player profile ---- */
  .player-photo, .player-photo-placeholder { width: 86px; height: 86px; font-size: 32px; }
  .player-name { font-size: 20px; }

  /* ---- Login ---- */
  .login-card { padding: 28px 20px; }
  .login-container { padding: 16px; }
}

/* ============================================================
   Mobile phone  (≤ 599px) — 縦表示でさらに詰める
   ============================================================ */
@media (max-width: 599px) {
  .main-content { padding-left: 12px; padding-right: 12px; }
  .page-header h2 { font-size: 20px; }

  /* ---- カレンダー: セルを広げ予定を表示 ---- */
  .cal-cell { min-height: 78px; padding: 4px 3px; }
  .cal-day-num { width: 22px; height: 22px; font-size: 11px; }
  .cal-cell.today .cal-day-num { width: 22px; height: 22px; }
  .cal-event {
    display: block;     /* スマホでも予定を表示する */
    font-size: 9.5px;
    padding: 1px 4px;
    line-height: 1.3;
    border-radius: 3px;
  }
  .cal-event-more { font-size: 9.5px; padding: 0 4px; }
  .cal-header { font-size: 10.5px; padding: 8px 0; letter-spacing: 0; }

  /* ---- 週ビュー: 横スクロールを止めて画面いっぱいに ---- */
  .calendar-wrapper { overflow-x: visible; }
  .week-view-header { grid-template-columns: 36px repeat(7, 1fr); }
  #weekViewHeader,
  #weekViewBody { min-width: 0; }
  .week-time-gutter { width: 36px; }
  .week-hour-label { font-size: 9px; right: 4px; }
  .week-day-head { padding: 6px 2px 8px; }
  .week-day-head-name { font-size: 10px; }
  .week-day-head-num { width: 28px; height: 28px; font-size: 16px; }
  .week-event { font-size: 10px; padding: 2px 3px; }
  .week-event-time { display: none; }
  .week-view-body { max-height: 60vh; overflow-y: auto; }

  /* ---- カレンダーナビ ---- */
  .calendar-nav { flex-wrap: wrap; gap: 6px; }
  .calendar-nav h3 { font-size: 16px; min-width: 110px; flex: 0; }
  .view-toggle { margin-left: 0; }

  /* ---- Players grid ---- */
  .players-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .player-card { padding: 10px 6px 8px; gap: 5px; }
  .player-card-photo-wrap,
  .card-photo-img,
  .card-photo-initial { width: 56px; height: 56px; font-size: 20px; }
  .player-card-name { font-size: 11.5px; }
  .player-card-furigana { display: none; }

  /* ---- Players toolbar ---- */
  .players-toolbar { gap: 6px; }
  .age-range-filter input { width: 58px; height: 34px; }
  .sort-dir-btn { width: 34px; height: 34px; }

  /* ---- Floating action bar ---- */
  .floating-action-bar {
    top: auto;
    bottom: calc(16px + env(safe-area-inset-bottom));
    right: 12px;
    left: 12px;
    justify-content: space-between;
    padding: 10px 14px;
  }

  /* ---- Result cards ---- */
  .result-card { padding: 12px 14px; gap: 10px; }
  .result-card-score { font-size: 20px; }

  /* ---- Teams grid ---- */
  .teams-grid { grid-template-columns: 1fr; }

  /* ---- Player profile ---- */
  .player-profile-card { padding: 16px; gap: 12px; }
  .player-photo, .player-photo-placeholder { width: 72px; height: 72px; font-size: 26px; }
  .player-name { font-size: 18px; }

  /* ---- topbar はやや薄く ---- */
  .topbar-brand-text { font-size: 14px; }
}

/* ============================================================
   Landscape mobile (横画面) — 高さが狭いので詰める
   スクロール構造はベース定義 (sidebar=flex / menu=overflow-y:auto) に従う
   ============================================================ */
@media (max-width: 932px) and (orientation: landscape) and (max-height: 500px) {
  /* topbar を薄く */
  .mobile-topbar { height: calc(48px + env(safe-area-inset-top)); }
  .topbar-btn    { width: 40px; height: 40px; }
  .main-content  { padding-top: calc(60px + env(safe-area-inset-top)); }

  /* ドロワーのサイズと密度を調整 */
  .sidebar { width: 260px; }
  .sidebar-brand { padding: 14px 20px; }
  .sidebar-menu li a { padding: 10px 20px; min-height: 40px; font-size: 14px; }
  .sidebar-section-label { padding: 8px 20px 2px; font-size: 10.5px; }
  .sidebar-section-label:first-child { padding-top: 2px; }
  .sidebar-user { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
}


/* ============================================================
   CSV Import
   ============================================================ */
.header-actions { display: flex; gap: 8px; align-items: center; }

.csv-import-modal { max-width: 720px; width: 95vw; }

.csv-template-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  background: var(--blue-pale); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 16px;
}
.csv-hint { color: var(--gray-600); font-size: .85rem; }

.csv-upload-area {
  border: 2px dashed var(--gray-200); border-radius: var(--radius);
  padding: 40px 20px; text-align: center; cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
}
.csv-upload-area svg { width: 40px; height: 40px; fill: var(--gray-400); margin-bottom: 8px; }
.csv-upload-area p { color: var(--gray-600); margin-bottom: 10px; font-size: .9rem; }
.csv-upload-area.drag-over { border-color: var(--blue); background: var(--blue-pale); }
.csv-file-label { display: inline-flex; align-items: center; cursor: pointer; }
.csv-file-name { font-size: .8rem; color: var(--blue); margin-top: 8px; min-height: 1.2em; }

.csv-preview-count { color: var(--gray-600); font-size: .9rem; margin-bottom: 10px; }
.csv-preview-table-wrap { max-height: 360px; overflow: auto; border-radius: var(--radius); border: 1px solid var(--gray-200); }
.csv-preview-table { font-size: .8rem; }
.csv-preview-table th { position: sticky; top: 0; background: var(--navy); color: #fff; white-space: nowrap; }
.csv-more-rows { text-align: center; color: var(--gray-400); padding: 8px; font-size: .8rem; }

.csv-result-summary { display: flex; gap: 16px; margin-bottom: 12px; }
.csv-result-ok  { font-size: 1.1rem; font-weight: 700; color: var(--green); }
.csv-result-err { font-size: 1.1rem; font-weight: 700; color: var(--red); }
.csv-error-list { list-style: none; max-height: 280px; overflow: auto; }
.csv-error-list li { padding: 6px 10px; border-bottom: 1px solid var(--gray-100); font-size: .85rem; color: var(--red); }
.csv-error-list li strong { color: var(--gray-800); }

/* ============================================================
   Parent-Player link UI & form hints
   ============================================================ */
.form-hint  { font-size: .82rem; color: var(--text-faint); font-weight: 400; margin-left: 4px; }
.form-small { font-size: 12px;   color: var(--text-muted); }

.linked-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.linked-item {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--gray-100); border-radius: 6px; padding: 6px 10px; font-size: .88rem;
}
.btn-link-remove {
  background: none; border: none; color: var(--red); font-size: 1rem;
  cursor: pointer; padding: 0 4px; line-height: 1;
}
.btn-link-remove:hover { opacity: .7; }
.no-links { font-size: .85rem; color: var(--text-faint); margin-bottom: 4px; }

.link-search-row { display: flex; gap: 8px; margin-bottom: 6px; }
.link-search-row input { flex: 1; }

.link-search-results { display: flex; flex-direction: column; gap: 4px; max-height: 160px; overflow: auto; }
.link-result-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; border: 1px solid var(--gray-200); border-radius: 6px; font-size: .88rem;
}

.csv-btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.csv-err-item  { color: var(--red); }

/* ============================================================
   Diary page
   ============================================================ */
.diary-date-nav {
  display: flex; align-items: center; gap: 6px;
}
.diary-date-input {
  border: 1px solid var(--gray-200); border-radius: var(--radius);
  padding: 6px 10px; font-size: .9rem; background: #fff;
  color: var(--gray-800); cursor: pointer;
}

.diary-summary {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-bottom: 12px; font-size: .88rem;
}
.diary-stat { color: var(--gray-600); }
.diary-stat strong { color: var(--gray-800); font-weight: 700; }
.diary-stat-ok  strong { color: var(--green); }
.diary-stat-warn strong { color: var(--orange, #f97316); }

.diary-list-wrap { }
.diary-list { display: flex; flex-direction: column; gap: 10px; }

.diary-row {
  display: grid;
  grid-template-columns: 64px 15fr 85fr;
  gap: 0 14px;
  background: #fff;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius);
  padding: 14px;
  align-items: start;
  transition: box-shadow var(--transition);
}
.diary-row:hover { box-shadow: var(--shadow-sm); }
.diary-row.diary-row-no-entry { background: var(--gray-50, #f9fafb); opacity: .85; }

.diary-photo-wrap {
  position: relative; display: block;
  width: 56px; height: 56px; flex-shrink: 0;
  text-decoration: none;
}
.diary-photo-img {
  width: 56px; height: 56px;
  border-radius: 50%; object-fit: cover;
  border: 2px solid var(--gray-200);
}
.diary-photo-initial {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 700;
}
.diary-cond-badge {
  position: absolute; bottom: -4px; right: -4px;
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}
.diary-cond-badge .cond-face { width: 22px; height: 22px; }

.diary-row-player { display: flex; flex-direction: column; gap: 3px; }
.diary-row-name {
  font-weight: 700; font-size: 1rem; color: var(--blue-dark);
  text-decoration: underline; text-underline-offset: 2px;
}
.diary-row-name:hover { text-decoration-thickness: 2px; }
.diary-row-furigana { font-size: .78rem; color: var(--text-faint); margin-top: 2px; }
.diary-row-tags { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.diary-cond-label { font-size: .8rem; font-weight: 600; margin-top: 2px; }

.diary-row-body { display: flex; flex-direction: column; gap: 6px; }
.diary-row-text {
  font-size: .9rem; color: var(--gray-800); line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical;
  overflow: hidden;
  white-space: pre-wrap; word-break: break-word;
}
.diary-row-text.expanded {
  display: block; -webkit-line-clamp: unset;
}
.diary-row-empty { font-size: .85rem; color: var(--text-faint); font-style: italic; }
.diary-expand-btn {
  background: none; border: none; color: var(--blue);
  font-size: .82rem; cursor: pointer; padding: 0; text-align: left;
  width: fit-content;
}
.diary-expand-btn:hover { text-decoration: underline; }

@media (max-width: 1024px) and (orientation: portrait), (max-width: 768px) {
  .diary-row { grid-template-columns: 52px 1fr; }
  .diary-row-body { grid-column: 1 / -1; padding-top: 8px; border-top: 1px solid var(--gray-100); }
}
@media (max-width: 599px) {
  .diary-date-nav { flex-wrap: wrap; gap: 4px; }
  .diary-summary { gap: 8px; font-size: .82rem; }
  .diary-row { grid-template-columns: 48px 1fr; padding: 10px; gap: 0 10px; }
  .diary-photo-wrap, .diary-photo-img, .diary-photo-initial { width: 44px; height: 44px; }
  .diary-row-name { font-size: .93rem; }
}
.csv-warn-item { color: var(--orange); }

/* ============================================================
   写真トリミングモーダル（Cropper.js）
   ============================================================ */
.crop-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.75);
  align-items: center; justify-content: center;
}
.crop-overlay.active { display: flex; }

.crop-modal {
  background: #fff; border-radius: var(--radius-lg, 12px);
  width: min(520px, 96vw);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0,0,0,.3);
}

.crop-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.crop-modal-title { font-weight: 700; font-size: 1rem; color: var(--navy); }
.crop-zoom-btns   { display: flex; gap: 6px; }

.crop-container {
  width: 100%; aspect-ratio: 1;
  background: #111;
  overflow: hidden; position: relative;
  max-height: 60vh;
}
.crop-container img { display: block; max-width: 100%; }

/* クロップ枠を丸くする */
.crop-container .cropper-view-box,
.crop-container .cropper-face { border-radius: 50%; }

.crop-modal-footer {
  display: flex; justify-content: flex-end; gap: 8px;
  padding: 12px 16px; border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}

@media (max-width: 599px) {
  .crop-modal { width: 100%; border-radius: 16px 16px 0 0; }
  .crop-overlay.active { align-items: flex-end; }
  .crop-container { max-height: 55vw; }
}

/* ============================================================
   Album page
   ============================================================ */
.album-schedule-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.album-sched-card {
  background: #fff; border: 1px solid var(--gray-200);
  border-radius: var(--radius); overflow: hidden;
  cursor: pointer; transition: box-shadow var(--transition), transform var(--transition);
}
.album-sched-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }

.album-card-img { width: 100%; aspect-ratio: 16/9; overflow: hidden; background: var(--gray-100); }
.album-card-img img.album-card-thumb { width: 100%; height: 100%; object-fit: cover; }
.album-card-no-thumb {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
}
.album-card-no-thumb svg { width: 48px; height: 48px; fill: var(--gray-300); }

.album-card-body   { padding: 10px 12px; }
.album-card-date   { font-size: .78rem; color: var(--gray-500); margin-bottom: 2px; }
.album-card-title  { font-weight: 700; font-size: .95rem; color: var(--navy); margin-bottom: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.album-card-meta   { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.album-card-count  { font-size: .8rem; color: var(--gray-500); }

/* Progress bar */
.upload-conditions {
  font-size: .82rem; color: var(--text-muted); white-space: nowrap;  /* #8 4.5:1 */
}

.album-progress-wrap {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 14px;
}
.album-progress-bar {
  flex: 1; height: 8px; background: var(--gray-200);
  border-radius: 999px; overflow: hidden;
}
.album-progress-fill {
  height: 100%; width: 0%; background: var(--blue);
  border-radius: 999px; transition: width .2s;
}
.album-progress-text { font-size: .85rem; color: var(--gray-600); min-width: 36px; text-align: right; }

/* Photo grid */
.album-photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.album-photo-item { display: flex; flex-direction: column; gap: 4px; }

.album-photo-img-wrap {
  position: relative; aspect-ratio: 1;
  background: var(--gray-100); border-radius: var(--radius);
  overflow: hidden; cursor: pointer;
}
.album-photo-img-wrap img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform .2s;
}
.album-photo-img-wrap:hover img { transform: scale(1.04); }

.album-delete-btn {
  position: absolute; top: 6px; right: 6px;
  background: rgba(0,0,0,.55); color: #fff;
  border: none; border-radius: 6px;
  width: 28px; height: 28px; font-size: .9rem;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s;
}
.album-photo-img-wrap:hover .album-delete-btn { opacity: 1; }

.album-photo-meta { display: flex; justify-content: space-between; font-size: .75rem; }
.album-uploader   { color: var(--gray-700); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-date       { color: var(--text-faint); flex-shrink: 0; margin-left: 4px; }

/* Lightbox */
.album-lightbox {
  display: none; position: fixed; inset: 0; z-index: 3000;
  background: rgba(0,0,0,.92);
  flex-direction: column; align-items: center; justify-content: center;
}
.album-lightbox.active { display: flex; }

.lightbox-img-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 48px 60px; max-width: 100%; overflow: hidden;
}
.lightbox-img-wrap img { max-width: 100%; max-height: 80vh; object-fit: contain; border-radius: 4px; }

.lightbox-close {
  position: absolute; top: 14px; right: 18px;
  background: none; border: none; color: #fff;
  font-size: 2rem; cursor: pointer; line-height: 1; opacity: .8;
}
.lightbox-close:hover { opacity: 1; }

.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(255,255,255,.15); border: none; color: #fff;
  font-size: 2.5rem; line-height: 1; padding: 8px 14px;
  border-radius: var(--radius); cursor: pointer; opacity: .8;
}
.lightbox-nav:hover { opacity: 1; background: rgba(255,255,255,.25); }
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }

.lightbox-info {
  position: absolute; bottom: 16px; left: 0; right: 0;
  text-align: center; color: rgba(255,255,255,.7); font-size: .85rem;
}

@media (max-width: 599px) {
  .album-schedule-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .album-photo-grid    { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .album-delete-btn    { opacity: 1; }
  .lightbox-img-wrap   { padding: 48px 12px; }
  .lightbox-nav        { font-size: 2rem; padding: 6px 10px; }
}

/* ============================================================
   経費管理 - 共通
   ============================================================ */
.page-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 8px;
  color: var(--gray-600);
  transition: var(--transition);
}
.btn-back:hover { background: var(--gray-200); }
.btn-back svg { width: 20px; height: 20px; fill: currentColor; }

/* 金額の色 */
.amount-in  { color: var(--green-income); font-weight: 700; }
.amount-out { color: var(--red); font-weight: 700; }

/* ============================================================
   残高サマリーカード
   ============================================================ */
.finance-summary-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.summary-card {
  flex: 1;
  min-width: 140px;
  background: var(--white);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  border-top: 3px solid var(--gray-200);
}
.summary-card.income-card  { border-top-color: var(--green-income); }
.summary-card.expense-card { border-top-color: var(--red); }
.summary-card.balance-card { border-top-color: var(--blue-dark); }
.summary-card.balance-card.negative { border-top-color: var(--red); }
.summary-label  { font-size: 11.5px; color: var(--gray-600); font-weight: 600; margin-bottom: 4px; }
.summary-scope { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 8px;
  background: var(--gray-100, #f1f5f9); color: var(--text-muted, #64748b); font-size: 10px; font-weight: 700; vertical-align: middle; }
.finance-scope-note { font-size: 12px; color: var(--text-muted, #64748b); margin: 6px 0 14px; padding: 0 4px; }
.summary-amount { font-size: 22px; font-weight: 700; color: var(--navy); }
.balance-card .summary-amount  { color: var(--blue-dark); }
.balance-card.negative .summary-amount { color: var(--red); }
.income-card .summary-amount   { color: var(--green-income); }
.expense-card .summary-amount  { color: var(--red); }
.summary-divider {
  font-size: 20px;
  font-weight: 700;
  color: var(--gray-400);
  flex-shrink: 0;
}
/* レポート画面でも使う同じカード */
.report-summary-cards {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.report-summary-cards .summary-card { min-width: 160px; }

/* ============================================================
   タブ
   ============================================================ */
.finance-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--gray-200);
  margin-bottom: 16px;
  width: 100%;
  background: transparent;
  padding: 0;
}
.finance-tab {
  padding: 10px 22px;
  font-size: 13.5px;
  font-weight: 600;
  background: transparent;
  color: var(--gray-600);
  cursor: pointer;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  border-radius: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.finance-tab:hover {
  color: var(--navy);
  background: var(--gray-100);
}
.finance-tab.active {
  color: var(--blue-dark);
  border-bottom-color: var(--blue-dark);
  background: transparent;
  box-shadow: none;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ============================================================
   フィルターバー
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}
.filter-bar select {
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  color: var(--gray-800);
  background: var(--white);
  cursor: pointer;
}
.filter-bar select:focus { outline: none; border-color: var(--blue); }

/* ============================================================
   経費リスト
   ============================================================ */
.finance-list-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.finance-list-header,
.finance-list-row {
  display: grid;
  grid-template-columns: 110px 120px 110px 100px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 0;
}
.finance-list-header {
  background: var(--navy);
  border-bottom: none;
  padding: 0;
}
.finance-list-header span {
  padding: 11px 12px;
  font-size: 12.5px;
  font-weight: 700;
  color: rgba(255,255,255,0.95);   /* #7 コントラスト改善 */
  /* uppercase / letter-spacing 削除 (#12) */
  border-right: 1px solid rgba(255,255,255,0.12);
  white-space: nowrap;
}
.finance-list-row {
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: background var(--transition);
}
.finance-list-row:last-child { border-bottom: none; }
.finance-list-row:hover { background: var(--gray-50); }
.finance-list-row.selected { background: var(--blue-pale); }
.finance-list-row span {
  padding: 11px 12px;
  font-size: 13px;
  color: var(--gray-800);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-right: 1px solid var(--gray-100);
}
.finance-list-row span:last-child { border-right: none; }
.fc-amount { text-align: right; font-variant-numeric: tabular-nums; }
.fc-receipt { text-align: center; }

.advance-row {
  grid-template-columns: 100px 110px 90px 90px 80px 90px minmax(0, 1fr) 72px;
}
.advance-row span { white-space: nowrap; }

/* 領収書リンク */
.receipt-link {
  display: inline-flex;
  align-items: center;
  color: var(--blue-dark);
}
.receipt-link:hover { color: var(--blue); }
.receipt-link svg { width: 18px; height: 18px; fill: currentColor; }

/* カテゴリバッジ */
.category-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--blue-pale);
  color: var(--blue-dark);
}

/* 入金種別バッジ */
.income-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11.5px;
  font-weight: 600;
}
.income-type-badge.type-dues         { background: #E8F5E9; color: #2E7D32; }
.income-type-badge.type-organization { background: #E3F2FD; color: #1565C0; }
.income-type-badge.type-return       { background: #FFF8E1; color: #F57F17; }
.income-type-badge.type-other        { background: var(--gray-100); color: var(--gray-600); }

/* フッター合計行 */
.finance-list-footer {
  padding: 10px 16px;
  background: var(--gray-50);
  border-top: 1px solid var(--gray-200);
  text-align: right;
  font-size: 13.5px;
}

/* 空リスト */
.list-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);   /* #8 4.5:1 */
  font-size: 14px;
}

/* ============================================================
   ポップオーバー（行アクション）
   ============================================================ */
.row-actions-popover {
  position: absolute;
  z-index: 300;
  background: var(--white);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(13,27,75,0.16);
  border: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 120px;
}
.popover-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-800);
  background: none;
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}
.popover-btn:hover { background: var(--gray-50); }
.popover-btn.danger { color: var(--red); }
.popover-btn.danger:hover { background: #FEF2F2; }
.popover-btn svg { width: 15px; height: 15px; fill: currentColor; }

/* ============================================================
   モーダル（finance用）
   ============================================================ */
.finance-modal {
  width: 560px;
  max-width: 95vw;
}

/* form-row: 2 カラムレイアウト（モバイルで 1 カラムに折り返し） */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 16px;
}
.form-group textarea { resize: vertical; min-height: 72px; }

/* レシートアップロードエリア */
.file-upload-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px;
  border: 2px dashed var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  color: var(--gray-400);
  text-align: center;
  font-size: 12.5px;
}
.file-upload-area:hover,
.file-upload-area.drag-over {
  border-color: var(--blue);
  background: var(--blue-pale);
  color: var(--blue-dark);
}
.file-upload-area svg { width: 32px; height: 32px; fill: currentColor; }
.receipt-preview {
  margin-top: 10px;
  font-size: 12.5px;
  color: var(--gray-600);
}
.receipt-preview img {
  max-width: 100%;
  max-height: 180px;
  border-radius: 6px;
  border: 1px solid var(--gray-200);
  display: block;
  margin-top: 6px;
}

/* ============================================================
   経費出力画面
   ============================================================ */
.report-mode-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.report-controls { display: flex; align-items: center; gap: 8px; }
.report-select {
  padding: 7px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  background: var(--white);
  cursor: pointer;
}

.report-content {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 28px;
}
.report-placeholder {
  text-align: center;
  padding: 48px;
  color: var(--gray-400);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  font-size: 14px;
}
.report-header { margin-bottom: 20px; }
.report-header h3 { font-size: 18px; font-weight: 700; color: var(--navy); }

.report-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
}
.report-table-section h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 8px;
}
.text-right { text-align: right; }
.total-row td { font-weight: 700; border-top: 2px solid var(--gray-200); }
.report-year-table { width: 100%; max-width: 500px; }

/* ============================================================
   部費管理画面
   ============================================================ */
.dues-month-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.dues-month-label {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  min-width: 130px;
  text-align: center;
}
.month-picker {
  padding: 6px 10px;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.dues-summary {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
}
.dues-stat {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 12px 20px;
  text-align: center;
  min-width: 100px;
}
.dues-stat-num {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
}
.dues-stat-num.unpaid { color: var(--red); }
.dues-stat-label { font-size: 11px; color: var(--gray-600); font-weight: 600; }

.dues-table-wrapper {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.dues-table { width: 100%; }

/* 入金状況バッジ */
.dues-status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
}
.dues-status-badge.paid    { background: #E8F5E9; color: #2E7D32; }
.dues-status-badge.unpaid  { background: #FFEBEE; color: #C62828; }
.dues-status-badge.partial { background: #FFF4E0; color: #B26A00; }

/* 不足額表示 */
.dues-shortfall { display: block; font-size: 11px; color: #C62828; margin-top: 2px; }

/* 行の背景 */
tr.dues-paid    { background: #F9FFF9; }
tr.dues-unpaid  { background: #FFFAFA; }
tr.dues-partial { background: #FFFBF2; }

/* 選手名セル */
.player-name-cell { position: relative; }
.furigana {
  display: block;
  font-size: 10px;
  color: var(--gray-400);
  font-weight: 400;
  margin-top: 1px;
}

/* ============================================================
   印刷スタイル
   ============================================================ */
@page { size: A4; margin: 12mm; }

@media print {
  .sidebar, .page-header .header-actions,
  .report-mode-bar, .btn-back, .page-header { display: none !important; }
  .app-layout { display: block !important; }
  .main-content { margin-left: 0 !important; padding: 0 !important;
    overflow: visible !important; height: auto !important; }
  .report-content { box-shadow: none !important; border: none !important;
    padding: 0 !important; overflow: visible !important; height: auto !important; }
  .print-area { display: block !important; }
  body, html { background: white; height: auto !important; overflow: visible !important; }
}

/* ============================================================
   レスポンシブ
   ============================================================ */
@media (max-width: 1024px) and (orientation: portrait), (max-width: 768px) {
  .finance-list-header,
  .finance-list-row {
    grid-template-columns: 100px 100px 100px 90px minmax(0, 1fr) 40px;
  }
  .finance-summary-row { gap: 8px; }
  .summary-card { min-width: 100px; padding: 12px 14px; }
  .summary-amount { font-size: 17px; }
  .report-tables { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}

/* ============================================================
   部費設定・一括入金 追加スタイル
   ============================================================ */

/* チェックボックス列 */
.col-check {
  width: 40px;
  text-align: center;
  padding: 0 8px;
}
.col-check input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* 部費設定バー（未設定表示） */
.dues-unset {
  color: var(--gray-400);
  font-size: 12px;
}

/* 未入金行のデフォルト金額ヒント */
.dues-default-hint {
  color: var(--gray-400);
  font-size: 12px;
}

/* 一括入金ボタンのバッジ */
.bulk-sel-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  background: var(--blue-600, #2563eb);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 700;
  margin-left: 4px;
}

/* ─── 部費設定画面: 一括設定バー ─── */
.bulk-set-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.bulk-set-label {
  font-size: 13px;
  font-weight: 600;
  color: #1d4ed8;
  white-space: nowrap;
}
.bulk-set-inputs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.bulk-set-inputs label {
  font-size: 13px;
  color: var(--gray-600);
  white-space: nowrap;
}
.bulk-set-inputs input[type="number"] {
  width: 120px;
  padding: 6px 10px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 13px;
}
.bulk-set-inputs span {
  font-size: 13px;
  color: var(--gray-600);
}

/* ─── 一括入金ダイアログ ─── */
.bulk-dues-modal {
  max-width: 560px;
}
.bulk-dues-count-label {
  font-weight: 400;
  color: var(--gray-500);
}
.bulk-dues-list {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--gray-200);
  border-radius: 6px;
  padding: 4px 0;
  margin-top: 4px;
}
.bulk-dues-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--gray-100);
}
.bulk-dues-item:last-child {
  border-bottom: none;
}
.bulk-dues-name {
  flex: 1;
  font-size: 13px;
  font-weight: 400;
}
.bulk-dues-amount {
  width: 100px;
  padding: 5px 8px;
  border: 1px solid var(--gray-300);
  border-radius: 5px;
  font-size: 13px;
  text-align: right;
}
.bulk-dues-yen {
  font-size: 13px;
  color: var(--gray-600);
  white-space: nowrap;
}

/* ============================================================
   経費詳細モーダル
   ============================================================ */
.expense-detail-modal {
  max-width: 480px;
}

.detail-dl {
  margin: 0;
  display: flex;
  flex-direction: column;
}
.detail-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 4px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
  align-items: start;
}
.detail-row:last-child { border-bottom: none; }
.detail-row dt {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-muted);
  /* uppercase / letter-spacing 削除 (#12) */
  padding-top: 3px;
}
.detail-row dd {
  font-size: 14px;
  color: var(--text-body);
  margin: 0;
  word-break: break-word;
}
.detail-amount {
  font-size: 20px;
  font-weight: 700;
}
.detail-empty {
  color: var(--gray-400);
  font-size: 13px;
}
.detail-receipt-img {
  max-width: 100%;
  max-height: 220px;
  border-radius: 6px;
  object-fit: contain;
  border: 1px solid var(--gray-200);
  display: block;
  margin-top: 4px;
}

/* .btn-danger は前方で定義済（重複削除） */

/* ============================================================
   部費徴収状況マトリクス
   ============================================================ */
.dues-year-label {
  font-size: 1rem;
  font-weight: 700;
  color: var(--navy);
  min-width: 80px;
  text-align: center;
}
.dues-status-wrap {
  padding: 0 24px 24px;
}
.dues-status-scroll {
  overflow-x: auto;
  border-radius: 10px;
  border: 1px solid var(--gray-200);
}
.dues-status-table {
  border-collapse: collapse;
  min-width: 900px;
  width: 100%;
  font-size: 13px;
}
.dues-status-table th,
.dues-status-table td {
  border: 1px solid var(--gray-200);
  padding: 6px 8px;
  white-space: nowrap;
}
.dues-status-table thead th {
  background: var(--gray-100);
  font-weight: 600;
  color: var(--navy);
  text-align: center;
}
.dues-status-table th.dst-name,
.dues-status-table td.dst-name { min-width: 90px; }
.dues-status-table th.dst-team,
.dues-status-table td.dst-team { min-width: 80px; color: var(--gray-600); font-size: 12px; }
.dues-status-table th.dst-month { width: 56px; }
.dues-status-table td.dst-cell  { text-align: center; font-size: 12px; }
.dues-status-table td.dst-paid    { background: #D1FAE5; color: #065F46; font-weight: 600; }
.dues-status-table td.dst-partial { background: #FEF3C7; color: #92400E; }
.dues-status-table td.dst-unpaid  { background: #FEE2E2; color: var(--red); }
.dues-status-table td.dst-noset   { background: var(--gray-50); color: var(--gray-400); }
.dues-status-table th.dst-summary,
.dues-status-table td.dst-summary { min-width: 52px; text-align: center; font-weight: 600; }
.dues-status-table td.dst-summary-warn { color: var(--red); }
.dues-status-table th.dst-sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
}
.dues-status-table th.dst-sortable::after {
  content: '⇅';        /* デフォルトの並べ替え可能アイコン */
  font-size: 10px;
  color: var(--text-faint);
  margin-left: 4px;
  vertical-align: middle;
}
.dues-status-table th.dst-sortable:hover { background: var(--gray-200); }
.sort-icon        { font-size: 10px; color: var(--text-faint); margin-left: 3px; }
.sort-icon.active { color: var(--blue-dark); }

/* ============================================================
   選手別経費帳簿
   ============================================================ */
.pl-list-header,
.pl-list-row {
  display: grid;
  grid-template-columns: 110px 120px 110px 120px 110px 90px;
  align-items: center;
  gap: 0 8px;
  padding: 8px 16px;
}
.pl-list-row:hover { background: var(--gray-50); }
.pl-detail-summary {
  display: flex;
  gap: 12px;
  padding: 16px 16px 8px;
  flex-wrap: wrap;
}
.pl-detail-header,
.pl-detail-row {
  display: grid;
  grid-template-columns: 56px 80px 100px 80px minmax(0,1fr);
  align-items: center;
  gap: 0 8px;
  padding: 8px 16px;
}
.pl-detail-row:nth-child(even) { background: var(--gray-50); }
.amount-partial { color: #92400E; }

/* ============================================================
   帯同者ピッカー / 不在情報
   ============================================================ */
.attendee-select-wrap { display: flex; flex-direction: column; gap: 6px; }
.attendee-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.attendee-chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--blue-light); color: var(--blue-dark);
  border-radius: 20px; padding: 3px 10px; font-size: 12px;
}
.chip-remove { background: none; border: none; cursor: pointer; color: inherit; font-size: 14px; line-height: 1; padding: 0; }

.attendee-picker-modal { max-width: 420px; }
.attendee-picker-list { display: flex; flex-direction: column; gap: 4px; max-height: 360px; overflow-y: auto; }
.attendee-picker-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 6px; cursor: pointer;
  border: 1px solid transparent;
}
.attendee-picker-item:hover { background: var(--gray-50); border-color: var(--gray-200); }
.attendee-picker-item.absent { opacity: 0.5; cursor: not-allowed; }
.attendee-name { flex: 1; font-size: 13px; }
.attendee-role { font-size: 11px; color: var(--gray-500); }
.attendee-absent-badge { font-size: 10px; background: #FEE2E2; color: var(--red); border-radius: 4px; padding: 1px 5px; }

.absence-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; padding: 5px 0;
  border-bottom: 1px solid var(--gray-100);
}
.absence-row span { flex: 1; }

/* ============================================================
   バス集金管理
   ============================================================ */
.bf-header,
.bf-row {
  display: grid;
  grid-template-columns: minmax(100px, 1fr) 80px 100px 90px 90px 120px;
  align-items: center;
  gap: 0 8px;
  padding: 7px 16px;
}
.bf-row:hover { background: var(--gray-50); }

.tf-header,
.tf-row {
  display: grid;
  grid-template-columns: minmax(120px,1.5fr) 90px minmax(80px,1fr) 90px 90px 90px minmax(140px,auto);
  align-items: center;
  gap: 0 8px;
  padding: 7px 16px;
}
.tf-row:hover { background: var(--gray-50); }

/* 各種データ入力 */
.pd-ex-header,
.pd-ex-row {
  display: grid;
  grid-template-columns: 90px 90px 90px 80px 60px minmax(0,1fr) 120px;
  align-items: center;
  gap: 0 8px;
  padding: 6px 16px;
}
.pd-ex-row:hover { background: var(--gray-50); }

.pd-gps-header,
.pd-gps-row {
  display: grid;
  grid-template-columns: 90px 90px 100px 80px 100px 80px minmax(0,1fr) 120px;
  align-items: center;
  gap: 0 8px;
  padding: 6px 16px;
}
.pd-gps-row:hover { background: var(--gray-50); }

.intensity-btn {
  width: 32px; height: 32px;
  border: 1px solid var(--gray-300);
  border-radius: 4px;
  background: var(--gray-100);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s, color 0.15s;
}
.intensity-btn.selected { background: var(--blue-dark); color: #fff; border-color: var(--blue-dark); }

.intensity-badge {
  display: inline-block;
  min-width: 24px; height: 24px;
  line-height: 24px;
  text-align: center;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  padding: 0 4px;
}

/* .data-table はファイル上部で navy ヘッダ仕様に統一済（player_data の局所用は別途上書き） */
.player-data-section .data-table {
  font-size: 13px;
}
.player-data-section .data-table th,
.player-data-section .data-table td {
  padding: 6px 10px;
  border-bottom: 1px solid var(--gray-200);
}
.player-data-section .data-table th {
  background: var(--gray-50);
  color: var(--text-body);
  font-weight: 700;
  white-space: nowrap;
}
.player-data-section .data-table tr:hover td { background: var(--gray-50); }

.tab-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--gray-200);
  padding-bottom: 0;
}
.tab-btn {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
  font-size: 13px;
  color: var(--gray-600);
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active, .tab-btn:hover { color: var(--blue-dark); border-bottom-color: var(--blue-dark); }
.tab-content { display: none; padding-top: 12px; }
.tab-content.active { display: block; }

/* インポート: 未マッチ名のチップ表示 */
.import-unmatched-names { display: flex; flex-wrap: wrap; gap: 6px; }
.import-unmatched-chip {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  background: #FFEBEE; color: #C62828; font-size: 12px; font-weight: 600;
}

/* ─── トースト通知 ─── */
.toast-host {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: max-content; max-width: 90vw;
}
.toast {
  pointer-events: auto;
  padding: 11px 18px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  color: #fff; background: #334155; box-shadow: 0 6px 20px rgba(0,0,0,.22);
  opacity: 0; transform: translateY(10px); transition: opacity .2s, transform .2s;
  max-width: 90vw; word-break: break-word; white-space: pre-wrap;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-success { background: #15803D; }
.toast-error   { background: #B91C1C; }
.toast-info    { background: #334155; }

/* ─── 確認ダイアログ ─── */
.cdlg-overlay {
  position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 2100;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; transition: opacity .15s;
}
.cdlg-overlay.open { opacity: 1; }
.cdlg {
  background: #fff; border-radius: 12px; max-width: 400px; width: 100%;
  box-shadow: 0 20px 50px rgba(0,0,0,.28); overflow: hidden;
  transform: scale(.96); transition: transform .15s;
}
.cdlg-overlay.open .cdlg { transform: scale(1); }
.cdlg-title { padding: 16px 20px 0; font-size: 15px; font-weight: 700; color: var(--navy, #1e293b); }
.cdlg-body  { padding: 16px 20px; font-size: 13.5px; line-height: 1.6; color: var(--gray-700, #374151); }
.cdlg-actions { padding: 12px 20px 16px; display: flex; gap: 10px; justify-content: flex-end; }

/* ─── 試合結果 戦績サマリー ─── */
.results-summary {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  background: #fff; border: 1px solid var(--gray-200, #e5e7eb); border-radius: 10px;
  padding: 12px 18px; margin-bottom: 14px;
}
.results-summary .rs-record { display: flex; align-items: baseline; gap: 12px; }
.results-summary .rs-stat { font-size: 14px; color: var(--text-muted, #475569); }
.results-summary .rs-stat b { font-size: 22px; font-weight: 800; margin-right: 2px; }
.results-summary .rs-win  { color: #15803D; }
.results-summary .rs-draw { color: #B26A00; }
.results-summary .rs-lose { color: #B91C1C; }
.results-summary .rs-played { font-size: 12px; color: var(--text-faint, #94a3b8); }
.results-summary .rs-goals { font-size: 13px; color: var(--text-muted, #475569); }
.results-summary .rs-goals b { font-size: 15px; color: var(--navy, #1e293b); }

/* ============================================================
   表示テーマ（設定で切替）
   1) theme-soft : 現状の紺配色を角丸＋柔らかい影に
   2) theme-warm : 案A 暖色 × ピッチグリーン（丸ゴシック）
   3) theme-light: 案B ライトサイドバー・ミニマル
   ※ レイアウト構造（サイドバー幅・位置）は変えず、色/角丸/影/フォントのみ調整
   ============================================================ */

/* 1) ソフト（現状ベース） */
body.theme-soft {
  --radius-sm: 10px; --radius: 14px; --radius-lg: 18px;
  --shadow:    0 10px 30px -14px rgba(13,27,75,.22);
  --shadow-sm: 0 4px 16px -8px rgba(13,27,75,.14);
  --nav-mx: 8px; --nav-radius: 12px;
  --sidebar-active-bar: transparent;     /* ピル表示なので左帯は出さない */
}

/* 2) 暖色 × ピッチグリーン（案A） */
body.theme-warm {
  font-family: "Hiragino Maru Gothic ProN","Hiragino Maru Gothic Pro",
               ui-rounded,"Hiragino Sans",system-ui,sans-serif;
  --app-bg: #F4F1E9;
  --sidebar-bg: #1F3D2E;
  --sidebar-fg: #BCD2C4;
  --sidebar-fg-strong: #FFFFFF;
  --sidebar-fg-muted: #9FB8A9;
  --sidebar-section: #84A290;
  --sidebar-hover-bg: rgba(255,255,255,.10);
  --sidebar-border: rgba(255,255,255,.12);
  --sidebar-active-bg: #2C7A52;
  --sidebar-active-fg: #FFFFFF;
  --sidebar-active-bar: transparent;
  --sidebar-scroll: rgba(255,255,255,.22);
  --avatar-bg: #2C7A52;
  --accent: #2C7A52; --accent-hover: #246343;
  /* 見出し・表ヘッダ・アクセント・リンク等のパレットも緑系に統一
     （当初の紺/青を上書き。チームカラーは別管理なので影響しない） */
  --navy:      #234D3A;
  --navy-mid:  #2C5D43;
  --blue-dark: #2C7A52;
  --blue:      #246343;
  --blue-light:#57A77B;
  --blue-pale: #E6F1EA;
  --focus-ring: rgba(44,122,82,0.40);
  --focus-glow: rgba(44,122,82,0.20);
  --radius-sm: 12px; --radius: 16px; --radius-lg: 18px;
  --shadow:    0 12px 28px -14px rgba(31,61,46,.30);
  --shadow-sm: 0 6px 18px -10px rgba(31,61,46,.18);
  --nav-mx: 8px; --nav-radius: 14px;
}
body.theme-warm { background: var(--app-bg); }

/* 3) ライトサイドバー・ミニマル（案B） */
body.theme-light {
  --app-bg: #F7F8FA;
  --sidebar-bg: #FFFFFF;
  --sidebar-fg: #5B6472;
  --sidebar-fg-strong: #111827;
  --sidebar-fg-muted: #94A3B8;
  --sidebar-section: #AAB2BF;
  --sidebar-hover-bg: #F3F5F9;
  --sidebar-border: #ECEFF3;
  --sidebar-active-bg: #EAF1FF;
  --sidebar-active-fg: #2563EB;
  --sidebar-active-bar: transparent;
  --sidebar-scroll: #D7DCE5;
  --avatar-bg: #3B82F6;
  --accent: #2563EB; --accent-hover: #1D4ED8;
  /* 見出し・表ヘッダ・アクセント・リンク等のパレットもライトブルー系に統一
     （当初の濃い紺/青を上書き。チームカラーは別管理なので影響しない） */
  --navy:      #1E293B;
  --navy-mid:  #2563EB;
  --blue-dark: #2563EB;
  --blue:      #1D4ED8;
  --blue-light:#60A5FA;
  --blue-pale: #EAF1FF;
  --focus-ring: rgba(37,99,235,0.32);
  --focus-glow: rgba(37,99,235,0.18);
  --radius-sm: 10px; --radius: 14px; --radius-lg: 16px;
  --shadow:    0 10px 26px -16px rgba(16,24,40,.18);
  --shadow-sm: 0 2px 8px rgba(16,24,40,.07);
  --nav-mx: 8px; --nav-radius: 12px;
}
/* 白サイドバーは右に境界線を引いて分離（暗い帯が無い分の視認性確保） */
body.theme-light .sidebar { border-right: 1px solid #ECEFF3; }
body.theme-light .mobile-topbar { color: #111827; border-bottom: 1px solid #ECEFF3; box-shadow: 0 2px 8px rgba(16,24,40,.06); }
body.theme-light .topbar-btn { color: #475569; }
body.theme-light .topbar-btn:hover { background: #F3F5F9; }
body.theme-light .sidebar-brand .brand-icon,
body.theme-light .mobile-topbar .brand-icon { filter: none; }
/* 白サイドバーでは「未読あり」ハイライトの黄文字が読めないため上書き */
body.theme-light .nav-unread { background: #FFF4E5; }
body.theme-light .nav-unread span:not(.nav-unread-badge) { color: #B45309; font-weight: 700; }
body.theme-light .nav-unread svg { fill: #B45309; }
body.theme-light .sidebar-user-link:hover { background: #F3F5F9; }
