/*!*****************************************************************************************************************************************************************************************************************************************************************!*\
  !*** css ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[2]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[14].oneOf[10].use[3]!./src/app/globals.css ***!
  \*****************************************************************************************************************************************************************************************************************************************************************/
/*
 * デザイン方針
 *   - シンプル / ミニマル。装飾を足さない
 *   - 絵文字は使わない。状態は文言で伝える
 *   - 生徒はスマートフォンでの利用が主。モバイルファースト
 *   - 中高生が初見で迷わないこと（分かりやすさ最優先）
 *
 * ブランド（スクールフォト！ https://www.schoolphoto.jp/ より）
 *   投稿の入口と購入先(スクールフォト！)が視覚的に地続きになるよう色を揃える。
 *   ただし赤は主張が強く写真の色を邪魔するため、
 *   ★面積を絞り、主要ボタンと重要な見出しにのみ使う★
 *   背景や広い面には使わない。
 */

:root {
  /* ブランドカラー（本家サイトのCSSより） */
  --brand: #e83617; /* 朱赤。ロゴ・主要ボタン・重要見出し */
  --brand-dark: #ce3116; /* hover / active */
  --brand-blue: #028fc3; /* ダウンロード系。写真館画面で使う */
  --brand-blue-dark: #0f759c;

  --bg: #ffffff;
  --surface: #ffffff;
  --surface-sub: #f6f6f7;
  --text: #16161a;
  --text-muted: #6b6b73;
  --border: #dcdce1;
  --border-strong: #b8b8c0;
  --accent: var(--brand);
  --accent-text: #ffffff;
  --danger: #b3261e;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    /* 暗背景では朱赤が沈むため、わずかに明度を上げる */
    --brand: #ff5334;
    --brand-dark: #e83617;
    --brand-blue: #35abd9;

    --bg: #131317;
    --surface: #1b1b20;
    --surface-sub: #232329;
    --text: #eeeef2;
    --text-muted: #9d9da6;
    --border: #33333b;
    --border-strong: #4a4a54;
    --accent: var(--brand);
    --accent-text: #ffffff;
    --danger: #f2857c;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    system-ui,
    -apple-system,
    'Hiragino Kaku Gothic ProN',
    'Noto Sans JP',
    Meiryo,
    sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-text-size-adjust: 100%;
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

/* ---- サイトヘッダー ---- */

/*
 * ロゴ（スクールフォト！）。
 * 投稿先と購入先が同じブランドであることを示すために置く。
 *
 * ★右寄せにする理由★
 * 左寄せだと ロゴ / 学校名 / 行事名 が左端で縦に揃い、
 * 視線の始点が3つ並んで散漫になる。
 * 右上へ寄せることで「左＝情報の列」「右上＝ブランド表示」と役割が分かれ、
 * 主役である行事名が読み取りやすくなる。
 */
.site-header {
  display: flex;
  justify-content: flex-end;
  padding: 0 0 16px;
}

.site-header img {
  height: 22px;
  width: auto;
  display: block;
  /* 主役は行事名。ロゴは控えめに置く */
  opacity: 0.85;
}

/* ---- 見出し ---- */

.page-head {
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
}

h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  margin: 2px 0 6px;
}

h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 16px;
}

.eyebrow {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0;
}

.muted {
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* ---- 区画 ---- */

.section {
  margin-bottom: 32px;
}

.panel {
  background: var(--surface-sub);
  border-radius: var(--radius);
  padding: 16px;
  font-size: 0.9rem;
  white-space: pre-wrap;
}

/* ---- フォーム ---- */

.field {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 8px;
}

.hint {
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: 6px 0 0;
}

select,
input[type='text'],
textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  /* 16px未満だとiOSがフォーカス時に拡大する */
  font-size: 16px;
  font-family: inherit;
  line-height: 1.5;
}

