/* ==========================================================================
   名簿・受付表作成ツール 専用CSS
   すべてのカスタムクラスは rst- プレフィックスを付け、既存Bizroute CSSと
   衝突しないようにする。
   ========================================================================== */

/* ── Reset & Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  background: #f3f5f8;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI',
    'Hiragino Kaku Gothic Pro', 'Yu Gothic', 'Meiryo', sans-serif;
  color: #1f2937;
  line-height: 1.6;
}

button { font-family: inherit; }

:focus-visible {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

@media (max-width: 991px) {
  body { padding-bottom: 64px; }
}

/* ── パンくず ──────────────────────────────────────────────────────── */
.rst-breadcrumb {
  max-width: 1180px;
  margin: 14px auto 0;
  padding: 0 16px;
}

/* ── SEO Header ───────────────────────────────────────────────────── */
.rst-seo-header {
  max-width: 1180px;
  margin: 10px auto 16px;
  padding: 0 16px;
}

.rst-seo-header h1 {
  font-size: 1.5rem;
  line-height: 1.4;
  margin-bottom: 8px;
}

.rst-seo-lead {
  color: #444;
  margin-bottom: 4px;
  line-height: 1.75;
}

.rst-seo-lead-sub {
  color: #6b7280;
  font-size: 0.82rem;
  margin: 0 0 10px;
}

/* ── Main Layout ──────────────────────────────────────────────────── */
.rst-main-container {
  max-width: 1180px;
  margin: 0 auto 48px;
  padding: 0 16px;
}

.rst-main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
}

@media (min-width: 992px) {
  .rst-main-grid {
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
    align-items: start;
  }

  .rst-col-preview {
    align-self: start;
    min-width: 0;
  }

  .rst-col-preview .rst-section-card {
    position: sticky;
    top: 20px;
  }
}


/* ── 3ステップ案内 ───────────────────────────────────────────────── */
.rst-quick-flow {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 9px;
  margin: 0 0 16px;
  padding: 9px 12px;
  border: 1px solid #dbe7f3;
  border-radius: 8px;
  background: #f7faff;
  color: #315d8c;
  font-size: 0.82rem;
  font-weight: 600;
}

@media (max-width: 480px) {
  .rst-quick-flow {
    justify-content: flex-start;
    font-size: 0.78rem;
  }
}

/* ── Section Cards ────────────────────────────────────────────────── */
.rst-section-card {
  background: #fff;
  border-radius: 12px;
  padding: 18px 20px;
  border: 1px solid #e4e9f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.rst-setting-section {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #eef1f5;
}

.rst-setting-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.rst-section-title {
  font-size: 1rem;
  font-weight: 700;
  color: #1f4f8a;
  margin: 0 0 10px;
}

/* ── フォーム部品 ─────────────────────────────────────────────────── */
.rst-form-field {
  margin-bottom: 14px;
}

.rst-form-field:last-child { margin-bottom: 0; }

.rst-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.rst-two-col .rst-form-field { margin-bottom: 0; }

.rst-form-field label,
.rst-form-field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.rst-form-field input[type="text"],
.rst-form-field input[type="date"],
.rst-form-field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  min-height: 42px;
  background: #fff;
  color: #111827;
}

.rst-form-field input:focus,
.rst-form-field select:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

.rst-mode-field {
  margin-top: 12px;
}

.rst-mode-field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #444;
  margin-bottom: 6px;
}

.rst-mode-field select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 0.92rem;
  min-height: 42px;
  background: #fff;
  color: #111827;
}

.rst-hint {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 0 0 12px;
  line-height: 1.6;
}

.rst-field-help {
  display: block;
  margin-top: 5px;
  color: #6b7280;
  font-size: 0.76rem;
  font-weight: 400;
  line-height: 1.5;
}

.rst-privacy-note {
  font-size: 0.78rem;
  color: #6b7280;
  margin: 8px 0 12px;
  line-height: 1.6;
}

.rst-save-status {
  font-size: 0.78rem;
  color: #2f6fb0;
  min-height: 1.2em;
  margin: 0 0 4px;
}

/* ── 表示項目チェックボックス ─────────────────────────────────────── */
.rst-column-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 10px;
}

.rst-column-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 0.88rem;
  color: #1f2937;
  min-height: 32px;
}

.rst-column-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #2f6fb0;
  flex: none;
}

.rst-column-item.is-locked {
  color: #6b7280;
}

.rst-column-item label {
  cursor: pointer;
  user-select: none;
}

.rst-column-item.is-locked label { cursor: default; }

@media (max-width: 420px) {
  .rst-column-list { grid-template-columns: minmax(0, 1fr); }
}

