html {
  -webkit-text-size-adjust: 100%;
}
body { font-family: "Yu Gothic UI","Meiryo",sans-serif; padding: 12px; max-width: 1500px; margin: 0 auto; font-size: 14px; color: #222; }
h1 { font-size: 1.25em; background: #e8eef5; padding: 8px 14px; border-left: 6px solid #4a6fa5; margin: 0 0 8px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.legend { background: #f5f5f5; padding: 8px 12px; margin: 8px 0; font-size: 0.92em; line-height: 1.6; }
.legend p { margin: 2px 0; }
.legend .warn { color: #c00; }
.nav { margin: 12px 0; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nav button { padding: 6px 12px; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
/* 年月ピッカー: input自体をアイコンサイズに固定し、内蔵のpicker indicatorで透明クリック領域を作る */
#current-month-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  border-radius: 4px;
  cursor: pointer;
}
#current-month-wrap:hover { background: #e8eef5; }
#month-picker {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
  border: none; background: transparent;
  margin: 0; padding: 0;
  -webkit-appearance: none; appearance: none;
  font-size: inherit;
}
#current-month { font-weight: bold; min-width: 100px; text-align: center; padding: 4px 6px; user-select: none; }
#me-selector { margin: 8px 0; padding: 8px 12px; border-radius: 4px; }
#me-selector select { font-size: 1em; padding: 2px 6px; }
#status-msg { color: #060; font-size: 0.9em; }
#error-msg { color: #c00; font-size: 0.9em; }

/* === テーブル === */
table.grid { border-collapse: separate; border-spacing: 0; }
table.grid th, table.grid td { padding: 4px 6px; text-align: center; font-size: 13px; color: #000; }
table.grid th { background: #f5f5f5; }

/* 日付・グループ列（クリックで活動実施/休止トグル） */
table.grid th.date-cell { text-align: left; padding: 4px 8px; min-width: 130px; white-space: nowrap; cursor: pointer; user-select: none;
  position: sticky; left: 0; z-index: 2; }
/* ヘッダー行の日付セルはさらに高いz-index（通常セルのsticky上に来るため） */
table.grid thead th.date-cell { z-index: 3; }
/* separate+spacing0でのセル境界線補完 */
table.grid th, table.grid td { border-right: 1px solid #888; border-bottom: 1px solid #888; }
table.grid thead tr:first-child th { border-top: 1px solid #888; }
table.grid th:first-child, table.grid td:first-child { border-left: 1px solid #888; }
table.grid th.date-cell:hover { outline: 2px solid #4a6fa5; outline-offset: -2px; }
table.grid th.date-cell.date-saturday { background: #fff5d0; }
table.grid th.date-cell.date-tuesday  { background: #f0fff0; }
/* 描画済み日付グループの交互色 */
tr.row-group-alt th.date-cell.date-tuesday  { background: #d8f0d8; }
tr.row-group-alt th.date-cell.date-saturday { background: #fce8a0; }
table.grid th.date-cell .grp-batsai   { color: #804000; font-weight: bold; }
table.grid th.date-cell .grp-satoyama { color: #006080; font-weight: bold; }
table.grid th.date-cell .cancel-mark  { color: #c00; font-weight: bold; margin-left: 6px; }

/* 活動休止（全日）状態の行 */
tr.row-cancelled th.date-cell { background: #ffd0d0 !important; }
tr.row-cancelled td.cell { background: #d8d8d8 !important; color: #999 !important; opacity: 0.5; cursor: not-allowed !important; pointer-events: none; }
tr.row-cancelled td.count-cell { background: #d8d8d8 !important; color: #999 !important; opacity: 0.5; }
/* 部分休止（午前/午後）の行 */
tr.row-partial th.date-cell { background: #ffe9c8 !important; }
tr.row-partial th.date-cell .cancel-mark { color: #c66; }

/* 集計列 */
table.grid th.count-header { min-width: 28px; }
table.grid td.count-cell { background: #fafafa; min-width: 28px; }
table.grid td.count-cell.max-d { background: #bfd8ff; font-weight: bold; }
table.grid td.count-cell.max-m { background: #c8eebf; font-weight: bold; }
table.grid td.count-cell.max-t { background: #ffe5a8; font-weight: bold; }
table.grid td.count-cell.max-x { background: #ffd0d0; font-weight: bold; }

/* mostline: ○が5人以上の行 — メンバーセルの背景は変えない（count-cellの強調のみ） */

/* メンバーヘッダ */
table.grid th.member-header { min-width: 36px; cursor: pointer; user-select: none; }
table.grid th.member-header:hover { background: #fffacd; }
table.grid th.member-header.member-mine { background: #ffe066; color: #c00; font-weight: bold; }

/* 出欠セル */
table.grid td.cell { min-width: 36px; user-select: none; cursor: not-allowed; font-weight: bold; color: #000; }
table.grid td.cell.editable { cursor: pointer; }
table.grid td.cell.editable:hover { outline: 2px solid #4a6fa5; outline-offset: -2px; }
table.grid td.bg-d { background: #bfd8ff; }
table.grid td.bg-m { background: #c8eebf; }
table.grid td.bg-t { background: #ffe5a8; }
table.grid td.bg-x { background: #ffd0d0; }
/* 特別活動日 */
tr.row-special th.date-cell { background: #f0e0ff !important; color: #602080; }
tr.row-special th.date-cell .special-tag { background: #b080d0; color: #fff; padding: 1px 6px; border-radius: 3px; font-size: 0.85em; margin-left: 4px; font-weight: bold; }
tr.row-special td.cell { background: #faf0ff; }
tr.row-special td.count-cell { background: #f5e8fa; }

/* === コメント === */
.comments { margin-top: 24px; }
.comments h2 { font-size: 1.05em; margin: 0 0 8px; background: #e8eef5; padding: 6px 12px; border-left: 6px solid #4a6fa5; }
.comment { padding: 6px 4px; border-bottom: 1px solid #eee; }
.comment-meta { font-size: 0.85em; color: #555; }
.comment-body { margin-top: 2px; white-space: pre-wrap; }
#comment-form textarea { width: 100%; box-sizing: border-box; font-family: inherit; padding: 4px; }
#comment-form button { padding: 6px 16px; margin-top: 4px; cursor: pointer; }
#comment-form .hint { font-size: 0.85em; color: #666; margin-left: 6px; }

/* === 活動日別集計 === */
.daily-summary { margin-top: 24px; }
.daily-summary h2 { font-size: 1.05em; margin: 0 0 8px; background: #e8eef5; padding: 6px 12px; border-left: 6px solid #4a6fa5; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#toggle-all-summary { font-size: 0.9em; padding: 4px 12px; cursor: pointer; background: #fff; border: 1px solid #4a6fa5; border-radius: 4px; color: #4a6fa5; }
#toggle-all-summary:hover { background: #d8e0f0; }
details.day-block { border: 1px solid #bbb; border-radius: 4px; margin: 8px 0; padding: 4px 10px; }
details.day-block[open] { padding: 4px 10px; }
details.day-block.day-saturday { background: #fffbe5; border-color: #e8d080; }
details.day-block.day-tuesday  { background: #f5fff5; border-color: #b0d8b0; }
details.day-block.day-tuesday.day-group-alt  { background: #e0f5e0; border-color: #90c090; }
details.day-block.day-saturday.day-group-alt { background: #fef0c0; border-color: #d0b060; }
details.day-block.day-cancelled { background: #d8d8d8 !important; border-color: #888 !important; }
details.day-block summary { cursor: pointer; user-select: none; list-style: none; padding: 4px 0; display: flex; align-items: center; }
details.day-block summary::-webkit-details-marker { display: none; }
details.day-block summary::before { content: '▶'; color: #888; margin-right: 6px; font-size: 0.8em; transition: transform 0.15s; display: inline-block; flex-shrink: 0; }
details.day-block[open] summary::before { transform: rotate(90deg); }
details.day-block[open] summary { padding: 4px 0; border-bottom: 1px dashed #ccc; margin-bottom: 6px; }
details.day-block .day-body { padding-top: 2px; }
.day-block .day-header { font-weight: bold; font-size: 1.05em; flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.day-block .day-header .hcount { margin-left: 8px; font-weight: normal; font-size: 0.95em; white-space: nowrap; }
.day-block .day-header .hc-d { color: #c00; }
.day-block .day-header .hc-m { color: #060; }
.day-block .day-header .hc-t { color: #c60; }
.day-block .day-header .grp { margin-left: 8px; padding: 1px 6px; border-radius: 3px; font-size: 0.85em; }
.day-block .day-header .grp.batsai   { background: #f5e0c0; color: #804000; }
.day-block .day-header .grp.satoyama { background: #c0e0e8; color: #006080; }
.day-block .day-header .total { font-weight: normal; color: #666; font-size: 0.9em; margin-left: 8px; }
.day-block .day-row { margin: 3px 0; line-height: 1.6; }
.day-block .day-row .label { display: inline-block; min-width: 110px; font-weight: bold; white-space: nowrap; }
.day-block .day-row .names-empty { color: #bbb; font-size: 0.9em; }
.day-block .day-row.r-cancel { color: #c00; font-weight: bold; font-size: 1.05em; padding: 4px 0; border-bottom: 1px solid #aaa; margin-bottom: 4px; }
.day-copy-btn {
  flex-shrink: 0;
  margin-left: 8px;
  padding: 2px 6px;
  cursor: pointer;
  background: #fff;
  border: 1px solid #aaa;
  border-radius: 3px;
  color: #4a6fa5;
  line-height: 1;
  display: flex;
  align-items: center;
}
.day-copy-btn:hover { background: #e8eef5; }
.day-copy-btn svg { display: block; }

/* === 運営者用セクション === */
.admin-section { margin-top: 24px; border: 1px solid #c0c0c0; border-radius: 4px; }
.admin-section summary { cursor: pointer; padding: 8px 12px; background: #f0f0f0; font-weight: bold; user-select: none; }
.admin-section summary:hover { background: #e8e8e8; }
.admin-section .admin-body { padding: 10px 14px; background: #fff8e1; }
.admin-section .admin-body .warn { color: #c00; font-weight: bold; }
.admin-section .admin-item { padding: 8px 0; border-bottom: 1px dashed #d0c080; }
.admin-section .admin-item:last-child { border-bottom: 0; }
.admin-section .admin-item h3 { font-size: 1em; margin: 0 0 4px; color: #604000; }
.admin-section #members-table { border-collapse: collapse; width: 100%; margin-top: 4px; }
.admin-section #members-table th, .admin-section #members-table td { border: 1px solid #c0c0c0; padding: 4px 8px; text-align: left; font-size: 0.95em; }
.admin-section #members-table th { background: #f0f0f0; }
.admin-section #members-table .del-btn { padding: 2px 8px; cursor: pointer; color: #c00; background: #fff; border: 1px solid #c66; border-radius: 3px; font-size: 0.9em; }
.admin-section #members-table .del-btn:hover { background: #ffe0e0; }
.admin-section #members-table .rename-btn { padding: 2px 8px; cursor: pointer; background: #fff; border: 1px solid #4a6fa5; border-radius: 3px; color: #4a6fa5; margin-right: 4px; font-size: 0.9em; }
.admin-section #members-table .rename-btn:hover { background: #e8eef5; }
.admin-section #members-table .felling-cert-btn { padding: 2px 8px; cursor: pointer; background: #fff; border: 1px solid #aaa; border-radius: 3px; color: #888; font-size: 0.85em; }
.admin-section #members-table .felling-cert-btn.cert-on { background: #e6f4ea; border-color: #4a8; color: #276; font-weight: bold; }
.admin-section #members-table .felling-cert-btn:hover { opacity: 0.8; }
.admin-section #special-table { border-collapse: collapse; width: 100%; margin-top: 4px; }
.admin-section #special-table th, .admin-section #special-table td { border: 1px solid #c0c0c0; padding: 4px 8px; text-align: left; font-size: 0.95em; }
.admin-section #special-table th { background: #f0f0f0; }
.admin-section #special-table .del-btn { padding: 2px 8px; cursor: pointer; color: #c00; background: #fff; border: 1px solid #c66; border-radius: 3px; font-size: 0.9em; }
.admin-section #special-table .edit-btn { padding: 2px 8px; cursor: pointer; background: #fff; border: 1px solid #4a6fa5; border-radius: 3px; color: #4a6fa5; margin-right: 4px; font-size: 0.9em; }
.admin-section #special-table .edit-btn:hover { background: #e8eef5; }
/* 共通: 日付列・操作列 */
.admin-col-date { width: 100px; white-space: nowrap; }
.admin-col-ops  { width: 108px; white-space: nowrap; }
.admin-section .special-add-row .field-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.admin-section .special-add-row .field-row label { min-width: 60px; font-weight: bold; color: #604000; }
.admin-section .special-month-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.admin-section .special-month-nav button { padding: 4px 10px; cursor: pointer; touch-action: manipulation; }
.admin-section .special-month-nav #special-current-month { font-weight: bold; min-width: 90px; text-align: center; cursor: pointer; padding: 4px 6px; border-radius: 4px; user-select: none; }
.admin-section .special-month-nav #special-current-month:hover { background: #e8eef5; }
.admin-section .special-month-nav #special-month-picker {
  position: relative; width: 32px; height: 28px; box-sizing: border-box; padding: 0; margin: 0;
  border: 1px solid #c0c0c0; border-radius: 4px; background-color: #fff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'><rect x='1.5' y='3.5' width='13' height='11' rx='1' fill='none' stroke='%234a6fa5' stroke-width='1.4'/><line x1='1.5' y1='6.5' x2='14.5' y2='6.5' stroke='%234a6fa5' stroke-width='1.4'/><line x1='5' y1='1.5' x2='5' y2='4.5' stroke='%234a6fa5' stroke-width='1.4'/><line x1='11' y1='1.5' x2='11' y2='4.5' stroke='%234a6fa5' stroke-width='1.4'/><rect x='4' y='8.5' width='2' height='2' fill='%234a6fa5'/><rect x='7' y='8.5' width='2' height='2' fill='%234a6fa5'/><rect x='10' y='8.5' width='2' height='2' fill='%234a6fa5'/><rect x='4' y='11.5' width='2' height='2' fill='%234a6fa5'/><rect x='7' y='11.5' width='2' height='2' fill='%234a6fa5'/></svg>");
  background-repeat: no-repeat; background-position: center; background-size: 16px 16px;
  cursor: pointer; -webkit-appearance: none; appearance: none;
  color: transparent; font-size: 0; overflow: hidden; touch-action: manipulation; flex: 0 0 32px;
}
.admin-section .special-month-nav #special-month-picker::-webkit-calendar-picker-indicator {
  opacity: 0; cursor: pointer; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
}
.admin-section .special-add-row .field-row input[type=date],
.admin-section .special-add-row .field-row input[type=text] { font-family: inherit; font-size: 16px; padding: 6px 8px; border: 1px solid #c0c0c0; border-radius: 4px; flex: 1; min-width: 140px; }
.admin-section code#distrib-url-text { display: block; padding: 8px; background: #fff; border: 1px solid #ccc; word-break: break-all; font-family: Consolas, "Courier New", monospace; font-size: 0.92em; }
.admin-section button { padding: 6px 14px; cursor: pointer; }
/* === 連絡テーブル === */
#communications-table { border-collapse: collapse; width: 100%; margin-top: 4px; }
#communications-table th, #communications-table td { border: 1px solid #c0c0c0; padding: 5px 8px; text-align: left; font-size: 0.93em; vertical-align: top; }
#communications-table th { background: #f0f0f0; white-space: nowrap; }
.comm-col-date    { width: 120px; white-space: nowrap; }
.comm-col-content { /* auto */ }
.comm-col-author  { width: 58px; }
.comm-col-ops     { width: 108px; white-space: nowrap; }
#communications-table .comm-content-cell { white-space: pre-wrap; word-break: break-all; }
#communications-table .comm-edit-btn { padding: 2px 8px; cursor: pointer; background: #fff; border: 1px solid #4a6fa5; border-radius: 3px; color: #4a6fa5; margin-right: 4px; font-size: 0.9em; }
#communications-table .comm-del-btn  { padding: 2px 8px; cursor: pointer; background: #fff; border: 1px solid #c00; border-radius: 3px; color: #c00; font-size: 0.9em; }
#communications-table .comm-edit-btn:hover { background: #e8eef5; }
#communications-table .comm-del-btn:hover  { background: #ffe8e8; }
.admin-section .comm-add-row .field-row { display: flex; gap: 6px; align-items: center; margin: 6px 0; flex-wrap: wrap; }
.admin-section .comm-add-row .field-row label { min-width: 60px; font-weight: bold; color: #604000; }
.admin-section .comm-add-row .field-row input[type=date],
.admin-section .comm-add-row .field-row input[type=text],
.admin-section .comm-add-row .field-row textarea { font-family: inherit; font-size: 16px; padding: 6px 8px; border: 1px solid #c0c0c0; border-radius: 4px; flex: 1; min-width: 140px; }

/* === ポップアップ === */
.status-popup { position: absolute; background: #fff; border: 2px solid #4a6fa5; border-radius: 4px; padding: 4px; box-shadow: 2px 2px 8px rgba(0,0,0,0.3); z-index: 100; min-width: 160px; }
.status-popup button { display: block; width: 100%; padding: 8px 12px; margin: 2px 0; cursor: pointer; text-align: left; border: 1px solid #ccc; background: #fff; font-size: 0.95em; color: #000; }
.status-popup button:hover { background: #f0f8ff; }
.status-popup button.opt-d { background: #bfd8ff; }
.status-popup button.opt-m { background: #c8eebf; }
.status-popup button.opt-t { background: #ffe5a8; }
.status-popup button.opt-x { background: #ffd0d0; }
.status-popup button.opt-cancel { background: #ffd0d0; color: #c00; font-weight: bold; }
.status-popup button.opt-active { background: #bfd8ff; color: #06c; font-weight: bold; }

/* カレンダー購読ポップアップ */
.cal-url-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200; display: flex; align-items: center; justify-content: center; padding: 16px; }
.cal-url-dialog { background: #fff; border-radius: 8px; padding: 16px 20px; max-width: 460px; width: 100%; box-shadow: 0 4px 24px rgba(0,0,0,0.25); }
.cal-url-dialog strong { display: block; margin-bottom: 10px; font-size: 1em; }
.cal-url-text { font-family: monospace; font-size: 0.8em; background: #f5f5f5; border: 1px solid #ddd; border-radius: 4px; padding: 8px; word-break: break-all; margin-bottom: 10px; user-select: all; }
.cal-url-buttons { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.cal-url-buttons button { padding: 6px 14px; border-radius: 4px; cursor: pointer; font-size: 0.9em; }
.cal-copy-btn { background: #4a6fa5; color: #fff; border: none; }
.cal-copy-btn:hover { background: #3a5f95; }
.cal-close-btn { background: #f0f0f0; border: 1px solid #ccc; }
.cal-url-hint { font-size: 0.8em; color: #666; }

/* === モバイル対応 === */
@media (max-width: 720px) {
  body { padding: 6px; font-size: 15px; }
  h1 { font-size: 1.05em; padding: 6px 10px; }
  .legend { font-size: 0.88em; padding: 6px 8px; }
  .nav { gap: 6px; }
  .nav button { padding: 8px 12px; min-height: 40px; min-width: 44px; }
  #me-selector select { min-height: 40px; padding: 4px 8px; font-size: 1em; }
  table.grid th, table.grid td { padding: 6px 5px; font-size: 14px; }
  table.grid th.date-cell { min-width: 120px; font-size: 13px; }
  table.grid td.cell { min-width: 40px; min-height: 40px; }
  table.grid th.member-header { min-width: 76px; font-size: 13px; }
  .status-popup button { padding: 12px 16px; font-size: 1.05em; min-height: 44px; }
  #comment-form textarea { font-size: 16px; }
  #comment-form button { padding: 8px 16px; min-height: 40px; }
  .day-block .day-row .label { min-width: 100px; font-size: 0.95em; white-space: nowrap; }
}

/* === ローディング表示 === */
body[data-loading="true"] { cursor: progress; }
body[data-loading="true"] .nav button,
body[data-loading="true"] .admin-section button,
body[data-loading="true"] #post-comment,
body[data-loading="true"] #delete-comment {
  opacity: 0.6;
  pointer-events: none;
}
#loading-spinner {
  position: fixed;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  border: 3px solid #e8eef5;
  border-top-color: #4a6fa5;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
  z-index: 1000;
  background: transparent;
}
body[data-loading="true"] #loading-spinner { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* === メンバー管理: 削除済み行 === */
.admin-section #members-table tr.member-inactive { background: #f0f0f0; color: #888; }
.admin-section #members-table tr.member-inactive td { color: #888; }
.admin-section #members-table .restore-btn { padding: 2px 8px; cursor: pointer; color: #060; background: #fff; border: 1px solid #6c6; border-radius: 3px; font-size: 0.9em; }
.admin-section #members-table .restore-btn:hover { background: #e0ffe0; }
.admin-section #members-table .section-header td { background: #e8eef5; font-weight: bold; color: #4a6fa5; padding: 4px 8px; }

/* === タブ === */
.tab-bar {
  display: flex;
  gap: 4px;
  border-bottom: 2px solid #4a6fa5;
  margin: 16px 0 0;
  flex-wrap: wrap;
}
.tab-btn {
  padding: 8px 16px;
  cursor: pointer;
  border: 1px solid #c0c0c0;
  border-bottom: none;
  background: #f5f5f5;
  border-radius: 6px 6px 0 0;
  font-size: 0.95em;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  color: #555;
}
.tab-btn:hover { background: #e8eef5; color: #222; }
.tab-btn.active {
  background: #4a6fa5;
  color: #fff;
  border-color: #4a6fa5;
  font-weight: bold;
}
.tab-content { display: none; padding-top: 12px; }
#tab-attendance { padding-top: 0; }
.tab-content.active { display: block; }

/* === 上端へスクロールボタン === */
#scroll-top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #4a6fa5;
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 50;
  touch-action: manipulation;
}
#scroll-top-btn.visible { display: flex; }
#scroll-top-btn:hover { background: #3a5a8a; }

@media (max-width: 720px) {
  .tab-btn { padding: 10px 14px; font-size: 0.95em; min-height: 44px; flex: 1 1 auto; min-width: 88px; }
  #scroll-top-btn { bottom: 16px; right: 16px; }
}

/* === フローティングボタン共通化（上端へ・下端へ） === */
.floating-btn {
  position: fixed;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #4a6fa5;
  color: #fff;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  z-index: 50;
  touch-action: manipulation;
}
.floating-btn.visible { display: flex; }
.floating-btn:hover { background: #3a5a8a; }

/* === フローティングボタン位置（上端へのみ） === */
#scroll-top-btn { bottom: 20px; right: 20px; }
@media (max-width: 720px) {
  #scroll-top-btn { bottom: 16px; right: 16px; }
}

/* === フローティング: 下端へボタン === */
#scroll-bottom-btn { bottom: 72px; right: 20px; }
@media (max-width: 720px) {
  #scroll-bottom-btn { bottom: 68px; right: 16px; }
}

/* === タイトルバー内文字サイズボタン === */
#font-size-btn {
  padding: 3px 9px;
  background: #fff;
  border: 1px solid #4a6fa5;
  border-radius: 4px;
  cursor: pointer;
  color: #4a6fa5;
  font-size: 0.85em;
  font-weight: bold;
  line-height: 1.4;
  white-space: nowrap;
  touch-action: manipulation;
  flex-shrink: 0;
}
#font-size-btn:hover { background: #d8e0f0; }

/* === 事務局サブタブ === */
.admin-tab-bar {
  display: flex;
  gap: 4px;
  flex-wrap: nowrap;
  overflow-x: auto;
  border-bottom: 2px solid #4a6fa5;
  margin: 12px 0 0;
  -webkit-overflow-scrolling: touch;
}
.admin-tab-btn {
  padding: 6px 14px;
  cursor: pointer;
  border: 1px solid #c0c0c0;
  border-bottom: none;
  background: #f5f5f5;
  border-radius: 6px 6px 0 0;
  font-size: 0.9em;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  color: #555;
  white-space: nowrap;
  flex: 0 0 auto;
}
.admin-tab-btn:hover { background: #e8eef5; color: #222; }
.admin-tab-btn.active {
  background: #4a6fa5;
  color: #fff;
  border-color: #4a6fa5;
  font-weight: bold;
}
.admin-tab-content { display: none; padding: 12px 4px 4px; }
.admin-tab-content.active { display: block; }

@media (max-width: 720px) {
  .admin-tab-btn { padding: 8px 10px; font-size: 0.85em; min-height: 40px; }
}

/* === メンバー管理: ドラッグ&ドロップ === */
#members-table tr.member-active { cursor: default; }
#members-table tr.member-active .drag-handle {
  cursor: move;
  cursor: grab;
  user-select: none;
  text-align: center;
  color: #999;
  font-weight: bold;
  font-size: 1.1em;
  touch-action: none;
}
#members-table tr.member-active .drag-handle:active { cursor: grabbing; }
#members-table tr.member-active.dragging { opacity: 0.4; background: #e8eef5; }

/* === メンバー順序保存バナー: クラス制御 === */
#members-order-save-area { display: none; }
#members-order-save-area.visible { display: block; }


/* === お知らせ機能 === */

/* ヘッダ: お知らせ件数バッジ */
.notice-header-badge {
  display: inline-block;
  background: #fff8e1;
  border: 1px solid #f5a623;
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.82em;
  color: #e67e00;
  font-weight: bold;
  margin-left: 4px;
  vertical-align: middle;
}
table.grid th.notice-header-th { cursor: pointer; }
table.grid th.notice-header-th:hover { outline: 2px solid #f5a623; outline-offset: -2px; }

/* 📢 絵文字マーク（日付セル内） */
.notice-emoji-mark { font-size: 0.88em; margin-left: 4px; }

/* お知らせ展開行 */
tr.notice-expanded-row td {
  padding: 0;
  border-top: 2px solid #f5a623;
  border-bottom: 2px solid #f5a623;
  border-left: none;
  border-right: none;
}
.notice-body {
  background: #fff8e1;
  border-left: 4px solid #f5a623;
  padding: 8px 36px 8px 12px;
  white-space: pre-wrap;
  text-align: left;
  font-size: 13px;
  line-height: 1.6;
  position: relative;
}
.notice-label {
  font-weight: bold;
  margin-right: 8px;
  color: #e67e00;
}
.notice-close {
  position: absolute;
  top: 6px;
  right: 8px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: #999;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 3px;
}
.notice-close:hover { color: #c00; background: #ffd0d0; }

/* お知らせ編集ダイアログ */
.notice-dialog-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  box-sizing: border-box;
}
.notice-dialog {
  background: #fff;
  border-radius: 6px;
  padding: 18px 16px 14px;
  max-width: 480px;
  width: 100%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
}
.notice-dialog-title {
  font-size: 1em;
  margin: 0 0 10px;
  line-height: 1.5;
  color: #333;
}
.notice-dialog-subtitle { font-size: 0.9em; color: #666; }
.notice-dialog textarea {
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 14px;
  padding: 6px 8px;
  border: 1px solid #c0c0c0;
  border-radius: 4px;
  resize: vertical;
  line-height: 1.6;
}
.notice-dialog-buttons {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.notice-dialog-buttons button {
  flex: 1;
  padding: 8px 12px;
  cursor: pointer;
  border: 1px solid #c0c0c0;
  background: #f5f5f5;
  border-radius: 4px;
  font-size: 0.95em;
  min-height: 36px;
}
.notice-dialog-buttons button:hover { background: #e8eef5; }
.notice-dialog-del { color: #c00 !important; border-color: #c66 !important; }
.notice-dialog-del:hover { background: #ffe0e0 !important; }
.notice-dialog-msg {
  font-size: 0.88em;
  color: #c00;
  margin-top: 6px;
  min-height: 1em;
}

/* 事務局パネル: お知らせ管理テーブル */
.notice-admin-table {
  border-collapse: collapse;
  width: 100%;
  max-width: 620px;
  margin-top: 8px;
  font-size: 0.93em;
}
.notice-admin-table th,
.notice-admin-table td {
  border: 1px solid #c0c0c0;
  padding: 5px 8px;
  text-align: left;
  vertical-align: middle;
}
.notice-admin-table th { background: #f0f0f0; }
.notice-admin-table .notice-edit-btn {
  padding: 2px 10px;
  cursor: pointer;
  background: #fff;
  border: 1px solid #4a6fa5;
  border-radius: 3px;
  color: #4a6fa5;
  white-space: nowrap;
}
.notice-admin-table .notice-edit-btn:hover { background: #e8eef5; }

@media (max-width: 720px) {
  .notice-dialog { padding: 12px 10px 10px; }
  .notice-dialog textarea { font-size: 16px; }
  .notice-admin-table th,
  .notice-admin-table td { font-size: 0.88em; padding: 4px 6px; }
  /* 基本ルール(.notice-body{font-size:13px})より後に置くこと */
  .notice-body { font-size: 11px; }
}

/* ====== 文字サイズ切替（案B: A＋ / A＋＋） ====== */
/* A＋: +2px 相当 */
body.font-lg { font-size: 16px; }
@media (max-width: 720px) {
  body.font-lg { font-size: 17px; }
  body.font-lg table.grid th, body.font-lg table.grid td { font-size: 16px; }
  body.font-lg table.grid th.date-cell { font-size: 15px; min-width: 130px; }
  body.font-lg table.grid th.member-header { font-size: 15px; min-width: 70px; }
  body.font-lg table.grid td.cell { min-width: 44px; min-height: 44px; }
  body.font-lg .status-popup button { font-size: 1.1em; padding: 14px 18px; min-height: 48px; }
}
/* A＋＋: +4px 相当 */
body.font-xl { font-size: 18px; }
@media (max-width: 720px) {
  body.font-xl { font-size: 19px; }
  body.font-xl table.grid th, body.font-xl table.grid td { font-size: 18px; }
  body.font-xl table.grid th.date-cell { font-size: 17px; min-width: 140px; }
  body.font-xl table.grid th.member-header { font-size: 17px; min-width: 74px; }
  body.font-xl table.grid td.cell { min-width: 48px; min-height: 48px; }
  body.font-xl .status-popup button { font-size: 1.15em; padding: 16px 20px; min-height: 52px; }
}
