/* =========================================================
   チーム出欠 — 共通スタイル
   色はCSS変数で管理し、設定画面のチームカラーで --primary / --accent を上書きする
   ========================================================= */
:root {
  --primary: #14254a;        /* 濃いネイビー */
  --accent: #1f9d55;         /* グリーン */
  --bg: #f2f4f7;             /* 薄いグレー */
  --card: #ffffff;
  --text: #1c2433;
  --muted: #667085;
  --line: #e3e7ee;
  --line-strong: #cfd6e1;
  --ok: #1f9d55;   --ok-bg: #e7f6ee;
  --ng: #d63939;   --ng-bg: #fdecec;
  --maybe: #c77700; --maybe-bg: #fff4de;
  --none: #7a8599; --none-bg: #eef1f5;
  --t-training: #1f9d55; --t-training-bg: #e7f6ee;
  --t-match: #d9480f;    --t-match-bg: #fdeee6;
  --t-tournament: #7048e8; --t-tournament-bg: #efebfd;
  --t-trip: #1971c2;     --t-trip-bg: #e6f0fb;
  --t-meeting: #0c8599;  --t-meeting-bg: #e3f5f7;
  --t-other: #667085;    --t-other-bg: #eef1f5;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --font: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.6; color: var(--text); background: var(--bg); }
img { max-width: 100%; height: auto; }
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.35; margin: 0; }
p { margin: 0 0 .6em; }
button, input, select, textarea { font: inherit; color: inherit; }
.ico { flex: none; display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mt0 { margin-top: 0 !important; } .mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mt24 { margin-top: 24px; }
.mb0 { margin-bottom: 0 !important; } .mb16 { margin-bottom: 16px; }
.right { text-align: right; } .center { text-align: center; }
.hide { display: none !important; }

/* ---------- ボタン ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 16px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: #fff; color: var(--text); font-weight: 600;
  text-decoration: none; cursor: pointer; line-height: 1.2; white-space: nowrap; }
.btn:hover { background: #f7f8fa; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary); filter: brightness(1.15); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent); filter: brightness(1.08); }
.btn-danger { color: var(--ng); border-color: #f1c0c0; }
.btn-danger:hover { background: var(--ng-bg); }
.btn-sm { min-height: 34px; padding: 5px 11px; font-size: 13px; border-radius: 8px; }
.btn-block { display: flex; width: 100%; }
.btn-link { background: none; border: 0; padding: 0; min-height: 0; color: var(--primary); text-decoration: underline; cursor: pointer; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---------- フォーム ---------- */
label { display: block; font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.req { color: var(--ng); font-size: 12px; margin-left: 4px; font-weight: 600; }
.hint { font-size: 12.5px; color: var(--muted); margin-top: 4px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=datetime-local],
input[type=number], input[type=url], input[type=search], input[type=color], select, textarea {
  width: 100%; min-height: 44px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff;
  font-size: 16px; /* iOSで拡大されないよう16px */ }
input[type=color] { padding: 4px; width: 72px; }
textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--primary) 35%, transparent); outline-offset: 0; border-color: var(--primary); }
.field { margin-bottom: 16px; min-width: 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr)); gap: 0 14px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px 4px; margin: 0 0 16px; min-width: 0; }
legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; margin: 0 0 8px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--primary); }
.checks { display: flex; flex-wrap: wrap; gap: 4px 18px; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 8px; }
.error-box { background: var(--ng-bg); color: #a52222; border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; font-size: 14px; }
.error-box ul { margin: 0; padding-left: 18px; }

/* ---------- メッセージ ---------- */
.flash { border-radius: var(--radius-sm); padding: 11px 14px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.flash-success { background: var(--ok-bg); color: #13703b; }
.flash-error { background: var(--ng-bg); color: #a52222; }
.flash-info { background: #e8effb; color: #1f3f7a; }
.notice { background: #fff8e6; color: #7a5200; border-radius: var(--radius-sm); padding: 10px 14px; font-size: 14px; margin-bottom: 14px; }
.info-box { background: #eef3fb; color: #203a66; border-radius: var(--radius-sm); padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }

/* ---------- カード ---------- */
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { font-size: 16px; }
.card-link { font-size: 13px; font-weight: 600; text-decoration: none; }
.section-title { font-size: 15px; font-weight: 800; margin: 22px 2px 10px; display: flex; align-items: center; gap: 8px; }
.section-title .count { background: var(--ng); color: #fff; font-size: 12px; border-radius: 999px; padding: 1px 8px; font-weight: 700; }

/* ---------- チップ・バッジ ---------- */
.chip { display: inline-flex; align-items: center; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; line-height: 1.5; white-space: nowrap; }
.chip-training { color: var(--t-training); background: var(--t-training-bg); }
.chip-match { color: var(--t-match); background: var(--t-match-bg); }
.chip-tournament { color: var(--t-tournament); background: var(--t-tournament-bg); }
.chip-trip { color: var(--t-trip); background: var(--t-trip-bg); }
.chip-meeting { color: var(--t-meeting); background: var(--t-meeting-bg); }
.chip-other { color: var(--t-other); background: var(--t-other-bg); }
.chip-cancel { color: #fff; background: var(--ng); }
.chip-draft { color: var(--muted); background: #fff; box-shadow: inset 0 0 0 1px var(--line-strong); }
.chip-team { color: var(--primary); background: color-mix(in srgb, var(--primary) 9%, #fff); }
.chip-important { color: #fff; background: var(--ng); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.badge-gray { background: var(--none-bg); color: var(--muted); }
.badge-green { background: var(--ok-bg); color: #13703b; }
.badge-amber { background: var(--maybe-bg); color: #8a5300; }
.badge-red { background: var(--ng-bg); color: #a52222; }
.badge-blue { background: #e6f0fb; color: #1b5aa0; }
.ans { display: inline-flex; align-items: center; justify-content: center; min-width: 52px; font-size: 13px; font-weight: 800; padding: 2px 10px; border-radius: 999px; white-space: nowrap; }
.ans-ok { background: var(--ok-bg); color: var(--ok); }
.ans-ng { background: var(--ng-bg); color: var(--ng); }
.ans-maybe { background: var(--maybe-bg); color: var(--maybe); }
.ans-none { background: var(--none-bg); color: var(--none); }

/* ---------- 日付ブロック ---------- */
.dateblock { flex: none; width: 54px; text-align: center; border-radius: 12px; background: color-mix(in srgb, var(--primary) 7%, #fff); padding: 6px 0 5px; line-height: 1.1; color: var(--primary); }
.dateblock .db-m { display: block; font-size: 11px; font-weight: 700; opacity: .8; }
.dateblock .db-d { display: block; font-size: 22px; font-weight: 800; margin: 2px 0; }
.dateblock .db-w { display: block; font-size: 11px; font-weight: 700; }
.dateblock.is-sun { color: #c92a2a; background: #fdf0f0; }
.dateblock.is-sat { color: #1c5fb0; background: #edf3fc; }

/* ---------- 予定カード ---------- */
.ev { display: flex; gap: 12px; align-items: flex-start; }
.ev-body { flex: 1; min-width: 0; }
.ev-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 4px; }
.ev-title { font-size: 16px; font-weight: 800; margin: 0 0 4px; word-break: break-word; }
.ev-title a { color: inherit; text-decoration: none; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 13px; color: var(--muted); }
.ev-meta span { display: inline-flex; align-items: center; gap: 4px; }
.ev-meta .ico { width: 15px; height: 15px; }
.ev.is-cancelled .ev-title { text-decoration: line-through; color: var(--muted); }
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-list > li { padding: 12px 0; border-top: 1px solid var(--line); }
.ev-list > li:first-child { border-top: 0; padding-top: 2px; }
.ev-list > li:last-child { padding-bottom: 0; }
.ev-link { display: flex; gap: 12px; text-decoration: none; color: inherit; align-items: center; }
.ev-link .chev { color: var(--line-strong); margin-left: auto; }
.my-answers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; font-size: 13px; }
.my-answers > span { display: inline-flex; gap: 5px; align-items: center; }

/* ---------- 回答が必要（学生・保護者のトップ） ---------- */
.todo { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; outline: 2px solid color-mix(in srgb, var(--ng) 22%, transparent); }
.todo-for { font-size: 13px; font-weight: 700; color: var(--primary); margin: 10px 0 8px; display: flex; align-items: center; gap: 6px; }
.todo-dl { font-size: 12.5px; font-weight: 700; color: var(--ng); }
.todo.is-done { outline-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.todo-done-msg { display: none; font-weight: 700; color: var(--ok); font-size: 14px; margin-top: 10px; align-items: center; gap: 6px; }
.todo.is-done .todo-done-msg { display: flex; }

/* ---------- 回答ボタン ---------- */
.ans-buttons { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ans-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 64px; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; font-size: 15px; font-weight: 800; cursor: pointer; color: var(--muted); transition: background .12s, border-color .12s; -webkit-tap-highlight-color: transparent; }
.ans-btn .ico { width: 24px; height: 24px; }
.ans-btn-ok { color: var(--ok); } .ans-btn-ng { color: var(--ng); } .ans-btn-maybe { color: var(--maybe); }
.ans-btn-ok.is-on { background: var(--ok); border-color: var(--ok); color: #fff; }
.ans-btn-ng.is-on { background: var(--ng); border-color: var(--ng); color: #fff; }
.ans-btn-maybe.is-on { background: var(--maybe); border-color: var(--maybe); color: #fff; }
.ans-btn:active { transform: scale(.97); }
.ans-btn[disabled] { cursor: default; opacity: .75; }
.ans-form.is-compact .ans-btn { min-height: 52px; font-size: 14px; }
.ans-form.is-busy { opacity: .6; pointer-events: none; }
.ans-comment { margin-top: 10px; }
.ans-comment summary { font-size: 13px; color: var(--primary); cursor: pointer; font-weight: 600; list-style: none; display: inline-flex; align-items: center; gap: 4px; }
.ans-comment summary::-webkit-details-marker { display: none; }
.ans-comment[open] summary { margin-bottom: 6px; }
.ans-comment-row { display: flex; gap: 8px; }
.ans-comment-row input { flex: 1; min-width: 0; }
.ans-status { font-size: 13px; margin-top: 8px; color: var(--muted); min-height: 1em; }
.ans-status.is-error { color: var(--ng); font-weight: 700; }

/* ---------- 予定詳細（1画面で回答） ---------- */
.detail-hero { background: var(--primary); color: #fff; border-radius: var(--radius); padding: 18px 16px 16px; margin-bottom: 14px; position: relative; overflow: hidden; }
.detail-hero::after { content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px; border: 2px solid rgba(255,255,255,.12); border-radius: 50%; }
.detail-hero .chip { background: rgba(255,255,255,.16); color: #fff; }
.detail-hero .chip-cancel { background: var(--ng); }
.detail-date { font-size: 14px; font-weight: 700; opacity: .9; margin-top: 8px; }
.detail-title { font-size: 21px; font-weight: 800; margin: 2px 0 0; word-break: break-word; }
.detail-hero.is-cancelled .detail-title { text-decoration: line-through; opacity: .8; }
.facts { display: grid; gap: 0; margin: 0; }
.facts > div { display: grid; grid-template-columns: 88px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.facts > div:first-child { border-top: 0; padding-top: 0; }
.facts dt { font-size: 13px; color: var(--muted); font-weight: 700; display: flex; gap: 5px; align-items: flex-start; }
.facts dt .ico { width: 16px; height: 16px; margin-top: 2px; }
.facts dd { margin: 0; font-weight: 600; word-break: break-word; min-width: 0; }
.big-time { font-size: 18px; font-weight: 800; }
.answer-card h2 { font-size: 16px; margin-bottom: 4px; }
.answer-for { font-weight: 800; font-size: 15px; margin: 14px 0 8px; display: flex; align-items: center; gap: 8px; }
.answer-for:first-of-type { margin-top: 6px; }

/* ---------- 集計 ---------- */
.tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tally > div { border-radius: 12px; padding: 10px 6px; text-align: center; }
.tally b { display: block; font-size: 24px; line-height: 1.2; font-weight: 800; }
.tally span { font-size: 12px; font-weight: 700; }
.tally .t-ok { background: var(--ok-bg); color: var(--ok); }
.tally .t-ng { background: var(--ng-bg); color: var(--ng); }
.tally .t-maybe { background: var(--maybe-bg); color: var(--maybe); }
.tally .t-none { background: var(--none-bg); color: var(--none); }
.tally-mini { display: inline-flex; gap: 10px; font-size: 13px; font-weight: 700; flex-wrap: wrap; }
.tally-mini .ok { color: var(--ok); } .tally-mini .ng { color: var(--ng); } .tally-mini .maybe { color: var(--maybe); } .tally-mini .none { color: var(--none); }
.bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--none-bg); margin-top: 8px; }
.bar i { display: block; height: 100%; }
.bar .ok { background: var(--ok); } .bar .ng { background: var(--ng); } .bar .maybe { background: var(--maybe); }
.pos-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr)); gap: 8px; }
.pos-grid > div { background: #f6f8fb; border-radius: 12px; padding: 10px; text-align: center; }
.pos-grid .pos { font-size: 12px; font-weight: 800; color: var(--muted); letter-spacing: .05em; }
.pos-grid .num { font-size: 22px; font-weight: 800; }
.pos-grid .num small { font-size: 14px; color: var(--muted); font-weight: 700; }

/* ---------- 表 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; background: #fafbfc; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.num, .tbl th.num { text-align: right; }
.tbl .name { font-weight: 700; }
.tbl .sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
.tbl tr.is-inactive td { color: var(--muted); background: #fafafa; }
.tbl a.row-link { font-weight: 700; text-decoration: none; }
.tbl a.row-link:hover { text-decoration: underline; }

/* ---------- タブ・フィルター ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs a { flex: none; padding: 7px 14px; border-radius: 999px; background: #fff; color: var(--text); text-decoration: none; font-size: 14px; font-weight: 700; box-shadow: inset 0 0 0 1px var(--line-strong); white-space: nowrap; }
.tabs a.is-active { background: var(--primary); color: #fff; box-shadow: none; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-bottom: 14px; }
.filters .field { margin: 0; flex: 1 1 150px; }
.filters select, .filters input { min-height: 40px; font-size: 15px; }

/* ---------- 空の状態 ---------- */
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.empty .ico { margin: 0 auto 8px; opacity: .45; }
.empty p { margin: 0; font-size: 14px; }

/* ---------- カレンダー ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.cal-head h2 { font-size: 18px; font-weight: 800; }
.cal-nav { display: flex; gap: 6px; }
.cal-nav a { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 10px; background: #fff; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--text); }
.cal-nav a.cal-today { width: auto; padding: 0 12px; font-size: 13px; font-weight: 700; text-decoration: none; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--line); gap: 1px; border-radius: 12px; overflow: hidden; }
.cal-dow { background: #fafbfc; text-align: center; font-size: 12px; font-weight: 700; padding: 6px 0; color: var(--muted); }
.cal-dow.sun { color: #c92a2a; } .cal-dow.sat { color: #1c5fb0; }
.cal-day { background: #fff; min-height: 64px; padding: 4px 3px; display: block; color: inherit; text-decoration: none; min-width: 0; }
.cal-day.is-out { background: #fafbfc; }
.cal-day.is-out .cal-num { color: #b8c0cc; }
.cal-num { display: inline-flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; width: 24px; height: 24px; border-radius: 50%; }
.cal-day.sun .cal-num { color: #c92a2a; } .cal-day.sat .cal-num { color: #1c5fb0; }
.cal-day.is-today .cal-num { background: var(--primary); color: #fff; }
.cal-items { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.cal-item { display: block; font-size: 10.5px; font-weight: 700; line-height: 1.35; padding: 1px 4px; border-radius: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-item.is-cancelled { text-decoration: line-through; opacity: .6; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.cal-list-date { font-size: 13px; font-weight: 800; color: var(--muted); margin: 14px 0 6px; }
@media (max-width: 560px) {
  .cal-day { min-height: 54px; }
  .cal-item { font-size: 0; padding: 0; width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
  .cal-items { flex-direction: row; flex-wrap: wrap; gap: 3px; padding: 0 2px; }
  .cal-item.chip-training { background: var(--t-training); } .cal-item.chip-match { background: var(--t-match); }
  .cal-item.chip-tournament { background: var(--t-tournament); } .cal-item.chip-trip { background: var(--t-trip); }
  .cal-item.chip-meeting { background: var(--t-meeting); } .cal-item.chip-other { background: var(--t-other); }
}

/* ---------- お知らせ ---------- */
.news-list { list-style: none; margin: 0; padding: 0; }
.news-list li { border-top: 1px solid var(--line); }
.news-list li:first-child { border-top: 0; }
.news-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; text-decoration: none; color: inherit; }
.news-list li:first-child .news-row { padding-top: 2px; }
.news-main { flex: 1; min-width: 0; }
.news-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; line-height: 1.4; }
.news-title { font-weight: 700; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 2px; word-break: break-word; }
.news-date { font-size: 12.5px; color: var(--muted); }
.news-new { font-size: 11px; font-weight: 800; color: #fff; background: var(--ng); border-radius: 999px; padding: 0 7px; line-height: 1.6; }

/* お知らせのカテゴリ色（ここを変えればカテゴリの色が変わる） */
.cat-general  { --cat: #3b5bdb; --cat-bg: #e9eefc; }
.cat-schedule { --cat: #0c8599; --cat-bg: #e3f5f7; }
.cat-match    { --cat: #d9480f; --cat-bg: #fdeee6; }
.cat-trip     { --cat: #1971c2; --cat-bg: #e6f0fb; }
.cat-money    { --cat: #b7791f; --cat-bg: #fdf3dc; }
.cat-document { --cat: #7048e8; --cat-bg: #efebfd; }
.cat-ico { flex: none; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; color: var(--cat); background: var(--cat-bg); }
.cat-label { font-size: 12px; font-weight: 800; color: var(--cat); }
.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pick label { margin: 0; cursor: pointer; }
.cat-pick input { position: absolute; opacity: 0; pointer-events: none; }
.cat-pick .cat-opt { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 12px; border: 2px solid var(--line); font-size: 14px; font-weight: 700; background: #fff; }
.cat-pick .cat-opt .cat-ico { width: 30px; height: 30px; border-radius: 9px; }
.cat-pick input:checked + .cat-opt { border-color: var(--cat); background: var(--cat-bg); color: var(--cat); }
.cat-pick input:focus-visible + .cat-opt { outline: 2px solid var(--cat); outline-offset: 2px; }
.news-body { font-size: 15px; line-height: 1.85; word-break: break-word; }
.files { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 6px; }
.files a { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: #f6f8fb; text-decoration: none; font-weight: 600; word-break: break-all; }

/* =================== 学生・保護者レイアウト =================== */
body.member { padding-bottom: calc(72px + var(--safe-b)); }
.m-top { background: var(--primary); color: #fff; position: sticky; top: 0; z-index: 20; }
.m-top-in { max-width: 640px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 16px; }
.m-brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 800; font-size: 15px; min-width: 0; }
.m-brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-who { font-size: 13px; font-weight: 700; text-align: right; line-height: 1.25; flex: none; }
.m-who small { display: block; font-size: 11px; opacity: .75; font-weight: 500; }
.m-main { max-width: 640px; margin: 0 auto; padding: 16px 16px 24px; }
.m-hello { font-size: 20px; font-weight: 800; margin: 2px 2px 4px; }
.m-sub { color: var(--muted); font-size: 13px; margin: 0 2px 6px; }
.m-nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: repeat(6, 1fr); padding-bottom: var(--safe-b); }
.m-nav a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 60px;
  color: #8a94a6; text-decoration: none; font-size: 10.5px; font-weight: 700; -webkit-tap-highlight-color: transparent; }
.m-nav a.is-active { color: var(--primary); }
.m-nav a.is-active .ico { stroke-width: 2.3; }
.dot-count { position: absolute; top: 6px; left: 50%; margin-left: 6px; background: var(--ng); color: #fff; font-size: 10px; min-width: 18px; height: 18px; border-radius: 99px; display: flex; align-items: center; justify-content: center; padding: 0 4px; }
.page-title { font-size: 20px; font-weight: 800; margin: 2px 2px 14px; }
.back { display: inline-flex; align-items: center; gap: 2px; font-size: 14px; font-weight: 700; text-decoration: none; margin-bottom: 10px; }
.back .ico { width: 18px; height: 18px; }
.child-switch { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }

/* =================== 管理レイアウト =================== */
.a-shell { min-height: 100vh; }
.a-side { position: fixed; top: 0; bottom: 0; left: 0; width: 232px; background: var(--primary); color: #fff; display: flex; flex-direction: column; z-index: 50; overflow-y: auto; }
.a-brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.a-brand strong { display: block; font-size: 15px; line-height: 1.3; }
.a-brand small { display: block; font-size: 11px; opacity: .65; }
.a-menu { display: flex; flex-direction: column; gap: 2px; padding: 6px 10px; flex: 1; }
.a-menu a { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 10px; color: rgba(255,255,255,.82); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.a-menu a:hover { background: rgba(255,255,255,.08); color: #fff; }
.a-menu a.is-active { background: rgba(255,255,255,.14); color: #fff; }
.a-menu a.is-active .ico { color: #6fe3a4; }
.a-side-foot { padding: 12px 10px 16px; border-top: 1px solid rgba(255,255,255,.12); }
.a-me { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; padding: 6px 10px; border-radius: 10px; font-size: 14px; font-weight: 700; }
.a-me:hover { background: rgba(255,255,255,.08); }
.a-me small { display: block; font-size: 11px; opacity: .65; font-weight: 500; }
.a-logout { display: flex; align-items: center; gap: 8px; width: 100%; background: none; border: 0; color: rgba(255,255,255,.75); padding: 8px 10px; cursor: pointer; font-size: 13.5px; border-radius: 10px; }
.a-logout:hover { background: rgba(255,255,255,.08); color: #fff; }
.a-body { margin-left: 232px; min-width: 0; }
.a-top { display: flex; align-items: center; gap: 10px; padding: 16px 24px 4px; }
.a-title { font-size: 21px; font-weight: 800; }
.a-burger { display: none; }
.a-main { padding: 12px 24px 40px; max-width: 1180px; }
.a-overlay { display: none; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; align-items: center; }
.page-actions .spacer { flex: 1; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 12px; margin-bottom: 14px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1.2; margin-top: 2px; }
.stat-value small { font-size: 14px; color: var(--muted); font-weight: 700; margin-left: 2px; }
.stat.is-alert .stat-value { color: var(--ng); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 14px; align-items: start; }
.grid-2 > .card { margin-bottom: 0; }
.form-card { max-width: 760px; }
.invite-box { background: #f4f7fb; border-radius: var(--radius-sm); padding: 12px 14px; margin: 10px 0; }
.invite-box input { font-size: 13px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.inline-form { display: inline; }
.proxy-select { min-height: 34px !important; padding: 4px 8px !important; font-size: 14px !important; width: auto !important; }

@media (max-width: 900px) {
  .a-side { transform: translateX(-100%); transition: transform .2s ease; width: 264px; box-shadow: 0 0 30px rgba(0,0,0,.2); }
  body.menu-open .a-side { transform: none; }
  body.menu-open .a-overlay { display: block; position: fixed; inset: 0; background: rgba(10,18,35,.45); z-index: 40; }
  .a-body { margin-left: 0; }
  .a-top { position: sticky; top: 0; z-index: 20; background: var(--primary); color: #fff; padding: 10px 12px; }
  .a-title { font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .a-burger { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; background: rgba(255,255,255,.1); color: #fff; border-radius: 10px; cursor: pointer; flex: none; }
  .a-main { padding: 14px 16px 40px; }
  .tally b { font-size: 21px; }
}

/* ---------- ログイン等の単独ページ ---------- */
body.plain { min-height: 100vh; display: flex; flex-direction: column; background: var(--primary); }
.auth-wrap { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px 16px; position: relative; overflow: hidden; }
.auth-wrap::before { content: ""; position: absolute; border: 2px solid rgba(255,255,255,.07); pointer-events: none;
  width: 340px; height: 340px; border-radius: 50%; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.auth-card { position: relative; z-index: 1; width: 100%; max-width: 400px; background: #fff; border-radius: 18px; padding: 26px 22px 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-logo { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--primary); margin-bottom: 4px; }
.auth-logo .ico { width: 30px; height: 30px; }
.auth-card h1 { text-align: center; font-size: 20px; font-weight: 800; }
.auth-card .lead { text-align: center; font-size: 13px; color: var(--muted); margin: 4px 0 18px; }
.auth-foot { text-align: center; font-size: 13px; margin-top: 14px; }
.deny { max-width: 460px; margin: 12vh auto; background: #fff; border-radius: 18px; padding: 28px 22px; text-align: center; }
.deny-code { font-size: 42px; font-weight: 800; color: var(--line-strong); margin: 0; }
.deny h1 { font-size: 19px; margin-bottom: 8px; }

/* ---------- 印刷（招待状） ---------- */
.print-sheet { max-width: 720px; margin: 0 auto; background: #fff; padding: 32px; }
.print-grid { display: grid; grid-template-columns: 1fr 180px; gap: 24px; align-items: center; }
@media print {
  body { background: #fff; }
  .no-print { display: none !important; }
  .print-sheet { padding: 0; }
}
@media print {
  .a-side, .a-top, .back, .flash, .m-top, .m-nav { display: none !important; }
  .a-body { margin: 0 !important; }
  .a-main { padding: 0 !important; }
  .card { box-shadow: none; }
}
@media (max-width: 560px) {
  .print-grid { grid-template-columns: 1fr; }
}

/* ---------- 各画面の説明（×で閉じられる） ---------- */
.intro { margin-bottom: 14px; }
.intro-box { display: flex; gap: 10px; align-items: flex-start; background: #eef3fb; color: #203a66; border-radius: var(--radius-sm); padding: 11px 12px 11px 14px; font-size: 13.5px; line-height: 1.7; }
.intro-box > .ico { color: #3b5bdb; margin-top: 2px; }
.intro-box p { margin: 0; flex: 1; min-width: 0; }
.intro-close { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; margin: -4px -4px 0 0; border: 0; border-radius: 8px; background: transparent; color: #5a6f94; cursor: pointer; }
.intro-close:hover { background: rgba(32,58,102,.08); }
.intro-open { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 2px 0; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.intro-open:hover { color: var(--primary); }
.intro.is-closed .intro-box { display: none; }
.intro-open[hidden], .intro-close[hidden] { display: none; }
@media print { .intro { display: none !important; } }

/* ---------- 使い方ページ ---------- */
.m-right { display: flex; align-items: center; gap: 12px; flex: none; }
.m-help { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; color: #fff; text-decoration: none; font-size: 10px; font-weight: 700; opacity: .9; }
.m-help:hover { opacity: 1; }
.intro-more { font-weight: 700; white-space: nowrap; }
.guide-card { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.guide-card > .ico:first-child { color: #3b5bdb; }
.guide-card span { flex: 1; min-width: 0; }
.guide-card small { display: block; color: var(--muted); font-size: 12.5px; }
.guide-card > .ico:last-child { color: var(--line-strong); }
.guide-login { background: #fff; color: var(--primary); border-color: #fff; }
.guide-main { max-width: 760px; }
.guide-tabs a { display: inline-flex; align-items: center; gap: 6px; }
.guide-toc-title { font-weight: 800; margin: 0 0 6px; font-size: 14px; }
.guide-toc ol { margin: 0; padding-left: 1.4em; display: grid; gap: 4px; font-size: 14.5px; }
.guide-toc a { text-decoration: none; font-weight: 600; }
.guide-toc a:hover { text-decoration: underline; }
.guide-sec { scroll-margin-top: 70px; }
.guide-h { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 800; margin-bottom: 8px; }
.guide-no { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 15px; }
.guide-lead { color: var(--muted); font-size: 14px; margin-bottom: 10px; }
.guide-grid { display: grid; gap: 16px; }
.guide-grid.has-img { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.guide-grid.has-img.is-phone { grid-template-columns: minmax(0, 1fr) minmax(0, 280px); }
.guide-steps { margin: 0 0 10px; padding-left: 1.5em; display: grid; gap: 8px; font-size: 15px; line-height: 1.75; }
.guide-steps li::marker { font-weight: 800; color: var(--primary); }
.guide-tip { display: flex; gap: 8px; align-items: flex-start; background: #eef3fb; color: #203a66; border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13.5px; line-height: 1.7; margin: 8px 0 0; }
.guide-tip .ico { flex: none; color: #3b5bdb; margin-top: 2px; }
.guide-faq { margin: 0; display: grid; gap: 10px; }
.guide-faq dt { font-weight: 800; display: flex; gap: 6px; }
.guide-faq dt::before { content: "Q"; color: var(--accent); }
.guide-faq dd { margin: 2px 0 0 1.2em; font-size: 14.5px; line-height: 1.75; }
.guide-fig { margin: 0; }
.guide-fig img { display: block; width: 100%; height: auto; border-radius: 12px; border: 1px solid var(--line); box-shadow: var(--shadow); background: #fff; }
.guide-fig figcaption { font-size: 12px; color: var(--muted); text-align: center; margin-top: 6px; }
.guide-top { text-align: right; margin: 10px 0 0; font-size: 12.5px; }
.guide-top a { color: var(--muted); text-decoration: none; }
@media (max-width: 760px) {
  .guide-grid.has-img, .guide-grid.has-img.is-phone { grid-template-columns: 1fr; }
  .guide-grid.is-phone .guide-fig { max-width: 300px; margin: 0 auto; }
}

/* ---------- 表：スマホで名前などが1文字ずつ折り返さないように ----------
   基本は折り返さず、表ごと横にスクロールする。長い文章の列だけ .wrap / .wrap-s で折り返す */
.tbl td { white-space: nowrap; }
.tbl td.wrap { white-space: normal; min-width: 200px; }
.tbl td.wrap-s { white-space: normal; min-width: 140px; }

/* 出欠一覧・メンバー一覧は、スマホでは1人1枚のカードにする */
@media (max-width: 640px) {
  .table-wrap:has(.tbl--cards) { margin: 0; padding: 0; overflow: visible; }
  .tbl--cards thead { display: none; }
  .tbl--cards, .tbl--cards tbody { display: block; }
  .tbl--cards tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .tbl--cards tr:last-child { border-bottom: 0; }
  .tbl--cards td { display: block; padding: 0; border: 0; background: none !important; white-space: normal; min-width: 0; }
  .tbl--cards .c-name { order: 1; flex: 1 1 0; font-size: 16px; }
  .tbl--cards .c-name .sub { display: inline; margin-left: 6px; }
  .tbl--cards .c-ans, .tbl--cards .c-login, .tbl--cards .c-act { order: 2; flex: none; }
  .tbl--cards .c-meta { order: 3; font-size: 13px; color: var(--muted); }
  .tbl--cards .c-meta + .c-meta::before { content: "・"; margin-right: 8px; color: var(--line-strong); }
  .tbl--cards .c-num::after { content: "番"; }
  .tbl--cards .c-meta:first-of-type { flex-basis: auto; }
  .tbl--cards .c-comment { order: 4; flex: 0 0 100%; font-size: 14px; color: var(--text); background: #f6f8fb !important; border-radius: 8px; padding: 6px 10px; }
  .tbl--cards .c-comment:empty { display: none; }
  .tbl--cards .c-guard { order: 4; flex: 0 0 100%; color: var(--muted); }
  .tbl--cards .c-guard::before { content: "保護者："; }
  .tbl--cards .c-guard div { display: inline; margin-right: 8px; }
  .tbl--cards .c-at { order: 5; flex: 1 1 0; color: var(--muted); font-size: 12px; }
  .tbl--cards .c-at .sub { display: inline; margin-left: 4px; }
  .tbl--cards .c-at::before { content: "回答 "; }
  .tbl--cards .c-at:has(.c-none)::before, .tbl--cards .c-at .c-none { display: none; }
  .tbl--cards .c-proxy { order: 6; flex: none; }
  /* 名前と出欠の行のあとに、学年などを必ず次の行から並べる */
  .tbl--cards tr::after { content: ""; order: 2; flex-basis: 100%; height: 0; }
}

/* ---------- 招待QRの一覧（画面ではカードを並べ、印刷では A4 に2列×4段） ---------- */
.qr-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.qr-card { display: flex; gap: 12px; align-items: center; justify-content: space-between; background: #fff; border: 1.5px dashed #b9c2cf; border-radius: 10px; padding: 14px 14px 14px 16px; break-inside: avoid; }
.qr-card-text { min-width: 0; }
.qr-card-text p { margin: 0; }
.qr-club { font-size: 11px; color: var(--muted); }
.qr-name { font-size: 17px; font-weight: 800; margin-top: 2px !important; word-break: break-all; }
.qr-who { font-size: 12px; color: var(--muted); }
.qr-id { font-size: 11px; color: var(--muted); margin-top: 8px !important; line-height: 1.4; }
.qr-id b { font-family: ui-monospace, Menlo, monospace; font-size: 14px; color: var(--text); word-break: break-all; }
.qr-howto { font-size: 10.5px; color: var(--muted); margin-top: 6px !important; line-height: 1.5; }
.qr-card-code { flex: none; }
.qr-card-code svg { display: block; width: 132px; height: 132px; }
@media print {
  @page { size: A4; margin: 8mm; }
  .qr-list { grid-template-columns: 1fr 1fr; gap: 0; }
  .qr-card { height: 69mm; border-radius: 0; border: 1px dashed #999; margin: -0.5px 0 0 -0.5px; padding: 6mm 5mm 6mm 7mm; }
  .qr-card-code svg { width: 36mm; height: 36mm; }
}
.check.choice { align-items: flex-start; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; margin-bottom: 8px; }
.check.choice input { margin-top: 3px; }
.check.choice:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 5%, #fff); }
.check.choice small { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; line-height: 1.6; margin-top: 2px; }

/* ---------- スマホの通知 ---------- */
.push-prompt { background: #f3f6fd; box-shadow: none; outline: 1.5px solid #d8e2f6; }
.push-prompt-in { display: flex; gap: 10px; align-items: flex-start; }
.push-prompt-in > .ico { color: #3b5bdb; flex: none; margin-top: 2px; }
.push-prompt-in p { flex: 1; margin: 0; min-width: 0; }
.push-prompt-in small { display: block; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
[data-push] [hidden] { display: none !important; }

/* ---------- アプリのロゴ（ホーム画面のアイコンと同じ画像） ---------- */
.app-logo { display: block; flex: none; height: auto; border-radius: 22%; }
.auth-logo .app-logo { margin: 0 auto 6px; box-shadow: 0 4px 12px rgba(20, 60, 160, .25); }
.m-brand .app-logo, .a-brand .app-logo { box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .25); }

/* ---------- 動画 ---------- */
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 14px; }
.vcard { display: block; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; text-decoration: none; color: inherit; }
.vthumb { position: relative; display: block; aspect-ratio: 16 / 9; background: #1b2436; overflow: hidden; }
.vthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vthumb-none { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.5); }
.vplay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 46px; height: 46px; border-radius: 50%; background: rgba(0,0,0,.55); color: #fff; display: flex; align-items: center; justify-content: center; }
.vdur, .vsrc { position: absolute; bottom: 8px; font-size: 11.5px; font-weight: 700; color: #fff; background: rgba(0,0,0,.65); border-radius: 6px; padding: 1px 7px; }
.vdur { right: 8px; } .vsrc { left: 8px; background: #d6252a; }
.vbody { display: block; padding: 10px 12px 12px; }
.vtitle { display: block; font-weight: 800; line-height: 1.45; word-break: break-word; }
.vmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.vcomments { display: inline-flex; align-items: center; gap: 3px; }
.vdetail { padding: 0; overflow: hidden; }
.vplayer { background: #000; aspect-ratio: 16 / 9; }
.vplayer video, .vplayer iframe { display: block; width: 100%; height: 100%; border: 0; }
.vinfo { padding: 14px 16px 16px; }
.vh1 { font-size: 19px; font-weight: 800; margin: 6px 0 8px; word-break: break-word; }
.vcomments-h { display: flex; align-items: center; gap: 6px; font-size: 16px; margin-bottom: 10px; }
.clist { list-style: none; margin: 0 0 14px; padding: 0; }
.clist li { padding: 10px 0; border-top: 1px solid var(--line); }
.clist li:first-child { border-top: 0; padding-top: 0; }
.cmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 2px; font-size: 13.5px; }
.cbody { margin: 0; font-size: 15px; line-height: 1.7; word-break: break-word; }
.cdel { margin-top: 2px; }
.cform textarea { min-height: 72px; }
.vprep { background: #f6f8fb; border-radius: var(--radius-sm); padding: 12px; margin-bottom: 16px; }
.vpreview { display: block; width: 100%; max-height: 260px; background: #000; border-radius: 8px; margin-bottom: 8px; }
.vprogress { background: #eef3fb; border-radius: var(--radius-sm); padding: 12px 14px; margin: 8px 0; }
.vbar { height: 10px; border-radius: 99px; background: #d7e1f2; overflow: hidden; margin: 8px 0; }
.vbar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.vworker { position: fixed; left: -10px; top: -10px; width: 2px; height: 2px; opacity: 0.01; pointer-events: none; }
