/* =========================================================
   週間予定ボード 共通スタイル（モダンUI版）
   アクセント：オレンジグラデーション ／ 背景：暖色系ライトグレー
   ========================================================= */
:root {
  --accent: #E8762B;
  --accent-2: #F49A4A;
  --accent-dark: #C95F1B;
  --accent-grad: linear-gradient(135deg, #F49A4A 0%, #E8762B 55%, #DE5F14 100%);
  --accent-light: #FCEFE3;
  --accent-faint: #FDF6EE;
  --bg: #F6F3EF;
  --card: #FFFFFF;
  --text: #2E2822;
  --muted: #9B9289;
  --line: #ECE6DF;
  --line-strong: #E0D8CF;
  --sat: #3B82F6;
  --sun: #EF4444;
  --today-bg: #FFF6EC;
  --shadow-sm: 0 1px 2px rgba(46, 33, 20, 0.06);
  --shadow: 0 1px 2px rgba(46, 33, 20, 0.05), 0 10px 28px -14px rgba(46, 33, 20, 0.18);
  --shadow-pop: 0 4px 10px -2px rgba(232, 118, 43, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(1200px 320px at 50% -80px, #FBEEDF 0%, rgba(251, 238, 223, 0) 70%),
    var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", "Segoe UI", Meiryo, "Yu Gothic UI", "Hiragino Kaku Gothic ProN", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-light); }

/* ---------- ヘッダー ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.topbar .brand {
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 9px;
}
.topbar .brand .dept {
  display: inline-flex;
  align-items: center;
  background: var(--accent-grad);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  border-radius: 999px;
  padding: 3px 12px;
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-pop);
}
.weeknav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 6px;
  box-shadow: var(--shadow-sm);
}
.week-label {
  font-size: 13.5px;
  font-weight: 700;
  min-width: 240px;
  text-align: center;
  letter-spacing: 0.01em;
  padding: 0 4px;
}
.weeknav .btn { border: none; box-shadow: none; }
.topbar .spacer { flex: 1; }
.sync-note {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

/* ---------- ボタン ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid transparent;
  background: var(--accent-grad);
  color: #fff;
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  box-shadow: var(--shadow-pop);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn.ghost {
  background: #fff;
  color: var(--accent-dark);
  border-color: #F3D9C3;
  box-shadow: var(--shadow-sm);
}
.btn.ghost:hover { background: var(--accent-faint); filter: none; }
.btn.small { padding: 4px 13px; font-size: 12px; }
.btn.gray {
  background: #fff;
  color: var(--text);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.btn.gray:hover { background: var(--bg); filter: none; }
.icon-btn {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 8px;
  transition: background-color 0.12s ease, color 0.12s ease;
}
.icon-btn:hover { background: var(--accent-light); color: var(--accent-dark); }
.icon-btn:disabled { opacity: 0.3; cursor: default; }
.icon-btn:disabled:hover { background: none; color: var(--muted); }

/* ---------- アバター ---------- */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: var(--shadow-pop);
}
.avatar.sm {
  width: 24px;
  height: 24px;
  font-size: 12px;
  box-shadow: none;
}
.avatar { overflow: hidden; }
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.avatar-btn {
  border: none;
  background: none;
  padding: 0;
  cursor: pointer;
  border-radius: 50%;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.avatar-btn:hover { transform: scale(1.1); }
.wtable .member-col .avatar { margin: 0 auto 4px; }

/* ---------- サイドバー付きレイアウト ---------- */
.layout {
  display: flex;
  align-items: flex-start;
  gap: 18px;
  max-width: 1260px;
  margin: 0 auto;
  padding: 18px 18px 70px;
}
.sidebar {
  width: 196px;
  flex-shrink: 0;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  position: sticky;
  top: 72px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 13px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--text);
  user-select: none;
  transition: background-color 0.12s ease, color 0.12s ease;
  margin-bottom: 2px;
}
.nav-item:hover { background: var(--accent-faint); color: var(--accent-dark); }
.nav-item.active {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: var(--shadow-pop);
}
.nav-item.active .avatar.sm { background: rgba(255, 255, 255, 0.25); }
.nav-sep { border-top: 1px solid var(--line); margin: 8px 6px; }
.nav-label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 4px 13px 4px;
}
.content { flex: 1; min-width: 0; }
.content-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.content-head h1 {
  font-size: 17px;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  letter-spacing: 0.01em;
}
.content-head .spacer { flex: 1; }

/* 表示切替（表／カード） */
.seg {
  display: inline-flex;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px;
  box-shadow: var(--shadow-sm);
}
.seg button {
  border: none;
  background: none;
  color: var(--muted);
  padding: 4px 14px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  border-radius: 999px;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.seg button.active {
  background: var(--accent-grad);
  color: #fff;
  box-shadow: var(--shadow-pop);
}

/* ---------- 全員カレンダー（表形式） ---------- */
.wtable-wrap {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 6px;
  overflow-x: auto;
}
table.wtable {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
  font-size: 12.5px;
  line-height: 1.55;
}
.wtable th, .wtable td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #F4EFE9;
  padding: 8px 9px;
  vertical-align: top;
  word-break: break-all;
}
.wtable tr > *:last-child { border-right: none; }
.wtable tbody tr:last-child > * { border-bottom: none; }
.wtable thead th {
  background: #FBF8F4;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 9px 4px;
  position: sticky;
  top: 0;
}
.wtable thead th:first-child { border-top-left-radius: 12px; }
.wtable thead th:last-child { border-top-right-radius: 12px; }
.wtable thead th.dow-sat { color: var(--sat); }
.wtable thead th.dow-sun { color: var(--sun); }
.wtable thead th.today-col {
  background: var(--accent-light);
  color: var(--accent-dark);
}
.wtable td.today-col { background: var(--today-bg); }
.wtable .member-col {
  width: 80px;
  background: #FBF8F4;
  font-weight: 700;
  text-align: center;
  vertical-align: middle;
}
.wtable .member-col .to-edit {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-dark);
  cursor: pointer;
  margin-top: 4px;
  padding: 1px 9px;
  border: 1px solid #F3D9C3;
  border-radius: 999px;
  background: #fff;
  transition: background-color 0.12s ease;
}
.wtable .member-col .to-edit:hover { background: var(--accent-light); }
.wtable .task-col { width: 185px; background: #FCFAF7; }
.wtable .entry { margin-bottom: 3px; }
.wtable .cell-none { color: #D8D2CA; text-align: center; }
.wtable .task-item {
  margin-bottom: 3px;
  padding-left: 1em;
  text-indent: -1em;
}
.wtable .task-item::before { content: "・"; color: var(--accent); }

/* 時間チップ（表・カード共通） */
.time {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 11.5px;
  border-radius: 6px;
  padding: 0 6px;
  margin-right: 5px;
  white-space: nowrap;
}

/* ---------- カード（カード表示） ---------- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(46,33,20,.05), 0 16px 36px -16px rgba(46,33,20,.22); }
.card-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
}
.card-head h2 {
  margin: 0;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-head .updated { font-size: 11px; color: var(--muted); }
.card-head .spacer { flex: 1; }
.card-body {
  display: grid;
  grid-template-columns: 1fr 280px;
}

/* 週間予定（左） */
.days { padding: 6px 0; }
.day-row {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 10px;
  padding: 6px 18px;
  border-bottom: 1px dashed var(--line);
}
.day-row:last-child { border-bottom: none; }
.day-row.today {
  background: var(--today-bg);
  border-left: 3px solid var(--accent);
  padding-left: 15px;
}
.day-label {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  padding-top: 1px;
}
.day-label .dow-sat { color: var(--sat); }
.day-label .dow-sun { color: var(--sun); }
.day-label .today-mark {
  display: inline-block;
  background: var(--accent-grad);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 999px;
  padding: 0 7px;
  margin-left: 6px;
  vertical-align: 1px;
}
.entries { margin: 0; padding: 0; list-style: none; }
.entries li { padding: 1.5px 0; }
.entries .none { color: #D8D2CA; }

/* 継続案件（右） */
.ongoing {
  border-left: 1px solid var(--line);
  background: #FCFAF7;
  padding: 12px 18px;
}
.ongoing h3 {
  margin: 0 0 8px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
}
.ongoing ul { margin: 0; padding: 0; list-style: none; }
.ongoing li {
  padding: 3px 0 3px 15px;
  position: relative;
  font-size: 13px;
}
.ongoing li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 11px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-grad);
}
.ongoing .none { color: #D8D2CA; }
.ongoing .none::before { display: none; }

/* ---------- 入力（係長別タブ） ---------- */
select, input[type="text"], input[type="date"] {
  font: inherit;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 12px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select:focus, input[type="text"]:focus, input[type="date"]:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
input::placeholder { color: #C6BEB5; }

.edit-section {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.edit-section > h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #FDFBF8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.edit-day {
  padding: 9px 18px;
  border-bottom: 1px dashed var(--line);
}
.edit-day:last-child { border-bottom: none; }
.edit-day.today {
  background: var(--today-bg);
  border-left: 3px solid var(--accent);
  padding-left: 15px;
}
.edit-day .day-label { margin-bottom: 6px; }
.edit-row {
  display: grid;
  grid-template-columns: 112px 1fr 36px;
  gap: 8px;
  margin-bottom: 7px;
  align-items: center;
}
input.time {
  display: inline-block;
  background: #fff;
  color: var(--text);
  font-weight: 400;
  font-size: inherit;
  text-align: center;
  padding: 7px 8px;
  margin: 0;
  border-radius: var(--radius-sm);
  white-space: normal;
}
.add-row-btn {
  border: 1.5px dashed #EBC7A8;
  background: none;
  color: var(--accent-dark);
  border-radius: 999px;
  padding: 4px 15px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  margin: 2px 0 4px;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.add-row-btn:hover { background: var(--accent-faint); border-color: var(--accent); }

.ongoing-edit-row {
  display: grid;
  grid-template-columns: 30px 1fr 36px;
  gap: 8px;
  align-items: center;
  padding: 6px 18px;
}
.ongoing-edit-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
}
.edit-section .section-foot { padding: 10px 18px 14px; }

/* 一括入力パネル */
.bulk-grid {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 12px 14px;
  align-items: center;
  font-size: 13px;
}
.bulk-grid > label { font-weight: 700; }
.bulk-grid .inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
#bulkPanel {
  border: 1.5px solid #F3D9C3;
  box-shadow: var(--shadow), 0 0 0 4px var(--accent-faint);
}

/* ---------- 設定 ---------- */
.admin-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  overflow: hidden;
}
.admin-box > h2 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #FDFBF8;
}
.admin-box .box-body { padding: 14px 18px; }
.member-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}
.member-row:last-child { border-bottom: none; }
.member-row .name {
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  padding: 3px 8px;
  margin-left: -8px;
  transition: background-color 0.12s ease;
}
.member-row .name:hover { background: var(--accent-faint); }
.member-row.hidden-member .name { color: var(--muted); text-decoration: line-through; }
.badge-hidden {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 0 8px;
}

/* ---------- アニメーション ---------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes popIn {
  0%   { opacity: 0; transform: scale(0.96) translateY(6px); }
  100% { opacity: 1; transform: none; }
}
@keyframes softPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 118, 43, 0.35); }
  60%      { box-shadow: 0 0 0 6px rgba(232, 118, 43, 0); }
}

.content-head { animation: fadeUp 0.3s ease both; }
.wtable-wrap, .edit-section, .admin-box { animation: fadeUp 0.35s ease both; }
.wtable tbody tr { animation: fadeUp 0.4s ease both; }   /* 行ごとの遅延はJS側でstyle指定 */
.card { animation: popIn 0.4s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
#bulkPanel { animation: popIn 0.3s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
.day-label .today-mark { animation: softPulse 2.4s ease-in-out infinite; }

/* 表の行ホバー */
.wtable tbody tr { transition: background-color 0.15s ease; }
.wtable tbody tr:hover td:not(.today-col):not(.member-col) { background: #FDFBF7; }

/* ナビのマイクロインタラクション */
.nav-item { transition: background-color 0.15s ease, color 0.15s ease, transform 0.1s ease; }
.nav-item:active { transform: scale(0.97); }

/* 完了チェックの余韻（消える前に打ち消し線でフィードバック） */
.ongoing-edit-row:has(input[type="checkbox"]:checked) { opacity: 0.4; transition: opacity 0.3s ease; }
.ongoing-edit-row:has(input[type="checkbox"]:checked) input[type="text"] {
  text-decoration: line-through;
  color: var(--muted);
}

/* 自動更新（ポーリング）時はアニメーションを再生しない */
.no-anim, .no-anim * { animation: none !important; }

/* 動きを減らす設定のユーザーには全て無効化 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- スマホ（サイドバー→横タブ） ---------- */
@media (max-width: 720px) {
  .topbar { padding: 8px 12px; gap: 8px; }
  .week-label { min-width: 0; font-size: 12.5px; }
  .layout { flex-direction: column; padding: 12px 10px 70px; gap: 12px; }
  .sidebar {
    width: 100%;
    position: static;
    display: flex;
    overflow-x: auto;
    padding: 8px;
    gap: 4px;
    border-radius: 999px;
  }
  .nav-item { white-space: nowrap; padding: 8px 14px; margin-bottom: 0; border-radius: 999px; }
  .nav-sep, .nav-label { display: none; }
  .card-body { grid-template-columns: 1fr; }
  .ongoing { border-left: none; border-top: 1px solid var(--line); }
  .day-row { grid-template-columns: 84px 1fr; padding: 6px 12px; }
  .day-row.today { padding-left: 9px; }
  .edit-day { padding: 9px 12px; }
  .edit-day.today { padding-left: 9px; }
  .edit-row { grid-template-columns: 86px 1fr 36px; }
  .bulk-grid { grid-template-columns: 1fr; gap: 4px; }
}
