/* =====================================================
 * 上覧日程調整 - 調整さん風モダンスタイル
 * グリーン基調、行=日程の転置レイアウト
 * ===================================================== */

:root {
  --joran-green:        #15803d;
  --joran-green-hover:  #166534;
  --joran-green-light:  #dcfce7;
  --joran-bg:           #f5f7f5;
  --joran-card-bg:      #fff;
  --joran-border:       #e5e7eb;
  --joran-border-strong:#d1d5db;
  --joran-text:         #1f2937;
  --joran-text-sub:     #6b7280;
  --joran-text-muted:   #9ca3af;
  --joran-radius:       10px;
  --joran-radius-sm:    6px;
  --joran-shadow:       0 1px 3px 0 rgba(0,0,0,.05);
  --joran-row-hover:    #f9fafb;
  --joran-row-best:     #f0fdf4;
}

/* 出欠フォームの開閉で縦スクロールバーが出ても、開いた時の幅を維持する。 */
html {
  overflow-y: scroll;
  scrollbar-gutter: stable;
}

/* ========== ページ全体 ========== */

.joran-page {
  max-width: 1400px;
  margin: 0 auto;
}

/* 作成画面は最初に入力を始められる順で並べ、補助情報を下へ送る。 */
#create-view {
  display: flex;
  flex-direction: column;
}
#joran-schedule-banner-create { order: 1; }
#create-event-meta-card { order: 2; }
#create-generator-card { order: 3; }
#create-dates-card { order: 4; }
#create-view > .joran-cta-wrap { order: 5; }
#joran-schedule-upcoming-create { order: 6; }
#history-section { order: 7; }
#create-view > .joran-help-btn-wrap { order: 8; }

/* 回答対象の詳細画面では、サイト全体の次回開催情報を表示しない。 */
#detail-view > #joran-schedule-banner-detail,
#detail-view > #joran-schedule-upcoming-detail {
  display: none !important;
}

#detail-view {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
@media (min-width: 641px) {
  #detail-view {
    width: 70%;
    /* タブレット幅で内容が極端に細くならないよう、親幅を超えない下限を設ける。 */
    min-width: min(100%, 680px);
    margin-inline: auto;
  }
}


.joran-card {
  background: var(--joran-card-bg);
  border: 1px solid var(--joran-border);
  border-radius: var(--joran-radius);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--joran-shadow);
}

@media (max-width: 640px) {
  .joran-card { padding: 16px 12px; }
}

.joran-card-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--joran-text);
  margin: 0 0 16px 0;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--joran-green);
}

.joran-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--joran-text);
  margin: 0 0 12px 0;
}

.joran-section-bar {
  display: inline-block;
  width: 4px;
  height: 18px;
  background: var(--joran-green);
  border-radius: 2px;
}

.joran-help {
  font-size: 12px;
  color: var(--joran-text-sub);
  margin: 0 0 12px 0;
}

/* ========== フォーム要素 ========== */

.joran-field {
  margin-bottom: 16px;
}
.joran-field:last-child { margin-bottom: 0; }

.joran-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--joran-text);
  margin-bottom: 6px;
}

.joran-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--joran-border-strong);
  border-radius: var(--joran-radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--joran-text);
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.joran-input:focus {
  outline: none;
  border-color: var(--joran-green);
  box-shadow: 0 0 0 3px rgba(21, 128, 61, .12);
}
textarea.joran-input { resize: vertical; min-height: 60px; }

.joran-monospace { font-family: ui-monospace, "SFMono-Regular", Menlo, monospace; font-size: 13px; }
.joran-dates-summary {
  margin: 8px 0 0;
  color: var(--joran-green-hover);
  line-height: 1.5;
}

.joran-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 16px;
  margin-bottom: 16px;
}
@media (max-width: 640px) {
  .joran-grid-2 { grid-template-columns: 1fr; }
}

/* ラジオグループ */
.joran-radio-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.joran-radio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--joran-border-strong);
  border-radius: 999px;
  cursor: pointer;
  font-size: 13px;
  background: #fff;
  user-select: none;
  transition: background .15s, border-color .15s;
}
.joran-radio:hover { background: var(--joran-row-hover); }
.joran-radio input[type="radio"] {
  margin: 0;
  accent-color: var(--joran-green);
}
.joran-radio input[type="radio"]:checked + span {
  color: var(--joran-green);
  font-weight: 700;
}
.joran-radio:has(input:checked) {
  background: var(--joran-green-light);
  border-color: var(--joran-green);
}

/* ========== ボタン ========== */

