/* ========================================
   入試応援 共通スタイル
   css/exam-cheer.css

   staff-cheer.html（申請・参加）と exam-cheer-admin.html（承認管理）が
   同じ見た目になるよう、両方から読み込む。片方だけ直さないこと。
======================================== */
* { margin: 0; padding: 0; box-sizing: border-box; }
/* .btn 等の display 指定がブラウザ既定の [hidden]{display:none} を上回ってしまうため明示する */
[hidden] { display: none !important; }

:root {
  --ink: #1f2937;
  --ink-soft: #5b6b68;
  --ink-faint: #8b9895;
  --bg: #f5f8f7;
  --surface: #fff;
  --surface-2: #f0f4f3;
  --line: #dde5e3;
  --line-strong: #c4d0cd;
  --teal: #0e7c6b;
  --teal-weak: #e4f1ee;
  --teal-line: #9fcdc4;
  --amber: #9a5b06;
  --amber-weak: #fdf2e0;
  --amber-line: #e7bf82;
  --red: #a8231b;
  --red-weak: #fceceb;
  --red-line: #e6b4b0;
  --blue: #1c4ed8;
  --blue-weak: #e7ecfd;
  --shadow: 0 1px 2px rgba(20,32,31,.06), 0 8px 24px rgba(20,32,31,.08);
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.7;
}