/* ── 参加者入力テーブル ───────────────────────────────────────────── */
.rst-participant-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  margin-bottom: 10px;
}

.rst-participant-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 420px;
}

.rst-participant-table th,
.rst-participant-table td {
  border-bottom: 1px solid #eef1f5;
  padding: 4px;
  vertical-align: middle;
}

.rst-participant-table th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
  font-size: 0.78rem;
  padding: 8px 6px;
  text-align: left;
  white-space: nowrap;
  position: sticky;
  top: 0;
}

.rst-participant-table th.rst-col-actions,
.rst-participant-table td.rst-col-actions {
  width: 96px;
  white-space: nowrap;
  position: sticky;
  left: 0;
  z-index: 2;
  box-shadow: 1px 0 0 #e4e9f0;
}

.rst-participant-table th.rst-col-actions {
  z-index: 3;
  background: #f8fafc;
}

.rst-participant-table td.rst-col-actions {
  background: #fff;
}

.rst-participant-table tbody tr:last-child td {
  border-bottom: none;
}

.rst-row-input {
  width: 100%;
  min-width: 90px;
  border: 1px solid transparent;
  background: transparent;
  font: inherit;
  font-size: 0.86rem;
  color: #111827;
  padding: 7px 8px;
  border-radius: 6px;
}

.rst-row-input:hover {
  border-color: #e2e8f0;
}

.rst-row-input:focus {
  outline: none;
  border-color: #2f6fb0;
  background: #f7faff;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.15);
}

.rst-row-controls {
  display: flex;
  gap: 2px;
  align-items: center;
  justify-content: flex-end;
}

.rst-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid #dbe3ec;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 0.85rem;
  cursor: pointer;
  flex: none;
}

.rst-icon-btn:hover:not(:disabled) { background: #eef2f7; }

.rst-icon-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.rst-icon-btn-danger {
  color: #a83232;
  border-color: #f0d3d3;
}

.rst-icon-btn-danger:hover { background: #fbecec; }

/* ── まとめて入力 ─────────────────────────────────────────────────── */
.rst-bulk-details {
  margin: 4px 0 14px;
  border: 1px solid #e4e9f0;
  border-radius: 8px;
  overflow: hidden;
}

.rst-bulk-details summary {
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
  color: #2f6fb0;
  padding: 10px 12px;
  list-style: none;
  background: #f8fafc;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
}

.rst-bulk-details summary::-webkit-details-marker { display: none; }

.rst-bulk-details summary::before {
  content: '▶';
  font-size: 0.68rem;
  transition: transform 0.15s;
}

.rst-bulk-details[open] summary::before { transform: rotate(90deg); }

.rst-bulk-inner {
  padding: 12px;
  border-top: 1px solid #eef1f5;
}

.rst-bulk-textarea {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 9px 11px;
  font: inherit;
  font-size: 0.86rem;
  resize: vertical;
  margin-bottom: 10px;
}

.rst-bulk-textarea:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

.rst-bulk-btn-row {
  display: flex;
  justify-content: flex-end;
}

/* ── 追加ボタン行 ─────────────────────────────────────────────────── */
.rst-add-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}

/* ── 詳細設定 ─────────────────────────────────────────────────────── */
.rst-advanced-settings {
  margin: 2px 0 16px;
  border: 1px solid #dbe3ec;
  border-radius: 9px;
  background: #fbfcfe;
  overflow: hidden;
}

.rst-advanced-settings > summary {
  cursor: pointer;
  list-style: none;
  padding: 11px 13px;
  font-size: 0.88rem;
  font-weight: 700;
  color: #2f6fb0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.rst-advanced-settings > summary::-webkit-details-marker { display: none; }

.rst-advanced-settings > summary::before {
  content: '▶';
  font-size: 0.68rem;
  transition: transform 0.15s;
}

.rst-advanced-settings[open] > summary::before { transform: rotate(90deg); }

.rst-advanced-inner {
  padding: 4px 13px 14px;
  border-top: 1px solid #edf1f5;
}

.rst-segmented {
  display: inline-flex;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
}

.rst-segmented-option {
  position: relative;
}

.rst-segmented-option input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.rst-segmented-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  font-size: 0.86rem;
  font-weight: 600;
  color: #475569;
  min-height: 38px;
  border-right: 1px solid #cbd5e1;
}

.rst-segmented-option:last-child span { border-right: none; }

.rst-segmented-option input:checked + span {
  background: #2f6fb0;
  color: #fff;
}

.rst-segmented-option input:focus-visible + span {
  outline: 2px solid #2f6fb0;
  outline-offset: 2px;
}

/* ── ボタン群 ─────────────────────────────────────────────────────── */
.rst-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  color: #333;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s;
  min-height: 42px;
}

