/* イベント管理システム 第1段階（試作）　PC・スマホ共通。色は :root の変数だけで決める */
:root {
  --bg: #F4F5F2;
  --surface: #FFFFFF;
  --fg: #1F2421;
  --muted: #646B66;
  --line: #DDE1DC;
  --accent: #2F6F5E;        /* 主なボタン・選択中 */
  --accent-soft: #E3EFEA;
  --warn: #B4471F;
  --warn-soft: #FBEDE5;
  --ok: #2E7D4F;
  --ok-soft: #E3F2E8;
  --info-soft: #E6EEF7;
  --info: #2D5C8A;
  --pending-soft: #F1F0EA;
  --radius: 10px;
  --font: "Hiragino Sans", "Noto Sans JP", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.7; }
a { color: var(--accent); }
h1, h2 { line-height: 1.35; margin: 0; text-wrap: balance; }
h1 { font-size: 22px; }
h2 { font-size: 17px; margin-bottom: 12px; }
small { display: block; font-size: 12px; }
.muted { color: var(--muted); }
.warn { color: var(--warn); font-weight: 600; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 8px; z-index: 50; background: var(--surface); padding: 6px 12px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- ヘッダー ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0px); }
.site-header-in { max-width: 1080px; margin: 0 auto; display: flex; align-items: center; gap: 20px; min-height: 56px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.logo { font-weight: 700; color: var(--fg); text-decoration: none; display: flex; align-items: baseline; gap: 6px; white-space: nowrap; }
.logo small { display: inline; font-weight: 400; color: var(--muted); font-size: 11px; border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.nav { display: flex; gap: 4px; }
.nav a { color: var(--muted); text-decoration: none; padding: 8px 12px; border-radius: 8px; font-weight: 600; white-space: nowrap; }
.nav a.is-active { color: var(--accent); background: var(--accent-soft); }
.reset { margin-left: auto; }

.container { max-width: 1080px; margin: 0 auto; padding-block: 20px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); outline: none; }
.container-narrow { max-width: 640px; }

/* ---------- ページの見出し ---------- */
.page-head { margin-bottom: 16px; }
.back { display: inline-block; font-size: 13px; text-decoration: none; margin-bottom: 6px; }
.page-head-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- ボタン ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-height: 40px; padding: 8px 16px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; font-weight: 600;
  text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #255A4C; border-color: #255A4C; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 34px; padding: 4px 10px; font-size: 13px; }
.btn-block { width: 100%; min-height: 48px; font-size: 16px; }

/* ---------- カード・パネル ---------- */
.card { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px; }
.panel { margin-bottom: 16px; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.card.empty { padding: 24px 16px; }
.placeholder { text-align: center; padding-block: 36px; }

.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; }
.event-card { color: var(--fg); text-decoration: none; margin: 0; transition: border-color .15s; }
.event-card:hover { border-color: var(--accent); }
.event-card h2 { margin: 8px 0 2px; }
.event-card p { margin: 0; font-size: 13px; }
.event-card-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0 0; border-top: 1px solid var(--line); padding-top: 10px; }
.stats div { min-width: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.note-warn { margin: 10px 0 0; padding: 6px 10px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 13px; }

/* 情報の一覧 */
.info { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 10px 20px; margin: 0; }
.info dt { font-size: 12px; color: var(--muted); }
.info dd { margin: 0; overflow-wrap: anywhere; }
.info-wide { grid-column: 1 / -1; }

/* ---------- タブ ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 14px; }
.tab { font: inherit; cursor: pointer; text-decoration: none; color: var(--muted); background: transparent; border: 1px solid transparent; }
.tabs-pill .tab { padding: 5px 12px; border-radius: 999px; border-color: var(--line); background: var(--surface); font-size: 13px; min-height: 34px; }
.tabs-pill .tab.is-active { background: var(--fg); color: #fff; border-color: var(--fg); }
.tabs-area { border-bottom: 2px solid var(--line); gap: 0; margin-top: 8px; }
.tabs-area .tab { padding: 10px 16px; font-weight: 700; font-size: 16px; margin-bottom: -2px; border-bottom: 3px solid transparent; }
.tabs-area .tab.is-active { color: var(--fg); border-bottom-color: var(--accent); }
.tabs-sub { margin-top: 0; }
.tabs-sub .tab { padding: 8px 14px; border-radius: 8px; font-weight: 600; }
.tabs-sub .tab.is-active { background: var(--accent-soft); color: var(--accent); }

/* ---------- 状態の印 ---------- */
.chip { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.8; white-space: nowrap;
  background: var(--pending-soft); color: var(--muted); }
.chip-event-recruiting, .chip-response-wish, .chip-booking-confirmed, .chip-send-sent, .chip-job-completed { background: var(--ok-soft); color: var(--ok); }
.chip-event-draft, .chip-response-undecided, .chip-send-queued, .chip-job-sending { background: var(--info-soft); color: var(--info); }
.chip-response-decline, .chip-booking-not_selected, .chip-booking-cancelled, .chip-event-cancelled, .chip-band-inactive { background: #ECEDEA; color: #5C625E; }
.chip-send-failed, .chip-job-failed, .chip-job-partially_failed { background: var(--warn-soft); color: var(--warn); }
.chip-booking-confirmed { background: var(--accent); color: #fff; }

/* ---------- 出演回答 ---------- */
.summary { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 8px; }
.summary div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px; display: flex; flex-direction: column; min-width: 84px; }
.summary span { font-size: 12px; color: var(--muted); }
.summary b { font-size: 20px; font-variant-numeric: tabular-nums; }
.summary-key { border-color: var(--accent) !important; }
.invite { margin: 12px 0; }
.invite-panel { margin-top: 10px; }
.comment { margin: 4px 0 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

/* 表（スマホでは1行をカードにする） */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 12px; color: var(--muted); font-weight: 600; background: #FAFBF9; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #FAFBF9; }
.card .table-wrap { border: 0; }

/* ---------- フォーム ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; border: 0; padding: 0; margin: 0 0 14px; }
.form-grid .field { margin: 0; }
.field-wide { grid-column: 1 / -1; }
.field label, .field legend, .label { font-weight: 600; font-size: 14px; padding: 0; }
.req, .opt { font-size: 11px; font-weight: 700; border-radius: 4px; padding: 0 5px; margin-left: 4px; }
.req { background: var(--warn-soft); color: var(--warn); }
.opt { background: var(--pending-soft); color: var(--muted); }
input, select, textarea { font: inherit; font-size: 16px; color: var(--fg); background: #fff; border: 1px solid #C9CEC8; border-radius: 8px; padding: 9px 11px; width: 100%; min-height: 44px; }
textarea { resize: vertical; line-height: 1.6; }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--warn); }
.hint { margin: 0; font-size: 12px; color: var(--muted); }
.err { margin: 0; font-size: 13px; color: var(--warn); font-weight: 600; }
.form-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr)); gap: 6px; margin: 6px 0; }
.check { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; background: #fff; }
.check input { width: 20px; height: 20px; min-height: 0; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.check span { min-width: 0; overflow-wrap: anywhere; }
.check:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.check:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.check-inline { border: 0; background: none; padding: 0; align-items: center; }
/* 送信先バンドの選択一覧だけに適用 */
.recipient-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.recipient-list .check { min-width: 0; }
.recipient-list .check span { white-space: normal; overflow-wrap: anywhere; }
@media (max-width: 760px) {
  .recipient-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 14px; }
.search { flex: 1 1 260px; }
.filter select { width: auto; min-height: 44px; }
.chip-band-archived { background: #E9E4F0; color: #5B4A78; }
.import-errors { margin: 10px 0; padding: 8px 12px; border-radius: 8px; background: var(--warn-soft); font-size: 13px; }
.import-errors ul, .import-ok { margin: 6px 0 0; padding-left: 1.2em; max-height: 220px; overflow: auto; }
.import-ok { list-style: disc; font-size: 14px; }
.import-ok small { display: inline; margin-left: 8px; }

/* ---------- メール ---------- */
.mail-layout { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.preview { margin: 0; padding: 12px; background: #FAFBF9; border: 1px dashed var(--line); border-radius: 8px; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; font-size: 13px; max-height: 320px; overflow: auto; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; color: var(--fg); text-decoration: none; }
.history a:hover { border-color: var(--accent); }
.history-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; }
.history .muted { font-size: 12px; }
.body-detail { margin: 12px 0; }
.body-detail summary { cursor: pointer; font-weight: 600; margin-bottom: 8px; }
/* メールの下書き・担当者・引き継ぎ・送信前確認 */
.mail-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin-bottom: 4px; }
.mail-head h2 { margin: 0; }
.as-staff { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.as-staff select { width: auto; min-height: 34px; padding: 4px 8px; font-size: 13px; }
.owner-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 6px 0 10px; font-size: 13px; }
.notice-box { margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--line); border-left: 3px solid var(--info); border-radius: 8px; background: var(--info-soft); font-size: 13px; }
.notice-box p { margin: 0 0 8px; }
.notice-box p:last-child { margin-bottom: 0; }
.mail-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.mail-fields:disabled { opacity: .7; }
.mail-side { display: grid; gap: 16px; align-content: start; }
.mail-side .card { margin: 0; }
.btn-danger { color: var(--warn); margin-right: auto; }
.pv-mail { border: 1px solid var(--line); border-radius: 8px; padding: 10px; margin-bottom: 4px; }
.pv-head { margin: 0 0 8px; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---------- ダイアログ・通知 ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100% - 24px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .25); }
dialog::backdrop { background: rgba(20, 24, 22, .45); }
.dialog-body { padding: 20px; }
.dialog-body h2 { margin-bottom: 2px; }
.dialog-body > p { margin: 0 0 14px; font-size: 13px; }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(20px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  background: var(--fg); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 14px; box-shadow: 0 6px 20px rgba(0, 0, 0, .2); max-width: calc(100% - 32px); }

/* ---------- 回答フォーム（バンド向け） ---------- */
.answer-page .container { padding-top: max(24px, env(safe-area-inset-top, 0px)); }
.eyebrow { margin: 0 0 4px; font-size: 12px; font-weight: 700; color: var(--accent); letter-spacing: .08em; }
.lead { margin: 4px 0 14px; font-weight: 600; }
.answer-page .info { margin-bottom: 18px; padding: 12px 14px; background: #FAFBF9; border-radius: 8px; }
.current { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }
.current span { display: block; font-size: 12px; color: var(--muted); }
.current b { font-size: 18px; }
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 4px; }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice span { display: flex; align-items: center; justify-content: center; min-height: 52px; border: 2px solid var(--line); border-radius: 10px; font-weight: 700; background: #fff; text-align: center; padding: 6px; }
.choice input:checked + span { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.notice, .notice-ok { padding: 10px 14px; border-radius: 8px; margin: 0 0 14px; }
.notice { background: var(--pending-soft); }
.notice-ok { background: var(--ok-soft); color: var(--ok); font-weight: 600; }
.proto-note { text-align: center; }
.answer-page .confirm-list { grid-template-columns: 1fr; }
.answer-page .confirm-list .comment { font-size: 14px; }
.answer-actions { flex-direction: column; }

/* ---------- スマホ ---------- */
@media (max-width: 760px) {
  h1 { font-size: 20px; }
  .site-header-in { gap: 6px; min-height: 52px; }
  .logo small { display: none; }
  .nav a { padding: 6px 8px; }
  .reset { font-size: 11px; padding: 4px 8px; min-height: 32px; white-space: normal; line-height: 1.3; max-width: 7.5em; }
  .form-grid { grid-template-columns: 1fr; }
  .mail-layout { grid-template-columns: 1fr; }
  .page-actions .btn { flex: 1 1 auto; }
  .tabs-area .tab { flex: 1 1 0; text-align: center; padding-inline: 8px; font-size: 15px; }
  /* 表は1行ずつカードに */
  .table-wrap { background: transparent; border: 0; overflow: visible; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; }
  .table td { border: 0; padding: 3px 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; }
  .table td::before { content: attr(data-label); flex: 0 0 5.5em; font-size: 12px; color: var(--muted); }
  .table td > p, .table td > small, .table td > .row-actions { flex-basis: 100%; }
  .table td > p, .table td > small { padding-left: calc(5.5em + 8px); }
  .table td[data-label=""]::before { content: none; }
  .row-actions { margin-top: 4px; }
  .card .table tr { border-color: var(--line); }
  .choices { grid-template-columns: 1fr; }
}
