/* 誘導管理アプリの見た目（2026-10-22 作り直し。主人の指示「全体のデザインをイケてるデザインにして」）
   - 明るいグレーの地に、白いカード（角丸・薄い影）。色は、シートの見出しの紺を基調にする
   - マスタ表だけは「シートと同じ見た目」（spec.md 5章）なので、シートの色（紺の見出し・青緑の区分の行）を残す
   - 画面の安全の設定（CSP）で外部のフォントは読めないので、端末に入っている日本語フォントを使う */
:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --fg: #172033;
  --fg-2: #3c475c;
  --muted: #6b7489;
  --line: #e2e6ee;
  --line-2: #cfd5e1;
  --accent: #1f4fd1;
  --accent-ink: #163a9e;
  --accent-soft: #eaf0fe;
  --navy: #1c4587;
  --warn: #fff6db;
  --warn-ink: #8a5a00;
  --ng: #fde8e8;
  --ng-ink: #b42318;
  --ok: #e6f6ec;
  --ok-ink: #17713a;
  --head: #1c4587;
  --head-fg: #fff;
  --g2: #d0e0e3;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --ring: 0 0 0 3px rgba(31, 79, 209, .22);
}
* { box-sizing: border-box; }
/* hidden の印を、display を指定した要素（詳細の覆い・タブなど）でも必ず効かせる */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--fg); background: var(--bg); font-size: 14px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
::selection { background: #cddcff; }

/* ── 上の帯（ブランド・メニュー・ログインしている人） ── */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 10px 20px; background: rgba(255, 255, 255, .92); backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; letter-spacing: .02em; color: var(--fg); white-space: nowrap; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--navy), var(--accent)); color: #fff; font-size: 14px; font-weight: 800;
  box-shadow: 0 2px 6px rgba(31, 79, 209, .35);
}
.tabs { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap;
  color: var(--fg-2); font-weight: 600; font-size: 13px; transition: background .15s, color .15s;
}
.tabs button:hover { background: #eef1f6; color: var(--fg); }
.tabs button.on { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow); }
.spacer { flex: 1; }
.sheet-link { font-size: 13px; text-decoration: none; color: var(--fg-2); padding: 6px 10px; border-radius: 8px; }
.sheet-link:hover { background: #eef1f6; }
.who {
  font-size: 12px; color: var(--fg-2); background: var(--surface-2); border: 1px solid var(--line);
  padding: 4px 10px; border-radius: 999px; white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis;
}
.who:empty { display: none; }
.logout { font-size: 13px; text-decoration: none; color: var(--fg-2); padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); }
.logout:hover { border-color: var(--line-2); color: var(--fg); }
.muted { color: var(--muted); }
.notice { padding: 10px 20px; background: var(--warn); color: var(--warn-ink); border-bottom: 1px solid #f3dfa2; font-weight: 600; }
main { padding: 20px; max-width: 1600px; margin: 0 auto; }
main > p.muted:only-child { text-align: center; padding: 64px 0; }

/* ── 見出し・帯・カード ── */
.section-title { margin: 20px 0 10px; font-size: 17px; font-weight: 700; letter-spacing: .01em; color: var(--fg); }
main > .section-title:first-child, .toolbar + .section-title { margin-top: 4px; }
.toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.toolbar .section-title { margin: 0; font-size: 15px; }
.toolbar label { display: flex; align-items: center; gap: 6px; color: var(--fg-2); font-size: 13px; }
.toolbar select { padding: 6px 30px 6px 10px; }
.notice-inline { padding: 10px 14px; background: var(--warn); color: var(--warn-ink); border: 1px solid #f3dfa2; border-radius: var(--radius-sm); font-weight: 600; }

/* ── ボタン ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--accent); background: var(--accent); color: #fff;
  padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 700; font-size: 13px; text-decoration: none;
  box-shadow: 0 1px 2px rgba(31, 79, 209, .25); transition: background .15s, box-shadow .15s, transform .05s;
}
.btn:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.sub { background: var(--surface); color: var(--fg-2); border-color: var(--line-2); box-shadow: none; }
.btn.sub:hover { background: var(--surface-2); color: var(--fg); border-color: #b9c1d1; }
.btn.small { padding: 4px 10px; font-size: 12px; border-radius: 7px; }

/* ── 入力欄 ── */
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], input[type=time], select, textarea {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); padding: 7px 10px;
  transition: border-color .15s, box-shadow .15s; min-height: 34px;
}
input:hover, select:hover, textarea:hover { border-color: #b9c1d1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
select:disabled, input:disabled { background: var(--surface-2); color: var(--fg-2); cursor: not-allowed; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.search { width: 100%; max-width: 520px; padding: 10px 14px; font-size: 15px; border-radius: 10px; box-shadow: var(--shadow); }

/* ── 一覧（検索の結果・追っかけ・管理） ── */
.list { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list th { background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 700; text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tr.row { cursor: pointer; }
.list tbody tr:hover td { background: #f6f8fc; }

/* ── 担当一覧（担当セクションの入力欄つきの表） ── */
.sheet-wrap { overflow: auto; max-height: calc(100vh - 230px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sheet { border-collapse: separate; border-spacing: 0; }
.sheet th, .sheet td { border-bottom: 1px solid var(--line); border-right: 1px solid #eef1f5; padding: 6px 8px; vertical-align: top; background: var(--surface); }
.sheet thead th {
  position: sticky; top: 0; z-index: 2; background: #f1f4fa; color: var(--fg-2);
  font-weight: 700; white-space: nowrap; font-size: 12px; text-align: left; border-bottom: 1px solid var(--line-2);
}
.sheet thead th small { display: block; font-weight: 600; color: var(--muted); font-size: 10px; letter-spacing: .04em; }
.sheet tbody tr:hover td { background: #f8faff; }
.sheet .sticky-col { position: sticky; left: 0; z-index: 1; }
.sheet thead .sticky-col { z-index: 3; }
.sheet .sticky-last { box-shadow: 4px 0 6px -4px rgba(16, 24, 40, .18); }
.sheet td { min-width: 120px; }
.sheet td[data-col="C"] { font-weight: 700; color: var(--fg); font-variant-numeric: tabular-nums; }
.sheet td .ro { white-space: nowrap; color: var(--fg-2); }

/* 1項目の入力欄（担当一覧・詳細で共通） */
.cell-editor { border-radius: 6px; transition: background .2s; }
.cell-editor .edit { display: flex; gap: 4px; align-items: center; }
.cell-editor input[type=text], .cell-editor select, .cell-editor textarea { width: 100%; min-width: 96px; padding: 5px 8px; min-height: 30px; font-size: 13px; }
.cell-editor input[type=date], .cell-editor input[type=time] { padding: 4px 6px; min-height: 30px; font-size: 13px; }
.cell-editor .actions { display: flex; gap: 3px; }
.cell-editor .msg { display: block; font-size: 11px; font-weight: 600; }
.cell-editor.compact .msg { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-editor.pending { background: var(--warn); box-shadow: 0 0 0 3px var(--warn); }
.cell-editor.pending .msg { color: var(--warn-ink); }
.cell-editor.saving .msg { color: var(--muted); }
.cell-editor.saved .msg { color: var(--ok-ink); }
.cell-editor.saved .msg::before { content: "✓ "; }
.cell-editor.error .msg, .cell-editor.changed .msg { color: var(--ng-ink); }
.cell-editor.changed { background: var(--ng); box-shadow: 0 0 0 3px var(--ng); }

/* ── 実施日時のプルダウン（レクチャー会・勉強会・個別） ── */
.session-label { font-weight: 700; display: flex; align-items: center; gap: 10px; color: var(--fg); font-size: 14px; }
.session-select {
  font-size: 15px; font-weight: 700; padding: 8px 36px 8px 14px; border-radius: 10px;
  border: 1px solid var(--accent); background: var(--accent-soft); color: var(--accent-ink); min-width: 280px;
}

/* ── 詳細（右から出るパネル） ── */
.detail { position: fixed; inset: 0; z-index: 30; background: rgba(15, 23, 42, .38); display: flex; justify-content: flex-end; backdrop-filter: blur(2px); }
.detail .panel { width: min(760px, 100%); height: 100%; overflow: auto; background: var(--bg); padding: 0 20px 24px; box-shadow: var(--shadow-lg); }
.detail .toolbar.sticky { position: sticky; top: 0; z-index: 1; margin: 0 -20px 12px; border-radius: 0; border-width: 0 0 1px; box-shadow: none; background: rgba(255, 255, 255, .95); backdrop-filter: blur(6px); padding: 14px 20px; }
.detail h2 { margin: 0; font-size: 18px; }
.detail fieldset { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; padding: 6px 16px 10px; box-shadow: var(--shadow); }
.detail legend { font-weight: 700; padding: 3px 10px; font-size: 12px; color: var(--accent-ink); background: var(--accent-soft); border-radius: 999px; }
.field { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f2f6; }
.field:last-child { border-bottom: 0; }
.field label { color: var(--muted); font-size: 12px; font-weight: 600; }
.field .ro { overflow-wrap: anywhere; color: var(--fg); }
.field input[type=text], .field textarea, .field select { width: 100%; }
.field .msg { grid-column: 2; font-size: 12px; }
.field .edit { display: flex; gap: 6px; align-items: center; }
.field .edit input, .field .edit textarea { flex: 1; }
.field .actions { display: flex; gap: 4px; white-space: nowrap; }
.field.changed { background: var(--warn); }
.field.error .msg { color: var(--ng-ink); }
.field.saved .msg { color: var(--ok-ink); }
.field.pending { background: var(--warn); }
.field.pending .msg { color: var(--warn-ink); font-weight: 700; }
.field.saving .msg { color: var(--muted); }

/* ── マスタ表（シートと同じ見た目。色はシートに合わせたまま） ── */
.master-wrap { overflow: auto; height: calc(100vh - 170px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.master { border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.master th, .master td { border-right: 1px solid #e3e3e3; border-bottom: 1px solid #e3e3e3; padding: 2px 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; height: 22px; background: #fff; }
.master thead th { position: sticky; z-index: 3; }
.master thead tr.r1 th { top: 0; background: #fff; color: #555; }
.master thead tr.r2 th { top: 22px; background: var(--g2); }
.master thead tr.r3 th { top: 44px; background: var(--head); color: var(--head-fg); cursor: pointer; }
.master thead tr.rf th { top: 66px; background: #f6f8fa; }
.master thead tr.rf input { width: 100%; font-size: 11px; padding: 1px 4px; min-height: 0; border-radius: 4px; }
.master .frozen { position: sticky; z-index: 2; }
.master thead .frozen { z-index: 4; }
.master .frozen-last { box-shadow: 4px 0 6px -4px rgba(16, 24, 40, .25); }
.master tbody tr:hover td { background: #f4f7ff; }
.master tr.cooloff td { background: #e0e0e0; }
.master tr.missing td { background: #fff2cc; }
.master td.paid-done { background: #d9ead3 !important; }
.master td.paid-open { background: #f4cccc !important; }
.master td.editable { cursor: text; }
.master td input, .master td select { width: 100%; font-size: 12px; min-height: 0; padding: 0 4px; border-radius: 4px; }

/* ── フォーム（新規登録・検索して記入・過去15日の担当分） ── */
.register-form { display: grid; gap: 14px; max-width: 980px; }
.register-form fieldset {
  margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px 18px 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px 16px;
}
.register-form legend { font-size: 12px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 3px 10px; border-radius: 999px; }
.register-field { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--fg-2); align-content: start; }
.register-field small { color: var(--muted); font-weight: 600; }
.register-field input, .register-field select { font-size: 15px; font-weight: 400; min-width: 0; padding: 9px 12px; min-height: 40px; }
.register-field .req { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; background: var(--ng); color: var(--ng-ink); font-size: 10px; line-height: 17px; vertical-align: 1px; }
.register-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.register-actions .btn { padding: 10px 22px; font-size: 14px; }
.register-msg:empty { display: none; }
.register-msg { padding: 10px 14px; border-radius: var(--radius-sm); }
.register-msg.saved { color: var(--ok-ink); background: var(--ok); border: 1px solid #b7e2c6; font-weight: 700; }
.register-msg.error { background: var(--warn); color: var(--warn-ink); border: 1px solid #f3dfa2; }
.register-msg .list { margin: 8px 0; box-shadow: none; }

/* ── 管理 ── */
.admin-form { display: grid; gap: 12px; max-width: 680px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.admin-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--fg-2); }
.admin-form .roles { display: flex; gap: 14px; flex-wrap: wrap; padding: 8px 0; }
.admin-form .roles label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.issued { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; max-width: 680px; }
.issued .password { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 22px; letter-spacing: 2px; font-weight: 700; color: var(--accent-ink); }

/* ── ログインの画面 ── */
.login { max-width: 420px; margin: 8vh auto 40px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px 28px 24px; }
.login h1 { font-size: 20px; text-align: center; margin: 12px 0 20px; letter-spacing: .02em; }
.login h1::before {
  content: "誘"; display: grid; place-items: center; width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 14px;
  background: linear-gradient(135deg, var(--navy), var(--accent)); color: #fff; font-size: 22px; font-weight: 800;
  box-shadow: 0 6px 16px rgba(31, 79, 209, .35);
}
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--fg-2); }
.login-form input { padding: 11px 12px; font-size: 16px; }
.login-form .btn { padding: 12px; font-size: 15px; margin-top: 4px; }
.login-msg { min-height: 1.4em; color: var(--ng-ink); margin: 0; font-size: 13px; }
.login .or { display: flex; align-items: center; gap: 12px; margin: 18px 0 12px; font-size: 12px; }
.login .or::before, .login .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login p:last-child { text-align: center; margin-bottom: 0; }
.login p:last-child .btn { width: 100%; padding: 11px; }

/* ── スマートフォンの幅 ── */
@media (max-width: 700px) {
  .bar { padding: 8px 12px; gap: 8px; }
  .bar .tabs { order: 10; width: 100%; }
  .sheet-link, .bar .spacer { display: none; }
  .who { flex: 1; min-width: 0; max-width: none; }
  .logout { padding: 5px 10px; }
  main { padding: 12px; }
  .toolbar { padding: 10px; }
  .session-select { min-width: 0; width: 100%; }
  .session-label { width: 100%; flex-wrap: wrap; }
  .field { grid-template-columns: 1fr; gap: 4px; }
  .field .msg { grid-column: 1; }
  .list .wide { display: none; }
  .sheet-wrap { max-height: none; border: 0; background: transparent; box-shadow: none; }
  .sheet thead { display: none; }
  .sheet, .sheet tbody, .sheet tr, .sheet td { display: block; width: 100%; }
  .sheet tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
  .sheet td { border: 0; min-width: 0; padding: 5px 0; background: transparent; }
  .sheet tbody tr:hover td { background: transparent; }
  .sheet td::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 700; color: var(--muted); }
  .sheet .sticky-col { position: static; box-shadow: none; }
  .cell-editor.compact .msg { max-width: none; white-space: normal; }
  .register-form fieldset { grid-template-columns: 1fr; padding: 14px; }
  .detail .panel { padding: 0 12px 20px; }
  .detail .toolbar.sticky { margin: 0 -12px 10px; padding: 12px; }
}

/* お知らせ（移し替えなど） */
.notices { display: flex; gap: 12px; align-items: center; padding: 10px 20px; background: var(--accent-soft); color: var(--accent-ink); border-bottom: 1px solid #c9d7fb; font-weight: 600; }
.notices-body { flex: 1; }
.notices-body p { margin: 2px 0; }

/* 管理の画面：小さな見出し・状態のカード */
.subtabs { display: flex; gap: 4px; margin-bottom: 14px; flex-wrap: wrap; }
.subtabs button { border: 1px solid var(--line); background: var(--surface); padding: 6px 14px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--fg-2); }
.subtabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 12px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; display: grid; gap: 6px; align-content: start; }
.stat-card.good { border-left-color: #2f9e5b; }
.stat-card.warn { border-left-color: #e0a100; }
.stat-card.bad { border-left-color: var(--ng-ink); background: #fffafa; }
.stat-title { font-size: 12px; font-weight: 700; color: var(--muted); }
.stat-value { font-size: 20px; font-weight: 800; color: var(--fg); }
.stat-note { font-size: 12px; color: var(--fg-2); }
.stat-card .btn { justify-self: start; }
.list td.wrap { white-space: normal; max-width: 360px; overflow-wrap: anywhere; }
.log-wrap { overflow-x: auto; }
.toolbar input[type=search] { min-width: 200px; }

/* 入力漏れ */
.gap-title { font-size: 14px; margin: 18px 0 8px; color: var(--warn-ink); }
.sheet td.gap-cell { background: #fff1d6; box-shadow: inset 0 0 0 2px #f0b429; }
.notice-ok { padding: 10px 14px; background: var(--ok); color: var(--ok-ink); border: 1px solid #b7e2c6; border-radius: var(--radius-sm); font-weight: 600; }
.gap-detail-cell { padding: 0 !important; border-bottom: 0 !important; }
.gap-detail { padding: 8px 12px 14px; background: var(--surface-2); }
