/* ─── ヘッダー（共通） ───────────────────────────────────────────────────────── */
.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; }

/* ─── アプリ固有 ───────────────────────────────────────────────────────────── */
body { font-family: 'Segoe UI', 'Noto Sans JP', sans-serif; background: #f4f6f9; margin: 0; color: #333; }
.main { max-width: 1200px; margin: 0 auto; padding: 24px; }

/* カード */
.card { background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.08); padding: 20px; margin-bottom: 16px; }

/* 入力フォーム */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: #555; margin-bottom: 5px; }
.form-group input, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.9rem; }
.form-group input:focus, .form-group select:focus { outline: none; border-color: #ff9900; box-shadow: 0 0 0 2px rgba(255,153,0,0.2); }

/* ボタン */
.btn-primary { background: #ff9900; color: #fff; border: none; padding: 10px 24px; border-radius: 6px; font-size: 0.9rem; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: #e68a00; }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary { background: #e5e7eb; color: #333; border: none; padding: 8px 18px; border-radius: 6px; font-size: 0.85rem; cursor: pointer; }
.btn-secondary:hover { background: #d1d5db; }
.btn-outline { background: transparent; border: 2px solid #ff9900; color: #ff9900; padding: 8px 18px; border-radius: 6px; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.btn-outline:hover { background: #fff7eb; }

/* プログレス */
.progress-bar { width: 100%; height: 8px; background: #e5e7eb; border-radius: 4px; overflow: hidden; margin: 12px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #ff9900, #f59e0b); border-radius: 4px; transition: width 0.5s ease; }

/* 画像グリッド */
.proposal-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.proposal-card { border: 2px solid #e5e7eb; border-radius: 10px; padding: 12px; cursor: pointer; transition: border-color 0.2s, box-shadow 0.2s; background: #fff; }
.proposal-card:hover { border-color: #ff9900; box-shadow: 0 2px 12px rgba(255,153,0,0.15); }
.proposal-card.selected { border-color: #ff9900; box-shadow: 0 0 0 3px rgba(255,153,0,0.3); }
.proposal-label { font-weight: 700; font-size: 1rem; margin-bottom: 8px; color: #232f3e; }
.proposal-images { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.proposal-images img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid #e5e7eb; }

/* スケルトン */
.skeleton { background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 6px; aspect-ratio: 1; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* 微調整ビュー */
.refine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; }
.refine-item { position: relative; cursor: pointer; border-radius: 8px; overflow: hidden; border: 2px solid transparent; transition: border-color 0.2s; }
.refine-item:hover { border-color: #ff9900; }
.refine-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.refine-item .overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); display: none; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 0.85rem; }
.refine-item:hover .overlay { display: flex; }
.refine-item.loading img { opacity: 0.3; }
.refine-item .spinner { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.refine-item .spinner::after { content: ''; width: 32px; height: 32px; border: 3px solid #ff990066; border-top-color: #ff9900; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* モーダル */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 560px; max-width: 90vw; max-height: 85vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,0.3); }
.modal h3 { font-size: 1rem; font-weight: 700; margin-bottom: 16px; color: #232f3e; }
.modal textarea { width: 100%; min-height: 100px; padding: 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 0.85rem; resize: vertical; }
.modal textarea:focus { outline: none; border-color: #ff9900; }

/* テーブル */
.sessions-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.sessions-table th { text-align: left; padding: 8px 12px; background: #f9fafb; color: #6b7280; font-weight: 600; border-bottom: 1px solid #e5e7eb; }
.sessions-table td { padding: 8px 12px; border-bottom: 1px solid #f3f4f6; }
.sessions-table tr:hover td { background: #fefce8; }
.sessions-table .status-badge { padding: 2px 8px; border-radius: 10px; font-size: 0.75rem; font-weight: 600; }
.status-completed { background: #dcfce7; color: #166534; }
.status-generating { background: #fef3c7; color: #92400e; }
.status-failed { background: #fce4ec; color: #c62828; }
.status-preparing, .status-identifying, .status-prompting { background: #e0f2fe; color: #0369a1; }
.status-refining { background: #f3e8ff; color: #7c3aed; }