.joran-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  border-radius: var(--joran-radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, transform .05s;
  white-space: nowrap;
  font-family: inherit;
}
.joran-btn:active { transform: translateY(1px); }
.joran-btn-primary {
  background: var(--joran-green);
  color: #fff;
}
.joran-btn-primary:hover { background: var(--joran-green-hover); }
.joran-btn-secondary {
  background: #fff;
  color: var(--joran-text);
  border-color: var(--joran-border-strong);
}
.joran-btn-secondary:hover { background: var(--joran-row-hover); border-color: var(--joran-text-sub); }
.joran-btn-danger {
  background: #fff;
  color: #b91c1c;
  border-color: #fecaca;
}
.joran-btn-danger:hover { background: #fef2f2; }

.joran-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* ========== 大きなCTAボタン（出欠を入力する 等） ========== */

.joran-cta-wrap {
  text-align: center;
  margin: 32px 0;
}
.joran-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: min(100%, 320px);
  min-height: 52px;
  height: auto;
  padding: 14px 24px;
  background: var(--joran-green);
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(21,128,61,.25);
  transition: background .15s, transform .1s, box-shadow .15s;
  font-family: inherit;
  letter-spacing: .02em;
  line-height: 1.4;
}
.joran-cta:hover {
  background: var(--joran-green-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(21,128,61,.3);
}
.joran-cta:active { transform: translateY(0); }
@media (max-width: 640px) {
  .joran-cta { width: 100%; min-height: 52px; font-size: 16px; }
}

/* ========== 詳細ヘッダー ========== */

.joran-detail-header-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 8px;
}
.joran-event-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--joran-text);
  margin: 0 0 6px 0;
  line-height: 1.4;
  word-break: break-word;
}
.joran-event-stat {
  font-size: 13px;
  color: var(--joran-text-sub);
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.joran-event-stat strong {
  font-size: 16px;
  color: var(--joran-green);
  margin: 0 2px;
}
.joran-event-desc {
  font-size: 13px;
  color: var(--joran-text-sub);
  margin: 0;
  white-space: pre-wrap;
}

.joran-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.joran-badge-closed { background: #4b5563; color: #fff; margin-left: 8px; }

/* ========== グリッド（行=日程・列=○△×+参加者） ========== */

.joran-grid-wrap {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  overflow-x: auto;
  border-radius: var(--joran-radius-sm);
  border: 1px solid var(--joran-border);
}
/* ページを縦スクロールしても、表の参加者名を上部で確認できる追従ヘッダー。 */
.joran-grid-sticky-head {
  position: fixed;
  top: 68px;
  left: 0;
  width: 0;
  height: 0;
  overflow: hidden;
  box-sizing: border-box;
  background: #fff;
  border: 1px solid var(--joran-border);
  border-radius: var(--joran-radius-sm);
  box-shadow: 0 4px 12px rgba(15, 23, 42, .12);
  pointer-events: none;
  z-index: 19;
}
.joran-grid-sticky-head-viewport {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.joran-grid-sticky-head-table {
  width: max-content;
  min-width: 0;
  table-layout: fixed;
  transform: translateX(0);
}
.joran-grid-sticky-head-table thead th {
  position: static !important;
  top: auto !important;
}
.joran-grid-sticky-head-table .joran-th-date,
.joran-grid-sticky-head-table .joran-th-participant {
  position: static !important;
  left: auto !important;
}
.joran-grid {
  border-collapse: collapse;
  width: 100%;
  min-width: 480px;
  font-size: 13px;
  background: #fff;
}
.joran-grid th, .joran-grid td {
  border-right: 1px solid var(--joran-border);
  border-bottom: 1px solid var(--joran-border);
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
  background: #fff;
}
.joran-grid th:last-child, .joran-grid td:last-child { border-right: none; }
.joran-grid tr:last-child td { border-bottom: none; }

.joran-grid thead th {
  background: #f9fafb;
  font-weight: 600;
  color: var(--joran-text-sub);
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}
.joran-grid tbody tr:hover td { background: var(--joran-row-hover); }
/* 最有力候補は色だけに頼らず、行の背景・枠線・ラベルで示す。 */
.joran-grid tbody tr.joran-row-best td {
  background: var(--joran-row-best);
  border-top: 2px solid var(--joran-green);
  border-bottom: 2px solid var(--joran-green);
}
.joran-grid tbody tr.joran-row-best td.joran-td-date {
  background: var(--joran-row-best) !important;
  border-left: 3px solid var(--joran-green);
}
.joran-best-label {
  display: block;
  margin-top: 3px;
  color: var(--joran-green-hover);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}
.joran-decided-grid-label {
  display: block;
  margin-top: 3px;
  color: #166534;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}
.joran-date-card-head .joran-best-label,
.joran-date-card-head .joran-decided-grid-label {
  display: inline-block;
  margin: 0 0 0 8px;
  white-space: nowrap;
}

.joran-th-date, .joran-td-date {
  text-align: left;
  white-space: nowrap;
  font-weight: 600;
  min-width: 130px;
  background: #fafbfa !important;
  position: sticky;
  left: 0;
  z-index: 1;
}
.joran-grid thead .joran-th-date {
  z-index: 2;
}

.joran-th-count, .joran-td-count {
  width: 44px;
  font-weight: 600;
  color: var(--joran-text-sub);
}
.joran-th-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--joran-text);
  white-space: normal;
  word-break: break-word;
  max-width: 100px;
  line-height: 1.3;
}
.joran-grid-view-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}
.joran-grid-orientation-status {
  color: var(--joran-text-muted);
  font-size: 11px;
  white-space: nowrap;
}
.joran-grid-orientation-toggle {
  white-space: nowrap;
}
.joran-th-participant {
  text-align: left;
  min-width: 104px;
}
.joran-th-grid-date {
  width: 88px;
  min-width: 88px;
  max-width: 88px;
  white-space: normal;
  line-height: 1.2;
  padding: 6px 5px !important;
}
.joran-grid-date-label,
.joran-grid-date-time,
.joran-grid-date-counts {
  display: block;
}
.joran-grid-date-time {
  font-weight: 500;
  color: var(--joran-text);
}
.joran-grid-date-counts {
  margin-top: 3px;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
}
.joran-grid--participant {
  width: max-content;
  min-width: 100%;
  table-layout: fixed;
}
.joran-grid--participant .joran-th-participant {
  position: sticky;
  left: 0;
  background: #fafbfa !important;
  box-shadow: 2px 0 0 rgba(148, 163, 184, .45);
  z-index: 3;
}
.joran-grid--participant thead .joran-th-participant {
  z-index: 5;
}
.joran-grid--participant .joran-th-grid-date {
  cursor: pointer;
}
.joran-grid--participant thead .joran-col-best {
  background: var(--joran-row-best);
  border-bottom: 2px solid var(--joran-green);
}
.joran-grid--participant tbody td.joran-col-best {
  background: var(--joran-row-best);
  box-shadow: inset 2px 0 0 var(--joran-green);
}
.joran-grid--participant .joran-th-comment {
  width: 140px;
  min-width: 140px;
  max-width: 140px;
}
.joran-td-ans { font-weight: 700; min-width: 44px; }
.joran-td-comment {
  text-align: left;
  font-size: 11px;
  color: var(--joran-text-sub);
  max-width: 120px;
  white-space: normal;
  word-break: break-word;
}
.joran-foot-comment td {
  background: #f9fafb;
  font-size: 11px;
}

.joran-ans-o { color: #15803d; }
.joran-ans-d { color: #ca8a04; }
.joran-ans-x { color: #b91c1c; }

/* 自分の列ハイライト */
.joran-grid .joran-cell-mine {
  background: #eff6ff !important;
  color: #1e3a8a;
}
.joran-grid thead .joran-cell-mine {
  border-bottom: 2px solid #2563eb !important;
  color: #1e3a8a;
  background: #dbeafe !important;
  font-weight: 700;
}
.joran-grid tbody tr:hover td.joran-cell-mine,
.joran-grid tbody tr.joran-row-best td.joran-cell-mine {
  background: #dbeafe !important;
}
/* 登録直後フラッシュ */
@keyframes joran-mine-flash {
  0%   { background: #bbf7d0 !important; box-shadow: inset 0 0 0 2px #15803d; }
  100% { background: inherit; box-shadow: none; }
}
.joran-cell-flash {
  animation: joran-mine-flash 1.8s ease-out !important;
}
@keyframes joran-bulk-flash {
  0%   { background: #dcfce7 !important; box-shadow: inset 0 0 0 2px #15803d; }
  100% { background: inherit; box-shadow: none; }
}
.joran-bulk-changed {
  animation: joran-bulk-flash 1.8s ease-out !important;
}

/* ========== コメント ========== */

.joran-comments {
  margin-bottom: 12px;
}
.joran-comments-empty {
  color: var(--joran-text-muted);
  font-size: 13px;
  margin: 8px 0;
}
.joran-comment {
  padding: 10px 0;
  border-bottom: 1px solid var(--joran-border);
}
.joran-comment:last-child { border-bottom: none; }
.joran-comment-meta {
  font-size: 11px;
  color: var(--joran-text-muted);
  margin-bottom: 3px;
}
.joran-comment-body {
  font-size: 14px;
  color: var(--joran-text);
  white-space: pre-wrap;
  word-break: break-word;
}
.joran-comment-reply-btn {
  border: none;
  background: transparent;
  color: var(--joran-green-hover);
  font-size: 12px;
  font-weight: 600;
  padding: 2px 0 0;
  margin-top: 2px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.joran-comment-reply-btn:hover { text-decoration: underline; }
/* 返信は親コメントの直下に少し右へ寄せて表示し、スレッドであることを視覚化する */
.joran-comment--reply {
  margin-left: 20px;
  padding-left: 10px;
  border-left: 2px solid var(--joran-border);
}
.joran-comment-reply-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--joran-green-hover);
  background: var(--joran-green-light);
  border-radius: var(--joran-radius-sm);
  padding: 6px 10px;
  margin-bottom: 8px;
}
.joran-comment-reply-cancel {
  border: none;
  background: transparent;
  color: var(--joran-text-muted);
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  flex-shrink: 0;
}
.joran-comment-form {
  display: flex;
  gap: 8px;
}
.joran-comment-form .joran-input { flex: 1; }

/* ========== URL共有ボックス ========== */

.joran-share-box {
  display: flex;
  gap: 8px;
}
.joran-share-box .joran-input {
  flex: 1;
  background: #f9fafb;
}

/* ========== ユーティリティ ========== */

.joran-hidden { display: none !important; }

.joran-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #111827;
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 100;
  opacity: 0;
  transition: opacity 200ms, transform 200ms;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.joran-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-4px);
}

/* ========== TOP5 カード ========== */

/* ヘッダー行: タイトル + ○/△ トグル */
.joran-top3-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.joran-top3-copy-btn {
  font-size: 12px;
  padding: 9px 12px;
  white-space: nowrap;
  min-height: 36px;
}

/* ○のみ / ○＋△ トグルボタン */
.joran-top3-mode-toggle {
  display: inline-flex;
  border: 1px solid var(--joran-border-strong);
  border-radius: var(--joran-radius-sm);
  overflow: hidden;
}
.joran-top3-mode-btn {
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  background: #fff;
  color: var(--joran-text-muted);
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  line-height: 1.6;
  min-height: 36px;
}
.joran-top3-mode-btn + .joran-top3-mode-btn {
  border-left: 1px solid var(--joran-border-strong);
}
.joran-top3-mode-btn--active {
  background: var(--joran-green);
  color: #fff;
}
.joran-top3-mode-btn:not(.joran-top3-mode-btn--active):hover {
  background: var(--joran-row-hover);
}

/* ---- TOP5 フィルターバー ---- */
.joran-top3-filter-bar {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.joran-filter-search-wrap {
  display: flex;
}
.joran-filter-search-input {
  width: 100%;
  max-width: 320px;
  font-size: 13px;
  padding: 6px 10px;
  border: 1px solid var(--joran-border-strong);
  border-radius: var(--joran-radius-sm);
  background: #fff;
}
.joran-filter-search-input:focus {
  outline: none;
  border-color: var(--joran-green);
  box-shadow: 0 0 0 2px var(--joran-green-light);
}
.joran-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.joran-filter-row-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--joran-text-muted);
  white-space: nowrap;
  min-width: 52px;
}
.joran-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}
.joran-filter-chip {
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  background: #fff;
  color: var(--joran-text-sub);
  border: 1px solid var(--joran-border-strong);
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  line-height: 1.5;
  white-space: nowrap;
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}
.joran-filter-chip:hover {
  background: var(--joran-green-light);
  border-color: var(--joran-green);
  color: var(--joran-green);
}
.joran-filter-chip--active {
  background: var(--joran-green);
  border-color: var(--joran-green);
  color: #fff;
}
.joran-filter-chip--active:hover {
  background: var(--joran-green-hover);
  border-color: var(--joran-green-hover);
  color: #fff;
}
.joran-filter-count-wrap {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.joran-filter-count-input {
  width: 44px;
  padding: 3px 6px;
  font-size: 11px;
  border: 1px solid var(--joran-border-strong);
  border-radius: var(--joran-radius-sm);
  text-align: center;
  background: #fff;
  color: var(--joran-text);
}
.joran-filter-count-input:focus {
  outline: none;
  border-color: var(--joran-green);
}
.joran-filter-count-unit {
  font-size: 11px;
  color: var(--joran-text-sub);
  white-space: nowrap;
}
.joran-filter-select {
  padding: 3px 24px 3px 8px;
  font-size: 11px;
  border: 1px solid var(--joran-border-strong);
  border-radius: var(--joran-radius-sm);
  background: #fff;
  color: var(--joran-text);
  cursor: pointer;
  appearance: auto;
}
.joran-filter-select:focus {
  outline: none;
  border-color: var(--joran-green);
}
.joran-filter-reset {
  align-self: flex-start;
  padding: 3px 10px;
  font-size: 11px;
  background: none;
  color: var(--joran-text-sub);
  border: 1px solid var(--joran-border);
  border-radius: 20px;
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.joran-filter-reset:hover {
  color: #dc2626;
  border-color: #fca5a5;
}
.joran-filter-no-results {
  font-size: 13px;
  color: var(--joran-text-sub);
  text-align: center;
  padding: 20px 0;
  margin: 0;
}
/* ---- TOP5 フィルターバー（モバイル） ---- */
@media (max-width: 640px) {
  /* 注意: 共通CSS(components.css)が max-width:767px で
     input/select/textarea を font-size:16px !important にしている。
     ここで font-size を小さく指定しても実機では効かないため、
     文字サイズではなく幅・余白で収まりを調整する */
  .joran-filter-row-label { min-width: 44px; font-size: 12px; }
  .joran-filter-chip { font-size: 12px; padding: 6px 10px; }
  .joran-filter-count-unit { font-size: 12px; }
}

.joran-top3-wrap {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* その他の日程（6位以降）*/
.joran-top3-others-wrap {
  width: 100%;
  margin-top: 10px;
}
.joran-top3-others-summary {
  list-style: none;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  padding: 4px 2px;
  position: relative;
  padding-right: 20px;
}
.joran-top3-others-summary::-webkit-details-marker { display: none; }
.joran-top3-others-summary::marker { display: none; }
.joran-top3-others-summary::after {
  content: '';
  position: absolute;
  right: 4px;
  top: 50%;
  width: 7px;
  height: 7px;
  border-right: 2px solid #9ca3af;
  border-bottom: 2px solid #9ca3af;
  transform: translateY(-75%) rotate(45deg);
  transition: transform .2s ease;
}
.joran-top3-others-wrap[open] > .joran-top3-others-summary::after {
  transform: translateY(-25%) rotate(-135deg);
}
/* ========== 未回答警告バナー ========== */

.joran-unanswered-warn {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--joran-radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  color: #92400e;
  margin-bottom: 12px;
}

/* ========== 締切バッジ ========== */

.joran-deadline-badge {
  display: inline-block;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}

/* ========== 履歴セクション ========== */

.joran-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.joran-history-header .joran-card-title {
  margin-bottom: 0;
}

.joran-history-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.joran-history-search {
  flex: 1;
  min-width: 140px;
  padding: 7px 10px;
  font-size: 13px;
}

.joran-history-sort-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
}

.joran-history-sort-label {
  font-size: 12px;
  color: var(--joran-text-muted);
  white-space: nowrap;
}

.joran-history-sort-select {
  padding: 6px 8px;
  font-size: 12px;
  width: auto;
}

.joran-history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}

.joran-history-privacy {
  margin-top: 4px;
}

.joran-history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 8px;
}

.joran-history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--joran-border);
  border-radius: var(--joran-radius-sm);
  background: #fff;
  transition: background 0.15s, border-color 0.15s;
}

