/* 産業分類を探す */

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: #1a202c;
  background: #f7f8fa;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
}

/* ── ヘッダー ── */
.header {
  padding: 1.5rem 0 1rem;
  border-bottom: 1px solid #e2e8f0;
  margin-bottom: 1.25rem;
}
.header h1 {
  margin: 0 0 0.2rem;
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a202c;
}
.subtitle {
  margin: 0;
  font-size: 0.875rem;
  color: #718096;
}

/* ── ローディング / エラー ── */
.loading { padding: 2.5rem; text-align: center; color: #718096; }
.error {
  padding: 1rem 1.25rem;
  background: #fff5f5;
  border: 1px solid #fc8181;
  border-radius: 8px;
  color: #c53030;
}
.error p { margin: 0; }

/* ── 検索 ── */
.search-area { margin-bottom: 1rem; }

.search-input {
  display: block;
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1.05rem;
  border: 2px solid #cbd5e0;
  border-radius: 10px;
  background: #fff;
  color: #1a202c;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input:focus {
  border-color: #4299e1;
  box-shadow: 0 0 0 3px rgba(66,153,225,0.18);
}

.result-count {
  margin: 0.4rem 0 0;
  font-size: 0.82rem;
  color: #718096;
  min-height: 1.2em;
}

/* ── ツリー折りたたみ ── */
.browse-details {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 1.25rem;
  overflow: hidden;
}
.browse-details summary {
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  color: #4a5568;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.browse-details summary::before {
  content: '▶';
  font-size: 0.65rem;
  transition: transform 0.15s;
  color: #718096;
}
.browse-details[open] summary::before { transform: rotate(90deg); }
.browse-details summary:hover { background: #f7f8fa; }

.browse-inner { padding: 0.75rem 1rem 1rem; border-top: 1px solid #e2e8f0; }
.browse-level { margin-bottom: 0.85rem; }
.browse-level:last-child { margin-bottom: 0; }
.browse-level label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: #4a5568;
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.browse-level select {
  width: 100%;
  max-width: 420px;
  padding: 0.45rem 0.75rem;
  border: 1px solid #cbd5e0;
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: #2d3748;
}

/* ピル */
.pills { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pill {
  padding: 0.3rem 0.7rem;
  border: 1px solid #a0aec0;
  border-radius: 999px;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  color: #4a5568;
  transition: background 0.1s, border-color 0.1s, color 0.1s;
}
.pill:hover { background: #edf2f7; border-color: #718096; }
.pill.active { background: #3182ce; border-color: #3182ce; color: #fff; }

/* ── 結果カード（一覧） ── */
.results { display: flex; flex-direction: column; gap: 0.6rem; }

.result-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  role: listitem;
}
.result-card:hover {
  border-color: #90cdf4;
  box-shadow: 0 2px 12px rgba(66,153,225,0.12);
  transform: translateY(-1px);
}
.result-card:active { transform: translateY(0); }

.rc-breadcrumb {
  font-size: 0.75rem;
  color: #a0aec0;
  margin-bottom: 0.3rem;
  line-height: 1.4;
}
.rc-title {
  font-size: 1rem;
  font-weight: 700;
  color: #2b6cb0;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.rc-code {
  font-size: 0.78rem;
  background: #ebf8ff;
  color: #2b6cb0;
  border: 1px solid #bee3f8;
  border-radius: 4px;
  padding: 0 0.4em;
  font-weight: 600;
  font-family: monospace;
  flex-shrink: 0;
}
.rc-desc {
  font-size: 0.875rem;
  color: #4a5568;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.rc-examples {
  font-size: 0.82rem;
  color: #718096;
  margin-top: 0.3rem;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── 詳細パネル ── */
.detail-panel { padding-top: 0.25rem; }

.detail-close {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.45rem 1rem;
  margin-bottom: 1.25rem;
  background: #edf2f7;
  border: 1px solid #cbd5e0;
  border-radius: 7px;
  font-size: 0.875rem;
  color: #4a5568;
  cursor: pointer;
  font-weight: 600;
  transition: background 0.12s;
}
.detail-close:hover { background: #e2e8f0; }

/* 詳細メインカード */
.detail-main {
  background: #fff;
  border: 2px solid #bee3f8;
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1.5rem;
}
.dm-breadcrumb {
  font-size: 0.78rem;
  color: #718096;
  margin-bottom: 0.6rem;
}
.dm-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1a365d;
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}
.dm-code {
  font-size: 0.85rem;
  background: #ebf8ff;
  color: #2b6cb0;
  border: 1px solid #bee3f8;
  border-radius: 5px;
  padding: 0.05em 0.5em;
  font-family: monospace;
  font-weight: 600;
}
.dm-desc {
  font-size: 0.95rem;
  color: #2d3748;
  margin-bottom: 1rem;
  line-height: 1.7;
}

/* 事例ボックス */
.examples-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}
@media (max-width: 560px) { .examples-row { grid-template-columns: 1fr; } }

.ex-box {
  border-radius: 8px;
  padding: 0.75rem 0.9rem;
  font-size: 0.875rem;
  line-height: 1.6;
}
.ex-box-yes {
  background: #f0fff4;
  border: 1px solid #9ae6b4;
}
.ex-box-no {
  background: #fff5f5;
  border: 1px solid #feb2b2;
}
.ex-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.ex-label-yes { color: #276749; }
.ex-label-no  { color: #9b2c2c; }
.ex-label-icon { font-size: 0.9rem; }
.ex-body { color: #2d3748; }

/* 不適合事例リスト */
.fugou-list { list-style: none; margin: 0; padding: 0; }
.fugou-item {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}
.fugou-text { color: #742a2a; }
.fugou-arrow { color: #718096; font-size: 0.8rem; }
.fugou-code {
  font-size: 0.78rem;
  background: #fff5f5;
  color: #9b2c2c;
  border: 1px solid #feb2b2;
  border-radius: 4px;
  padding: 0 0.4em;
  font-family: monospace;
  font-weight: 600;
  white-space: nowrap;
}

/* ── 類似比較セクション ── */
.similar-section {
  margin-top: 0.5rem;
}
.similar-heading {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #718096;
  margin-bottom: 0.9rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.similar-heading::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #e2e8f0;
}

.similar-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.85rem;
}

.similar-card {
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.similar-card:hover {
  border-color: #90cdf4;
  box-shadow: 0 2px 10px rgba(66,153,225,0.1);
}

.sc-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2b6cb0;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
  flex-wrap: wrap;
}
.sc-code {
  font-size: 0.75rem;
  background: #ebf8ff;
  color: #2b6cb0;
  border: 1px solid #bee3f8;
  border-radius: 4px;
  padding: 0 0.4em;
  font-family: monospace;
  font-weight: 600;
}
.sc-desc {
  font-size: 0.82rem;
  color: #4a5568;
  line-height: 1.55;
  margin-bottom: 0.5rem;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sc-distinction {
  font-size: 0.8rem;
  padding: 0.45rem 0.6rem;
  background: #fffaf0;
  border: 1px solid #fbd38d;
  border-radius: 6px;
  color: #744210;
  line-height: 1.55;
}
.sc-distinction-label {
  font-weight: 700;
  margin-right: 0.3em;
}

/* ── レスポンシブ ── */
@media (max-width: 640px) {
  #app { padding: 0 0.75rem 3rem; }
  .header h1 { font-size: 1.2rem; }
  .similar-cards { grid-template-columns: 1fr; }
  .dm-title { font-size: 1.1rem; }
}
