/* ══════════════════════════════════════════
   WP案件ビルダー — 業務ツール風スタイル
   白ベース + アクセント1色（brand-600 / #2563eb）
   ══════════════════════════════════════════ */

/* ── カード ── */
.card {
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #fff;
  padding: 1.25rem;
  box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.04);
}
/* fieldset をカードとして使う場合の既定スタイル打ち消し */
fieldset.card { min-width: 0; }
.card-legend {
  display: block;
  width: 100%;
  margin-bottom: 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  letter-spacing: 0.01em;
}

/* ── ラベル / 入力 ── */
.lbl {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #475569;
}
.req { color: #e11d48; font-weight: 400; }
.hint { margin-top: 0.3125rem; font-size: 0.6875rem; line-height: 1.5; color: #94a3b8; }

/* 「反映時のみ必要」の区切り案内 */
.wp-block-note {
  margin-top: 0.25rem;
  border-radius: 0.375rem;
  border: 1px dashed #bfdbfe;
  background: #eff6ff;
  padding: 0.5625rem 0.75rem;
  font-size: 0.75rem;
  line-height: 1.7;
  color: #1e40af;
}
.wp-block-note strong { font-weight: 600; }

/* 任意項目タグ */
.opt-tag {
  display: inline-block;
  margin-left: 0.25rem;
  border-radius: 0.1875rem;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  padding: 0.0625rem 0.3125rem;
  font-size: 0.625rem;
  font-weight: 500;
  color: #64748b;
  vertical-align: 1px;
}

/* WordPress接続テスト */
.btn-check {
  display: inline-flex;
  align-items: center;
  border-radius: 0.375rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 0.4375rem 0.75rem;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.btn-check:hover:not(:disabled) { background: #f1f5f9; border-color: #94a3b8; }
.btn-check:disabled { opacity: 0.6; cursor: not-allowed; }

.chk-box { border-radius: 0.375rem; border: 1px solid; padding: 0.625rem 0.75rem; font-size: 0.8125rem; line-height: 1.65; }
.chk-ok { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.chk-ng { border-color: #fecdd3; background: #fff1f2; color: #9f1239; }
.chk-warn { border-color: #fde68a; background: #fffbeb; color: #92400e; }
.chk-box strong { font-weight: 600; }
.chk-box ul { margin: 0.375rem 0 0; padding-left: 1.15rem; list-style: disc; font-size: 0.75rem; }
.chk-box ul li { margin-bottom: 0.1875rem; }
.chk-box code {
  background: rgba(255, 255, 255, 0.7);
  border-radius: 0.1875rem;
  padding: 0.0625rem 0.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6875rem;
}

/* 入力欄ごとの折りたたみヘルプ */
.help { margin-top: 0.375rem; font-size: 0.75rem; }
.help > summary {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: #2563eb;
  font-size: 0.6875rem;
  font-weight: 500;
  list-style: none;
  user-select: none;
}
.help > summary::-webkit-details-marker { display: none; }
.help > summary::before { content: '\f059'; font-family: 'Font Awesome 6 Free'; font-weight: 900; font-size: 0.75rem; }
.help > summary:hover { text-decoration: underline; }
.help[open] > summary { margin-bottom: 0.375rem; }
.help-body,
.help > *:not(summary) { color: #475569; line-height: 1.7; }
.help ol { margin: 0.25rem 0 0; padding-left: 1.15rem; list-style: decimal; }
.help ol li { margin-bottom: 0.1875rem; }
.help p { margin: 0.25rem 0 0; }
.help code {
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 0.25rem;
  padding: 0.0625rem 0.25rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.6875rem;
  color: #0f172a;
}
.help a { color: #2563eb; text-decoration: underline; }
.help strong { color: #1e293b; font-weight: 600; }
.help-note {
  margin-top: 0.375rem;
  padding: 0.4375rem 0.5rem;
  background: #f8fafc;
  border-left: 2px solid #cbd5e1;
  border-radius: 0.25rem;
  font-size: 0.6875rem;
  color: #64748b;
}
.help[open] {
  padding: 0.5rem 0.625rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.375rem;
}

.inp {
  display: block;
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #1e293b;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.inp::placeholder { color: #cbd5e1; }
.inp:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.12);
}
.inp:disabled { background: #f8fafc; color: #94a3b8; cursor: not-allowed; }
textarea.inp { resize: vertical; min-height: 8rem; }
.inp.invalid { border-color: #e11d48; box-shadow: 0 0 0 3px rgb(225 29 72 / 0.1); }

/* パスワード表示切替ボタン */
.reveal {
  position: absolute;
  top: 50%;
  right: 0.5rem;
  transform: translateY(-50%);
  padding: 0.25rem 0.375rem;
  font-size: 0.8125rem;
  color: #94a3b8;
  background: none;
  border: 0;
  cursor: pointer;
  border-radius: 0.25rem;
}
.reveal:hover { color: #475569; background: #f1f5f9; }

/* ── ラジオカード ── */
.radio-card { display: block; cursor: pointer; }
.radio-body {
  display: block;
  height: 100%;
  border-radius: 0.5rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 0.75rem;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
}
.radio-card:hover .radio-body { border-color: #94a3b8; }
.radio-card input:checked + .radio-body {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 1px #2563eb inset;
}
.radio-card input:focus-visible + .radio-body { box-shadow: 0 0 0 3px rgb(37 99 235 / 0.2); }
.radio-title { display: block; font-size: 0.8125rem; font-weight: 600; color: #1e293b; }
.radio-desc { display: block; margin-top: 0.25rem; font-size: 0.6875rem; line-height: 1.5; color: #64748b; }

/* ── ボタン ── */
.btn-primary, .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border-radius: 0.5rem;
  padding: 0.6875rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s, box-shadow 0.12s, opacity 0.12s;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-primary {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 1px 2px rgb(37 99 235 / 0.3), 0 4px 12px -2px rgb(37 99 235 / 0.25);
}
.btn-primary:hover:not(:disabled) { background: #1d4ed8; }
.btn-primary:active:not(:disabled) { background: #1e40af; }
.btn-secondary { background: #fff; color: #334155; border-color: #cbd5e1; }
.btn-secondary:hover:not(:disabled) { background: #f8fafc; border-color: #94a3b8; }
.btn-primary:disabled, .btn-secondary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary:focus-visible, .btn-secondary:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ── ステップ表示 ── */
.step {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  border-radius: 0.5rem;
  padding: 0.5rem 0.625rem;
  font-size: 0.8125rem;
  background: #f8fafc;
}
.step-icon {
  flex-shrink: 0;
  width: 1.125rem;
  margin-top: 0.0625rem;
  text-align: center;
  font-size: 0.75rem;
}
.step-body { min-width: 0; flex: 1; }
.step-label { display: block; font-weight: 500; color: #334155; word-break: break-word; }
.step-detail { display: block; margin-top: 0.125rem; font-size: 0.6875rem; line-height: 1.5; color: #64748b; word-break: break-word; }

.step-running { background: #eff6ff; }
.step-running .step-icon { color: #2563eb; }
.step-running .step-label { color: #1d4ed8; }
.step-done .step-icon { color: #059669; }
.step-error { background: #fff1f2; }
.step-error .step-icon { color: #e11d48; }
.step-error .step-label { color: #be123c; font-weight: 600; }
.step-error .step-detail { color: #e11d48; }

/* ── 反映結果リスト ── */
.result-item { display: flex; align-items: flex-start; gap: 0.625rem; padding: 0.625rem 0; }
.badge {
  flex-shrink: 0;
  border-radius: 0.25rem;
  padding: 0.0625rem 0.375rem;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.badge-created { background: #d1fae5; color: #047857; }
.badge-updated { background: #dbeafe; color: #1d4ed8; }
.badge-failed { background: #ffe4e6; color: #be123c; }

/* ── ログ（ターミナル風） ── */
.log-pane {
  max-height: 22rem;
  min-height: 10rem;
  overflow: auto;
  padding: 0.75rem;
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.6875rem;
  line-height: 1.65;
  color: #cbd5e1;
  white-space: pre-wrap;
  word-break: break-word;
  background: #0f172a;
}
.log-pane::-webkit-scrollbar { width: 8px; height: 8px; }
.log-pane::-webkit-scrollbar-track { background: #0f172a; }
.log-pane::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.log-info    { color: #cbd5e1; }
.log-success { color: #34d399; }
.log-warn    { color: #fbbf24; }
.log-error   { color: #fb7185; font-weight: 600; }
.log-time    { color: #64748b; }

/* ── コード表示 ── */
.code-pane {
  max-height: 30rem;
  overflow: auto;
  border-radius: 0.5rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  padding: 0.875rem;
  margin: 0;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.6875rem;
  line-height: 1.6;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ── タブ ── */
.tab-btn {
  border-radius: 0.375rem;
  border: 1px solid #cbd5e1;
  background: #fff;
  padding: 0.25rem 0.625rem;
  font-size: 0.6875rem;
  font-weight: 500;
  color: #475569;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.tab-btn:hover { background: #f1f5f9; }
.tab-btn.tab-active { background: #2563eb; border-color: #2563eb; color: #fff; }

/* ── 折りたたみ（プレビューHTML） ── */
.page-acc { border: 1px solid #e2e8f0; border-radius: 0.5rem; overflow: hidden; }
.page-acc > summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  background: #f8fafc;
  font-size: 0.8125rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
  list-style: none;
}
.page-acc > summary::-webkit-details-marker { display: none; }
.page-acc > summary:hover { background: #f1f5f9; }
.page-acc[open] > summary { border-bottom: 1px solid #e2e8f0; }
.page-acc-body { padding: 0.875rem; }

/* ── レンダリングプレビュー（WPブロックの簡易再現） ── */
.wp-render {
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  background: #fff;
  padding: 1.5rem;
  font-size: 0.875rem;
  line-height: 1.85;
  color: #334155;
}
.wp-render h2 { margin: 1.75rem 0 0.75rem; font-size: 1.25rem; font-weight: 700; color: #0f172a; }
.wp-render h2:first-child { margin-top: 0; }
.wp-render h3 { margin: 1.25rem 0 0.5rem; font-size: 1.0625rem; font-weight: 600; color: #1e293b; }
.wp-render p { margin: 0.75rem 0; }
.wp-render ul, .wp-render ol { margin: 0.75rem 0; padding-left: 1.5rem; list-style: disc; }
.wp-render ol { list-style: decimal; }
.wp-render li { margin: 0.25rem 0; }
.wp-render img { max-width: 100%; height: auto; border-radius: 0.375rem; }
.wp-render figure { margin: 1.25rem 0; }
.wp-render table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.8125rem; }
.wp-render th, .wp-render td { border: 1px solid #e2e8f0; padding: 0.5rem 0.75rem; text-align: left; }
.wp-render th { background: #f8fafc; font-weight: 600; }
.wp-render .wp-block-button__link {
  display: inline-block;
  background: #2563eb;
  color: #fff;
  padding: 0.625rem 1.5rem;
  border-radius: 0.375rem;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.8125rem;
}
.wp-render .wp-block-buttons { margin: 1.25rem 0; display: flex; gap: 0.625rem; flex-wrap: wrap; }
.wp-render blockquote {
  margin: 1.25rem 0;
  border-left: 3px solid #2563eb;
  padding-left: 1rem;
  color: #475569;
  font-style: italic;
}
.wp-render a { color: #2563eb; text-decoration: underline; }

/* ── ユーティリティ ── */
.spin { animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 640px) {
  .card { padding: 1rem; border-radius: 0.625rem; }
  .log-pane { font-size: 0.625rem; max-height: 16rem; }
}

/* ══════════════════════════════════════════
   作り方の選択（API生成 / Codex取り込み）
   ══════════════════════════════════════════ */
.way-card { display: block; cursor: pointer; }
.way-body {
  display: block;
  border: 1.5px solid #e2e8f0;
  border-radius: 0.625rem;
  padding: 0.875rem 1rem;
  background: #fff;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  height: 100%;
}
.way-card:hover .way-body { border-color: #cbd5e1; background: #fafbfc; }
.way-card input:checked + .way-body {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}
.way-title {
  display: block;
  font-size: 0.8125rem;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 0.25rem;
}
.way-desc { display: block; font-size: 0.6875rem; line-height: 1.55; color: #64748b; }

/* ── Codex取り込みの手順表示 ── */
.codex-flow { display: flex; flex-direction: column; gap: 0.875rem; }
.codex-step { display: flex; gap: 0.75rem; align-items: flex-start; }
.codex-num {
  flex: 0 0 1.5rem;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 9999px;
  background: #2563eb;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.05rem;
}
.codex-head { font-size: 0.8125rem; font-weight: 600; color: #0f172a; }
.codex-sub { font-size: 0.6875rem; line-height: 1.6; color: #64748b; margin-top: 0.15rem; }
.codex-sub code {
  background: #f1f5f9;
  border-radius: 0.25rem;
  padding: 0.05rem 0.3rem;
  font-size: 0.625rem;
  color: #0f172a;
}
.btn-copy {
  margin-top: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 1px solid #2563eb;
  color: #2563eb;
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.4rem 0.85rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn-copy:hover { background: #2563eb; color: #fff; }
.codex-note {
  margin-top: 1rem;
  border: 1px dashed #a7d3f5;
  background: #f0f8ff;
  border-radius: 0.5rem;
  padding: 0.7rem 0.85rem;
  font-size: 0.6875rem;
  line-height: 1.65;
  color: #1e4976;
}
.codex-note b { color: #0c3a63; }

/* ══════════════════════════════════════════
   選択式 案件シート
   ══════════════════════════════════════════ */

/* コンパクト版の way-card（入力方法の切り替え用） */
.way-card-sm .way-body { padding: 0.625rem 0.8rem; }
.way-card-sm .way-title { font-size: 0.78125rem; margin-bottom: 0.125rem; }
.way-card-sm .way-desc { font-size: 0.65rem; }

/* 小さいラベル・小さい入力欄 */
.lbl-sm {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
}
.inp-sm { padding: 0.4375rem 0.625rem; font-size: 0.8125rem; }
textarea.inp-sm { min-height: 0; resize: vertical; }

/* 選択肢のグループ枠 */
.opt-group {
  border: 1px solid #e8edf3;
  border-radius: 0.625rem;
  background: #fbfcfd;
  padding: 0.75rem 0.875rem 0.875rem;
}
.opt-group-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  margin-bottom: 0.5rem;
}
.opt-group-note {
  margin-left: 0.4rem;
  font-size: 0.625rem;
  font-weight: 400;
  color: #94a3b8;
}

/* チップ（複数選択） */
.chip-grid { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip { display: inline-block; cursor: pointer; }
.chip-body {
  display: inline-block;
  border: 1px solid #d6dde6;
  border-radius: 9999px;
  background: #fff;
  padding: 0.3125rem 0.6875rem;
  font-size: 0.75rem;
  line-height: 1.3;
  color: #475569;
  transition: border-color 0.12s, background 0.12s, color 0.12s;
  user-select: none;
}
.chip:hover .chip-body { border-color: #94a3b8; background: #f8fafc; }
.chip input:checked + .chip-body {
  border-color: #2563eb;
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}
.chip input:focus-visible + .chip-body {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
.chip input:disabled + .chip-body { opacity: 0.5; cursor: not-allowed; }

/* 指示書プレビュー枠 */
.sheet-preview {
  border: 1px dashed #bfdbfe;
  background: #f7fbff;
  border-radius: 0.625rem;
  padding: 0.75rem 0.875rem 0.875rem;
}
.sheet-preview .btn-copy { margin-top: 0; }
.sheet-preview textarea { min-height: 12rem; }
