/* SNAPGATE CLOUD 管理画面
   方針: 1画面1目的。主ボタンは画面に1つ。状態は色帯と言葉の両方で示す。
   目印はトンボ（裁ち線）。写真を表す枠にだけ使う。 */

/* ── 骨組み ─────────────────────────────── */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
.rail { background: var(--sheet); border-right: 1px solid var(--rule); align-self: start; padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.mark { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; color: var(--ink); text-decoration: none; }
.mark-box { width: 30px; height: 38px; border: 2px solid var(--backdrop); border-radius: 3px; background: var(--sky); position: relative; }
.mark-box::after { content: ""; position: absolute; left: 7px; right: 7px; top: 8px; height: 13px; border-radius: 50% 50% 45% 45%; background: var(--backdrop); }
.mark-name { font-weight: 700; line-height: 1.2; font-size: 15px; }
.mark-name small { display: block; font-weight: 400; color: var(--ink-3); font-size: 11px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; font-size: 15px; }
.nav a:hover { background: var(--paper); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--sky); color: var(--backdrop-deep); font-weight: 700; }
.nav .count { margin-left: auto; font-size: 12px; background: var(--wait-tint); color: var(--wait); border-radius: 10px; padding: 0 8px; }
.nav-group { margin-top: 14px; padding: 0 12px 4px; font-size: 12px; color: var(--ink-3); }
.rail-foot { margin-top: auto; padding: 14px 12px 0; border-top: 1px solid var(--rule); font-size: 13px; color: var(--ink-3); }
.rail-foot form { display: inline; }
.linkish { background: none; border: 0; padding: 0; color: var(--backdrop); font: inherit; cursor: pointer; text-decoration: underline; }

.main { padding: 28px clamp(16px, 3vw, 40px) 64px; max-width: 1280px; width: 100%; }
.head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.head h1 { font-size: 26px; line-height: 1.35; margin: 0; font-weight: 700; }
.head .sub { color: var(--ink-3); font-size: 14px; margin-top: 2px; }
.head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.crumb a { color: var(--ink-3); }

.topbar { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .rail.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .topbar { display: flex; align-items: center; gap: 12px; padding: 10px 16px; background: var(--sheet); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 20; }
  .main { padding-top: 20px; }
}

/* ── ボタン ─────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); font: 700 15px/1 var(--font); text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--ink-3); }
.btn-primary { background: var(--backdrop); border-color: var(--backdrop); color: #fff; }
.btn-primary:hover { background: var(--backdrop-deep); border-color: var(--backdrop-deep); }
.btn-danger { color: var(--trim); border-color: var(--trim); background: var(--sheet); }
.btn-danger:hover { background: var(--trim-tint); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ── お知らせ ───────────────────────────── */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; border-left: 4px solid; }
.flash-ok { background: var(--ok-tint); border-color: var(--ok); }
.flash-error { background: var(--trim-tint); border-color: var(--trim); }
.flash-info { background: var(--sky); border-color: var(--backdrop); }
.flash ul { margin: 4px 0 0; padding-left: 20px; }

/* ── 面 ─────────────────────────────────── */
.panel { background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 20px; }
.panel > h2 { font-size: 17px; margin: 0 0 4px; }
.panel > .lead { color: var(--ink-3); font-size: 14px; margin: 0 0 16px; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* 数字の並び（ダッシュボード） */
.tally { display: flex; gap: 0; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); margin-bottom: 20px; flex-wrap: wrap; }
.tally > div { flex: 1 1 140px; padding: 14px 18px; border-right: 1px solid var(--rule); }
.tally > div:last-child { border-right: 0; }
.tally b { display: block; font: 700 28px/1.2 var(--font-num); }
.tally span { font-size: 13px; color: var(--ink-3); }