.joran-history-item:hover {
  background: var(--joran-row-hover);
  border-color: var(--joran-border-strong);
}

.joran-history-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.joran-history-role-badge {
  flex: 0 0 auto;
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.joran-history-role-owner {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.joran-history-role-responder {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.joran-history-title {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 14px;
  color: var(--joran-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.joran-history-time {
  flex: 0 0 auto;
  font-size: 12px;
  color: var(--joran-text-muted);
}

.joran-history-remove {
  flex: 0 0 auto;
  background: transparent;
  border: none;
  color: var(--joran-text-muted);
  cursor: pointer;
  padding: 4px 8px;
  font-size: 14px;
  line-height: 1;
  border-radius: 4px;
}

.joran-history-remove:hover {
  background: #fee2e2;
  color: #b91c1c;
}

.joran-history-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.joran-history-empty {
  color: var(--joran-text-muted);
  font-size: 13px;
  margin: 8px 0;
}

/* ========== 使い方ガイド ========== */

.joran-step-guide {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 8px 0 4px;
}

.joran-step {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.joran-step-num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--joran-green);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.joran-step-text {
  flex: 1;
  font-size: 14px;
  line-height: 1.5;
  color: var(--joran-text);
  padding-top: 3px;
}

/* ========== 使い方ヘルプボタン & モーダル ========== */

/* 幹事画面への入口は低強調で常設し、クリック後の認証・操作だけを表示する。 */
.joran-owner-entry {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 24px;
  margin: 0 2px 10px;
}
.joran-owner-entry-hint {
  color: var(--joran-text-muted);
  font-size: 11px;
}
.joran-owner-entry-btn {
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--joran-text-sub);
  font-size: 12px;
  line-height: 1.4;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.joran-owner-entry-btn:hover {
  color: var(--joran-text);
}
.joran-owner-entry-btn:focus-visible {
  outline: 2px solid var(--joran-green);
  outline-offset: 3px;
  border-radius: 3px;
}

.joran-owner-date-editor,
.joran-owner-danger-zone {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--joran-border);
}
.joran-owner-subheading {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--joran-text);
}
.joran-owner-date-list {
  display: grid;
  gap: 6px;
}
.joran-owner-date-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--joran-border);
  border-radius: var(--joran-radius-sm);
  background: #fafafa;
}
.joran-owner-date-label {
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.joran-owner-date-row .joran-btn {
  flex: 0 0 auto;
}
.joran-owner-date-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.joran-owner-danger-zone {
  display: flex;
  justify-content: flex-end;
}

/* 合言葉入力を開いた後の認証ボタン */
.joran-reauth-trigger-btn {
  display: block;
  width: 100%;
  margin-bottom: 4px;
}
.joran-reauth-input-row {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}
.joran-reauth-input-row .joran-input {
  flex: 1;
  font-size: 13px;
  padding: 8px 10px;
}

.joran-help-btn-wrap {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 8px;
}
.joran-help-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  background: #fff;
  border: 1px solid var(--joran-green);
  color: var(--joran-green-hover);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.joran-help-btn:hover {
  background: var(--joran-green-light);
}

.joran-help-modal-inner {
  max-width: 520px;
}
.joran-help-modal-section {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px dashed #e5e7eb;
}
.joran-help-modal-section:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.joran-help-modal-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--joran-green-hover);
  margin: 0 0 10px;
}
.joran-help-modal-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: #6b7280;
  line-height: 1.5;
}
.joran-help-modal-desc {
  margin: 0;
  font-size: 13px;
  color: var(--joran-text);
  line-height: 1.6;
}

/* ========== ヘルプティップ（詳細画面） ========== */

.joran-help-tip {
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  color: #1e3a8a;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 0 12px 0;
}

/* ========== 参加者列ヘッダー：全員クリック可（URL共有編集） ========== */

.joran-th-name {
  cursor: pointer;
}

.joran-th-name:hover {
  text-decoration: underline;
  text-decoration-style: dotted;
}

.joran-th-name.joran-cell-mine {
  position: relative;
}

.joran-th-name.joran-cell-mine::after {
  content: '✎';
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  opacity: 0.7;
}

/* ========== 自動保存インジケーター ========== */

.joran-autosave-indicator {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 600;
  margin-right: auto;
  padding: 4px 10px;
  border-radius: 999px;
  transition: opacity 0.2s;
}

.joran-autosave-indicator.autosave-saving {
  background: #fef3c7;
  color: #92400e;
}

.joran-autosave-indicator.autosave-saved {
  background: #dcfce7;
  color: #166534;
}

.joran-autosave-indicator.autosave-error {
  background: #fee2e2;
  color: #b91c1c;
}

/* ========== 出欠フォーム改善（フェーズ1-2）========== */

/* 一括選択ボタン行 */
.joran-bulk-actions {
  display: block;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--joran-border);
  border-radius: var(--joran-radius-sm);
  background: rgba(255, 255, 255, .72);
}
.joran-bulk-actions > summary {
  cursor: pointer;
  list-style: none;
}
.joran-bulk-actions > summary::-webkit-details-marker { display: none; }
.joran-bulk-actions > summary::before {
  content: '+';
  display: inline-block;
  width: 1.2em;
  color: var(--joran-green);
  font-weight: 700;
}
.joran-bulk-actions[open] > summary::before { content: '−'; }
.joran-bulk-toggle { display: none; }
.joran-bulk-actions[open] > .joran-bulk-row,
.joran-bulk-actions[open] > .joran-bulk-scope-summary {
  margin-top: 8px;
}

/* select を非表示にしてチップで代替 */
.joran-select-hidden {
  display: none !important;
}

/* 職業・特化チップグループ */
.joran-chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

/* 個別チップ */
.joran-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--joran-border-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--joran-text);
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
  min-height: 32px;
}
.joran-chip:hover {
  background: var(--joran-green-light);
  border-color: var(--joran-green);
  color: var(--joran-green-hover);
}
.joran-chip.selected {
  background: var(--joran-green);
  border-color: var(--joran-green);
  color: #fff;
  font-weight: 700;
}
/* 特化チップはわずかに小さく */
#r-tokuka-chips .joran-chip {
  font-size: 12px;
  padding: 4px 10px;
}

/* フィールドの縦幅調整（チップ化でセレクトより背が高くなる） */
.joran-field-chips { align-self: start; }

@media (max-width: 640px) {
  .joran-chip { min-height: 36px; }
}

/* ========== グリッド直接入力「あなたの列」（フェーズ1-1）========== */

/* ヘッダーセル */
.joran-grid thead .joran-col-you {
  background: #f0fdf4 !important;
  border-bottom: 2px solid var(--joran-green) !important;
  min-width: 90px;
  vertical-align: top;
  padding: 6px 4px;
}

/* ボディ・フッターセル */
.joran-col-you-td {
  background: #f0fdf4 !important;
}
.joran-grid tbody tr:hover .joran-col-you-td,
.joran-grid tbody tr.joran-row-best .joran-col-you-td {
  background: #dcfce7 !important;
}

/* 「あなた」ラベル */
.joran-you-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--joran-green);
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: 0.05em;
}

