/* 誘導管理アプリ（FunnelMaster）の見た目（2026-10-23 作り直し。主人の指示「もうちょっと2026年っぽくイケてるデザインに」）
   - 広い画面では、メニューを左の縦の帯（サイドバー）にする。狭い画面では、今までどおり上の帯
   - 色は、落ち着いた灰色（zinc）を地に、藍（インディゴ）〜紫を差し色にする。端末がダークモードなら暗い配色に自動で切り替える
   - 角は大きめに丸め、影は薄く重ねる。数字は桁をそろえる（tabular-nums）
   - マスタ表だけは「シートと同じ見た目」（spec.md 5章）なので、ダークモードでもシートの色のまま
   - 画面の安全の設定（CSP）で外部のフォント・画像は読めないので、端末の日本語フォントと、data: の SVG のアイコンを使う
   - 画面の部品の名前（class）は、前の版から変えていない（JavaScript はそのまま） */
:root {
  color-scheme: light;
  --bg: #f6f6f8;
  --bg-tint: radial-gradient(1200px 600px at 100% -10%, rgba(99, 102, 241, .07), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(168, 85, 247, .05), transparent 60%);
  --surface: #ffffff;
  --surface-2: #f8f8fa;
  --surface-3: #f1f1f4;
  --fg: #18181b;
  --fg-2: #3f3f46;
  --muted: #71717a;
  --line: #e7e7ec;
  --line-2: #d4d4dc;
  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-ink: #4338ca;
  --accent-soft: #eef0ff;
  --accent-line: #c7cbfb;
  --warn: #fff7e0;
  --warn-ink: #92400e;
  --warn-line: #f5d58a;
  --ng: #fdecec;
  --ng-ink: #b42318;
  --ng-line: #f5c2c2;
  --ok: #e8f7ee;
  --ok-ink: #15803d;
  --ok-line: #b5e3c6;
  --hover: #f4f4f7;
  --row-hover: #f7f7fc;
  --head: #1c4587;
  --head-fg: #fff;
  --g2: #d0e0e3;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 2px 8px rgba(24, 24, 27, .04);
  --shadow-md: 0 1px 2px rgba(24, 24, 27, .05), 0 8px 24px -8px rgba(24, 24, 27, .12);
  --shadow-lg: 0 24px 48px -12px rgba(24, 24, 27, .28);
  --ring: 0 0 0 3px rgba(79, 70, 229, .25);
  --brand: linear-gradient(135deg, #6366f1 0%, #8b5cf6 55%, #d946ef 100%);
  --side-w: 248px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0c0c0f;
    --bg-tint: radial-gradient(1200px 600px at 100% -10%, rgba(99, 102, 241, .12), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(168, 85, 247, .08), transparent 60%);
    --surface: #16161a;
    --surface-2: #1c1c21;
    --surface-3: #23232a;
    --fg: #f4f4f5;
    --fg-2: #d4d4d8;
    --muted: #a1a1aa;
    --line: #27272f;
    --line-2: #3a3a44;
    --accent: #818cf8;
    --accent-2: #a78bfa;
    --accent-ink: #c7d2fe;
    --accent-soft: rgba(129, 140, 248, .14);
    --accent-line: rgba(129, 140, 248, .35);
    --warn: rgba(245, 158, 11, .14);
    --warn-ink: #fcd34d;
    --warn-line: rgba(245, 158, 11, .35);
    --ng: rgba(239, 68, 68, .14);
    --ng-ink: #fca5a5;
    --ng-line: rgba(239, 68, 68, .35);
    --ok: rgba(34, 197, 94, .13);
    --ok-ink: #86efac;
    --ok-line: rgba(34, 197, 94, .32);
    --hover: #202027;
    --row-hover: #1d1d24;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px -8px rgba(0, 0, 0, .6);
    --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, .7);
    --ring: 0 0 0 3px rgba(129, 140, 248, .35);
  }
}

