/* 名刺ホルダー：業種の札で絞り込み、名刺を格子に並べる。色と書体はここの :root だけで決めている。 */
:root {
  --bg: #eceff3;
  --card: #ffffff;
  --ink: #17202b;
  --sub: #556173;
  --line: #d3dae3;
  --ai: #1f4b8e;
  --ai-soft: #e2eaf6;
  --on-ai: #ffffff;
  --shu: #b83a27;
  --shu-soft: #fbeae6;
  --ok: #23693f;
  --ok-soft: #e4f3ea;
  --shadow: 0 1px 2px rgba(23, 32, 43, .08), 0 6px 16px rgba(23, 32, 43, .06);

  --f-display: "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif CJK JP", "Noto Serif JP", serif;
  --f-body: "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Yu Gothic", "YuGothic", "Noto Sans CJK JP", "Noto Sans JP", Meiryo, sans-serif;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 40px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10161d; --card: #1a222c; --ink: #e8edf3; --sub: #9aa7b8; --line: #2e3a48;
    --ai: #8fb4ee; --ai-soft: #1c2b43; --on-ai: #0e1a2c;
    --shu: #ee8572; --shu-soft: #3a1f1a; --ok: #7fd3a0; --ok-soft: #173224;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.7;
}
a { color: var(--ai); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .92em; background: var(--ai-soft); padding: 1px 6px; border-radius: 4px; }
.wrap {
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: var(--s4);
  padding-block: calc(var(--s5) + env(safe-area-inset-top, 0px)) calc(var(--s6) + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}
.small { font-size: 14px; color: var(--sub); }
.nowrap { white-space: nowrap; }

/* 見出し */
.masthead { display: flex; flex-direction: column; gap: var(--s2); }
.eyebrow { font-size: 14px; font-weight: 700; letter-spacing: .18em; color: var(--ai); }
h1 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 800;
  font-size: clamp(30px, 7.4vw, 52px);
  line-height: 1.25;
  letter-spacing: .04em;
  text-wrap: balance;
}
.lead { margin: 0; max-width: 34em; color: var(--sub); }
.lead b { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ボタン */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  font: inherit; font-weight: 700; text-decoration: none;
  min-height: 48px; padding: 8px 22px;
  color: var(--on-ai); background: var(--ai);
  border: 1.5px solid var(--ai); border-radius: 999px; cursor: pointer;
}
.btn.ghost { color: var(--ai); background: transparent; }
.btn.warn { color: var(--shu); background: transparent; border-color: var(--shu); }
.btn.big { min-height: 58px; font-size: 19px; width: 100%; }
.btn.sm { min-height: 36px; padding: 2px 14px; font-size: 14px; white-space: nowrap; }
:is(.btn, .chip, input, select, textarea, a):focus-visible { outline: 3px solid var(--ai); outline-offset: 2px; }

/* 自分の登録 */
.mine {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s3) var(--s4);
  padding: var(--s4); background: var(--ai-soft); border-radius: 6px;
}
.mine p { margin: 0; flex: 1 1 280px; min-width: 0; font-size: 16px; }

/* 絞り込み */
.controls { display: flex; flex-direction: column; gap: var(--s3); }
.search { display: flex; flex-direction: column; gap: var(--s1); }
.search label { font-size: 14px; font-weight: 700; color: var(--sub); }
.search input { max-width: 420px; }
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: 0; padding: 0; list-style: none; }
.chip {
  font: inherit; font-weight: 700; font-size: 16px;
  display: inline-flex; align-items: center; gap: var(--s2);
  min-height: 46px; padding: 6px 16px;
  color: var(--ai); background: var(--card);
  border: 1.5px solid var(--ai); border-radius: 999px; cursor: pointer;
}
.chip .n { font-variant-numeric: tabular-nums; font-weight: 500; font-size: 14px; opacity: .8; }
.chip[aria-pressed="true"] { background: var(--ai); color: var(--on-ai); }
.status { margin: 0; font-size: 15px; color: var(--sub); font-variant-numeric: tabular-nums; }

/* 名刺 */
.grid {
  display: grid; gap: var(--s4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  margin: 0; padding: 0; list-style: none;
}
.meishi {
  min-width: 0; height: 100%;
  display: flex; flex-direction: column; gap: var(--s3);
  background: var(--card); border-radius: 4px; box-shadow: var(--shadow);
  padding: var(--s5) var(--s5) var(--s4);
}
.meishi .top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.cat {
  font-size: 13px; font-weight: 700; letter-spacing: .08em;
  color: var(--ai); background: var(--ai-soft);
  padding: 3px 10px; border-radius: 3px;
}
.who { display: flex; gap: var(--s3); align-items: center; }
.mark {
  flex: none; width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-display); font-weight: 800; font-size: 26px; line-height: 1;
  color: var(--ai); border: 1.5px solid var(--ai);
}
.who .txt { min-width: 0; }
.yago {
  margin: 0;
  font-family: var(--f-display); font-weight: 800; font-size: 23px; line-height: 1.35;
  letter-spacing: .02em; overflow-wrap: anywhere;
}
.rep { margin: 0; font-size: 15px; color: var(--sub); overflow-wrap: anywhere; }
.pr { margin: 0; flex: 1; overflow-wrap: anywhere; }
.contact {
  display: grid; grid-template-columns: auto 1fr; align-items: baseline;
  column-gap: var(--s3); row-gap: var(--s1);
  margin: 0; padding-top: var(--s3);
  border-top: 1px solid var(--line);
  font-size: 15px;
}
.contact dt { color: var(--sub); font-size: 13px; font-weight: 700; letter-spacing: .08em; }
.contact dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tel {
  font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em;
  white-space: nowrap; text-underline-offset: 4px;
}
.tel-none { color: var(--sub); }

