/* v2 追加分 */
.stats.four { grid-template-columns: repeat(4, 1fr); }
.stats.five { grid-template-columns: repeat(5, 1fr); }
.stat small { display: block; margin-top: 2px; font-size: 11px; color: var(--muted); font-weight: 500; }

.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  margin-bottom: 20px;
}
.panel > h2 { font-size: 16px; margin: 0 0 14px; }
.panel > h2 + .muted { margin-top: -8px; }

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 20px; align-items: start; }
.split > .panel { margin-bottom: 0; }

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}
.filter-bar input[type="search"],
.filter-bar select {
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
  min-width: 160px;
}
.filter-bar input[type="search"] { min-width: 220px; }

.admin-form input[type="text"],
.admin-form input[type="email"],
.admin-form input[type="password"],
.admin-form input[type="number"],
.admin-form input[type="search"],
.admin-form input[type="datetime-local"],
.admin-form select,
.admin-form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
}
.admin-form textarea { resize: vertical; line-height: 1.6; }
.admin-form input[type="file"] { font-size: 13px; }
.admin-form input:focus,
.admin-form select:focus,
.admin-form textarea:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.15);
}
.admin-form > label { display: block; margin-top: 16px; font-size: 13px; font-weight: 700; }
.admin-form > label:first-of-type { margin-top: 0; }
.admin-form .check { display: inline-flex; align-items: center; gap: 6px; margin: 6px 14px 0 0; font-weight: 500; font-size: 13px; }
.admin-form .hint { margin: 6px 0 0; font-size: 12px; color: var(--muted); }

#company-scope { margin-top: 12px; padding: 12px 14px; background: #f8fafc; border: 1px solid var(--line); border-radius: 10px; }
#company-scope label { font-size: 13px; font-weight: 700; display: block; margin-bottom: 4px; }

.actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.actions form { margin: 0; }
.mini.on { background: var(--navy); color: #fff; border-color: var(--navy); }

.poster-preview { display: block; margin-top: 12px; width: 240px; max-width: 100%; border-radius: 10px; border: 1px solid var(--line); }

.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 130px;
  padding-top: 8px;
  overflow-x: auto;
}
.bar-item { flex: 1 0 18px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bar { width: 100%; max-width: 26px; background: linear-gradient(180deg, #34d3d1, var(--teal)); border-radius: 5px 5px 2px 2px; display: block; }
.bar-item small { font-size: 9px; color: var(--muted); white-space: nowrap; }

.pager { display: flex; gap: 6px; margin-top: 16px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 34px;
  text-align: center;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 12px;
  background: #fff;
}
.pager span.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.message-page { padding: 80px 0; text-align: center; }
.message-page h1 { font-size: 22px; margin-bottom: 10px; }
.message-page .back { font-size: 13px; }

.narrow-box { max-width: 520px; margin: 60px auto; background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; }
.narrow-box h1 { font-size: 20px; margin-bottom: 6px; }
.narrow-box .admin-form { margin-top: 18px; }

.fine { font-size: 12px; color: var(--muted); }

/* カテゴリ */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; margin-bottom: 28px; }
.cat-card {
  display: flex; flex-direction: column; gap: 6px; padding: 18px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  text-decoration: none; color: var(--ink); min-height: 110px;
}
.cat-card:hover { border-color: var(--teal); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06); }
.cat-card strong { font-size: 16px; }
.cat-card small { font-size: 12px; color: var(--teal); font-weight: 700; }
.cat-card span { font-size: 11px; color: var(--muted); margin-top: auto; }
.resume {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 18px 0 6px; padding: 16px 18px;
  background: #effcfb; border: 1px solid #b6ecea; border-radius: 14px;
  text-decoration: none; color: var(--ink);
}
.resume-label { font-size: 11px; font-weight: 700; color: #0f766e; background: #ccfbf1; padding: 4px 8px; border-radius: 999px; }
.resume strong { font-size: 15px; }
.resume small { color: var(--muted); }
.cat-block { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; margin-bottom: 12px; }
.cat-block-head { display: flex; justify-content: space-between; align-items: center; text-decoration: none; color: var(--ink); }
.cat-block-head strong { font-size: 16px; }
.cat-block-head span { font-size: 12px; color: var(--muted); }
.cat-block .chips { margin-top: 10px; }
.breadcrumb { display: flex; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--teal); text-decoration: none; }
.category-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.category-head h1 { font-size: 24px; margin: 2px 0 4px; }
.seen.started { background: #fef3c7; color: #92400e; }

/* QR */
.qr-page { max-width: 980px; margin: 0 auto; }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 20px; }
.qr-card { display: flex; gap: 16px; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.qr-img { width: 148px; min-width: 148px; height: 148px; display: flex; align-items: center; justify-content: center; background: #fff; }
.qr-img img, .qr-img canvas { width: 148px !important; height: 148px !important; }
.qr-card-body { min-width: 0; }
.qr-card-body h2 { font-size: 16px; margin: 0 0 4px; }
.qr-url { font-size: 10px; color: var(--muted); word-break: break-all; margin: 6px 0 10px; }

@media (max-width: 980px) {
  .split { grid-template-columns: 1fr; }
  .stats.four, .stats.five { grid-template-columns: repeat(2, 1fr); }
  .admin-head { flex-direction: column; }
}

@media (max-width: 600px) {
  .stats, .stats.four, .stats.five { grid-template-columns: repeat(2, 1fr); }
  .admin-main { padding-top: 20px; }
  .panel { padding: 16px; }
}


/* v3.1 利用者画面の見直し */
.section-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 28px 0 12px;
}
h1, h2, h3 { overflow-wrap: anywhere; line-break: strict; }
.topbar {
  height: 64px;
  padding: 0 clamp(14px, 3vw, 40px);
  gap: 10px;
}
.brand { min-width: 0; }
.brand-name { white-space: nowrap; }
.top-right { gap: 8px; min-width: 0; }
.customer {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.link-btn {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.qr-pop { position: relative; }
.qr-pop summary {
  list-style: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  color: #475569;
  cursor: pointer;
}
.qr-pop summary::-webkit-details-marker { display: none; }
.qr-pop[open] summary { border-color: var(--teal); color: var(--teal-d); }
.qr-pop-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 60;
  width: 176px;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  display: grid;
  justify-items: center;
  gap: 8px;
}
.qr-pop-panel .qr-img { width: 120px; min-width: 0; height: 120px; margin: 0; }
.qr-pop-panel .qr-img img,
.qr-pop-panel .qr-img canvas { width: 120px !important; height: 120px !important; }
.qr-pop-panel strong { font-size: 12px; color: var(--ink); }
.qr-pop-panel small { font-size: 10px; color: var(--muted); }
.hero-simple {
  grid-template-columns: 1fr;
  padding: 34px 38px;
}
.hero-simple h1 { font-size: clamp(24px, 3.2vw, 34px); margin-bottom: 10px; }
.hero-simple p { max-width: 38em; }
.controls { margin: 22px 0 10px; }
.search { max-width: 560px; border-radius: 12px; }
.grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 16px;
}
.cat-grid {
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}
.cat-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 60px;
  align-items: center;
  justify-content: initial;
  min-height: 96px;
  padding: 16px 18px;
  gap: 16px;
}
.cat-card .cat-name {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.5;
  min-width: 0;
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}
.cat-card .cat-qr { margin: 0; justify-self: end; }
.cat-qr {
  flex: none;
  width: 60px;
  height: 60px;
  display: grid;
  place-items: center;
  background: #f8fafc;
  border: 1px solid #eef2f7;
  border-radius: 9px;
}
.cat-qr .qr-img { width: 60px; min-width: 0; height: 60px; margin: 0; }
.cat-qr .qr-img img,
.cat-qr .qr-img canvas { width: 60px !important; height: 60px !important; }
.category-search { margin: 14px 0 26px; }
.category-page .category-search { margin-bottom: 26px; }
.category-page .grid { margin-top: 0; }
.category-search + .grid { margin-top: 0; }
.category-head { margin-bottom: 6px; align-items: flex-start; }
.category-head h1 { font-size: clamp(24px, 4vw, 32px); }
.breadcrumb { margin-bottom: 10px; }
.pager { margin: 22px 0 0; }
.result-note { margin-top: 16px; }
.btn-primary { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; }
.mini { min-height: 32px; display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 980px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .topbar { height: 58px; padding: 0 12px; }
  .brand .logo { width: 30px; height: 30px; }
  .brand-name { font-size: 12px; }
  .brand-name small { font-size: 9px; }
  .customer { display: none; }
  .qr-pop summary { width: 34px; height: 34px; border-radius: 9px; }
  .link-btn { min-height: 34px; padding: 0 9px; font-size: 11px; }
  .hero-simple { padding: 22px 20px; border-radius: 18px; }
  .hero-simple h1 { font-size: 23px; }
  .section-title { margin-top: 22px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .cat-grid { grid-template-columns: 1fr; }
  .cat-card { min-height: 92px; padding: 15px 16px; grid-template-columns: minmax(0, 1fr) 58px; gap: 12px; }
  .cat-card .cat-name { font-size: 18px; }
  .cat-qr, .cat-qr .qr-img { width: 58px; height: 58px; }
  .cat-qr .qr-img img, .cat-qr .qr-img canvas { width: 58px !important; height: 58px !important; }
  .qr-pop-panel { right: -44px; }
}

/* v3.1 QRコードの視認性と全カテゴリ表示 */
.cat-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.cat-card {
  grid-template-columns: minmax(0, 1fr) 120px;
  min-height: 152px;
  padding: 16px 18px;
  gap: 14px;
}
.cat-qr, .cat-qr .qr-img { width: 120px; height: 120px; }
.cat-qr .qr-img img, .cat-qr .qr-img canvas { width: 120px !important; height: 120px !important; }

.qr-pop-panel {
  top: calc(100% + 14px);
  width: 360px;
  padding: 0;
  display: block;
  overflow: hidden;
  max-height: min(78vh, 700px);
}
.qr-pop-head {
  display: grid;
  gap: 2px;
  padding: 15px 18px 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}
.qr-pop-head strong { font-size: 13px; color: var(--ink); }
.qr-pop-head small { font-size: 10px; color: var(--muted); }
.qr-pop-list {
  max-height: calc(78vh - 64px);
  overflow-y: auto;
  padding: 8px 12px 12px;
}
.qr-pop-item {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 8px 6px;
  border-bottom: 1px solid #eef2f7;
}
.qr-pop-item:last-child { border-bottom: 0; }
.qr-pop-item .qr-img { width: 80px; min-width: 0; height: 80px; margin: 0; }
.qr-pop-item .qr-img img,
.qr-pop-item .qr-img canvas { width: 80px !important; height: 80px !important; }
.qr-pop-copy { display: grid; gap: 3px; min-width: 0; justify-items: start; }
.qr-pop-copy small { font-size: 10px; color: var(--muted); }
.qr-pop-copy strong { font-size: 13px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.qr-pop-copy .mini { margin-top: 3px; min-height: 28px; font-size: 10px; padding: 0 8px; }

@media (max-width: 640px) {
  .qr-pop { display: none; }
  .cat-grid { grid-template-columns: 1fr; }
  .cat-card { min-height: 140px; grid-template-columns: minmax(0, 1fr) 108px; gap: 12px; }
  .cat-qr, .cat-qr .qr-img { width: 108px; height: 108px; }
  .cat-qr .qr-img img, .cat-qr .qr-img canvas { width: 108px !important; height: 108px !important; }
}