/* ========== ヘッダー ========== */
.header {
  background: #111; padding: 18px 24px; display: flex; align-items: center;
  position: sticky; top: 0; z-index: 100;
}
.header-content {
  max-width: 1200px; margin: 0 auto; width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.header-left { display: flex; align-items: center; gap: 16px; min-width: 0; }
.back-btn {
  display: flex; align-items: center; gap: 6px; color: #aaa; text-decoration: none;
  font-size: 14px; padding: 8px 12px; border-radius: 8px; transition: all .2s; white-space: nowrap;
}
.back-btn:hover { color: #fff; background: rgba(255,255,255,.1); }
.header-divider { width: 1px; height: 20px; background: #444; }
.header-title { font-size: 20px; font-weight: 600; color: #fff; white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: 12px; }
.user-menu { position: relative; }
.user-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px; background: rgba(255,255,255,0.1);
  border: none; border-radius: 8px; color: #fff;
  font-size: 13px; font-family: inherit; cursor: pointer; transition: all 0.2s;
}
.user-btn:hover { background: rgba(255,255,255,0.2); }
.user-avatar {
  width: 28px; height: 28px; background: #10b981;
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.user-name { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-dropdown {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: #fff; border: 1px solid #e5e5e5; border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.15); min-width: 200px;
  opacity: 0; visibility: hidden; transform: translateY(-10px);
  transition: all 0.2s; z-index: 200;
}
.user-dropdown.show { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-header { padding: 14px 16px; border-bottom: 1px solid #f0f0f0; }
.dropdown-name { font-size: 14px; font-weight: 600; color: #111; margin-bottom: 2px; }
.dropdown-email { font-size: 12px; color: #888; }
.dropdown-menu { padding: 8px; }
.dropdown-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; color: #555;
  text-decoration: none; transition: all 0.2s; cursor: pointer;
  border: none; background: none; width: 100%; font-family: inherit;
}
.dropdown-item:hover { background: #f5f5f5; color: #111; }
.dropdown-item.danger { color: #ef4444; }
.dropdown-item.danger:hover { background: #fef2f2; }
.dropdown-divider { height: 1px; background: #f0f0f0; margin: 6px 0; }

/* ========== 本体 ========== */
.main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.page-head h2 { font-size: 20px; font-weight: 700; }
.page-head p { margin-top: 4px; font-size: 13px; color: var(--ink-soft); }
.help-btn {
  width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft);
  font: inherit; font-weight: 700; font-size: 15px;
}
.help-btn:hover { background: var(--surface-2); color: var(--ink); }

/* 1段目: ページ切替（黒塗り） */
.tabs1 { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.tabs1 button {
  border: 1px solid var(--ink); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 13px; font-weight: 500; padding: 9px 18px; border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 8px;
}
.tabs1 button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tabs1 .count {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
  background: var(--amber-weak); color: var(--amber); border: 1px solid var(--amber-line);
}
.tabs1 button[aria-pressed="true"] .count { background: var(--amber); color: #fff; border-color: var(--amber); }

/* カード */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  font: inherit; font-size: 12px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft);
}
.chip[aria-pressed="true"] { background: var(--blue-weak); border-color: var(--blue); color: var(--blue); font-weight: 700; }
.spacer { flex: 1 1 auto; }

.btn {
  font: inherit; font-size: 13px; font-weight: 500; padding: 9px 18px; border-radius: 8px;
  cursor: pointer; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 6px;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-main { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn-main:hover:not(:disabled) { background: #0b6759; }
.btn-sub { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-sub:hover:not(:disabled) { background: var(--surface-2); }
.btn-danger { background: var(--surface); color: var(--red); border-color: var(--red-line); }
.btn-danger:hover:not(:disabled) { background: var(--red-weak); }

/* 一覧（PC） */
.tbl-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: center; font-weight: 500; font-size: 12px; color: var(--ink-soft);
  padding: 11px 8px; border-bottom: 1px solid var(--line); white-space: nowrap;
}
tbody td { padding: 12px 8px; border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
td.date { font-variant-numeric: tabular-nums; white-space: nowrap; }
td.uni { text-align: left; min-width: 190px; }
td.uni .campus { display: block; font-size: 12px; color: var(--ink-soft); }
tr.dim td { opacity: .55; }

.badge {
  display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 9px;
  border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.b-open { background: var(--surface-2); color: var(--ink-soft); border-color: var(--line-strong); }
.b-wait { background: var(--amber-weak); color: var(--amber); border-color: var(--amber-line); }
.b-ok { background: var(--teal-weak); color: var(--teal); border-color: var(--teal-line); }
.b-no { background: var(--surface-2); color: var(--ink-faint); border-color: var(--line); }
.b-me { background: var(--teal-weak); color: var(--teal); border-color: var(--teal-line); }

.mark.alert { background: var(--red-weak); border-color: var(--red-line); color: var(--red); }
.mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; margin-left: 6px; cursor: pointer;
  background: var(--amber-weak); border: 1px solid var(--amber-line); color: var(--amber);
  font-size: 11px; font-weight: 700; vertical-align: middle;
}

/* 一覧（スマホ・カード） */
.rowcards { display: none; padding: 6px; }
.rowcard {
  display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; margin: 8px 0;
}
.rowcard .r1 { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.rowcard .r1 .d { font-weight: 700; }
.rowcard .r2 { font-weight: 500; margin-top: 3px; }
.rowcard .r3 { font-size: 12px; color: var(--ink-soft); }
.rowcard.dim { opacity: .55; }

.empty { padding: 36px 16px; text-align: center; color: var(--ink-soft); font-size: 13px; }

/* モーダル */
.veil {
  position: fixed; inset: 0; background: rgba(12,20,19,.45); z-index: 200;
  display: none; align-items: flex-start; justify-content: center;
  padding: 24px 16px; overflow-y: auto;
}
.veil.open { display: flex; }
.modal {
  width: 100%; max-width: 640px; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
  margin: auto;                       /* 収まるときは上下中央 */
  max-height: calc(100vh - 48px);     /* 画面の外へ伸ばさない */
  display: flex; flex-direction: column;
}
.modal.narrow { max-width: 440px; }
/* 見出し・ステップ・フッターは固定し、真ん中だけスクロールさせる */
.m-head { flex: 0 0 auto; display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.m-head h3 { font-size: 17px; font-weight: 700; flex: 1; min-width: 0; }
.m-head .sub { margin-top: 3px; font-size: 12px; color: var(--ink-soft); }
.x {
  width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft);
  font: inherit; font-size: 15px;
}
.x:hover { background: var(--surface-2); }
.m-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 4px 16px 16px; }
.m-foot { flex: 0 0 auto; display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface-2); }

.sect { padding: 14px 0; border-bottom: 1px solid var(--line); }
.sect:last-child { border-bottom: 0; }
.sect h4 { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--ink-faint); margin-bottom: 8px; }
.kv { display: grid; grid-template-columns: 116px 1fr; gap: 5px 12px; font-size: 13px; }
.kv dt { color: var(--ink-soft); }
.people { display: flex; flex-wrap: wrap; gap: 6px; }
.person {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  padding: 4px 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
}
.person.me { background: var(--teal-weak); border-color: var(--teal-line); color: var(--teal); font-weight: 700; }
.person.off { opacity: .6; }
.person.off .pname { text-decoration: line-through; }
.person .kick {
  font: inherit; font-size: 11px; color: var(--red); background: none; border: 0;
  cursor: pointer; padding: 0 0 0 2px; text-decoration: underline;
}
.banner {
  display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; line-height: 1.65;
  padding: 10px 12px; border-radius: 8px; background: var(--amber-weak);
  border: 1px solid var(--amber-line); color: var(--amber);
}
.banner.info { background: var(--teal-weak); border-color: var(--teal-line); color: var(--teal); }
details.fold { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
details.fold summary { padding: 10px 12px; cursor: pointer; font-size: 13px; font-weight: 500; list-style: none; }
details.fold summary::-webkit-details-marker { display: none; }
details.fold summary::after { content: '開く'; float: right; font-size: 11px; color: var(--ink-faint); font-weight: 400; }
details.fold[open] summary::after { content: '閉じる'; }
details.fold .fold-body { padding: 0 12px 12px; font-size: 12.5px; color: var(--ink-soft); }
details.fold ul { margin: 6px 0 0; padding-left: 1.2em; }

/* フォーム */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--ink-soft); margin-bottom: 4px; }
.field .req { color: var(--red); font-weight: 700; }
.field input[type="text"], .field input[type="date"], .field select, .field textarea {
  font: inherit; font-size: 13px; padding: 8px 10px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: var(--surface); color: var(--ink); width: 100%;
}
.field textarea { resize: vertical; min-height: 58px; }
.field .hint, .hint { font-size: 11.5px; color: var(--ink-faint); margin-top: 3px; }
.field-row { display: flex; flex-wrap: wrap; gap: 12px 22px; }
.field-row > .field { margin-bottom: 12px; }
.w-date input, .w-date { max-width: 190px; }
.w-time input, .w-time { max-width: 140px; }
.w-short input, .w-short select, .w-short { max-width: 200px; }
.w-mid { flex: 1 1 240px; min-width: 200px; }
.w-uni { flex: 0 0 auto; width: 100%; max-width: 320px; }
/* チェックを入れると現れる欄は、ひとまとまりの箱にして「出てきた」ことを分かるようにする */
.revealbox {
  margin-top: 12px; padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--teal-line); background: var(--teal-weak);
}
.rb-title { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--teal); margin-bottom: 10px; }
.revealbox .field:last-child { margin-bottom: 0; }
.revealbox select, .revealbox textarea, .revealbox input { background: var(--surface); }
.revealbox .hint { color: var(--ink-soft); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; }
/* 時刻は hh と mm を選ぶ形にして表記のばらつきを防ぐ */
/* 開門時間と試験時間が隣り合うと境目が分からなくなるため、まとまりごとに箱で囲む */
.timeg {
  display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap;
  padding: 5px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2);
}
.timeg select {
  font: inherit; font-size: 13px; padding: 7px 6px; border: 1px solid var(--line-strong);
  border-radius: 7px; background: var(--surface); color: var(--ink); width: auto;
}
.timeg .sep { color: var(--ink-soft); font-size: 12px; }
.timeg .wave { color: var(--ink-soft); font-size: 13px; padding: 0 2px; }
.check input { width: 16px; height: 16px; }

/* 選ぶ一覧はモーダルの中に直接置く（重ね表示にすると枠の外で切れる） */
.pick-search {
  width: 100%; font: inherit; font-size: 13px; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink);
}
.pick-list {
  max-height: 196px; overflow-y: auto; margin-top: 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
}
.pick-item {
  display: block; width: 100%; text-align: left; font: inherit; font-size: 13px;
  padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line);
  background: none; cursor: pointer; color: var(--ink);
}
.pick-item:last-child { border-bottom: 0; }
.pick-item:hover { background: var(--surface-2); }
.pick-sub { display: block; font-size: 11.5px; color: var(--ink-faint); margin-top: 1px; }
.pick-empty { padding: 14px 12px; font-size: 12.5px; color: var(--ink-faint); }
.chosenbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border: 1px solid var(--teal-line); background: var(--teal-weak);
  border-radius: 8px; color: var(--teal); font-size: 13px; font-weight: 600;
}

.applist { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.applist label {
  display: flex; gap: 9px; align-items: flex-start; font-size: 13px; padding: 9px 11px;
  border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; background: var(--surface);
}
.applist label:hover { background: var(--surface-2); }
.applist input { margin-top: 4px; }
.applist .al-sub { display: block; font-size: 11.5px; color: var(--ink-soft); }

.tchip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px;
  padding: 5px 10px; border-radius: 999px; background: var(--teal-weak);
  border: 1px solid var(--teal-line); color: var(--teal); font-weight: 500;
}
.tchip button { font: inherit; font-size: 13px; line-height: 1; color: var(--teal); background: none; border: 0; cursor: pointer; }

/* 長い入力はステップに分ける（縦長のまま出さない） */
.stepbar { flex: 0 0 auto; padding: 12px 16px 10px; border-bottom: 1px solid var(--line); background: var(--surface); }
.stepbar-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.stepno { font-size: 11px; font-weight: 700; letter-spacing: .08em; color: var(--teal); }
.steptitle { font-size: 14px; font-weight: 700; }
.progress { height: 5px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress-fill { height: 100%; background: var(--teal); border-radius: 999px; transition: width .2s; }
.step[hidden] { display: none !important; }
.step .sect:first-child { padding-top: 10px; }

/* 未入力は赤枠で示す（トーストだけでは気づかれない） */
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--red); background: var(--red-weak); }
.field.invalid .pick-list { border-color: var(--red); }
.field.invalid input[type="hidden"] { background: none; }
.field.invalid .timeg select { border-color: var(--red); background: var(--red-weak); }
.ferr { font-size: 11.5px; color: var(--red); margin-top: 3px; font-weight: 500; }
.invalid > .applist, .invalid > .people { outline: 1px solid var(--red); outline-offset: 3px; border-radius: 8px; }

/* ポップアップ */
.pop {
  position: absolute; z-index: 300; max-width: 290px; font-size: 12px; line-height: 1.65;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  border-radius: 8px; box-shadow: var(--shadow); padding: 10px 12px; display: none;
}
.pop.open { display: block; }

/* 処理中の覆い（カレンダー登録などが終わるまで操作させない） */
.busy { position: fixed; inset: 0; background: rgba(12,20,19,.55); z-index: 500; display: none; align-items: center; justify-content: center; padding: 16px; }
.busy.open { display: flex; }
.busy-box { background: var(--surface); border-radius: 12px; padding: 20px 26px; display: flex; align-items: center; gap: 14px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); max-width: 100%; }
.spinner { width: 20px; height: 20px; flex: none; border: 2px solid var(--line-strong); border-top-color: var(--teal); border-radius: 50%; animation: cheerspin .8s linear infinite; }
@keyframes cheerspin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* トースト */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(14px);
  background: #111; color: #fff; font-size: 13px; padding: 11px 20px; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: all .22s; z-index: 400; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--red); }

.loading, .errorbox { padding: 40px 16px; text-align: center; color: var(--ink-soft); font-size: 13px; }
.errorbox { color: var(--red); }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

@media (max-width: 760px) {
  .header { padding: 14px 14px; }
  .header-title { font-size: 17px; }
  .main { padding: 18px 14px 56px; }
  .tbl-scroll { display: none; }
  .rowcards { display: block; }
  .kv { grid-template-columns: 100px 1fr; }
  .m-foot .btn { flex: 1 1 auto; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
