/* 営業リスト自動作成の画面。
   見た目の題材は、会社名簿(見出しの耳が付いた帳面)と、地図に刺すピン。
   文字の大きさ・行の高さ・ボタンの高さは、実在の企業検索サービス11件を測った範囲に合わせている
   (本文16px、一覧14〜16px、結果の題28〜36px、ボタン44〜56px、表の行44〜58px、表は4〜6列、白地)。 */
:root {
  --ink: #25215e;
  --muted: #625f8a;
  --line: #d9d5ee;
  --paper: #ffffff;
  --page: #f6f5fc;       /* 帳面の紙の外の色 */
  --tint: #ebe8fa;
  --pin: #e2484d;        /* 地図のピン。新着と、押す所の印に使う */
  --pin-pale: #ffecec;
  --num: "Space Grotesk", "IBM Plex Sans JP", sans-serif;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: "IBM Plex Sans JP", "Hiragino Sans", "Yu Gothic", Meiryo, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}
h1, h2, h3, p, ul, ol, dl, dd { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--pin); outline-offset: 2px; }

.wrap { width: min(100% - 2rem, 76rem); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.book-head { padding: 1.5rem 0 1rem; }
.book-head .wrap { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.25rem 1rem; }
.book-head h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.02em; }
.book-head h1::before {
  content: "";
  display: inline-block;
  width: 0.7em; height: 0.7em;
  margin-right: 0.5rem;
  border-radius: 50% 50% 50% 0;
  background: var(--pin);
  transform: rotate(-45deg) translateY(-0.1em);
}
.updated { font-size: 0.8125rem; color: var(--muted); }

main.wrap { padding-bottom: 3rem; }

.banner { margin-bottom: 1rem; padding: 0.5rem 0.9rem; border-left: 4px solid var(--ink); background: var(--tint); font-size: 0.875rem; }
.banner-warn { border-left-color: var(--pin); background: var(--pin-pale); }

/* ---------- リストの切りかえ:帳面の見出しの耳 ---------- */
.list-tabs { display: flex; gap: 0.25rem; align-items: flex-end; overflow-x: auto; }
.tab {
  flex: 0 1 auto;
  display: grid;
  min-height: 3.25rem;
  padding: 0.4rem 1rem 0.5rem;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 0.6rem 0.6rem 0 0;
  background: var(--tint);
  text-align: left;
  cursor: pointer;
}
.tab-name { font-weight: 700; font-size: 0.9375rem; line-height: 1.4; }
.tab-count { font-size: 0.75rem; color: var(--muted); }
.tab[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tab[aria-pressed="true"] .tab-count { color: #cfcbf2; }

/* ---------- いまの条件を、1つの文で見せる ---------- */
.sentence {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 0.25rem 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--ink);
  color: #fff;
}
.sentence-text { font-size: 1.0625rem; line-height: 1.8; }
.sentence-list { font-weight: 700; }
.sentence-text b { font-weight: 500; padding: 0.05rem 0.4rem; background: rgba(255, 255, 255, 0.16); border-bottom: 2px solid var(--pin); white-space: nowrap; }
.sentence-count { font-family: var(--num); font-weight: 700; font-size: 3.5rem; line-height: 1; white-space: nowrap; }
.sentence-count small { margin-left: 0.2rem; font-family: "IBM Plex Sans JP", sans-serif; font-size: 1.125rem; font-weight: 500; }
.sentence-base { grid-column: 1 / -1; font-size: 0.8125rem; color: #cfcbf2; }

/* ---------- 条件の欄と、結果 ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--paper); border: 1px solid var(--line); border-top: 0; }
.layout > * { min-width: 0; }

.facets { padding: 1.25rem; border-bottom: 1px solid var(--line); }
.facets-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.facets h2 { font-size: 1.0625rem; }
.facet { border-bottom: 1px solid var(--line); }
.facet summary { display: flex; justify-content: space-between; align-items: center; min-height: 2.75rem; font-weight: 700; font-size: 0.9375rem; cursor: pointer; list-style: none; }
.facet summary::-webkit-details-marker { display: none; }
.facet summary::after { content: ""; width: 0.5rem; height: 0.5rem; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg) translateY(-0.15rem); }
.facet[open] summary::after { transform: rotate(-135deg) translateY(-0.15rem); }
.chosen { margin: 0 auto 0 0.6rem; padding: 0 0.4rem; background: var(--pin-pale); color: #a3262b; font-size: 0.75rem; font-weight: 500; }
.facet[open] { padding-bottom: 0.5rem; }

.check { display: flex; align-items: center; gap: 0.6rem; min-height: 2.25rem; font-size: 0.9375rem; cursor: pointer; }
.check input { flex: none; width: 1.125rem; height: 1.125rem; accent-color: var(--ink); }
.check .n { margin-left: auto; font-family: var(--num); font-size: 0.875rem; color: var(--muted); }
.check.is-zero { color: #9a98b8; }
.only-new { margin-top: 0.5rem; font-weight: 700; }
.facets-note { margin-top: 0.75rem; font-size: 0.75rem; color: var(--muted); }
.facets-close { display: none; margin-top: 1rem; width: 100%; }

.results { padding: 1.25rem; }
.results-head { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.results h2 { font-family: var(--num); font-size: 2rem; line-height: 1.2; }
.results h2 small { margin-left: 0.6rem; font-family: "IBM Plex Sans JP", sans-serif; font-size: 0.875rem; font-weight: 400; color: var(--muted); }

.active { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin-top: 0.75rem; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 2rem;
  padding: 0 0.3rem 0 0.75rem;
  border: 1px solid var(--ink);
  border-radius: 999px;
  background: var(--tint);
  font-size: 0.8125rem;
  cursor: pointer;
}
.chip-x { display: grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 50%; background: var(--ink); color: #fff; font-size: 0.875rem; line-height: 1; }
.link { padding: 0.25rem 0; border: 0; background: none; color: var(--ink); font-size: 0.875rem; text-decoration: underline; text-underline-offset: 0.2em; cursor: pointer; }

.tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 0.75rem; margin: 1rem 0 0.75rem; }
.search { flex: 1 1 16rem; }
.search input, .pick select {
  height: 2.75rem;
  padding: 0 0.8rem;
  border: 1px solid var(--muted);
  border-radius: 0.25rem;
  background: #fff;
}
.search input { width: 100%; }
.pick { display: flex; align-items: center; gap: 0.4rem; font-size: 0.875rem; white-space: nowrap; }
.columns { position: relative; font-size: 0.875rem; }
.columns summary { display: flex; align-items: center; height: 2.75rem; padding: 0 0.8rem; border: 1px solid var(--muted); border-radius: 0.25rem; background: #fff; cursor: pointer; list-style: none; }
.columns summary::-webkit-details-marker { display: none; }
.columns-box { position: absolute; right: 0; top: 3rem; z-index: 5; min-width: 11rem; padding: 0.5rem 0.9rem; border: 1px solid var(--ink); background: #fff; box-shadow: 4px 4px 0 var(--tint); }

/* ---------- 表 ---------- */
.table-wrap { border-top: 2px solid var(--ink); }
table { width: 100%; border-collapse: collapse; }
thead th { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--ink); font-size: 0.75rem; font-weight: 500; color: var(--muted); text-align: left; white-space: nowrap; }
tbody th, tbody td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 0.9375rem; font-weight: 400; }
.num { text-align: right !important; font-family: var(--num); white-space: nowrap; }
td.col-number, td.col-added { font-family: var(--num); white-space: nowrap; }
.company:hover { background: var(--page); }
.company.is-open { background: var(--tint); }
.company.is-open th, .company.is-open td { border-bottom-color: transparent; }