* { box-sizing: border-box; }
/* hidden の印を、display を指定した要素（詳細の覆い・タブなど）でも必ず効かせる */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh;
  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-tint), var(--bg); background-attachment: fixed;
  font-size: 14px; line-height: 1.6; letter-spacing: .01em;
  font-feature-settings: "palt" 1; -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--accent); }
::selection { background: rgba(99, 102, 241, .22); }
.muted { color: var(--muted); }
.spacer { flex: 1; }

/* ── 上の帯（狭い画面）／左のサイドバー（広い画面） ── */
.bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 20px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; color: var(--fg); white-space: nowrap; line-height: 1.15; }
.brand-name { display: grid; }
.brand-name b { font-size: 15px; letter-spacing: -.01em; }
.brand-name small { font-size: 10.5px; font-weight: 600; color: var(--muted); letter-spacing: .08em; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--brand); color: #fff; font-size: 15px; font-weight: 900; letter-spacing: -.02em;
  box-shadow: 0 6px 16px -6px rgba(99, 102, 241, .7), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.tabs { display: flex; gap: 2px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; padding: 7px 12px; border-radius: 10px; cursor: pointer; white-space: nowrap;
  color: var(--fg-2); font-weight: 600; font-size: 13px; text-align: left; transition: background .15s, color .15s;
}
.tabs button:hover { background: var(--hover); color: var(--fg); }
.tabs button.on { background: var(--accent-soft); color: var(--accent-ink); }
.tabs button:focus-visible { outline: none; box-shadow: var(--ring); }
/* メニューのアイコン（線の絵。色は文字の色に合わせる） */
.tabs button::before {
  content: ""; width: 17px; height: 17px; flex: none; background: currentColor; opacity: .85;
  -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
  --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6h18M3 12h18M3 18h12'/%3E%3C/svg%3E");
}
.tabs button[data-tab="register"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='4'/%3E%3Cpath d='M2 21v-1a6 6 0 0 1 10-4.5M19 14v6M16 17h6'/%3E%3C/svg%3E"); }
.tabs button[data-tab="office"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9'/%3E%3Cpath d='M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4Z'/%3E%3C/svg%3E"); }
.tabs button[data-tab="officeSearch"]::before, .tabs button[data-tab="search"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E"); }
.tabs button[data-tab="lecture"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='12' rx='2'/%3E%3Cpath d='M8 20h8M12 16v4'/%3E%3C/svg%3E"); }
.tabs button[data-tab="study"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 5h6a4 4 0 0 1 4 4v11a3 3 0 0 0-3-3H2ZM22 5h-6a4 4 0 0 0-4 4v11a3 3 0 0 1 3-3h7Z'/%3E%3C/svg%3E"); }
.tabs button[data-tab="kobetsu"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a8 8 0 0 1-11.8 7L3 21l2-6A8 8 0 1 1 21 12Z'/%3E%3C/svg%3E"); }
.tabs button[data-tab$="Recent"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 3-6.7L3 8'/%3E%3Cpath d='M3 3v5h5M12 7v5l3 2'/%3E%3C/svg%3E"); }
.tabs button[data-tab="gaps"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0Z'/%3E%3Cpath d='M12 9v4M12 17h.01'/%3E%3C/svg%3E"); }
.tabs button[data-tab="master"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Cpath d='M3 9h18M3 15h18M9 3v18'/%3E%3C/svg%3E"); }
.tabs button[data-tab="admin"]::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 21v-7M4 10V3M12 21v-9M12 8V3M20 21v-5M20 12V3M1 14h6M9 8h6M17 16h6'/%3E%3C/svg%3E"); }
.sheet-link { font-size: 13px; text-decoration: none; color: var(--fg-2); padding: 7px 10px; border-radius: 10px; white-space: nowrap; }
.sheet-link:hover { background: var(--hover); color: var(--fg); }
.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 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); white-space: nowrap; }
.logout:hover { border-color: var(--line-2); color: var(--fg); }
.notice { padding: 10px 24px; background: var(--warn); color: var(--warn-ink); border-bottom: 1px solid var(--warn-line); font-weight: 600; }
main { padding: 24px 28px 40px; max-width: 1640px; margin: 0 auto; }
main > p.muted:only-child { text-align: center; padding: 72px 0; }

/* 広い画面：左のサイドバー */
@media (min-width: 1024px) {
  body:not(.auth) { padding-left: var(--side-w); }
  body:not(.auth) .bar {
    position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 25;
    flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 6px;
    padding: 18px 14px 16px; border-bottom: 0; border-right: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 70%, transparent);
  }
  body:not(.auth) .brand { padding: 2px 6px 16px; }
  body:not(.auth) .tabs { flex-direction: column; overflow: visible; gap: 2px; }
  body:not(.auth) .tabs button { padding: 9px 12px; font-size: 13.5px; }
  body:not(.auth) .spacer { flex: 1; }
  body:not(.auth) .sheet-link { padding: 8px 12px; }
  body:not(.auth) .who { max-width: none; border-radius: 12px; padding: 8px 12px; white-space: normal; line-height: 1.4; }
  body:not(.auth) .logout { text-align: center; }
  body:not(.auth) .notice, body:not(.auth) .notices { padding-left: 28px; }
}
/* ログインの画面：帯を目立たせない */
body.auth .bar { background: transparent; border-bottom-color: transparent; backdrop-filter: none; }
body.auth .sheet-link { display: none; }

/* ── 見出し・帯・カード ── */
.section-title { margin: 22px 0 10px; font-size: 18px; font-weight: 800; letter-spacing: -.005em; color: var(--fg); }
main > .section-title:first-child, .toolbar + .section-title { margin-top: 4px; }
.toolbar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px;
  padding: 12px 16px; 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; }
.toolbar input[type=search] { min-width: 200px; }
.notice-inline { padding: 12px 16px; background: var(--warn); color: var(--warn-ink); border: 1px solid var(--warn-line); border-radius: var(--radius-sm); font-weight: 600; }
.notice-ok { padding: 12px 16px; background: var(--ok); color: var(--ok-ink); border: 1px solid var(--ok-line); border-radius: var(--radius-sm); font-weight: 600; }

/* ── ボタン ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; background: var(--accent); color: #fff;
  padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer; font-weight: 700; font-size: 13px; text-decoration: none; white-space: nowrap;
  background-image: linear-gradient(180deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, 0));
  box-shadow: 0 1px 2px rgba(24, 24, 27, .12), 0 4px 12px -4px rgba(79, 70, 229, .55), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: filter .15s, box-shadow .15s, transform .06s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.sub { background: var(--surface); background-image: none; color: var(--fg-2); border-color: var(--line-2); box-shadow: var(--shadow); }
.btn.sub:hover { background: var(--hover); color: var(--fg); filter: none; }
.btn.small { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
@media (prefers-color-scheme: dark) { .btn:not(.sub) { color: #0c0c0f; } }

/* ── 入力欄 ── */
input[type=text], input[type=search], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number], 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: 36px;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--line-2) 60%, var(--fg) 15%); }
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(--muted); cursor: not-allowed; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); }
.search { width: 100%; max-width: 560px; padding: 12px 16px; font-size: 15px; border-radius: 12px; box-shadow: var(--shadow-md); margin-bottom: 6px; }