select:disabled {
  background: var(--surface-sub);
  color: var(--text-muted);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible,
button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.passcode-input {
  letter-spacing: 0.5em;
  text-transform: uppercase;
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 1.25rem !important;
  text-align: center;
  padding-left: 0.5em;

  /*
    ★日本語入力を切る（2026-08-24 指摘）★

    「文字を打つと意図せず重複して入る」
    「トグル入力ができない」という報告があった。

    パスコードは英数字だけなので、IMEが開く必要が無い。
    ime-mode は標準から外れた指定だが、
    Android の一部で今も効く。効かない環境では
    JS 側の絞り込み（英数字以外を捨てる）が受け止める。
  */
  ime-mode: disabled;
}

/* ---- ボタン ---- */

button,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  /* タップ領域を確保する */
  min-height: 48px;
  padding: 12px 20px;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.98rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

button.text-danger {
  background: transparent;
  color: var(--danger);
  border-color: transparent;
  min-height: 36px;
  width: auto;
  padding: 4px 8px;
  font-size: 0.85rem;
  font-weight: 500;
}

/* ---- 状態表示 ---- */

.error {
  color: var(--danger);
  font-size: 0.88rem;
  margin: 12px 0 0;
}

.notice-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  text-align: center;
}

.notice-box p:first-child {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 8px;
}

.notice-box p:last-child {
  margin: 0;
}

/* ---- 写真グリッド ---- */

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  grid-gap: 8px;
  gap: 8px;
}

/* 班名とログアウトを横に並べる（2026-08-23） */
/* ログアウトの失敗を伝える（2026-08-23 レビュー指摘）
   共用端末で「ログアウトした」と誤認させない */
.logout-box {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.logout-error {
  margin: 0;
  font-size: 0.8rem;
  text-align: right;
}

.page-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.page-head-row p {
  margin: 0;
}

.photo-item {
  position: relative;
  aspect-ratio: 1;
  background: var(--surface-sub);
  border-radius: var(--radius);
  overflow: hidden;
}

/* ★写真の上に置く削除ボタン（2026-08-23）★
   以前は一覧の下に日時と削除を並べていたが、
   どの削除がどの写真か対応しなかった。

   指で押す前提なので、44px 角を確保する（誤タップを防ぐ）。
   スマートフォンには hover が無いため、常に見える状態にする。 */
.photo-del {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 30px;
  height: 30px;
  min-height: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  /* 写真の色に負けないよう、地を濃くする */
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  /* 白い写真でも輪郭が分かるように */
  box-shadow: 0 0 0 1.5px rgba(255, 255, 255, 0.5);
}

.photo-del:hover,
.photo-del:focus-visible {
  background: var(--danger);
}

.photo-del:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 1px;
}

.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 8px;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--text-muted);
}

.count {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0 0 4px;
}

/* 枚数の内訳（送信中・失敗）。2026-08-23
   なぜ枠が減っているのかを説明する行なので、
   本体の数字より控えめにしつつ、読める大きさは保つ */
/* 前回の送信が終わっていない分の案内（2026-08-23）
   枠が減っている理由を説明し、その場で戻せるようにする */
/* 通信量の注意（2026-08-23）
   投稿前の確認画面に出す。責める調子にならないよう
   警告色ではなく枠線で示す */
.data-warn {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 24px;
}

.data-warn p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.6;
}

.stale-box {
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stale-box p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.6;
}

.stale-box button {
  align-self: flex-start;
}

.count-detail {
  font-size: 0.82rem;
  color: var(--danger);
  margin: 0 0 12px;
}

/* ---- 管理画面 ---- */

.container.narrow {
  max-width: 460px;
}

input[type='password'],
input[type='email'] {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  line-height: 1.5;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 400;
  cursor: pointer;
}

.checkbox-row input[type='checkbox'] {
  width: 18px;
  height: 18px;
  margin: 0;
  flex-shrink: 0;
}

.qr-box {
  display: flex;
  justify-content: center;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.secret-text {
  display: block;
  margin-top: 8px;
  padding: 10px 12px;
  background: var(--surface-sub);
  border-radius: var(--radius);
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

/* リカバリコード。読み間違いを防ぐため等幅で並べる */
.code-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  grid-gap: 8px;
  gap: 8px;
  padding: 16px;
  background: var(--surface-sub);
  border-radius: var(--radius);
}

.code-list code {
  font-family: ui-monospace, 'SF Mono', Consolas, monospace;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
}

details summary {
  cursor: pointer;
  font-size: 0.88rem;
}

/* ---- 管理画面シェル ---- */

.admin-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.admin-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
}