.empty {
  padding: var(--s5); text-align: center;
  border: 1px dashed var(--line); border-radius: 4px; color: var(--sub);
  display: flex; flex-direction: column; align-items: center; gap: var(--s3);
}
.empty p { margin: 0; }

/* 入力欄 */
input[type="text"], input[type="tel"], input[type="search"], input[type="password"], select, textarea {
  width: 100%;
  font: inherit; color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line); border-radius: 6px;
  padding: 10px 14px; min-height: 50px;
}
textarea { min-height: 104px; resize: vertical; }
[aria-invalid="true"] { border-color: var(--shu); }

.form { display: flex; flex-direction: column; gap: var(--s5); max-width: 640px; }
.q {
  margin: 0; min-width: 0;
  display: flex; flex-direction: column; gap: var(--s4);
  background: var(--card); border: 0; border-radius: 6px; box-shadow: var(--shadow);
  padding: var(--s5);
}
.q legend {
  float: left; width: 100%; padding: 0;
  font-family: var(--f-display); font-weight: 800; font-size: 22px; letter-spacing: .04em;
  display: flex; align-items: center; gap: var(--s3);
}
.q legend + * { clear: both; }
.q legend b {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--f-body); font-size: 17px; color: var(--on-ai); background: var(--ai);
}
.fld { display: flex; flex-direction: column; gap: var(--s1); }
.fld label { font-weight: 700; }
.hint { margin: 0; font-size: 14px; color: var(--sub); }
.req { display: inline-block; white-space: nowrap; font-size: 12px; font-weight: 700; color: var(--shu); border: 1px solid var(--shu); border-radius: 3px; padding: 0 5px; margin-left: 4px; vertical-align: 2px; }
.err { margin: 0; font-size: 15px; font-weight: 700; color: var(--shu); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.choices { display: grid; gap: var(--s3); grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.choice {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s4); border: 2px solid var(--line); border-radius: 8px; cursor: pointer;
}
.choice:has(input:checked) { border-color: var(--ai); background: var(--ai-soft); }
.choice input, .check input { flex: none; width: 24px; height: 24px; margin: 3px 0 0; accent-color: var(--ai); }
.choice span { display: flex; flex-direction: column; min-width: 0; }
.choice strong { font-size: 19px; }
.choice small { font-size: 14px; color: var(--sub); }
.check { display: flex; gap: var(--s3); align-items: flex-start; cursor: pointer; font-weight: 700; }
.ifpub { display: flex; flex-direction: column; gap: var(--s3); padding-left: var(--s2); }
.pub:has(#pub0:checked) .ifpub { opacity: .45; }

.danger .q { box-shadow: none; border: 1px dashed var(--shu); background: transparent; }
.danger .btn { align-self: flex-start; }

.done, .errbox, .panel {
  display: flex; flex-direction: column; gap: var(--s3);
  padding: var(--s5); border-radius: 6px;
}
.done { background: var(--ok-soft); border-left: 0; }
.done h2 { margin: 0; font-family: var(--f-display); font-size: 26px; color: var(--ok); }
.done p, .errbox p, .panel p { margin: 0; }
.errbox { background: var(--shu-soft); max-width: 640px; }
.errbox ul { margin: 0; padding-left: 1.3em; }
.panel { background: var(--card); box-shadow: var(--shadow); }
.panel h2 { margin: 0; font-family: var(--f-display); font-size: 22px; letter-spacing: .04em; }
.urlbox { display: flex; flex-wrap: wrap; gap: var(--s2); }
.urlbox input { flex: 1 1 260px; min-width: 0; font-size: 14px; }
.back { margin: 0; }

.foot {
  border-top: 1px solid var(--line); padding-top: var(--s4);
  font-size: 14px; color: var(--sub);
  display: flex; flex-direction: column; gap: var(--s1);
}
.foot p { margin: 0; max-width: 44em; }
.foot strong { color: var(--ink); }

/* 管理画面 */
.facts { display: grid; grid-template-columns: auto 1fr; gap: var(--s2) var(--s4); margin: 0; }
.facts dt { font-weight: 700; color: var(--sub); white-space: nowrap; }
.facts dd { margin: 0; min-width: 0; }
.bad { color: var(--shu); font-weight: 700; }
.good { color: var(--ok); font-weight: 700; }
.inline { display: block; }
.tablewrap { overflow-x: auto; }
.list { border-collapse: collapse; width: 100%; font-size: 15px; }
.list th, .list td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.list th { font-size: 13px; color: var(--sub); white-space: nowrap; }
.list td { min-width: 5em; }
.list td:nth-child(2) { min-width: 9em; }
.list td:nth-child(5) { min-width: 11em; }
.list .num { font-variant-numeric: tabular-nums; min-width: 0; }
.pill { font-size: 13px; font-weight: 700; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--sub); }
.pill.on { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.del { display: flex; flex-direction: column; gap: var(--s1); align-items: flex-start; min-width: 4.5em; }
.qrs { display: flex; flex-wrap: wrap; gap: var(--s5); }
.qrs figure { margin: 0; display: flex; flex-direction: column; gap: var(--s2); max-width: 260px; }
.qr { background: #ffffff; padding: 12px; border-radius: 6px; width: 244px; max-width: 100%; }
.qr img, .qr canvas { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.url { font-size: 13px; color: var(--sub); overflow-wrap: anywhere; }

@media (min-width: 720px) {
  .controls { flex-direction: row; align-items: flex-end; flex-wrap: wrap; gap: var(--s4); }
  .search { flex: 0 1 260px; }
  .chips { flex: 1 1 420px; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .chip, .choice { transition: background-color .15s, color .15s, border-color .15s; }
}