/* ── 一覧（検索の結果・追っかけ・管理） ── */
.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; font-variant-numeric: tabular-nums; }
.list th { background: var(--surface-2); color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.list td { padding: 11px 14px; 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 { transition: background .12s; }
.list tbody tr:hover td { background: var(--row-hover); }
.list td.wrap { white-space: normal; max-width: 360px; overflow-wrap: anywhere; }
.log-wrap { overflow-x: auto; border-radius: var(--radius); }

/* ── 担当一覧（担当セクションの入力欄つきの表） ── */
.sheet-wrap { overflow: auto; max-height: calc(100vh - 210px); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.sheet { border-collapse: separate; border-spacing: 0; font-variant-numeric: tabular-nums; }
.sheet th, .sheet td { border-bottom: 1px solid var(--line); border-right: 1px solid color-mix(in srgb, var(--line) 60%, transparent); padding: 7px 10px; vertical-align: top; background: var(--surface); }
.sheet thead th {
  position: sticky; top: 0; z-index: 2; background: var(--surface-2); 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: 700; color: var(--muted); font-size: 10px; letter-spacing: .08em; }
.sheet tbody tr:hover td { background: var(--row-hover); }
.sheet .sticky-col { position: sticky; left: 0; z-index: 1; }
.sheet thead .sticky-col { z-index: 3; }
.sheet .sticky-last { box-shadow: 6px 0 8px -6px rgba(24, 24, 27, .2); }
.sheet td { min-width: 120px; }
.sheet td[data-col="C"] { font-weight: 800; color: var(--accent-ink); }
.sheet td .ro { white-space: nowrap; color: var(--fg-2); }

/* 1項目の入力欄（担当一覧・詳細で共通） */
.cell-editor { border-radius: 8px; transition: background .2s, box-shadow .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: 32px; font-size: 13px; border-radius: 8px; }
.cell-editor input[type=date], .cell-editor input[type=time] { padding: 4px 6px; min-height: 32px; font-size: 13px; border-radius: 8px; }
.cell-editor .actions { display: flex; gap: 3px; }
.cell-editor .msg { display: block; font-size: 11px; font-weight: 700; }
.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: 800; padding: 9px 38px 9px 14px; border-radius: 12px;
  border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent-ink); min-width: 300px;
}

/* ── 詳細（右から出るパネル） ── */
.detail { position: fixed; inset: 0; z-index: 30; background: rgba(9, 9, 11, .42); display: flex; justify-content: flex-end; backdrop-filter: blur(4px); animation: fade .18s ease-out; }
.detail .panel { width: min(780px, 100%); height: 100%; overflow: auto; background: var(--bg); padding: 0 22px 28px; box-shadow: var(--shadow-lg); border-left: 1px solid var(--line); animation: slide .22s cubic-bezier(.2, .8, .2, 1); }
.detail .toolbar.sticky { position: sticky; top: 0; z-index: 1; margin: 0 -22px 14px; border-radius: 0; border-width: 0 0 1px; box-shadow: none; background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: blur(12px); padding: 16px 22px; }
.detail h2 { margin: 0; font-size: 19px; font-weight: 800; }
.detail fieldset { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin: 14px 0; padding: 8px 18px 12px; box-shadow: var(--shadow); }
.detail legend { font-weight: 800; padding: 3px 12px; font-size: 11.5px; letter-spacing: .04em; color: var(--accent-ink); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 999px; }
@keyframes fade { from { opacity: 0; } }
@keyframes slide { from { transform: translateX(24px); opacity: .6; } }
.field { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.field:last-child { border-bottom: 0; }
.field label { color: var(--muted); font-size: 12px; font-weight: 700; }
.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, .field.pending { background: var(--warn); border-radius: 8px; }
.field.error .msg { color: var(--ng-ink); }
.field.saved .msg { color: var(--ok-ink); }
.field.pending .msg { color: var(--warn-ink); font-weight: 700; }
.field.saving .msg { color: var(--muted); }

/* ── マスタ表（シートと同じ見た目。ダークモードでもシートの色のまま） ── */
.master-wrap {
  color-scheme: light; --surface: #fff; --surface-2: #f8fafc; --line-2: #cfd5e1; --fg: #172033; color: #172033;
  overflow: auto; height: calc(100vh - 150px); background: #fff; 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: 16px; max-width: 1000px; }
.register-form fieldset {
  margin: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 20px 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px 18px;
}
.register-form legend { font-size: 11.5px; font-weight: 800; letter-spacing: .04em; color: var(--accent-ink); background: var(--accent-soft); border: 1px solid var(--accent-line); padding: 3px 12px; 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: 10px 12px; min-height: 42px; }
.register-field .req { display: inline-block; margin-left: 4px; padding: 0 7px; border-radius: 999px; background: var(--ng); color: var(--ng-ink); border: 1px solid var(--ng-line); font-size: 10px; line-height: 16px; vertical-align: 1px; }
.register-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.register-actions .btn { padding: 11px 24px; font-size: 14px; }
.register-msg:empty { display: none; }
.register-msg { padding: 12px 16px; border-radius: var(--radius-sm); }
.register-msg.saved { color: var(--ok-ink); background: var(--ok); border: 1px solid var(--ok-line); font-weight: 700; }
.register-msg.error { background: var(--warn); color: var(--warn-ink); border: 1px solid var(--warn-line); }
.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: 20px; }
.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: 20px; 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); }
.subtabs { display: inline-flex; gap: 2px; margin-bottom: 16px; flex-wrap: wrap; padding: 4px; background: var(--surface-3); border: 1px solid var(--line); border-radius: 12px; }
.subtabs button { border: 0; background: transparent; padding: 6px 14px; border-radius: 9px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--fg-2); transition: background .15s, color .15s; }
.subtabs button:hover { color: var(--fg); }
.subtabs button.on { background: var(--surface); color: var(--fg); box-shadow: var(--shadow); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 14px; }
.stat-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px 16px 20px; display: grid; gap: 6px; align-content: start; overflow: hidden; }
.stat-card::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--line-2); }
.stat-card.good::before { background: #22c55e; }
.stat-card.warn::before { background: #f59e0b; }
.stat-card.bad { background: color-mix(in srgb, var(--ng) 40%, var(--surface)); }
.stat-card.bad::before { background: #ef4444; }
.stat-title { font-size: 11.5px; font-weight: 800; letter-spacing: .04em; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 800; letter-spacing: -.02em; color: var(--fg); font-variant-numeric: tabular-nums; }
.stat-note { font-size: 12px; color: var(--fg-2); }
.stat-card .btn { justify-self: start; }

/* ── ログインの画面 ── */
body.auth { background: radial-gradient(700px 420px at 15% 10%, rgba(99, 102, 241, .22), transparent 60%), radial-gradient(640px 400px at 90% 85%, rgba(217, 70, 239, .16), transparent 60%), var(--bg); }
.login { max-width: 420px; margin: 9vh auto 40px; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(18px); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 34px 30px 26px; }
.login h1 { font-size: 21px; font-weight: 800; letter-spacing: -.01em; text-align: center; margin: 10px 0 4px; }
.login h1::before {
  content: "F"; display: grid; place-items: center; width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 16px;
  background: var(--brand); color: #fff; font-size: 24px; font-weight: 900;
  box-shadow: 0 12px 28px -10px rgba(99, 102, 241, .8), inset 0 1px 0 rgba(255, 255, 255, .35);
}
.login-sub { text-align: center; margin: 0; font-size: 13px; }
.login-form { display: grid; gap: 14px; margin-top: 22px; }
.login-form label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--fg-2); }
.login-form input { padding: 12px 14px; font-size: 16px; border-radius: 12px; }
.login-form .btn { padding: 12px; font-size: 15px; margin-top: 4px; border-radius: 12px; }
.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; border-radius: 12px; }

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

/* 入力漏れ */
.gap-title { font-size: 14px; font-weight: 800; margin: 20px 0 8px; color: var(--warn-ink); }
.sheet td.gap-cell { background: var(--warn); box-shadow: inset 0 0 0 2px #f0b429; }
.gap-detail-cell { padding: 0 !important; border-bottom: 0 !important; }
.gap-detail { padding: 8px 12px 14px; background: var(--surface-2); }

/* ── スマートフォンの幅 ── */
@media (max-width: 700px) {
  .bar { padding: 8px 12px; gap: 8px; }
  .bar .tabs { order: 10; width: 100%; }
  .sheet-link, .bar .spacer { display: none; }
  .brand-name small { display: none; }
  .who { flex: 1; min-width: 0; max-width: none; }
  .logout { padding: 5px 10px; }
  main { padding: 14px 12px 28px; }
  .toolbar { padding: 10px 12px; }
  .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: 12px 14px; 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: 16px; }
  .detail .panel { padding: 0 12px 20px; }
  .detail .toolbar.sticky { margin: 0 -12px 10px; padding: 12px; }
  .login { margin-top: 4vh; padding: 28px 20px 22px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