.rst-btn:hover { background: #eef2f7; }

.rst-btn-primary {
  background: #2f6fb0;
  border-color: #2f6fb0;
  color: #fff;
}

.rst-btn-primary:hover { background: #245a91; }

.rst-btn-outline {
  background: #fff;
  border-color: #2f6fb0;
  color: #2f6fb0;
}

.rst-btn-outline:hover { background: #eaf2fb; }

.rst-btn-subtle {
  background: #fff;
  border-color: #cbd5e1;
  color: #475569;
}

.rst-btn-subtle:hover { background: #f1f5f9; }

.rst-btn-text-danger {
  background: none;
  border: none;
  color: #a83232;
  font-size: 0.82rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 10px 4px;
  min-height: 40px;
}

.rst-btn-text-danger:hover { color: #7a1f1f; }

.rst-clear-row {
  display: flex;
  justify-content: flex-end;
}

/* ── プレビュー・ツールバー ───────────────────────────────────────── */
.rst-preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.rst-preview-toolbar .rst-section-title { margin: 0; }

.rst-preview-guide {
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 7px;
  background: #f6f9fc;
  color: #64748b;
  font-size: 0.78rem;
  line-height: 1.55;
}

/* ── 表示倍率 ──────────────────────────────────────────────────────── */
.rst-preview-zoom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #475569;
}

.rst-preview-zoom-row select {
  padding: 6px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 600;
  background: #fff;
  color: #111827;
  min-height: 34px;
}

.rst-preview-zoom-row select:focus {
  outline: none;
  border-color: #2f6fb0;
  box-shadow: 0 0 0 2px rgba(47, 111, 176, 0.2);
}

/* ── A4プレビュー用紙 ─────────────────────────────────────────────── */
/* 表示倍率(#zoomSelect)に応じて.rst-paperをtransform: scale()で縮小し、
   .rst-paper-stageの幅・高さを縮小後のサイズにJSで合わせることで、
   周囲のレイアウトに余白や欠けを作らずタイトル・表全体を縮小表示する。
   選択倍率でも収まらない場合だけ.rst-paper-wrapが横スクロールの受け皿になる */
.rst-paper-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.rst-paper-stage {
  position: relative;
  margin: 0 auto;
}

.rst-paper {
  background: #fff;
  border: 1px solid #dbe3ec;
  border-radius: 4px;
  padding: 18px 16px;
  width: max-content;
  transform-origin: top left;
}

/* 用紙内では表の幅なりに広がってよいため、内側では横スクロールさせない
   (表全体の横スクロール・縮小は外側の.rst-paper-wrap/倍率選択に任せる) */
.rst-table-scroll {
  overflow-x: visible;
}

.rst-preview-store,
.rst-preview-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 10px;
  text-align: center;
}

.rst-preview-meta {
  text-align: center;
  margin: 0 0 22px;
}

.rst-preview-meta p {
  font-size: 0.88rem;
  color: #555;
  margin: 0;
}

.rst-preview-empty {
  color: #888;
  font-size: 0.88rem;
  text-align: center;
  padding: 30px 0;
}

/* table-layout:autoにして各列にmin-widthだけを与える。列数が多く
   min-width合計が.rst-table-scrollの幅を超えたときだけ横スクロールになり、
   PC・スマホともに列を増やしても文字が潰れない（詰め込み優先にしない） */
.rst-preview-table {
  width: auto;
  min-width: 100%;
  border-collapse: collapse;
  table-layout: auto;
}

.rst-preview-table th,
.rst-preview-table td {
  border: 1px solid #cbd5e1;
  vertical-align: middle;
  padding: 7px 8px;
  word-break: break-word;
  min-width: 84px;
}

.rst-preview-table th {
  background: #f2f6fb;
  color: #1f4f8a;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
}

.rst-preview-table td { color: #111827; }

.rst-preview-table td.rst-col-no,
.rst-preview-table td.rst-col-attendance,
.rst-preview-table td.rst-col-checkin {
  text-align: center;
  color: #475569;
}

.rst-preview-table th.rst-col-narrow,
.rst-preview-table td.rst-col-narrow { min-width: 46px; }

.rst-preview-table th.rst-col-attendance-w,
.rst-preview-table td.rst-col-attendance-w { min-width: 84px; }

.rst-preview-table th.rst-col-checkin-w,
.rst-preview-table td.rst-col-checkin-w { min-width: 64px; }

.rst-preview-table th.rst-col-wide,
.rst-preview-table td.rst-col-wide { min-width: 130px; }

/* 出欠・受付確認の記入マーク */
.rst-mark {
  display: inline-block;
}

.rst-mark-checkbox {
  width: 15px;
  height: 15px;
  border: 1.4px solid #64748b;
  border-radius: 2px;
}

.rst-mark-circle {
  width: 17px;
  height: 17px;
  border: 1.4px solid #64748b;
  border-radius: 50%;
}

.rst-mark-text {
  font-size: 0.82rem;
  color: #64748b;
  white-space: nowrap;
}

/* 文字サイズ */
.rst-preview-table[data-fontsize="sm"] { font-size: 0.8rem; }
.rst-preview-table[data-fontsize="md"] { font-size: 0.9rem; }
.rst-preview-table[data-fontsize="lg"] { font-size: 1.02rem; }

/* 行の高さ */
.rst-preview-table[data-rowheight="compact"] th,
.rst-preview-table[data-rowheight="compact"] td { padding: 4px 6px; }

.rst-preview-table[data-rowheight="standard"] th,
.rst-preview-table[data-rowheight="standard"] td { padding: 8px 8px; }

.rst-preview-table[data-rowheight="relaxed"] th,
.rst-preview-table[data-rowheight="relaxed"] td { padding: 14px 8px; }

/* ── スマートフォン固定操作バー ───────────────────────────────────── */
.rst-mobile-action-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 900;
  display: flex;
  gap: 8px;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0px));
  background: #fff;
  border-top: 1px solid #e4e9f0;
  box-shadow: 0 -4px 14px rgba(0, 0, 0, 0.1);
}

.rst-mobile-action-bar .rst-btn {
  flex: 1 1 0;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 0.86rem;
}

@media (min-width: 992px) {
  .rst-mobile-action-bar { display: none; }
}

/* ── 解説エリア ───────────────────────────────────────────────────── */
.rst-doc-section {
  max-width: 1180px;
  margin: 40px auto 60px;
  padding: 0 16px;
  line-height: 1.8;
  color: #374151;
}

.rst-doc-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 40px 0 14px;
  color: #111827;
  border-left: 4px solid #2f6fb0;
  padding-left: 10px;
}

