/* ─── ヘッダー（共通） ───────────────────────────────────────────────────────── */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: #232f3e; color: #fff;
  height: 54px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
  flex-shrink: 0;
}
.header-left  { display: flex; align-items: center; gap: 10px; }
.header-logo  { font-size: 0.85rem; color: #ff9900; font-weight: 700; text-decoration: none; letter-spacing: 0.5px; }
.header-sep   { color: #4a5568; font-size: 0.9rem; }
.header-title { font-size: 0.95rem; font-weight: 600; color: #e2e8f0; }
.header-right { display: flex; align-items: center; gap: 8px; }

/* ─── ステータスバッジ ───────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: 9999px;
  font-size: 0.75rem; font-weight: 600; white-space: nowrap;
}
.badge-pending    { background: #fef3c7; color: #92400e; }
.badge-processing { background: #dbeafe; color: #1e40af; }
.badge-completed  { background: #dcfce7; color: #166534; }
.badge-failed     { background: #fee2e2; color: #991b1b; }
.badge-retry      { background: #ede9fe; color: #5b21b6; }

/* 問い合わせステータス */
.badge-inquiry-none    { background: #f1f5f9; color: #64748b; }
.badge-inquiry-pending { background: #fef9c3; color: #713f12; }
.badge-inquiry-done    { background: #dbeafe; color: #1d4ed8; }
.badge-inquiry-trading { background: #dcfce7; color: #15803d; }

/* 売れ行きスコア */
.score-dot {
  display: inline-block; width: 10px; height: 10px;
  border-radius: 50%; margin-right: 2px;
}
.score-1 { color: #94a3b8; }
.score-2 { color: #60a5fa; }
.score-3 { color: #f59e0b; }
.score-4 { color: #10b981; }
.score-5 { color: #ef4444; }

/* ─── セクションカード（参考資料の section-card パターン） ───────────────────── */
.section-card {
  background: white;
  border-radius: 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  padding: 1.5rem;
  margin-bottom: 1rem;
}
.section-header {
  display: flex; align-items: center; gap: 12px; margin-bottom: 1.25rem;
}
.section-icon {
  width: 44px; height: 44px; border-radius: 0.75rem;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.section-icon-blue   { background: #dbeafe; color: #2563eb; }
.section-icon-green  { background: #dcfce7; color: #16a34a; }
.section-icon-orange { background: #ffedd5; color: #ea580c; }
.section-icon-purple { background: #ede9fe; color: #7c3aed; }
.section-icon-red    { background: #fee2e2; color: #dc2626; }
.section-icon-yellow { background: #fef9c3; color: #ca8a04; }
.section-icon-gray   { background: #f1f5f9; color: #475569; }

/* ─── キー情報ハイライト（参考資料の「まず確認すべき3項目」パターン） ────────── */
.key-info-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-bottom: 1.5rem;
}
@media (max-width: 768px) { .key-info-grid { grid-template-columns: 1fr; } }
.key-info-card {
  border-radius: 0.75rem; padding: 1rem 1.25rem;
  display: flex; flex-direction: column; gap: 4px;
}
.key-info-card.blue   { background: #eff6ff; border: 1.5px solid #bfdbfe; }
.key-info-card.green  { background: #f0fdf4; border: 1.5px solid #bbf7d0; }
.key-info-card.orange { background: #fff7ed; border: 1.5px solid #fed7aa; }
.key-info-label { font-size: 0.75rem; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: 0.05em; }
.key-info-value { font-size: 1.25rem; font-weight: 700; color: #1e293b; }
.key-info-sub   { font-size: 0.8rem; color: #64748b; }

/* ─── テーブル ─────────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th {
  background: #f8fafc; color: #475569; font-weight: 600;
  padding: 8px 10px; text-align: left; border-bottom: 2px solid #e2e8f0;
  white-space: nowrap; font-size: 0.8rem;
}
.data-table td {
  padding: 8px 10px; border-bottom: 1px solid #f1f5f9;
  vertical-align: middle;
}
.data-table tr:hover td { background: #f8fafc; }
.data-table .td-url {
  max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ─── フィルターバー ─────────────────────────────────────────────────────────── */
.filter-bar {
  background: white; border-radius: 0.75rem;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  padding: 1rem 1.25rem; margin-bottom: 1.25rem;
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
}
.filter-group { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: 0.75rem; font-weight: 600; color: #64748b; }
.filter-input, .filter-select {
  padding: 6px 10px; border: 1.5px solid #e2e8f0; border-radius: 6px;
  font-size: 0.85rem; outline: none; background: white;
  transition: border-color 0.15s;
}
.filter-input:focus, .filter-select:focus { border-color: #ff9900; }
.filter-search { min-width: 200px; }

/* ─── ボタン ─────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px; font-size: 0.875rem; font-weight: 600;
  cursor: pointer; border: none; transition: all 0.15s; white-space: nowrap;
}
.btn-primary   { background: #ff9900; color: white; }
.btn-primary:hover { background: #e68a00; }
.btn-secondary { background: #f1f5f9; color: #475569; border: 1.5px solid #e2e8f0; }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger    { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-run       { background: #fff7ed; color: #c2410c; border: 1.5px solid #fed7aa; }
.btn-run:hover { background: #ffedd5; }
.btn-run:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-sm { padding: 5px 10px; font-size: 0.8rem; }
.btn-icon { padding: 6px; }

/* ─── モーダル ───────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 1rem;
}
.modal-box {
  background: white; border-radius: 1rem; width: 100%; max-width: 560px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.modal-header {
  padding: 1.25rem 1.5rem; border-bottom: 1px solid #f1f5f9;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-title  { font-size: 1.1rem; font-weight: 700; color: #1e293b; }
.modal-body   { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid #f1f5f9; display: flex; justify-content: flex-end; gap: 8px; }

/* ─── フォーム ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-label { display: block; font-size: 0.875rem; font-weight: 600; color: #374151; margin-bottom: 6px; }
.form-label .required { color: #dc2626; margin-left: 4px; }
.form-input, .form-textarea, .form-select {
  width: 100%; padding: 9px 12px; border: 1.5px solid #e2e8f0; border-radius: 8px;
  font-size: 0.875rem; outline: none; transition: border-color 0.15s; box-sizing: border-box;
}
.form-input:focus, .form-textarea:focus, .form-select:focus { border-color: #ff9900; }
.form-textarea { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.75rem; color: #94a3b8; margin-top: 4px; }

/* ─── 詳細ページ目次（参考資料の toc パターン） ──────────────────────────────── */
.detail-toc {
  position: fixed; right: 1.5rem; top: 50%; transform: translateY(-50%);
  background: white; padding: 1rem; border-radius: 0.75rem;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 80vh; overflow-y: auto; z-index: 50; width: 160px;
}
@media (max-width: 1280px) { .detail-toc { display: none; } }
.toc-item {
  display: block; padding: 5px 8px; border-radius: 6px; font-size: 0.8rem;
  color: #64748b; text-decoration: none; transition: all 0.1s;
}
.toc-item:hover, .toc-item.active { background: #fff7ed; color: #ff9900; font-weight: 600; }

/* ─── 価格表示 ───────────────────────────────────────────────────────────────── */
.price-range { display: flex; align-items: baseline; gap: 4px; }
.price-min   { font-size: 0.8rem; color: #64748b; }
.price-med   { font-size: 1.1rem; font-weight: 700; color: #1e293b; }
.price-max   { font-size: 0.8rem; color: #64748b; }

/* ─── モール価格カード ─────────────────────────────────────────────────────── */
.marketplace-card {
  border: 1.5px solid #e2e8f0; border-radius: 0.75rem; padding: 1rem;
  display: flex; flex-direction: column; gap: 8px;
}
.marketplace-name { font-size: 0.875rem; font-weight: 700; color: #1e293b; }
.marketplace-price { font-size: 1.25rem; font-weight: 700; color: #dc2626; }

/* ─── スペック表 ─────────────────────────────────────────────────────────────── */
.spec-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.spec-table th { background: #f8fafc; width: 35%; padding: 8px 12px; text-align: left; border: 1px solid #e2e8f0; color: #475569; font-weight: 600; }
.spec-table td { padding: 8px 12px; border: 1px solid #e2e8f0; color: #1e293b; }

/* ─── 利益計算ブロック ─────────────────────────────────────────────────────── */
.calc-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid #f1f5f9; font-size: 0.9rem;
}
.calc-row:last-child { border-bottom: none; }
.calc-label { color: #64748b; }
.calc-value { font-weight: 600; color: #1e293b; }
.calc-row.calc-result { background: #fff7ed; border-radius: 8px; padding: 12px; margin-top: 8px; }
.calc-row.calc-result .calc-label { color: #92400e; font-weight: 700; }
.calc-row.calc-result .calc-value { color: #ea580c; font-size: 1.2rem; }

/* ─── トークスクリプト ─────────────────────────────────────────────────────── */
.script-block {
  background: #1e293b; color: #e2e8f0;
  padding: 1.25rem; border-radius: 0.75rem;
  font-family: 'Noto Sans JP', sans-serif; font-size: 0.875rem;
  line-height: 1.8; white-space: pre-wrap;
}

/* ─── 編集履歴 ──────────────────────────────────────────────────────────────── */
.log-item {
  display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f5f9;
}
.log-dot { width: 8px; height: 8px; border-radius: 50%; background: #cbd5e1; margin-top: 6px; flex-shrink: 0; }
.log-dot.dot-system  { background: #94a3b8; }
.log-dot.dot-user    { background: #ff9900; }
.log-meta { font-size: 0.75rem; color: #94a3b8; }

/* ─── 空状態 ─────────────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center; padding: 3rem 1rem; color: #94a3b8;
}
.empty-state i { margin-bottom: 1rem; }

/* ─── ローディング ───────────────────────────────────────────────────────────── */
.loading-spinner {
  display: inline-block; width: 20px; height: 20px;
  border: 2px solid #e2e8f0; border-top-color: #ff9900;
  border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── トースト通知 ───────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 9999;
  padding: 12px 20px; border-radius: 8px; font-size: 0.875rem; font-weight: 600;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
  transform: translateY(100px); opacity: 0; transition: all 0.3s;
  pointer-events: none;
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.toast-success { background: #166534; color: white; }
#toast.toast-error   { background: #991b1b; color: white; }
#toast.toast-info    { background: #1e40af; color: white; }