/* ── 表 ─────────────────────────────────── */
.table-wrap { overflow-x: auto; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 20px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
.list th { text-align: left; font-weight: 700; color: var(--ink-2); background: var(--paper); padding: 10px 14px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.list td { padding: 11px 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: var(--sky); }
.list .r { text-align: right; }
.list a.rowlink { color: var(--ink); font-weight: 700; text-decoration: none; }
.list a.rowlink:hover { color: var(--backdrop); text-decoration: underline; }

/* 状態の札 */
.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--paper); color: var(--ink-2); border: 1px solid var(--rule); }
.tag-ok { background: var(--ok-tint); color: var(--ok); border-color: transparent; }
.tag-wait { background: var(--wait-tint); color: var(--wait); border-color: transparent; }
.tag-now { background: var(--sky); color: var(--backdrop-deep); border-color: transparent; }
.tag-bad { background: var(--trim-tint); color: var(--trim); border-color: transparent; }

/* ── フォーム ───────────────────────────── */
.field { margin-bottom: 18px; }
.field > label, .field > .label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.field .help { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.field .err { font-size: 13px; color: var(--trim); margin-top: 4px; font-weight: 700; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=time], input[type=url], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--rule); border-radius: var(--radius);
  background: var(--sheet); color: var(--ink); font: 16px/1.5 var(--font);
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--backdrop); outline: 2px solid var(--sky); }
.input-short { max-width: 220px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.check { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; cursor: pointer; }
.check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--backdrop); flex: none; }
.check > span { display: block; color: var(--ink); }
.check b { display: block; font-size: 15px; }
.check > span > span { display: block; font-size: 13px; color: var(--ink-3); font-weight: 400; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 20px; background: var(--sheet); cursor: pointer; font-size: 14px; }
.choice input:checked + span { border-color: var(--backdrop); background: var(--sky); color: var(--backdrop-deep); font-weight: 700; }
.choice input:focus-visible + span { outline: 3px solid var(--backdrop); outline-offset: 2px; }
.swatch { width: 16px; height: 16px; border-radius: 50%; border: 1px solid var(--rule); display: inline-block; }
.form-foot { position: sticky; bottom: 0; background: var(--paper); padding: 14px 0; border-top: 1px solid var(--rule); display: flex; gap: 10px; align-items: center; z-index: 5; }
.form-foot .note { color: var(--ink-3); font-size: 13px; }

