/* ===== 画面の骨組み（メンバー用・管理用 共通） ===== */
.bar .title { color: #fff; text-decoration: none; display: block; min-width: 0; }
.head { align-items: center; flex-direction: row !important; }
.iconbtn { background: none; border: 0; color: #fff; padding: 6px; margin-left: -6px; display: grid; place-items: center; }
.iconbtn svg { font-size: 24px; }
.actions { margin-top: 0 !important; align-self: center !important; }
.layout { max-width: 1240px; margin: 0 auto; }
.content { max-width: none; }
#page.narrow { max-width: 780px; margin: 0 auto; }

/* 左のメニュー（PC） */
.side { display: none; }
.sgroup { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .08em; margin: 18px 12px 6px; }
.slink { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 10px; color: var(--text);
  text-decoration: none; font-size: 15px; background: none; border: 0; text-align: left; }
.slink svg { font-size: 20px; color: var(--muted); }
.slink:hover { background: var(--card); }
.slink.on { background: var(--red-soft); color: var(--red); font-weight: 700; }
.slink.on svg { color: var(--red); }
.nbadge { font-style: normal; margin-left: auto; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; border-radius: 999px;
  min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center; }

@media (min-width: 900px) {
  .layout { display: grid; grid-template-columns: 220px 1fr; gap: 8px; align-items: start; }
  .side:not([hidden]) { display: block; position: sticky; top: 0; padding: 12px 8px 40px; max-height: 100vh; overflow-y: auto; }
  .tabs, #menuBtn { display: none !important; }
  body.member { padding-bottom: 0; }
}

/* 下のタブ（スマホ）：5つまで */
.tabs { justify-content: stretch !important; } /* 列の数はタブの数に合わせて JS で決める */
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 3px; height: 56px; font-size: 11px;
  color: var(--muted); text-decoration: none; position: relative; }
.tabs a svg { font-size: 22px; }
.tabs a.on { color: var(--red); font-weight: 700; }
.tabs a .nbadge { position: absolute; top: 2px; left: 55%; margin: 0; }
.tabs a.center .plus { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--red); color: #fff; }
.tabs a.center .plus svg { font-size: 20px; stroke-width: 2.5; }

/* 名簿ページ上の赤い検索帯 */
.band { background: var(--red); margin: -16px -16px 0; padding: 4px 16px 16px; }
.band .search { margin-top: 0; }
@media (min-width: 900px) { .band { margin: 0 0 0; border-radius: 14px; padding: 14px 16px; } }
#page .chips { position: sticky; top: 0; margin: 0 -16px; }
@media (min-width: 900px) { #page .chips { margin: 0; border-radius: 0 0 12px 12px; } }
.meeting { margin-top: 14px; }

/* ホーム */
.hello { font-size: 20px; margin: 4px 0 14px; }
.hgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.hcard { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; color: var(--text); text-decoration: none; }
a.hcard:hover { border-color: var(--red-line); }
.hcard.accent { background: var(--red-soft); border-color: var(--red-line); }
.hlabel { font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.hbig { font-size: 22px; font-weight: 800; color: var(--red); }
.hbig.warn { color: #c2410c; }
.hsub { font-size: 14px; color: var(--muted); margin-top: 4px; }
.hcard .stack { margin-top: 12px; }
.hrow { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--line); }
.hrow:first-of-type { border-top: 0; padding-top: 0; }

/* メニュー（スマホの ☰） */
.mgroup { font-size: 13px; color: var(--muted); margin: 20px 4px 8px; }
.mlist { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.mitem { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border: 0; border-top: 1px solid var(--line);
  background: none; color: var(--text); text-decoration: none; font-size: 16px; text-align: left; }
.mitem:first-child { border-top: 0; }
.mitem svg { font-size: 22px; color: var(--muted); }
.mitem span:first-of-type { flex: 1; }
.mitem .chev { font-size: 18px; }
.mitem.danger { color: var(--red); }

/* 会費 */
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.kv:first-child { border-top: 0; }
.kv span { color: var(--muted); }
.card .notice { margin-top: 12px; }
.empty .primary.sm { margin-top: 10px; }

/* ===== レスポンシブ調整（画面の幅に合わせる） ===== */
/* 中身がはみ出さないように（横に長いチップ等があっても列が広がらない） */
.layout { max-width: 1440px; }
@media (min-width: 900px) { .layout { grid-template-columns: 220px minmax(0, 1fr); } }
.content { min-width: 0; }
.bar { text-align: left; }
.bar .head { max-width: 1440px; }
.title h1, .title .sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* ☰ は下の「メニュー」タブと同じなので出さない */
#menuBtn { display: none !important; }

/* スマホ：ヘッダーを1行におさめる */
@media (max-width: 640px) {
  .bar { padding: calc(10px + env(safe-area-inset-top)) 0 10px; }
  .bar h1 { font-size: 15px; }
  .bar .sub { font-size: 11px; margin-top: 2px; }
  .hbtn { padding: 3px 10px 3px 3px; font-size: 12px; }
  .hbtn .av.xs { width: 26px; height: 26px; }
  .band { padding-top: 10px; }
  /* 名簿カードを少しコンパクトに */
  .grid { gap: 10px; }
  .mcard { padding: 12px; gap: 12px; }
  .mcard .photo { width: 64px; height: 78px; }
  .nm { font-size: 16px; }
}
/* タブレット：名簿は2列、PCは幅に合わせて3〜5列 */
.grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.vgrid { grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr)); }
/* 中央寄せの指定（margin:auto）が残ると、列の幅を超えて伸びてしまうので打ち消す */
.layout > .content { margin: 0; width: 100%; max-width: 100%; }
@media (max-width: 899px) { .layout > .content { max-width: 1240px; margin: 0 auto; } }
@media (max-width: 420px) { .title h1 .lg { display: none; } }

/* ===== スマホ：左上の ☰ で左からメニューを引き出す ===== */
#menuBtn:not([hidden]) { display: grid !important; }
.sdhead { display: none; }
.slink small { margin-left: auto; font-size: 12px; }
.slink.danger { color: var(--red); }
.iconbtn.dark { color: var(--text); font-size: 26px; line-height: 1; }
.scrim { display: none; }
@media (max-width: 899px) {
  .side:not([hidden]) { display: block; position: fixed; z-index: 50; top: 0; bottom: 0; left: 0; width: min(300px, 82vw);
    background: var(--bg); padding: calc(10px + env(safe-area-inset-top)) 10px 30px; overflow-y: auto;
    transform: translateX(-105%); transition: transform .22s ease; box-shadow: 4px 0 24px rgba(0,0,0,.18); }
  body.drawer .side { transform: none; }
  .sdhead { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 12px; }
  .sdhead b { font-size: 17px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.drawer .scrim { opacity: 1; pointer-events: auto; }
  .slink { padding: 12px; font-size: 16px; }
}
@media (min-width: 900px) { #menuBtn { display: none !important; } }

/* 名簿カードのバッジ：ビジター紹介は青、話してみたいは赤 */
.mcard.intro { border: 2px solid #b9d3f5; box-shadow: 0 0 0 3px #eaf2fd; }
.mcard.intro .badge { background: #2563eb; }
@media (prefers-color-scheme: dark) {
  .mcard.intro { border-color: #2b4a77; box-shadow: 0 0 0 3px #16253b; }
}

/* 自分が登録したビジターの操作 */
.vedit { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--line); }
.vedit .muted { flex: 1 1 100%; }

/* ===== PC：ログイン前は1列で中央に／☰は出さない ===== */
@media (min-width: 900px) {
  #menuBtn, #menuBtn:not([hidden]) { display: none !important; }
  body:not(.started) .layout { display: block; }
  body:not(.started) .layout > .content { max-width: 1240px; margin: 0 auto; }
  body:not(.started) .gate { margin-top: 48px; }
}