.admin-brand img {
  height: 20px;
  width: auto;
  opacity: 0.85;
}

.admin-user {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.88rem;
}

.link-button {
  width: auto;
  min-height: auto;
  padding: 0;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 400;
  text-decoration: underline;
  cursor: pointer;
}

.container.wide {
  max-width: 1100px;
  padding: 28px 20px 64px;
}

.page-head.row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.btn.compact {
  width: auto;
  min-height: 40px;
  padding: 8px 18px;
  font-size: 0.9rem;
  white-space: nowrap;
}

/* ★ZIPの削除ボタン（2026-08-23）★
   ダウンロードと並ぶので、押し間違えないよう見た目を分ける。
   赤一色にすると目立ちすぎるため、枠線だけで示し、
   触れたときに危険色へ寄せる */
.btn.compact.subtle {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
}

.btn.compact.subtle:hover:not(:disabled) {
  color: var(--danger);
  border-color: var(--danger);
}

.btn.compact.subtle:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ダウンロードと削除を横に並べる。
   幅が足りないときは折り返す（スマートフォンでの閲覧） */
.job-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* ---- 表 ---- */

.table-wrap {
  /* 列が多い表は横スクロールさせる。ページ全体は横に伸ばさない */
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

th {
  background: var(--surface-sub);
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
}

tbody tr:last-child td {
  border-bottom: none;
}

td.num,
th.num {
  text-align: right;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

td a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  border-bottom: 1px solid var(--border-strong);
}

td a:hover {
  border-bottom-color: var(--brand);
}

.code {
  margin-left: 8px;
  font-size: 0.8rem;
  font-family: ui-monospace, Consolas, monospace;
}

.badge {
  display: inline-block;
  min-width: 22px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  text-align: center;
}

/* ---- パンくず ---- */

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.breadcrumb a:hover {
  border-bottom-color: var(--border-strong);
}

.breadcrumb > * + *::before {
  content: '/';
  margin-right: 8px;
  color: var(--border-strong);
}

/* ---- フォーム ---- */

.form-narrow {
  max-width: 520px;
}

.fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0 0 20px;
}

.fieldset legend {
  padding: 0 8px;
  font-size: 0.9rem;
  font-weight: 600;
}

/* 権限の補足（2026-08-23）
   「行事の作成」と「クラス・班の設定」は対で必要なことを伝える */
/* 見出しの横にボタンを置く（2026-08-23） */
/* 画面上部の導線（2026-08-23） */
.quick-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.quick-links .muted {
  font-size: 0.85rem;
}

.section-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section-head-row h2 {
  margin: 0;
}

.perm-note {
  margin-top: 14px;
  padding: 10px 12px;
  border-left: 3px solid var(--accent, #1f4e79);
  background: var(--surface-sub);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.perm-note p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
}

.perm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  grid-gap: 10px;
  gap: 10px;
}

.success {
  color: var(--text);
  font-size: 0.88rem;
  margin: 12px 0 0;
}

.button-row {
  display: flex;
  gap: 10px;
}

.head-actions {
  display: flex;
  gap: 10px;
}