/* 名前入力フィールド（グリッドヘッダー内） */
.joran-inline-name {
  display: block;
  width: 100%;
  min-width: 72px;
  max-width: 120px;
  padding: 4px 6px;
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--joran-border-strong);
  border-radius: var(--joran-radius-sm);
  background: #fff;
  color: var(--joran-text);
  box-sizing: border-box;
  outline: none;
  transition: border-color .15s;
}
.joran-inline-name:focus {
  border-color: var(--joran-green);
  box-shadow: 0 0 0 2px rgba(21,128,61,.15);
}
/* 名前未入力の警告アニメーション */
.joran-inline-name.joran-name-required {
  border-color: #ef4444;
  box-shadow: 0 0 0 2px rgba(239,68,68,.2);
  animation: joran-shake .3s ease;
}
@keyframes joran-shake {
  0%,100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

/* グリッド内インライントグルボタン */
.joran-inline-toggle {
  display: block;
  width: 100%;
  min-width: 44px;
  height: 36px;
  border: 1px solid var(--joran-border-strong);
  background: #fff;
  cursor: pointer;
  border-radius: var(--joran-radius-sm);
  font-weight: 700;
  font-size: 16px;
  font-family: inherit;
  transition: background .12s, border-color .12s, transform .08s;
  text-align: center;
}
.joran-inline-toggle:hover  { background: #f0fdf4; border-color: var(--joran-green); }
.joran-inline-toggle:active { transform: scale(.93); }

/* 状態別カラー */
.joran-inline-blank { color: var(--joran-text-muted); background: #fafafa; }
.joran-inline-o     { color: #15803d; background: #dcfce7; border-color: #15803d; }
.joran-inline-d     { color: #ca8a04; background: #fef3c7; border-color: #ca8a04; }
.joran-inline-x     { color: #b91c1c; background: #fee2e2; border-color: #b91c1c; }

@media (max-width: 640px) {
  .joran-grid thead .joran-col-you { min-width: 64px; }
  .joran-inline-name { font-size: 11px; }
  .joran-inline-toggle { height: 40px; font-size: 18px; } /* スマホはタップ面積を広く */
}

/* form-actions に保存インジケーターを左寄せで並べる */
.joran-form-actions {
  align-items: center;
}
.joran-form-actions .joran-autosave-indicator {
  margin-right: auto;
}

/* ========== 土日祝 凡例 ========== */
.joran-date-legend {
  display: flex;
  gap: 12px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}
.joran-date-legend-item {
  font-size: 12px;
  padding: 1px 8px;
  border-radius: 4px;
  font-weight: 600;
}
.joran-date-legend-sat {
  color: #2563eb;
  background: #eff6ff;
}
.joran-date-legend-sun {
  color: #dc2626;
  background: #fef2f2;
}
.joran-date-legend-best {
  color: #166534;
  background: #dcfce7;
}

/* ========== 土日祝の色分け ========== */
.joran-row-date-saturday td.joran-td-date {
  color: #2563eb;
  background: #eff6ff;
}
.joran-row-date-sunday td.joran-td-date,
.joran-row-date-holiday td.joran-td-date {
  color: #dc2626;
  background: #fef2f2;
}
/* 土日祝の行全体背景は廃止（日程セルの文字色のみで区別。行背景が重なりすぎるため） */

/* ========== 名前下の職業バッジ ========== */
.joran-name-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.joran-name {
  font-weight: 600;
}
.joran-role-tag {
  font-size: 10px;
  font-weight: 500;
  background: #f3f4f6;
  color: #4b5563;
  border: 1px solid #e5e7eb;
  border-radius: 999px;
  padding: 1px 8px;
  white-space: nowrap;
}

/* 表内の複数特化はセル幅を変えず、ラベル内で折り返す。 */
.joran-grid .joran-name-wrap {
  min-width: 0;
  max-width: 100%;
}
.joran-grid .joran-role-tag {
  box-sizing: border-box;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
}

/* ========== 登録職業 集計チップ ========== */
.joran-roles-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.joran-role-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  background: var(--joran-green-light);
  border: 1px solid var(--joran-green);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  color: var(--joran-green-hover);
}
.joran-role-chip-count {
  font-weight: 700;
}
.joran-role-chip.joran-role-chip-unset {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #6b7280;
}

/* ロール分布のロール別カラー */
.joran-role-chip.joran-role-chip-tank    { background: #dbeafe; border-color: #2563eb; color: #1e3a8a; }
.joran-role-chip.joran-role-chip-heal    { background: #dcfce7; border-color: #16a34a; color: #14532d; }
.joran-role-chip.joran-role-chip-phys    { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }
.joran-role-chip.joran-role-chip-magic   { background: #ede9fe; border-color: #7c3aed; color: #4c1d95; }
.joran-role-chip.joran-role-chip-support { background: #fef3c7; border-color: #d97706; color: #78350f; }

/* 職業×N＋特化内訳の2段表示 */
.joran-role-chip-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 4px 6px;
  background: #fafaf9;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  min-width: 88px;
  flex: 1 1 88px;
}
@media (max-width: 640px) {
  .joran-role-chip-group {
    min-width: 80px;
    flex: 1 1 auto;
  }
}
.joran-role-chip-group .joran-role-chip {
  align-self: flex-start;
}
.joran-role-chip-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.joran-spec-tag {
  display: inline-block;
  font-size: 11px;
  color: #4b5563;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}
.joran-roledist-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.joran-roledist-group { background: #fff; }

.joran-roledist-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid;
}
.joran-roledist-tag.joran-role-chip-tank    { background: #dbeafe; border-color: #2563eb; color: #1e3a8a; }
.joran-roledist-tag.joran-role-chip-heal    { background: #dcfce7; border-color: #16a34a; color: #14532d; }
.joran-roledist-tag.joran-role-chip-phys    { background: #fee2e2; border-color: #dc2626; color: #7f1d1d; }
.joran-roledist-tag.joran-role-chip-magic   { background: #ede9fe; border-color: #7c3aed; color: #4c1d95; }
.joran-roledist-tag.joran-role-chip-support { background: #fef3c7; border-color: #d97706; color: #78350f; }
.joran-roledist-tag-name { font-weight: 600; }
.joran-roledist-tag-count { font-weight: 700; }

.joran-comp-icon {
  font-weight: 700;
  font-size: 14px;
  width: 14px;
}
.joran-comp-ok .joran-comp-icon { color: #16a34a; }
.joran-comp-ng .joran-comp-icon { color: #d97706; }
.joran-comp-name { font-weight: 600; color: var(--joran-text); }

/* ========== 上覧開催期間バナー ========== */
.joran-schedule-banner {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border: 1px solid #6ee7b7;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.joran-schedule-banner-label {
  font-size: 12px;
  font-weight: 600;
  color: #047857;
  letter-spacing: .05em;
}
.joran-schedule-banner-period {
  font-size: 20px;
  font-weight: 700;
  color: #064e3b;
  line-height: 1.3;
}
.joran-schedule-banner-name {
  font-size: 13px;
  color: #065f46;
}
@media (max-width: 640px) {
  .joran-schedule-banner-period { font-size: 17px; }
}

/* ========== 今後の開催予定（先3回分） ========== */
.joran-schedule-upcoming {
  background: var(--joran-card-bg, #fff);
  border: 1px solid var(--joran-border, #e5e7eb);
  padding: 14px 20px;
  margin-top: -6px;
}
.joran-schedule-upcoming-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--joran-text-muted, #6b7280);
  letter-spacing: .03em;
  margin-bottom: 8px;
}
.joran-schedule-upcoming-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.joran-schedule-upcoming-item {
  font-size: 13px;
  color: var(--joran-text, #1f2937);
}
.joran-schedule-upcoming-item-skip {
  color: #b45309;
}

/* ========== 詳細画面 上部 sticky CTA ========== */
.joran-top-cta-sticky {
  position: sticky;
  top: 8px;
  z-index: 20;
  display: flex;
  justify-content: center;
  margin: 0 0 12px;
  pointer-events: none; /* 子ボタン以外のクリックは透過 */
}
.joran-top-cta-sticky .joran-cta-compact {
  pointer-events: auto;
  width: min(100%, 420px);
}
.joran-cta-compact {
  width: auto;
  height: auto;
  padding: 12px 28px;
  border-radius: 999px;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(21,128,61,.25);
}
@media (max-width: 640px) {
  .joran-cta-compact { width: min(100%, 420px); height: auto; font-size: 15px; padding: 10px 22px; }
}

/* ========== フェーズ2-1: TOP3 ロール充足バー ========== */
/* ========== フェーズ2-2: ロール分布プログレスバー ========== */
/* 既存の flex-wrap: wrap を縦積みに上書き */
#d-roledist-wrap.joran-roledist-wrap {
  flex-direction: column;
  gap: 0;
}
.joran-roledist-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
}
.joran-roledist-bar-label {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 120px;
  width: auto;
  flex-shrink: 0;
}
.joran-roledist-role-name {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.joran-roledist-bar-wrap {
  flex: 1;
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  overflow: hidden;
}
.joran-roledist-bar {
  height: 100%;
  background: #22c55e;
  border-radius: 4px;
  transition: width .3s;
}
.joran-roledist-bar-count {
  font-size: 12px;
  color: #64748b;
  white-space: nowrap;
  min-width: 40px;
  text-align: right;
}
.joran-roledist-unclassified {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 6px;
}
.joran-roledist-names {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 0 8px 0;
}
.joran-roledist-name-tag {
  font-size: 11px;
  color: #374151;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ========== フェーズ2-3: 日付クリックポップアップ ========== */
.joran-td-date-click {
  cursor: pointer;
  transition: background .15s;
}
.joran-td-date-click:hover {
  opacity: .85;
}
/* ========== イベント作成完了 URLコピーモーダル ========== */
.joran-url-modal-inner { max-width: 480px; }
.joran-url-modal-title {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 10px;
}
.joran-url-modal-desc {
  font-size: 13px;
  color: #475569;
  margin: 0 0 16px;
  line-height: 1.6;
}
.joran-url-modal-url-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}
.joran-url-modal-passphrase-note {
  font-size: 12px;
  color: #92400e;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 8px 10px;
  margin: -4px 0 12px;
  line-height: 1.6;
}
.joran-url-modal-url {
  flex: 1;
  font-size: 12px;
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f8fafc;
  color: #334155;
  min-width: 0;
}
.joran-url-modal-go {
  width: 100%;
  margin-top: 4px;
}

/* ========== ポップアップ共通 ========== */
.joran-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.joran-popup-overlay.joran-hidden {
  display: none;
}
.joran-popup-inner {
  background: #fff;
  border-radius: 12px;
  padding: 20px 20px 24px;
  max-width: 420px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 8px 32px rgba(0, 0, 0, .2);
}
.joran-popup-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  color: #64748b;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
}
.joran-popup-close:hover { color: #1e293b; }
.joran-popup-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 14px;
  padding-right: 28px;
}
.joran-popup-group {
  margin-bottom: 12px;
}
.joran-popup-ans-label {
  display: inline-block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.joran-popup-ans-label.joran-ans-o { color: #16a34a; }
.joran-popup-ans-label.joran-ans-d { color: #ca8a04; }
.joran-popup-ans-label.joran-ans-x { color: #dc2626; }
.joran-popup-ans-label.joran-popup-none { color: #94a3b8; }
.joran-popup-names {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.joran-popup-name-tag {
  display: flex;
  align-items: center;
  gap: 3px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 3px 8px;
}
.joran-popup-name {
  font-size: 13px;
  font-weight: 600;
  color: #1e293b;
}
.joran-popup-role {
  font-size: 11px;
  color: #64748b;
}

/* ========== フェーズ2-5: スマホ縦長カード表示 ========== */
.joran-date-cards {
  display: none;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
}
.joran-date-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 12px 14px;
}
/* カードヘッダー: 日付ラベル + ○△× カウントバッジ横並び */
.joran-date-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f1f5f9;
}
.joran-date-card-label {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  cursor: pointer;
}
.joran-date-card-label:hover { text-decoration: underline; }
.joran-date-card-counts {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.joran-date-card-badge {
  font-size: 13px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
}
.joran-date-card-badge.joran-ans-o { background: #dcfce7; color: #166534; }
.joran-date-card-badge.joran-ans-d { background: #fef9c3; color: #854d0e; }
.joran-date-card-badge.joran-ans-x { background: #fee2e2; color: #991b1b; }
/* 参加者行 */
.joran-date-card-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 13px;
}
.joran-date-card-ans {
  font-weight: 700;
  min-width: 20px;
}
.joran-date-card-ans.joran-ans-o { color: #16a34a; }
.joran-date-card-ans.joran-ans-d { color: #ca8a04; }
.joran-date-card-ans.joran-ans-x { color: #dc2626; }
.joran-date-card-names {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}
.joran-date-card-name {
  background: #f0fdf4;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 12px;
  color: #166534;
}
.joran-date-card-name.joran-ans-d { background: #fffbeb; color: #92400e; }
.joran-date-card-name.joran-ans-x { background: #fef2f2; color: #991b1b; }

@media (max-width: 640px) {
  /* 入力パネルの内側だけが縮み、ページ全体の幅を押し広げない。 */
  #detail-view,
  .joran-myinput-panel,
  .joran-myinput-panel > *,
  .joran-mobile-pickers-wrap,
  .joran-mobile-pickers,
  .joran-response-comment-card {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* 参加者列を横一列で比較できる表をスマホでも主表示にする。 */
  .joran-grid-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
  }
  .joran-grid-wrap > table {
    display: table;
    width: max-content;
    min-width: 680px;
    table-layout: fixed;
  }
  /* 横スクロール中も候補日列を画面左端に残す。 */
  .joran-grid .joran-th-date,
  .joran-grid .joran-td-date {
    position: sticky;
    left: 0;
    z-index: 3;
  }
  .joran-grid thead .joran-th-date {
    z-index: 4;
  }
  .joran-grid .joran-th-date,
  .joran-grid .joran-td-date {
    width: 96px;
    min-width: 96px;
    max-width: 96px;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
    padding-left: 6px;
    padding-right: 6px;
  }
  .joran-grid .joran-th-name {
    width: 68px;
    min-width: 68px;
    max-width: 68px;
    padding: 6px 4px;
  }
  .joran-grid .joran-td-ans {
    width: 48px;
    min-width: 48px;
    padding: 6px 4px;
  }
  .joran-grid .joran-th-count,
  .joran-grid .joran-td-count {
    width: 36px;
    min-width: 36px;
    padding: 6px 4px;
  }
  .joran-grid .joran-name-wrap {
    max-width: 60px;
  }
  .joran-grid .joran-role-tag {
    display: none;
  }
  .joran-grid .joran-td-date {
    box-shadow: 2px 0 0 rgba(148, 163, 184, .45);
  }
  .joran-grid-view-controls {
    width: 100%;
    justify-content: space-between;
    margin-left: 0;
  }
  .joran-grid--participant .joran-th-participant {
    width: 88px;
    min-width: 88px;
    max-width: 88px;
    padding: 6px 4px;
  }
  .joran-grid--participant .joran-th-grid-date,
  .joran-grid--participant .joran-td-ans {
    width: 76px;
    min-width: 76px;
    max-width: 76px;
    padding: 6px 4px;
  }
  .joran-grid--participant .joran-th-comment,
  .joran-grid--participant .joran-td-comment {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
  }
  .joran-grid--participant .joran-grid-date-counts {
    font-size: 9px;
    letter-spacing: -0.03em;
  }
  .joran-grid--participant .joran-name-wrap {
    max-width: 80px;
  }

  /* 名前折り返し時の左空白を解消: flex列→インライン流し込みに切り替え */
  .joran-date-card-row {
    display: block;
  }
  .joran-date-card-ans {
    min-width: unset;
    margin-right: 3px;
  }
  .joran-date-card-names {
    display: inline;
  }
  .joran-date-card-name {
    display: inline-block;
    margin: 1px 2px;
  }
}

/* ========== フェーズ3-1: インライン候補日追加 ========== */
.joran-td-inline-add {
  padding: 8px 6px;
  background: #f8fafc;
}
.joran-inline-add-input {
  width: calc(100% - 90px);
  min-width: 140px;
  height: 36px;
  font-size: 13px;
  padding: 4px 8px;
  display: inline-block;
  vertical-align: middle;
  margin-right: 6px;
}
.joran-inline-add-btn {
  height: 36px;
  font-size: 13px;
  padding: 0 14px;
  vertical-align: middle;
  white-space: nowrap;
}

/* ========== フェーズ3-2: 開催日確定バナー（コンパクト1行帯） ========== */
.joran-decided-banner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px 10px;
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-left: 4px solid var(--joran-green);
  border-radius: 6px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-size: 13px;
}
.joran-decided-label {
  font-weight: 700;
  color: var(--joran-green);
  white-space: nowrap;
}
.joran-decided-date {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--joran-text);
  min-width: 0;
}
.joran-decided-actions {
  display: flex;
  gap: 6px;
}
.joran-decided-actions .joran-btn {
  font-size: 12px;
  padding: 4px 10px;
  background: #fff;
  color: var(--joran-green);
  border-color: var(--joran-green);
}
.joran-decided-actions .joran-btn:hover {
  background: #f0fdf4;
}

/* TOP5テーブル内の確定ボタン */
.joran-btn-decide {
  display: inline-block;
  width: auto;
  margin-top: 3px;
  font-size: 10px;
  padding: 2px 6px;
  white-space: nowrap;
}
.joran-btn-decide--on {
  color: var(--joran-green);
  border-color: var(--joran-green);
}


/* ============================================================
 * フェーズ4: 「あなた」入力パネル
 * ============================================================ */
/* 回答済みの方パネル */
.joran-respondents-panel {
  border: 1px solid #e5e7eb;
  background: #ffffff;
  margin-bottom: 16px;
}
.joran-respondent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.joran-section-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7em;
  height: 1.7em;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--joran-green-light);
  color: var(--joran-green-hover);
  font-size: 11px;
  line-height: 1;
}
.joran-respondent-btn {
  padding: 8px 14px;
  border: 1px solid #d1d5db;
  border-radius: 999px;
  background: #f9fafb;
  font-size: 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.joran-respondent-btn:hover {
  background: #e0f2fe;
  border-color: #3b82f6;
}
.joran-respondent-btn--mine {
  background: #fef3c7;
  border-color: #f59e0b;
  font-weight: 700;
}
.joran-respondent-btn--active {
  background: #dbeafe;
  border-color: #3b82f6;
  font-weight: 700;
  box-shadow: 0 0 0 2px #bfdbfe;
}
.joran-respondent-btn--mine::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: .25em;
  background-color: #f59e0b;
  -webkit-mask: var(--horo-icon-check) center / contain no-repeat;
  mask: var(--horo-icon-check) center / contain no-repeat;
}
.joran-new-response-btn {
  margin-top: 12px;
}
.joran-new-response-status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: 0 0 12px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #ecfdf5;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
}
.joran-selected-response-heading {
  flex-wrap: wrap;
}
.joran-selected-response-heading .joran-btn {
  margin-left: auto;
}
.joran-response-comment-card {
  margin: 12px 0 0;
  padding: 12px;
  box-shadow: none;
}
.joran-closed-message {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fef2f2;
  color: #991b1b;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.5;
}
.joran-tokuka-help {
  margin: 0 0 6px;
}
.joran-respondent-btn:disabled {
  cursor: default;
  opacity: .7;
}
.joran-respondent-btn:disabled:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}

/* 日程編集パネルの折り畳み */
.joran-mobile-pickers-wrap {
  margin-top: 12px;
}
.joran-mobile-pickers-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  background: #ecfdf5;
  border: 1.5px solid #6ee7b7;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  list-style: none;
  user-select: none;
}
.joran-mobile-pickers-summary::-webkit-details-marker { display: none; }
.joran-mobile-pickers-summary::marker { content: ""; }
.joran-mobile-pickers-title { flex-shrink: 0; }
.joran-mobile-pickers-summary-text {
  flex: 1;
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
  text-align: right;
}
.joran-mobile-pickers-toggle {
  transition: transform .2s;
  font-size: 14px;
  color: #059669;
  font-weight: 700;
}
details[open] .joran-mobile-pickers-toggle { transform: rotate(180deg); }
.joran-mobile-pickers-wrap > #d-mobile-date-pickers {
  margin-top: 8px;
}

/* 登録済みバナー */
.joran-registered-banner {
  display: block;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  color: #166534;
  font-size: 13px;
  padding: 10px 14px;
  margin-bottom: 12px;
}
.joran-registered-message {
  margin: 0;
  font-weight: 700;
}
.joran-registered-summary {
  margin: 4px 0 0;
  color: #166534;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.joran-response-edit-link {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #bbf7d0;
}
.joran-response-edit-link-heading {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}
.joran-response-edit-link-note {
  margin: 4px 0 8px;
  color: #166534;
  font-size: 12px;
  line-height: 1.55;
}
.joran-response-edit-link-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.joran-response-edit-link-row .joran-input {
  flex: 1;
  min-width: 0;
  background: #fff;
  color: #14532d;
  font-size: 12px;
}
.joran-response-edit-link-row .joran-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .joran-response-edit-link-row {
    align-items: stretch;
    flex-direction: column;
  }
  .joran-response-edit-link-row .joran-btn {
    width: 100%;
  }
}

.joran-selected-response {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
}
.joran-selected-response-heading {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
}
.joran-selected-response-heading strong {
  font-size: 15px;
  overflow-wrap: anywhere;
}
.joran-selected-response .joran-help {
  margin: 4px 0 0;
  color: #1e40af;
}

/* 更新前の回答履歴 */
.joran-response-history {
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
}
.joran-response-history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.joran-response-history-title {
  margin: 0;
  color: var(--joran-text);
  font-size: 14px;
  font-weight: 700;
}
.joran-response-history-note {
  margin-bottom: 8px;
}
.joran-response-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.joran-response-history-item {
  overflow: hidden;
  border: 1px solid var(--joran-border);
  border-radius: 7px;
  background: #fff;
}
.joran-response-history-item > summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  box-sizing: border-box;
  padding: 8px 10px;
  cursor: pointer;
  list-style: none;
}
.joran-response-history-item > summary::-webkit-details-marker { display: none; }
.joran-response-history-item > summary::marker { content: ""; }
.joran-response-history-item > summary::after {
  content: '';
  width: 7px;
  height: 7px;
  flex-shrink: 0;
  color: var(--joran-text-sub);
  border-right: 2px solid var(--joran-text-sub);
  border-bottom: 2px solid var(--joran-text-sub);
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s ease;
}
.joran-response-history-item[open] > summary::after { transform: translateY(2px) rotate(-135deg); }
.joran-response-history-summary-main {
  min-width: 0;
  flex: 1;
  color: var(--joran-text);
  font-size: 13px;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.joran-response-history-summary-time {
  flex-shrink: 0;
  color: var(--joran-text-muted);
  font-size: 11px;
  white-space: nowrap;
}
.joran-response-history-body {
  padding: 10px;
  border-top: 1px solid var(--joran-border);
}
.joran-response-history-time,
.joran-response-history-meta {
  margin-bottom: 6px;
}
.joran-response-history-meta {
  color: var(--joran-text-sub);
  font-size: 12px;
  overflow-wrap: anywhere;
}
.joran-response-history-answer-label {
  margin: 8px 0 4px;
  color: var(--joran-text);
  font-size: 12px;
  font-weight: 700;
}
.joran-response-history-answer-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 6px;
  align-items: start;
  margin: 4px 0;
  font-size: 12px;
  line-height: 1.5;
}
.joran-response-history-answer-badge {
  text-align: center;
  font-weight: 700;
}
.joran-history-answer-o { color: #15803d; }
.joran-history-answer-d { color: #a16207; }
.joran-history-answer-x { color: #b91c1c; }
.joran-response-history-answer-list {
  overflow-wrap: anywhere;
}
.joran-response-history-unanswered,
.joran-response-history-comment {
  margin: 6px 0 0;
  color: var(--joran-text-sub);
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
.joran-response-history-restore {
  width: 100%;
  margin-top: 10px;
}
.joran-response-history-draft {
  margin: 8px 0 0;
  padding: 8px 10px;
  border-left: 3px solid #ca8a04;
  background: #fffbeb;
  color: #92400e;
  line-height: 1.5;
}

/* モバイル専用 CTA（デスクトップでは非表示） */
.joran-mobile-cta {
  display: none;
}
@media (max-width: 640px) {
  .joran-mobile-cta {
    display: flex;
    justify-content: center;
    margin-top: 12px;
  }
}

.joran-myinput-panel {
  border: 2px solid #16a34a;
  background: linear-gradient(180deg, #f0fdf4 0%, #ffffff 60%);
  scroll-margin-top: 72px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
}
.joran-myinput-panel.joran-disabled {
  opacity: 1;
  pointer-events: none;
}
.joran-myinput-panel.joran-disabled > *:not(#d-closed-message) {
  opacity: .5;
}
.joran-myinput-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
@media (min-width: 720px) {
  .joran-myinput-grid {
    grid-template-columns: minmax(180px, 1fr) 2fr 2fr;
  }
}
.joran-myinput-panel .joran-bulk-actions {
  display: block;
  margin: 12px 0 8px;
  padding: 8px 10px;
  background: #f9fafb;
  border-radius: 8px;
}
.joran-bulk-label {
  font-size: 13px;
  color: #475569;
  font-weight: 600;
}

.joran-bulk-toolbar-head,
.joran-bulk-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.joran-bulk-toolbar-head {
  gap: 8px;
}
.joran-bulk-help,
.joran-bulk-scope-summary {
  color: var(--joran-text-sub);
  font-size: 12px;
  line-height: 1.45;
}
.joran-bulk-help { flex: 1; }
.joran-bulk-control-label {
  flex: 0 0 3.5em;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}
.joran-bulk-time-select {
  width: auto;
  min-width: 112px;
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 13px;
}
.joran-bulk-range-separator {
  color: var(--joran-text-sub);
  font-weight: 700;
}
.joran-bulk-buttons { gap: 6px; }
.joran-bulk-buttons .joran-btn-sm {
  min-width: 86px;
}
.joran-bulk-scope-summary {
  margin: 0;
  font-variant-numeric: tabular-nums;
}
.joran-bulk-scope-summary--empty { color: #b91c1c; }

/* 一括の対象カテゴリ（全部/平日/土日祝）セグメントトグル */
.joran-bulk-category-group {
  display: inline-flex;
  border: 1px solid var(--joran-border-strong);
  border-radius: 999px;
  overflow: hidden;
  margin-right: 4px;
}
.joran-bulk-category-btn {
  border: none;
  background: #fff;
  color: #475569;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.joran-bulk-category-btn + .joran-bulk-category-btn {
  border-left: 1px solid var(--joran-border-strong);
}
.joran-bulk-category-btn--active {
  background: var(--joran-green);
  color: #fff;
}
.joran-myinput-panel .joran-form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.joran-btn-register {
  font-size: 16px;
  padding: 10px 28px;
  font-weight: 700;
  min-width: 160px;
}
.joran-help-muted {
  color: #94a3b8;
  font-size: 12px;
  margin: 4px 0 0;
}
.joran-cta-subtle {
  background: transparent;
  color: #475569;
  border: 1px dashed #cbd5e1;
  font-size: 13px;
  padding: 8px 14px;
}
.joran-cta-subtle:hover {
  background: #f1f5f9;
  color: #1e293b;
}

/* ========== 短縮URL セクション ========== */
.joran-share-short-input {
  font-size: 15px;
  font-weight: 700;
  color: #15803d;
  letter-spacing: 0.05em;
}
.joran-share-full-box {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--joran-border);
}

/* スマホ表示の最適化 */
@media (max-width: 640px) {
  .joran-share-short-input {
    font-size: 12px;
    letter-spacing: 0;
  }
}
@media (max-width: 479px) {
  .joran-myinput-panel .joran-bulk-actions {
    gap: 6px;
  }
  .joran-bulk-toolbar-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }
  .joran-bulk-row.joran-bulk-time-row {
    display: grid;
    grid-template-columns: 3.5em minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: center;
  }
  .joran-bulk-time-select {
    min-width: 0;
    width: 100%;
  }
  .joran-myinput-panel .joran-bulk-buttons .joran-btn-sm {
    flex: 1;
    min-width: 0;
    padding: 8px 4px;
    font-size: 12px;
  }
  .joran-bulk-label {
    width: 100%;
    margin-bottom: 4px;
  }
  .joran-myinput-panel .joran-bulk-category-group {
    flex: 1 1 100%;
    width: 100%;
    margin-right: 0;
  }
  .joran-myinput-panel .joran-bulk-category-btn {
    flex: 1;
    min-width: 0;
  }
  .joran-btn-register {
    width: 100%;
    min-width: 0;
  }
}

/* ============================================================
 * 日程編集: 日付ごと ○△× ピッカー
 * PCでは日付グループを複数列、スマホでは縦並びで表示する。
 * ============================================================ */

.joran-mobile-pickers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 4px;
}

@media (min-width: 641px) {
  .joran-mobile-pickers {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    align-items: start;
    gap: 10px;
  }
  .joran-mobile-pickers-hint {
    display: block;
    margin: 8px 2px 0;
  }
}

@media (max-width: 640px) {
  /* PC/タブレット向け「下のグリッドの『あなた』列をタップ…」ヒントは隠す */
  .joran-grid-hint-pc { display: none; }

  /* 日程行表示の「あなた」列は入力パネルと重複するため隠す。参加者行表示では行を残す。 */
  .joran-grid:not(.joran-grid--participant) .joran-col-you,
  .joran-grid:not(.joran-grid--participant) .joran-col-you-td {
    display: none !important;
  }
}

.joran-mobile-pickers-heading {
  font-size: 13px;
  font-weight: 700;
  color: var(--joran-green-hover);
  padding: 6px 2px 4px;
  letter-spacing: 0.02em;
}

/* 日単位一括の説明 */
.joran-mobile-pickers-hint { display: block; }
@media (max-width: 640px) {
  .joran-mobile-pickers-hint {
    display: block;
    margin: 8px 2px 0;
  }
}

/* ---------- 日付グループ ---------- */
/* 候補日を日付ごとに束ね、ヘッダーで「その日をまとめて設定」できるようにする。
   60件超の候補をフラットに並べると回答者が全件タップする羽目になるための構造。 */
.joran-mobile-daygroup {
  border: 1px solid var(--joran-border);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}

.joran-mobile-daygroup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 10px;
  background: var(--joran-green-light);
  border-bottom: 1px solid var(--joran-border);
  list-style: none;
  cursor: pointer;
}
.joran-mobile-daygroup-head::-webkit-details-marker { display: none; }
.joran-mobile-daygroup-head::after {
  content: '';
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-left: 2px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .15s ease;
}
.joran-mobile-daygroup[open] > .joran-mobile-daygroup-head::after {
  transform: translateY(2px) rotate(-135deg);
}

.joran-mobile-daygroup-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.joran-mobile-daygroup-date {
  font-size: 14px;
  font-weight: 700;
  color: var(--joran-text);
  line-height: 1.2;
}

.joran-mobile-daygroup-summary {
  font-size: 11px;
  font-weight: 600;
  color: var(--joran-text-sub);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.joran-mobile-daygroup-summary--done { color: var(--joran-green-hover); }

.joran-mobile-daygroup-bulk {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.joran-mobile-daybulk-btn {
  /* スロット側の ○△× と同じ 40px。ヘッダーだけ小さいと押し分けにくい */
  min-height: 40px;
  width: 40px;
  padding: 0;
  border: 1.5px solid var(--joran-border-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, transform .05s;
}
.joran-mobile-daybulk-btn:active { transform: scale(.96); }
.joran-mobile-daybulk-btn.joran-pick-o { color: #15803d; }
.joran-mobile-daybulk-btn.joran-pick-d { color: #ca8a04; }
.joran-mobile-daybulk-btn.joran-pick-x { color: #b91c1c; }
.joran-mobile-daybulk-btn.selected.joran-pick-o {
  background: #dcfce7;
  border-color: #15803d;
  box-shadow: inset 0 0 0 1px #15803d;
}
.joran-mobile-daybulk-btn.selected.joran-pick-d {
  background: #fef3c7;
  border-color: #ca8a04;
  box-shadow: inset 0 0 0 1px #ca8a04;
}
.joran-mobile-daybulk-btn.selected.joran-pick-x {
  background: #fee2e2;
  border-color: #b91c1c;
  box-shadow: inset 0 0 0 1px #b91c1c;
}

/* 土日祝はヘッダーの色で区別する（各スロットを塗るとうるさくなるため） */
.joran-mobile-day-saturday .joran-mobile-daygroup-head {
  background: #eff6ff;
  border-bottom-color: #bfdbfe;
}
.joran-mobile-day-saturday .joran-mobile-daygroup-date { color: #2563eb; }
.joran-mobile-day-sunday .joran-mobile-daygroup-head,
.joran-mobile-day-holiday .joran-mobile-daygroup-head {
  background: #fef2f2;
  border-bottom-color: #fecaca;
}
.joran-mobile-day-sunday .joran-mobile-daygroup-date,
.joran-mobile-day-holiday .joran-mobile-daygroup-date { color: #dc2626; }

.joran-mobile-daygroup-slots {
  display: flex;
  flex-direction: column;
}

.joran-mobile-pick-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: #fff;
  border-top: 1px solid var(--joran-border);
}
.joran-mobile-daygroup-slots > .joran-mobile-pick-card:first-child { border-top: none; }

/* 回答済みのスロットは背景を落として、未回答が視覚的に浮くようにする */
.joran-mobile-pick-card--answered { background: #fafafa; }

.joran-mobile-pick-label {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--joran-text);
  line-height: 1.3;
}

.joran-mobile-pick-row {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.joran-mobile-pick-btn {
  min-height: 40px;
  width: 40px;
  padding: 0;
  border: 1.5px solid var(--joran-border-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, transform .05s;
}
.joran-mobile-pick-btn:active { transform: scale(.96); }

.joran-mobile-pick-btn.joran-pick-o { color: #15803d; }
.joran-mobile-pick-btn.joran-pick-d { color: #ca8a04; }
.joran-mobile-pick-btn.joran-pick-x { color: #b91c1c; }
.joran-mobile-pick-btn.selected.joran-pick-o {
  background: #dcfce7;
  border-color: #15803d;
  box-shadow: inset 0 0 0 1px #15803d;
}
.joran-mobile-pick-btn.selected.joran-pick-d {
  background: #fef3c7;
  border-color: #ca8a04;
  box-shadow: inset 0 0 0 1px #ca8a04;
}
.joran-mobile-pick-btn.selected.joran-pick-x {
  background: #fee2e2;
  border-color: #b91c1c;
  box-shadow: inset 0 0 0 1px #b91c1c;
}

/* ============================================================
 * スマホ専用: 入力パネル内の登録CTA（詳細画面）
 * ============================================================ */
@media (max-width: 640px) {
  /* 登録ボタンは入力パネル内に配置し、画面下部への固定で入力欄を隠さない */
  #d-register-wrap.joran-cta-wrap {
    position: static;
    margin: 12px 0 24px;
    padding: 0;
    background: transparent;
    border-top: 0;
    box-shadow: none;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
  }
  #d-register-wrap .joran-btn-register {
    flex: 1;
    width: 100%;
    min-width: 0;
    height: 48px;
    font-size: 16px;
  }
  #d-register-wrap .joran-autosave-indicator {
    margin: 0;
  }
  #detail-view { padding-bottom: 0; }
}

/* ============================================================
 * スマホ専用: 作成画面のCTA + テキストエリア縮小
 * ============================================================ */
@media (max-width: 640px) {
  /* テキストエリア「候補日（1行に1つ）」をスマホでは縮小 */
  #f-dates {
    min-height: 80px;
    max-height: 200px;
  }

  /* 件数バッジを目立たせる（自動生成された件数の確認） */
  #f-dates-count {
    display: inline-block;
    background: var(--joran-green-light);
    color: var(--joran-green-hover);
    font-weight: 700;
    font-size: 14px;
    padding: 2px 10px;
    border-radius: 999px;
    margin-right: 4px;
  }

  /* 「候補日を生成」ボタンをフルワイド化（再生成ボタンとして扱う） */
  #btn-generate {
    width: 100%;
    height: 44px;
    font-size: 14px;
  }

  /* 「イベントを作成」ボタンは入力欄を隠さない通常のCTAにする */
  #create-view > .joran-cta-wrap {
    position: static;
    margin: 12px 0 24px;
    padding: 0;
    background: transparent;
    border-top: 0;
    box-shadow: none;
  }
  #btn-create.joran-cta {
    width: 100%;
    height: 52px;
    border-radius: 12px;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(21,128,61,.2);
  }
  #create-view { padding-bottom: 0; }
}

/* 作成画面の固定CTAがフッターを隠さないよう、セクション外にも余白を確保 */
@media (max-width: 640px) {
  #create-view:not(.joran-hidden) ~ #page-footer {
    margin-bottom: 0;
  }
}

/* ============================================================
 * 詳細画面のモバイル最適化（並び順 + 折り畳み）
 * ============================================================ */

/* details ベースの折り畳みカード共通スタイル */
.joran-mobile-collapsible {
  /* details 既定の overflow:hidden を回避 */
  overflow: visible;
}
.joran-section-collapsible {
  /* 主要セクションも標準の details として開閉できるようにする */
  overflow: visible;
}
.joran-mobile-summary {
  list-style: none;
  cursor: pointer;
  outline: none;
  position: relative;
  padding-right: 28px;
}
.joran-section-collapsible > .joran-mobile-summary .joran-section-title {
  margin-bottom: 0;
}
.joran-mobile-summary::-webkit-details-marker { display: none; }
.joran-mobile-summary::marker { display: none; }
.joran-mobile-summary::after {
  content: '';
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid #64748b;
  border-bottom: 2px solid #64748b;
  transform: translateY(-75%) rotate(45deg);
  transition: transform .2s ease;
}
.joran-mobile-collapsible[open] > .joran-mobile-summary::after {
  transform: translateY(-25%) rotate(-135deg);
}
.joran-section-collapsible[open] > .joran-mobile-summary::after {
  transform: translateY(-25%) rotate(-135deg);
}

/* 日程候補グリッドの「タイトル + アクション」横並び */
.joran-grid-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

@media (max-width: 640px) {
  /* 詳細画面のセクションを並び順制御するため flex 化 */
  #detail-view {
    display: flex;
    flex-direction: column;
  }

  /* 並び順: イベント情報 → 回答 → みんなの予定 → おすすめ → 補足 → URL */
  #joran-schedule-banner-detail   { order: 1; }
  .joran-detail-header            { order: 2; }
  #d-decided-banner               { order: 3; }
  #d-top-cta-wrap                 { order: 4; }
  #d-owner-panel                  { order: 5; }
  #d-reauth-section               { order: 6; }
  #d-myinput-panel                { order: 7; }
  #d-stats-container              { order: 8; }
  #d-respondents-panel            { order: 9; }
  #d-comments-section             { order: 10; }
  #d-supplementary-stats          { order: 11; }
  #d-share-section                { order: 12; }
  .joran-help-btn-wrap            { order: 13; }

  /* 折り畳みカード: スマホでもクリック可能（矢印は共通スタイルで対応済み） */

  /* カード余白を詰めて縦圧縮 */
  .joran-card {
    padding: 14px 12px;
    margin-bottom: 10px;
  }

  /* 集計コンテナの並び順 */
  #d-top3-section    { order: unset; }
  #d-roles-section   { order: unset; }
  #d-roledist-section{ order: unset; }
  #d-grid-section    { order: unset; }

  /* あなたの出欠パネル：フィールド間マージンをgapに一本化して高さを削減 */
  .joran-myinput-grid .joran-field { margin-bottom: 0; }
  .joran-myinput-grid { gap: 8px; margin-bottom: 8px; }
  .joran-myinput-panel .joran-section-title { margin-bottom: 6px; }
  .joran-myinput-panel .joran-bulk-actions { margin: 4px 0 2px; padding: 6px 8px; }
}

/* ========== 集計タブ（スマホ） ========== */

.joran-stats-container {
  display: contents; /* PCでは透過コンテナ */
}

.joran-stats-panel {
  /* PC では通常のカードと同じ */
}

@media (max-width: 640px) {
  /* 透過表示のままだと flex 親からカードへ幅が伝わらない端末があるため、
     スマホでは集計エリア自体を全幅ブロックとして扱う。 */
  .joran-stats-container {
    display: block;
    width: 100%;
  }

  .joran-stats-panel {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    border-radius: var(--joran-radius);
    margin-bottom: 10px;
    border-top: 1px solid var(--joran-border);
  }

  .joran-stats-panel > summary { display: block; }
}

.joran-supplementary-stats {
  padding: 14px 12px;
}
.joran-supplementary-stats > .joran-mobile-summary .joran-section-title {
  margin-bottom: 12px;
}
.joran-supplementary-stats > .joran-stats-panel {
  margin-bottom: 10px;
  box-shadow: none;
}
.joran-supplementary-stats > .joran-stats-panel:last-child {
  margin-bottom: 0;
}

/* ========== TOP5 テーブル ========== */

.joran-top5-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}

.joran-top5-table thead th {
  padding: 6px 8px;
  text-align: left;
  font-weight: 700;
  font-size: 11px;
  color: var(--joran-text-muted);
  border-bottom: 2px solid var(--joran-border);
  white-space: nowrap;
}

.joran-top5-table tbody tr {
  border-bottom: 1px solid var(--joran-border);
  transition: background .12s;
  cursor: pointer;
}

.joran-top5-table tbody tr:last-child { border-bottom: none; }

/* 確定日行の強調表示 */
.joran-top5-table tbody tr.joran-top5-row-decided {
  background: #ecfdf5;
  box-shadow: inset 3px 0 0 var(--joran-green);
}
.joran-top5-table tbody tr.joran-top5-row-decided:hover {
  background: #d1fae5;
}
.joran-top5-decided-badge {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #fff;
  background: var(--joran-green);
  border-radius: 4px;
  vertical-align: middle;
  white-space: nowrap;
}
@media (max-width: 640px) {
  .joran-top5-decided-badge {
    font-size: 9px;
    padding: 1px 4px;
    margin-right: 3px;
    margin-bottom: 2px;
  }
}

.joran-top5-table tbody tr:hover { background: var(--joran-row-hover); }

.joran-top5-table td {
  padding: 10px 8px;
  vertical-align: middle;
}

/* 列幅 */
.joran-top5-col-rank    { width: 32px; text-align: center; }
.joran-top5-col-date    { min-width: 120px; white-space: nowrap; }
.joran-top5-col-count   { width: 80px; white-space: nowrap; }
.joran-top5-col-roles   { white-space: nowrap; }
.joran-top5-col-members { width: 56px; text-align: center; }
.joran-top5-col-action  { white-space: nowrap; padding-left: 4px; }

/* スマホ: テーブル全幅・ロール折り返し・参加者列を小さく */
@media (max-width: 640px) {
  /* 列幅を縮めて 343px 以内に収める（合計 ~282px） */
  .joran-top5-col-rank    { width: 26px; }
  .joran-top5-col-date    { min-width: 92px; white-space: normal; overflow-wrap: break-word; }
  .joran-top5-col-count   { width: auto; min-width: 56px; white-space: normal; }
  .joran-top5-col-roles   { width: 70px; white-space: normal; }
  .joran-top5-col-members { width: 38px; font-size: 11px; }

  /* 中身も折り返し許可 */
  .joran-top5-count-wrap  { flex-wrap: wrap; }
  .joran-top5-role-bar    { flex-wrap: wrap; }

  /* セル padding 縮小で余白を確保 */
  .joran-top5-table td    { padding: 8px 4px; }
  .joran-top5-table thead th { padding: 6px 4px; font-size: 10px; }

  /* TOP5 ヘッダの「○のみ/○+△」「候補日をコピー」の折り返し */
  .joran-top3-header { flex-wrap: wrap; gap: 6px; }
  .joran-top3-mode-btn,
  .joran-top3-copy-btn { font-size: 11px; padding: 8px 8px; min-height: 36px; }
}

/* スマホでの横はみ出し安全ネット（TOP5以外の不意の overflow を遮断） */
@media (max-width: 640px) {
  #d-detail-view, #create-view, #list-view {
    max-width: 100%;
    overflow-x: clip;
  }
}

/* ランクバッジ */
.joran-top5-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-weight: 700;
  font-size: 12px;
  color: #fff;
  background: #9ca3af;
}

.joran-top5-rank-badge--1 { background: #d97706; }
.joran-top5-rank-badge--2 { background: #6b7280; }
.joran-top5-rank-badge--3 { background: #92400e; }

/* 日程ラベル */
.joran-top5-date-label {
  font-weight: 600;
  color: var(--joran-text);
  word-break: break-all;
}

/* 出欠バッジ */
.joran-top5-count-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.joran-top5-ans-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  white-space: nowrap;
}

.joran-top5-ans-o { color: #15803d; background: #dcfce7; }
.joran-top5-ans-d { color: #92400e; background: #fef3c7; }
/* 未回答バッジ：判定はしないが「あと何人待つべきか」の材料として淡く出す */
.joran-top5-ans-unanswered { color: #6b7280; background: #f3f4f6; }

/* ロール充足 mini bar */
.joran-top5-role-bar {
  display: flex;
  gap: 3px;
  align-items: center;
  flex-wrap: wrap;
}

.joran-top5-role-cell {
  display: flex;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 4px;
  border-radius: 3px;
  white-space: nowrap;
}

/* 0人のロールも常に出す（欠けが一目で分かるように）。淡色で非強調にする */
.joran-top5-role-cell--none {
  opacity: 0.45;
  background: transparent !important;
  color: var(--joran-text-sub) !important;
  box-shadow: inset 0 0 0 1px var(--joran-border);
}

/* 参加者カウント */
.joran-top5-members-btn {
  background: none;
  border: 1px solid var(--joran-border);
  border-radius: var(--joran-radius-sm);
  padding: 3px 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  color: var(--joran-green);
  transition: background .12s, border-color .12s;
  font-family: inherit;
}

.joran-top5-members-btn:hover {
  background: #dcfce7;
  border-color: var(--joran-green);
}

/* 参加者展開行 */
.joran-top5-detail-row td {
  padding: 0;
}

.joran-top5-detail-inner {
  padding: 8px 12px 10px 12px;
  background: #f9fafb;
  border-bottom: 1px solid var(--joran-border);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ○/△ グループ行 */
.joran-top5-ans-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.joran-top5-ans-group-label {
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  line-height: 1.4;
}

.joran-top5-ans-names {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

/* 名前チップ */
.joran-top5-name-chip {
  font-size: 12px;
  padding: 2px 9px;
  border-radius: 999px;
  white-space: nowrap;
}

.joran-top5-name-chip-o {
  background: #dcfce7;
  color: #15803d;
}

.joran-top5-name-chip-d {
  background: #fef3c7;
  color: #92400e;
}

/* 参加者カウントバッジ（▶/▼付き） */
.joran-top5-count-badge {
  font-size: 12px;
  color: var(--joran-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

/* ========== 凡例バー（グリッド直上） ========== */

.joran-legend-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: #f9fafb;
  border: 1px solid var(--joran-border);
  border-radius: var(--joran-radius-sm);
  margin-bottom: 8px;
  flex-wrap: wrap;
}

/* ========== 日程グリッド 編集色強化 ========== */

/* 自分の列ヘッダーに黄色リボン */
.joran-grid thead th.joran-col-self {
  position: relative;
  background: #fefce8;
}

.joran-grid thead th.joran-col-self::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: #ca8a04;
  border-radius: 2px 2px 0 0;
}

/* 自分の列セル */
.joran-grid td.joran-cell-self {
  background: #fffde7;
}

/* 自分セルにホバー */
.joran-grid td.joran-cell-self:hover {
  background: #fef9c3;
}

/* インライントグルボタン: 選択時のコントラスト強化 */
.joran-inline-o { box-shadow: 0 0 0 2px #15803d; }
.joran-inline-d { box-shadow: 0 0 0 2px #ca8a04; }
.joran-inline-x { box-shadow: 0 0 0 2px #b91c1c; }

/* 候補日テキストエリア高さ上限 */
.joran-dates-textarea {
  max-height: 240px;
  resize: vertical;
}

/* ========== 作成画面 2列グリッド強化 ========== */

/* PC幅でテンプレート4列 */
@media (min-width: 768px) {
  .joran-grid-2 {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* スマホでは2列のまま */
@media (max-width: 767px) {
  .joran-grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 作成画面: メインカードをスマホ縦・PC 2列 */
.joran-create-main-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 768px) {
  .joran-create-main-grid {
    grid-template-columns: 1fr 200px;
    gap: 0 16px;
    align-items: start;
  }
}

/* ============================================================
 * スマホ タップ領域・入力サイズの是正（2026-08-19）
 * ------------------------------------------------------------
 * なぜ末尾か: 同一セレクタの既存指定が本ファイル各所に散在しており、
 * カスケード順で確実に勝たせるため。PC(641px以上)には一切影響しない。
 *
 * 前提: 共通CSS components.css が
 *   - max-width:767px で input/select/textarea を font-size:16px !important
 *   - (hover:none)and(pointer:coarse) で button/select を min-height:44px
 * にしている。したがって
 *   - font-size の 10px/11px 指定は実機では無効 → 幅と余白で調整する
 *   - <summary> と <label> は上記44px補正の対象外 → ここで明示する
 * ============================================================ */
@media (max-width: 640px) {

  /* ---- 入力欄: 16px実効フォントでも破綻しない幅にする ---- */
  .joran-filter-count-input {
    width: auto;
    min-width: 56px;
    max-width: 72px;
    padding: 6px 8px;
    min-height: 44px;
  }
  .joran-filter-select {
    /* 右余白の固定値をやめ、狭い端末でも画面外へ出さない */
    padding: 6px 28px 6px 10px;
    max-width: 100%;
    min-height: 44px;
    text-overflow: ellipsis;
  }
  .joran-filter-search-input {
    min-height: 44px;
    padding: 8px 12px;
  }

  /* ---- タップ領域 44px 未満の是正 ----
     見た目を膨らませないため、余白ではなく min-height と
     flex 中央寄せで当たり判定だけを広げる */
  .joran-filter-chip,
  .joran-filter-reset,
  .joran-top3-mode-btn,
  .joran-top3-copy-btn,
  .joran-chip,
  .joran-bulk-category-btn,
  .joran-respondent-btn,
  .joran-help-btn,
  .joran-btn-decide {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* 表内の確定ボタンは実高18pxだった。文字は小さいまま当たり判定だけ確保する */
  .joran-btn-decide {
    font-size: 12px;
    padding: 4px 10px;
  }

  /* 補助文字の下限を12pxに揃える（11px指定が残っていた3箇所） */
  .joran-filter-reset,
  .joran-top3-mode-btn,
  .joran-top3-copy-btn {
    font-size: 12px;
  }

  /* ○△× と 日単位一括（40px → 44px） */
  .joran-mobile-pick-btn,
  .joran-mobile-daybulk-btn {
    min-height: 44px;
    min-width: 44px;
  }

  /* <summary> は共通CSSの44px補正が効かないので個別に確保する */
  .joran-mobile-pickers-summary,
  .joran-top3-others-summary {
    min-height: 44px;
    box-sizing: border-box;
  }
  .joran-top3-others-summary {
    display: flex;
    align-items: center;
    font-size: 13px;
    padding: 4px 20px 4px 2px;
  }

  /* 隣接操作の誤タップ防止（最低8px） */
  .joran-filter-chips { gap: 8px; }
  .joran-top3-actions { gap: 8px; }

  /* ---- トーストと safe-area ---- */
  .joran-toast {
    bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
  #detail-view,
  #create-view {
    padding-bottom: 0;
  }
}


/* ============================================================
 * TOP5 カード表示・絞り込みの折り畳み（2026-08-19）
 * ------------------------------------------------------------
 * 表とカードは同じ script.js の集計データ（computeRowData 等）を
 * 共有し、CSS の表示切替だけで PC=表 / スマホ=カード を出し分ける。
 * ============================================================ */

/* renderTop3FilterBar() が絞り込み本体を包む <details> の中身。
   旧 .joran-top3-filter-bar の flex 指定を引き継ぐ */
.joran-top3-filter-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 8px;
}
.joran-top3-filter-details {
  width: 100%;
}
.joran-top3-filter-summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  color: var(--joran-text-sub);
  list-style: none;
  user-select: none;
}
.joran-top3-filter-summary::-webkit-details-marker { display: none; }
.joran-top3-filter-summary::marker { content: ""; }
.joran-top3-filter-summary::before {
  content: '▶';
  display: inline-block;
  margin-right: 6px;
  font-size: 10px;
  transition: transform 0.15s;
}
.joran-top3-filter-details[open] > .joran-top3-filter-summary::before {
  transform: rotate(90deg);
}

@media (max-width: 640px) {
  /* <summary> は共通CSSの44px自動補正が効かないため個別に確保する */
  .joran-top3-filter-summary {
    display: flex;
    align-items: center;
    min-height: 44px;
  }
}

@media (min-width: 641px) {
  /* PCでも初期表示は閉じ、必要なときだけ展開できる */
  .joran-top3-filter-summary {
    display: flex;
    align-items: center;
    min-height: 36px;
  }
}

/* 表とカードの排他表示（データソースは共通、出し分けのみCSSで行う） */
@media (max-width: 640px) {
  .joran-top5-table-wrap { display: none; }
}
@media (min-width: 641px) {
  .joran-top5-cards-wrap { display: none; }
}

/* ========== TOP5 カード ========== */
.joran-top5-cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.joran-top5-card {
  border: 1px solid var(--joran-border);
  border-radius: var(--joran-radius-sm);
  padding: 12px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.joran-top5-card--decided {
  background: #ecfdf5;
  box-shadow: inset 3px 0 0 var(--joran-green);
}

.joran-top5-card-row1 {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.joran-top5-card-row1 .joran-top5-date-label {
  font-size: 15px;
}
/* 1位は色（ランクバッジ）だけでなく文言でも示す */
.joran-top5-card-rank1-label {
  display: inline-block;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  background: #d97706;
  border-radius: 999px;
}

.joran-top5-card-row2 .joran-top5-ans-badge {
  font-size: 13px;
}

.joran-top5-card-row3 {
  display: flex;
}
.joran-top5-card-row3 .joran-top5-role-bar {
  flex-wrap: wrap;
}
.joran-top5-card-row3 .joran-top5-role-cell {
  font-size: 12px;
  padding: 3px 6px;
}

.joran-top5-card-detail {
  border-top: 1px dashed var(--joran-border);
  padding-top: 8px;
}

.joran-top5-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}
.joran-top5-card-actions button {
  min-height: 44px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--joran-radius-sm);
  border: 1px solid var(--joran-border-strong);
  background: #fff;
  cursor: pointer;
}
.joran-top5-card-detail-btn {
  color: var(--joran-green);
}
.joran-top5-card-decide-btn {
  margin-left: auto;
}

/* 詳細画面のスマホ順序。参加者画面の回答導線を先に置く。 */
@media (max-width: 640px) {
  #joran-schedule-upcoming-detail { order: 1; }
  .joran-detail-header            { order: 2; }
  #d-decided-banner               { order: 3; }
  #d-top-cta-wrap                 { order: 4; }
  #d-owner-panel                  { order: 5; }
  #d-reauth-section               { order: 6; }
  #d-myinput-panel                { order: 7; }
  #d-stats-container              { order: 8; }
  #d-respondents-panel            { order: 9; }
  #d-comments-section             { order: 10; }
  #d-supplementary-stats          { order: 11; }
  #d-share-section                { order: 12; }
  .joran-help-btn-wrap            { order: 13; }
}

@media (max-width: 480px) {
  .joran-response-history-header {
    align-items: flex-start;
  }
  .joran-response-history-header .joran-btn {
    flex-shrink: 0;
    padding-left: 10px;
    padding-right: 10px;
  }
  .joran-response-history-item > summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .joran-response-history-summary-main {
    flex-basis: calc(100% - 28px);
  }
  .joran-response-history-summary-time {
    margin-left: 0;
  }
}