.rst-doc-section h2:first-of-type { margin-top: 0; }

.rst-doc-section p,
.rst-doc-section li {
  font-size: 0.92rem;
  line-height: 1.85;
  color: #374151;
}

.rst-doc-section p { margin: 0 0 12px; }

.rst-doc-section ul { margin: 0 0 12px; padding-left: 1.4em; }

.rst-doc-section li { margin-bottom: 4px; }

.rst-steps {
  list-style: none;
  counter-reset: rst-step;
  padding: 0;
  margin: 0 0 14px;
}

.rst-steps li {
  position: relative;
  padding: 10px 0 12px 34px;
  border-bottom: 1px solid #f3f4f6;
}

.rst-steps li:last-child { border-bottom: none; }

.rst-steps li::before {
  counter-increment: rst-step;
  content: counter(rst-step);
  position: absolute;
  left: 0;
  top: 10px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #2f6fb0;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 関連ページ */
.rst-related-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rst-related-link-list li {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
}

.rst-related-link-list a {
  color: #1d4ed8;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
}

.rst-related-link-list a:hover { text-decoration: underline; }

.rst-related-link-list .rst-note {
  display: block;
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 400;
  margin-top: 2px;
}

/* ── レスポンシブ ─────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .rst-two-col { grid-template-columns: minmax(0, 1fr); }
  .rst-section-card { padding: 14px 14px 16px; }
  .rst-preview-toolbar { align-items: stretch; flex-direction: column; }
  .rst-preview-toolbar .rst-btn { width: 100%; }

  .rst-participant-table th.rst-col-actions,
  .rst-participant-table td.rst-col-actions {
    width: 88px;
  }

  .rst-icon-btn {
    width: 26px;
    height: 30px;
  }
}

/* ── 印刷 ─────────────────────────────────────────────────────────── */
@media print {
  .no-print { display: none !important; }

  body {
    background: #fff;
    padding-bottom: 0;
  }

  .rst-main-grid { display: block; }

  .rst-col-preview .rst-section-card {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0;
  }

  .rst-paper-wrap { overflow: visible; }

  .rst-table-scroll { overflow: visible; }

  /* 画面上の表示倍率設定に関わらず、印刷は常に等倍で出力する */
  .rst-paper-stage {
    width: auto !important;
    height: auto !important;
  }

  .rst-paper {
    border: none;
    padding: 0;
    width: auto !important;
    transform: none !important;
  }

  .rst-preview-table th,
  .rst-preview-table td { border: 1px solid #333; }

  .rst-preview-table tbody tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .rst-preview-table thead {
    display: table-header-group;
  }

  @page {
    size: A4 portrait;
    margin: 15mm;
  }
}