.btn.secondary-link {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

/* ---- 状態バッジ ---- */

.status {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
}

.status-open {
  border-color: var(--brand);
  color: var(--brand);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.tag-list li {
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.85rem;
  background: var(--surface-sub);
}

/* ---- 危険な操作 ---- */

/* 削除で消えるものの一覧（2026-08-24） */
.delete-summary {
  margin: 8px 0 12px;
  padding-left: 20px;
}

.delete-summary li {
  margin-bottom: 3px;
}

/*
  募集の設定：状態と操作を横に並べる（2026-08-25 指摘）

  以前は「現在の状態」が横幅いっぱいの帯になり、
  その下に操作が続いていた。状態は1語しか無いので、
  画面の広い環境では間延びして見える。

  ★スマホでは縦のまま★
  横に並べると1つあたりが狭くなり、ボタンが押しづらい。
  700px 以上のときだけ横に並べる。
*/
.recruit-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.recruit-row > * {
  margin-bottom: 0;
}

@media (min-width: 700px) {
  .recruit-row {
    flex-direction: row;
    /*
      ★上端で揃える（2026-08-25 指摘）★
      stretch だと状態の枠が操作の高さまで伸び、
      「募集中」の下に大きな余白ができていた。
    */
    align-items: flex-start;
  }

  /* 状態は内容が少ないので、必要な分だけ */
  .recruit-state {
    flex: 0 0 180px;
  }

  /* 操作は残りを埋める */
  .recruit-actions {
    flex: 1 1 auto;
    min-width: 0;
  }
}

/*
  入力欄を横に並べる（2026-08-25 指摘）

  日時や数値の入力欄は幅が決まっているため、
  縦に積むと右側が大きく空いて間延びする。
  対になる項目（募集開始・終了）は横に並べる。

  ★スマホでは縦のまま★ 横に並べると狭くて打ちづらい。
*/
.field-row {
  display: flex;
  flex-direction: column;
  gap: 0;
}

@media (min-width: 700px) {
  .field-row {
    flex-direction: row;
    gap: 24px;
  }

  .field-row > .field {
    flex: 0 1 auto;
  }
}

/*
  ★入力欄の幅を内容に合わせる（2026-08-25 指摘）★

  既定では横幅いっぱいに広がるため、
  日付や数値のように短い入力でも枠だけ長くなる。
  種類ごとに必要な幅を与える。
*/
@media (min-width: 700px) {
  .control-block input[type='datetime-local'] {
    width: auto;
    min-width: 220px;
  }

  .control-block input[type='number'] {
    width: 120px;
  }
}

/* クラス見出しと「班を追加」を横に並べる（2026-08-24） */
.class-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}

.class-head h3 {
  margin: 0;
}

.danger-zone {
  margin-top: 48px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.danger-zone.open {
  border-color: var(--danger);
}

.danger-zone h2 {
  font-size: 0.98rem;
  margin-bottom: 8px;
}

.danger-zone p {
  font-size: 0.88rem;
  margin: 0 0 16px;
}

button.danger-outline {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

button.danger-solid {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

/* ---- タブ ---- */

.tabs {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tab {
  padding: 10px 16px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover {
  color: var(--text);
}

.tab.active {
  color: var(--text);
  font-weight: 600;
  border-bottom-color: var(--brand);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head h2 {
  margin: 0;
}

/* ---- 統計 ---- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  grid-gap: 1px;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.stat {
  background: var(--surface);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.3rem;
  font-weight: 600;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* ---- クラス・班 ---- */

.class-block {
  margin-bottom: 24px;
}

.class-block h3 {
  font-size: 0.95rem;
  margin: 0 0 10px;
}

.passcode-cell {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.95rem;
  letter-spacing: 0.12em;
  padding: 2px 8px;
  background: var(--surface-sub);
  border-radius: 4px;
}

.status-locked {
  border-color: var(--danger);
  color: var(--danger);
}

.inline-form {
  max-width: 420px;
}

button.compact {
  width: auto;
  min-height: 38px;
  padding: 6px 16px;
  font-size: 0.88rem;
}

/* ---- URL表示 ---- */

.url-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface-sub);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.url-box code {
  flex: 1 1;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

/* ---- 募集状態の選択 ---- */

.status-options {
  display: grid;
  grid-gap: 8px;
  gap: 8px;
  max-width: 560px;
}

.status-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 400;
  margin: 0;
}

.status-option.active {
  border-color: var(--brand);
  background: var(--surface-sub);
}

.status-option input {
  margin-top: 4px;
  flex-shrink: 0;
}

.status-option-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.status-option-body strong {
  font-size: 0.95rem;
}

.status-option-body .muted {
  font-size: 0.82rem;
}

.nowrap {
  white-space: nowrap;
}

textarea {
  resize: vertical;
  min-height: 90px;
}

/* ---- 管理ナビ ---- */

.admin-nav-left {
  display: flex;
  align-items: center;
  gap: 24px;
}

.admin-nav {
  display: flex;
  gap: 16px;
}

.admin-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
}

.admin-nav a:hover {
  color: var(--text);
}

.sub-head {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 14px;
}

.row-actions {
  display: flex;
  gap: 14px;
  white-space: nowrap;
}

.link-button.danger-text {
  color: var(--danger);
}

/*
  ★操作列のボタンを離す（2026-08-24 指摘）★

  .link-button は padding: 0 なので、隣り合うと文字が繋がり
  「再発行名前」と1語に見えていた。

  隣接セレクタ（+）では、間に条件分岐が入ると効かない。
  親を flex にして、gap で確実に間隔を作る。
*/
.row-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  white-space: nowrap;
}

/* ---- 発行したパスワードの表示 ---- */

.issued-box {
  border: 1px solid var(--brand);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 28px;
}

.issued-box h2 {
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.issued-password {
  display: block;
  margin: 12px 0;
  padding: 14px 16px;
  background: var(--surface-sub);
  border-radius: var(--radius);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  word-break: break-all;
}

.issued-box .button-row {
  max-width: 320px;
  margin-top: 16px;
}

/* ============================================================
   写真選別UI（仕様11章）
   ============================================================ */

.selector-section {
  /* 一覧の高さを画面に合わせる。ページ全体がスクロールすると
     仮想スクロールの計算が二重になり、操作感が悪くなる */
  display: flex;
  flex-direction: column;
}

.section-head {
  margin-bottom: 12px;
}

.section-head .hint {
  margin-top: 4px;
}

/* ★写真一覧の直前に置く操作説明（2026-08-23）★
   絞り込みバーの下、写真のすぐ上に来る。
   スクロール中に見返す位置なので、
   写真から離れないよう下の余白を詰める */
.grid-hint {
  margin: 10px 0 8px;
}

/* 案内状への導線（2026-08-23） */
.handout-link {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.handout-link h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.handout-link p {
  margin: 0 0 10px;
  font-size: 0.88rem;
}

/* ---- 絞り込みバー ---- */
.selector-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filters select {
  min-width: 140px;
}

.select-actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* ---- グリッド ---- */
.photo-grid-scroll {
  /* 画面の残り分を使う。ヘッダー・統計・バーの高さを引いた概算 */
  height: calc(100vh - 340px);
  min-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  /* スクロール中のちらつきを抑える */
  overscroll-behavior: contain;
  background: var(--surface-sub);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px;
}

.photo-cell {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--surface);
  border: 2px solid transparent;
  cursor: pointer;
  /* 選択の切り替えでテキスト選択が走らないように */
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
}

.photo-cell img {
  width: 100%;
  height: 100%;
  /*
    ★既定は全体表示（2026-08-24 実機での指摘）★

    以前は cover で枠を埋めていたが、**はみ出した部分が切り落とされる**。
    縦長・横長の写真は上下や左右が見えず、
    「表示しきれていない部分に不採用の要因があったら分からない」
    という状態だった。

    このシステムの目的は選別なので、見栄えより
    **判断材料が全部見えること**を優先する。
    余白が出るのは、写真の形が違うという情報でもある。

    密に並べたいときは .photo-grid.fit-cover で切り替えられる。
  */
  object-fit: contain;
  display: block;
  /* 読み込み前の背景。真っ白だとちらつく */
  background: var(--surface-sub);
}

/* 切り替え：枠いっぱいに表示する（一覧をざっと見るとき） */
.photo-grid-scroll.fit-cover .photo-cell img {
  object-fit: cover;
}

/* 表示の切り替えバー（2026-08-24 追加） */
.grid-view-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
}

.grid-view-bar .hint {
  margin: 0;
}

/* 表示の切り替えボタン */
.view-toggle {
  display: inline-flex;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.view-toggle button {
  padding: 4px 10px;
  font-size: 12px;
  border: 0;
  border-radius: 0;
  background: var(--surface);
  color: var(--text-sub);
  cursor: pointer;
}

.view-toggle button + button {
  border-left: 1px solid var(--border);
}

.view-toggle button[aria-pressed='true'] {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}

.photo-cell.selected {
  border-color: var(--brand);
  /* 枠だけだと見落とすので、少し沈ませる */
  box-shadow: inset 0 0 0 2px var(--surface);
}

/* フラグ済みは左端に細い帯を出す。
   サムネイルを覆わずに状態が分かるようにする */
.photo-cell.flag-candidate::before,
.photo-cell.flag-review::before,
.photo-cell.flag-rejected::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  z-index: 1;
}

.photo-cell.flag-candidate::before { background: var(--brand); }
.photo-cell.flag-review::before { background: #d99400; }
.photo-cell.flag-rejected::before { background: var(--text-muted); }

.cell-flag {
  position: absolute;
  left: 8px;
  bottom: 6px;
  font-size: 11px;
  line-height: 1;
  padding: 3px 6px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
}

.cell-note {
  position: absolute;
  right: 6px;
  top: 6px;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
}

.grid-status {
  text-align: center;
  padding: 16px;
  margin: 0;
}

/* ---- 操作バー（選択中だけ出す） ---- */
/* ★常に表示する★
   選択中だけ出していたとき、タブから戻るなどで選択が消えると
   ボタンごと消え「機能が無くなった」ように見えた */
.action-bar {
  position: -webkit-sticky;
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}

.action-status {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.selected-count {
  font-weight: 600;
}

.save-state {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 3px;
}

.save-state.saving {
  background: var(--surface-sub);
  color: var(--text-muted);
}

.save-state.saved {
  background: var(--brand);
  color: #fff;
}

.save-note {
  margin-top: 8px;
  text-align: right;
}

/* 選択が無いときはボタンを押せない。
   押せるのに何も起きない状態より、押せないと分かる方がよい */
.flag-buttons button:disabled {
  opacity: 0.45;
  cursor: default;
}

/* ---- 統計 ---- */
.stats-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.stats-updating {
  font-size: 12px;
}

/* 数字に色を添えて、グリッドの帯と対応づける */
.stat-candidate .stat-value { color: var(--brand); }
.stat-review .stat-value { color: #d99400; }
.stat-rejected .stat-value { color: var(--text-muted); }

.flag-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.flag-buttons kbd {
  margin-left: 6px;
  font-size: 11px;
  /*
    ★色をボタンに合わせる（2026-08-24 指摘）★

    既定の kbd は薄いグレー背景・色指定なし。
    「採用候補」は赤背景・白文字なので、
    **薄い背景に白文字**となり数字が読めなかった。

    背景を透かし、文字色をボタンから継ぐ。
  */
  background: transparent;
  border-color: currentColor;
  color: inherit;
  opacity: 0.75;
}

kbd {
  font-family: inherit;
  font-size: 12px;
  padding: 1px 5px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--surface-sub);
}

/* ---- 大型表示 ---- */
.viewer-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(0, 0, 0, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.viewer-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 1100px;
  width: 100%;
  max-height: 100%;
}

.viewer-image {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  flex: 1 1;
}

.viewer-image img {
  max-width: 100%;
  max-height: calc(100vh - 200px);
  object-fit: contain;
  border-radius: var(--radius);
  background: #000;
}

.viewer-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 64px;
  font-size: 28px;
  line-height: 1;
  padding: 0;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.viewer-nav:hover:not(:disabled) {
  background: rgba(0, 0, 0, 0.72);
}

.viewer-nav:disabled {
  opacity: 0.25;
  cursor: default;
}

.viewer-nav.prev { left: 8px; }
.viewer-nav.next { right: 8px; }

.viewer-info {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 16px;
}

.viewer-meta {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  font-size: 13px;
}

.viewer-position {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.flag-badge.flag-none { background: var(--surface-sub); color: var(--text-muted); }
.flag-badge.flag-candidate { background: var(--brand); color: #fff; }
.flag-badge.flag-review { background: #d99400; color: #fff; }
.flag-badge.flag-rejected { background: var(--text-muted); color: #fff; }

.viewer-comment {
  margin: 10px 0 0;
  padding: 8px 10px;
  background: var(--surface-sub);
  border-radius: var(--radius);
  font-size: 13px;
}

.viewer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

@media (max-width: 640px) {
  .photo-grid-scroll {
    height: calc(100vh - 300px);
  }
  .viewer-overlay {
    padding: 8px;
  }
  .viewer-image img {
    max-height: calc(100vh - 240px);
  }
}

/* ============================================================
   ZIPダウンロード（仕様13章）
   ============================================================ */

/* ジョブの状態。写真のフラグとは別系統の色にして、
   同じ画面に並んでも混同しないようにする */
.status.job-queued {
  background: var(--surface-sub);
  color: var(--text-muted);
}

.status.job-running {
  background: var(--brand-blue);
  color: #fff;
}

.status.job-done {
  background: var(--brand);
  color: #fff;
}

.status.job-failed {
  background: var(--danger);
  color: #fff;
}

/* 失敗の理由。長いことがあるので省略して title に全文を持たせる */
.job-error {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   学校担当者の画面（仕様3.2）
   ============================================================ */

/* 募集設定などの操作ブロック。
   権限ごとに出し分けるので、それぞれを枠で区切る */
.control-block {
  padding: 16px;
  margin-bottom: 16px;
  background: var(--surface-sub);
  border-radius: var(--radius);
}

.control-block:last-child {
  margin-bottom: 0;
}

.control-block .sub-head {
  margin: 0 0 12px;
  font-size: 14px;
}

.control-block .field {
  max-width: 320px;
}

/* 削除ボタン。取り返しがつかない操作なので、
   フラグのボタンと視覚的に分ける */
button.danger,
.btn.danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

button.danger:hover:not(:disabled),
.btn.danger:hover {
  filter: brightness(0.92);
}

/* ──────────────────────────────────────────────
   ZIP作成の一覧：状態を一目で分かるようにする
   （実機確認で「どこを見れば終わったか分からない」との指摘）
   ────────────────────────────────────────────── */

/* 作成中。動いていることが分かるよう薄く色を敷く */
.job-row-running,
.job-row-queued {
  background: var(--accent-soft, #eef4ff);
}

/* 完了。受け取れる状態であることを示す */
.job-row-done {
  background: var(--ok-soft, #eefaf0);
}

/* 失敗 */
.job-row-failed {
  background: var(--danger-soft, #fdeeee);
}

/* ──────────────────────────────────────────────
   投稿の失敗行：やり直し／取り消し
   （実機確認の指摘。消せないと残り枚数を食ったままになる）
   ────────────────────────────────────────────── */
/* ★失敗した行は正方形の枠から解放する（2026-08-23 修正）★

   .photo-item は aspect-ratio: 1 と overflow: hidden で
   正方形に固定されている。写真のサムネイルはそれでよいが、
   **失敗時は「状態」「やり直す」「取り消す」が縦に並ぶ**ので
   正方形に収まらず、はみ出した部分が切り取られて
   ボタンが押せなくなっていた。

   失敗した行だけ高さの制限を外す。

   :has() は使わない。対応していないブラウザで効かないと
   同じ問題が残り、しかも気づきにくい。 */
.photo-item.is-failed {
  aspect-ratio: auto;
  overflow: visible;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px 4px;
}

/* ★失敗時は状態表示を絶対配置から外す（2026-08-23 修正）★

   .photo-state は position: absolute; inset: 0 で
   **親要素の全面を覆う**。
   通常は「送信中 50%」を写真の中央に出すためだが、
   失敗時はその下にボタンが並ぶため、
   **文字のレイヤーがボタンの上に乗ってクリックを奪っていた**。

   見た目には押せそうなのに反応しない、という
   最も分かりにくい壊れ方をしていた。 */
.photo-item.is-failed .photo-state {
  position: static;
  inset: auto;
  padding: 4px 8px 8px;
  font-size: 0.78rem;
}

.photo-actions {
  display: flex;
  gap: 6px;
  padding: 6px;
  justify-content: center;
}

.photo-actions button {
  font-size: 0.82rem;
  padding: 6px 12px;
  /* スマートフォンで押しやすい大きさを確保する。
     2つ並ぶので、細くなりすぎないよう最低幅も決める */
  min-height: 38px;
  min-width: 68px;
  white-space: nowrap;
}