.name {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem 0.5rem;
  padding: 0;
  border: 0;
  background: none;
  font-weight: 700;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
}
.name-text { text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 0.25em; }
.name:hover .name-text { text-decoration-color: var(--ink); }
.name::before { content: "+"; display: grid; place-items: center; flex: none; width: 1.25rem; height: 1.25rem; border: 1px solid var(--ink); font-family: var(--num); font-size: 0.875rem; font-weight: 500; line-height: 1; }
.name[aria-expanded="true"]::before { content: "−"; background: var(--ink); color: #fff; }
.new { padding: 0 0.4rem; border-radius: 999px 999px 999px 0; background: var(--pin); color: #fff; font-size: 0.75rem; font-weight: 700; }
.summary { display: block; margin-left: 1.75rem; font-size: 0.8125rem; color: var(--muted); }

.detail-row td { padding: 0 0.75rem 1rem 2.5rem; background: var(--tint); }
.detail { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2rem; background: #fff; padding: 0.25rem 1rem; }
.detail div { display: grid; grid-template-columns: 8rem minmax(0, 1fr); gap: 0.75rem; padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.detail dt { font-size: 0.8125rem; color: var(--muted); padding-top: 0.1rem; }
.detail dd { font-size: 0.9375rem; overflow-wrap: anywhere; }
.detail dd small { display: block; font-size: 0.75rem; color: var(--muted); }
.detail-source { margin-top: 0.5rem; font-size: 0.75rem; color: var(--muted); }
.detail-source a { color: var(--ink); }

.none { margin-top: 1rem; padding: 1.25rem; border: 2px solid var(--pin); }
.none-title { font-weight: 700; font-size: 1.0625rem; }
.none ul { margin: 0.5rem 0 1rem; }
.none li { padding: 0.2rem 0; font-size: 0.9375rem; }

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 1rem; }
.pager-buttons { display: flex; flex-wrap: wrap; gap: 0.25rem; }
.pager-buttons button { min-width: 2.75rem; height: 2.75rem; padding: 0 0.7rem; border: 1px solid var(--line); border-radius: 0.25rem; background: #fff; font-family: var(--num); cursor: pointer; }
.pager-buttons button.is-current { background: var(--ink); border-color: var(--ink); color: #fff; font-weight: 700; }
.pager-buttons button:disabled { color: #9a98b8; cursor: not-allowed; }

.save { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.save-note { flex: 1 1 100%; font-size: 0.75rem; color: var(--muted); }
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0 1.4rem;
  border: 0; border-radius: 0.25rem;
  background: var(--ink); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer;
}
.button:hover { background: #18154a; }
.button-plain {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 3rem; padding: 0 1.1rem;
  border: 1px solid var(--ink); border-radius: 0.25rem;
  background: #fff; color: var(--ink); font-size: 0.9375rem; text-decoration: none; cursor: pointer;
}
.facets-open { display: none; }

/* ---------- リストに加わった会社の記録 ---------- */
.log { margin-top: 2rem; }
.log h2 { font-size: 1.25rem; }
.log-note { margin-top: 0.25rem; font-size: 0.875rem; color: var(--muted); }
.log-list { margin-top: 0.75rem; border-left: 2px solid var(--ink); }
.log-list li { position: relative; display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 0.75rem; padding: 0.6rem 0 0.6rem 1.25rem; }
.log-list li::before { content: ""; position: absolute; left: -0.45rem; top: 1rem; width: 0.7rem; height: 0.7rem; border-radius: 50% 50% 50% 0; background: var(--pin); transform: rotate(-45deg); }
.log-list time { font-family: var(--num); font-size: 0.875rem; color: var(--muted); padding-top: 0.1rem; }
.log-what { font-weight: 700; }
.log-names { font-size: 0.875rem; color: var(--muted); }

.site-footer { padding: 1.5rem 0 2rem; border-top: 1px solid var(--line); font-size: 0.8125rem; color: var(--muted); }
.site-footer a { color: var(--ink); }

/* ---------- 広い画面:左に条件、右に結果 ---------- */
@media (min-width: 60rem) {
  .layout { grid-template-columns: 17rem minmax(0, 1fr); }
  .facets { border-bottom: 0; border-right: 1px solid var(--line); }
}

/* ---------- 狭い画面:条件は押して開く。会社は、項目をしぼった1件ずつの形にする ---------- */
@media (max-width: 59.99rem) {
  .facets { display: none; }
  .show-facets .facets { display: block; }
  .show-facets .facets-close { display: inline-flex; }
  .facets-open { display: inline-flex; min-height: 2.75rem; flex: none; }
}
@media (max-width: 44rem) {
  .book-head h1 { font-size: 1.3125rem; }
  .tab { padding: 0.35rem 0.7rem 0.45rem; }
  .tab-name { font-size: 0.8125rem; }
  .sentence { grid-template-columns: 1fr; padding: 1rem; }
  .sentence-text { font-size: 0.9375rem; }
  .sentence-text b { white-space: normal; }
  .sentence-count { font-size: 2.75rem; }
  .results, .facets { padding: 1rem; }
  .results h2 { font-size: 1.5rem; }
  .results h2 small { display: block; margin: 0; }
  .pick { flex: 1 1 auto; }
  .pick select { flex: 1; min-width: 0; }
  .columns-box { right: auto; left: 0; }

  thead { display: none; }
  table, tbody, .company, .company th, .company td { display: block; }
  .company { padding: 0.7rem 0; border-bottom: 1px solid var(--line); }
  .company th, .company td { padding: 0; border: 0; }
  .company td { margin-left: 1.75rem; font-size: 0.8125rem; text-align: left !important; }
  .company td::before { content: attr(data-label) " "; color: var(--muted); font-family: "IBM Plex Sans JP", sans-serif; }
  .company td.col-location::before, .company td.col-industry::before { content: none; }
  /* 1件に出すのは、社名・事業・所在地・業種・従業員数まで。ほかは、開いた中で見る */
  .company td.col-founded, .company td.col-capital, .company td.col-number, .company td.col-added { display: none; }
  .company td.col-industry, .company td.col-employees { display: inline-block; }
  .company td.col-employees { margin-left: 0.9rem; }
  .company.is-open { padding-inline: 0.5rem; margin-inline: -0.5rem; }
  .detail-row, .detail-row td { display: block; }
  .detail-row td { padding: 0 0 0.9rem; margin-inline: -0.5rem; padding-inline: 0.5rem; }
  .detail { grid-template-columns: 1fr; padding: 0.25rem 0.75rem; }
  .detail div { grid-template-columns: 6.5rem minmax(0, 1fr); }
  .pager { justify-content: center; }
  .save > .button, .save > .button-plain { flex: 1 1 100%; }
  .log-list li { grid-template-columns: 1fr; gap: 0; }
}

/* スマートフォンでは、押す部品・入力欄の高さを44px以上にそろえる */
@media (max-width: 48rem) {
  button, select, a.button,
  input:not([type="radio"]):not([type="checkbox"]):not([type="hidden"]) { min-height: 2.75rem; }
}