/* 設定の章立て（左に目次、右に中身） */
.settings { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: start; }
.settings-toc { position: sticky; top: 20px; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.settings-toc a { padding: 7px 12px; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; }
.settings-toc a:hover { background: var(--sheet); }
@media (max-width: 960px) { .settings { grid-template-columns: 1fr; } .settings-toc { display: none; } }

/* ── コンタクトシート（撮影対象者の一覧） ── */
.sheet-tools { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.sheet-tools input[type=search] { max-width: 320px; }
.filter { display: flex; border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden; background: var(--sheet); }
.filter a { padding: 9px 14px; font-size: 14px; color: var(--ink-2); text-decoration: none; border-right: 1px solid var(--rule); white-space: nowrap; }
.filter a:last-child { border-right: 0; }
.filter a[aria-current="true"] { background: var(--sky); color: var(--backdrop-deep); font-weight: 700; }
.filter .n { font-family: var(--font-num); margin-left: 4px; color: var(--ink-3); }
.contact { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 22px 18px; padding: 8px 6px; }
.frame { display: block; text-decoration: none; color: var(--ink); }
.frame .tombo, .shot .tombo { margin: 6px; }
.frame .pic { aspect-ratio: 3 / 4; background: var(--sky); border: 1px solid var(--rule); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.frame .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame .pic .none { color: var(--ink-3); font-size: 12px; }
.frame .band { height: 5px; background: var(--rule); }
.frame .band.s-checked_in { background: var(--wait); }
.frame .band.s-shooting { background: var(--backdrop); }
.frame .band.s-done { background: var(--ok); }
.frame .num { display: block; font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.frame .nm { display: block; font-weight: 700; font-size: 14px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame:hover .pic { border-color: var(--backdrop); }
.frame:focus-visible { outline: 3px solid var(--backdrop); outline-offset: 8px; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-3); }
.legend i { display: inline-block; width: 14px; height: 5px; margin-right: 6px; vertical-align: middle; background: var(--rule); }
.legend .s-checked_in { background: var(--wait); } .legend .s-shooting { background: var(--backdrop); } .legend .s-done { background: var(--ok); }

/* 写真（人の詳細） */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 24px; padding: 8px 6px; }
.shot figure { margin: 0; }
.shot .pic { aspect-ratio: 3 / 4; background: var(--sky); border: 1px solid var(--rule); overflow: hidden; }
.shot .pic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot.selected .pic { border: 3px solid var(--ok); }
.shot.selected .tombo::before, .shot.selected .tombo::after { border-color: var(--ok); }
.shot figcaption { font-size: 13px; margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* 共有リンク（コピーしやすい1行） */
.copyline { display: flex; gap: 8px; align-items: stretch; }
.copyline input { font-family: var(--font-num); font-size: 14px; }
.passcode { font: 700 30px/1.2 var(--font-num); letter-spacing: .14em; }

/* 名簿の取り込み */
.dropzone { border: 2px dashed var(--rule); border-radius: var(--radius); padding: 36px 20px; text-align: center; background: var(--sheet); }
.dropzone.over { border-color: var(--backdrop); background: var(--sky); }
.dropzone input[type=file] { margin-top: 12px; }
.mapping select { min-height: 38px; font-size: 14px; padding: 4px 8px; }

/* 認証（ゲート・ログイン・2段階） */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--sheet); border: 1px solid var(--rule); border-radius: var(--radius); padding: 32px 28px; }
.auth-card .mark { padding: 0 0 22px; }
.auth-card h1 { font-size: 21px; margin: 0 0 6px; }
.auth-card p { color: var(--ink-3); font-size: 14px; margin: 0 0 20px; }
.auth-card .btn { width: 100%; }
.code-input { font: 700 28px/1 var(--font-num) !important; letter-spacing: .3em; text-align: center; }
.qr { display: flex; justify-content: center; padding: 12px; background: #fff; border: 1px solid var(--rule); border-radius: var(--radius); margin-bottom: 12px; }
.secret { font: 15px var(--font-num); word-break: break-all; background: var(--paper); padding: 8px 10px; border-radius: var(--radius); }

.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); }
.empty p { margin: 0 0 16px; }
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.pagination a, .pagination span { min-width: 38px; min-height: 38px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--rule); border-radius: var(--radius); background: var(--sheet); text-decoration: none; font-size: 14px; padding: 0 10px; }
.pagination .on { background: var(--backdrop); color: #fff; border-color: var(--backdrop); }

/* 狭い画面で横にはみ出さない */
.main { min-width: 0; }
.head .sub { overflow-wrap: anywhere; }
.filter { overflow-x: auto; max-width: 100%; }
@media (max-width: 560px) {
  .tally > div { flex-basis: 50%; border-bottom: 1px solid var(--rule); }
  .contact { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 18px 12px; }
  .head .actions { margin-left: 0; }
}

/* 写真の追加（人の画面） */
.uploader { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.uploader .btn { cursor: pointer; }
body.dropping::after { content: "ここで離すと写真を追加します"; position: fixed; inset: 12px; border: 3px dashed var(--backdrop); border-radius: var(--radius);
  background: color-mix(in srgb, var(--sky) 85%, transparent); color: var(--backdrop-deep); font: 700 24px/1 var(--font);
  display: flex; align-items: center; justify-content: center; z-index: 50; pointer-events: none; }
body.uploading { cursor: progress; }

/* 仕上がりパターンの行（狭い画面では横にスクロール） */
.profile-rows { min-width: 1240px; table-layout: fixed; }
.profile-rows td { padding: 8px 6px; }
.profile-rows th:nth-child(1) { width: 150px; } .profile-rows th:nth-child(2) { width: 170px; }
.profile-rows th:nth-child(3) { width: 120px; } .profile-rows th:nth-child(4) { width: 170px; }
.profile-rows th:nth-child(5) { width: 170px; } .profile-rows th:nth-child(6) { width: 170px; }
.profile-rows th:nth-child(7) { width: 130px; } .profile-rows th:nth-child(8) { width: 220px; }
.profile-rows select, .profile-rows input { min-height: 38px; font-size: 14px; padding: 4px 8px; }
