/* 移住のすゝめ WBS — Backlog風のシンプルで親しみやすいUI */
:root {
  --primary: #2eb886;
  --primary-dark: #249c70;
  --danger: #e05252;
  --warning: #f0a840;
  --text: #333;
  --muted: #888;
  --border: #e0e4e8;
  --bg: #f5f7f8;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Hiragino Kaku Gothic ProN", "Hiragino Sans", Meiryo, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.6;
}
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ヘッダー */
.global-header { background: #fff; border-bottom: 1px solid var(--border); }
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 6px 16px;
  display: flex; align-items: center; gap: 12px 20px; min-height: 52px; flex-wrap: wrap;
}
.brand { font-weight: bold; font-size: 16px; color: var(--text); white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand span { color: var(--primary); }
.brand-logo { height: 32px; width: auto; display: block; }

/* ヘッダーのタスク作成ドロップダウン(ボタン見た目は .btn .btn-primary .btn-sm と共通) */
.header-create { position: relative; }
.header-create summary { list-style: none; white-space: nowrap; }
.header-create summary::-webkit-details-marker { display: none; }
.header-create .dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; min-width: 180px;
  background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 4px 16px rgba(0, 0, 0, .12); padding: 4px;
}
.header-create .dropdown a { display: block; padding: 7px 12px; border-radius: 6px; color: var(--text); white-space: nowrap; }
.header-create .dropdown a:hover { background: var(--bg); text-decoration: none; }
.global-nav { display: flex; gap: 8px; flex: 1; }
.global-nav a { color: var(--text); padding: 4px 8px; border-radius: 4px; white-space: nowrap; }
.global-nav a:hover { background: var(--bg); text-decoration: none; }
.header-user { display: flex; align-items: center; gap: 8px; color: var(--muted); white-space: nowrap; margin-left: auto; }
.inline-form { display: inline; }
.header-select { width: 160px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 6px; font-size: 13px; color: var(--muted); background: #fff; }
.header-search input { width: 150px; padding: 5px 10px; margin: 0; font-size: 13px; }

/* 変更履歴 */
.inline-h2 { display: inline; font-size: 15px; }
.history summary { cursor: pointer; }
.history-list { list-style: none; padding: 0; margin: 10px 0 0; }
.history-list > li { padding: 6px 0; border-top: 1px solid var(--border); }
.history-changes { margin: 4px 0 0; padding-left: 20px; color: var(--muted); }
.search-excerpt { background: var(--bg); border-radius: 4px; padding: 6px 10px; margin-top: 4px; }

/* レイアウト */
.container { max-width: 1200px; margin: 24px auto; padding: 0 16px; }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; margin-bottom: 16px;
}
h1 { font-size: 20px; }
h2 { font-size: 16px; margin-top: 0; }
.muted { color: var(--muted); }

/* ボタン */
.btn {
  display: inline-block; padding: 8px 16px; border-radius: 6px; border: 1px solid transparent;
  cursor: pointer; font-size: 14px; background: #fff;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--muted); border: none; padding: 4px 8px; }
.btn-ghost:hover { color: var(--text); }
.btn-block { width: 100%; }

/* フォーム */
label { display: block; margin-bottom: 12px; font-weight: bold; }
input[type="text"], input[type="email"], input[type="password"],
input[type="date"], input[type="number"], select, textarea {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 6px; font-size: 14px; font-weight: normal;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(46, 184, 134, .15);
}

/* フラッシュメッセージ */
.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.flash-success { background: #e6f6ef; color: #1d7a56; border: 1px solid #bfe8d6; }
.flash-error { background: #fdecec; color: #b03030; border: 1px solid #f5c6c6; }

/* ページ共通 */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head h1 { margin-top: 0; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }
.ta-right { text-align: right; }
.small { font-size: 12px; }
.narrow { max-width: 520px; }
.narrow-lg { max-width: 760px; }
.req { color: var(--danger); font-size: 11px; font-weight: normal; }

/* テーブル */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-size: 12px; font-weight: normal; }
.table tr:last-child td { border-bottom: none; }
.task-table td { white-space: nowrap; }
.task-table td:nth-child(2) { white-space: normal; min-width: 200px; }
.child-mark { color: var(--muted); margin-right: 2px; }

/* バッジ・タグ */
.badge { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; color: #fff; white-space: nowrap; }
.badge-s1 { background: #e05252; }   /* 未対応 */
.badge-s2 { background: #4a90d9; }   /* 処理中 */
.badge-s3 { background: #2eb886; }   /* 処理済み */
.badge-closed { background: #9aa4ad; } /* 完了 */
.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 11px; background: var(--bg); border: 1px solid var(--border); color: var(--muted); margin-left: 6px; }
.prio { color: var(--muted); }
.prio-high { color: var(--danger); font-weight: bold; }
.prio-low { color: #4a90d9; }

/* 期限の強調 */
.overdue { color: var(--danger); font-weight: bold; }
.due-soon { color: #c77700; font-weight: bold; }

/* 進捗バー */
.progress { display: inline-block; width: 80px; height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; vertical-align: middle; margin-right: 6px; border: 1px solid var(--border); }
.progress-bar { height: 100%; background: var(--primary); }

/* フィルタバー */
.filter-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; }
.filter-bar input[type="text"], .filter-bar select { display: inline-block; width: auto; margin: 0; }
.check-label { display: flex; align-items: center; gap: 6px; font-weight: normal; margin: 0; white-space: nowrap; }

/* フォーム */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.form-actions { margin-top: 16px; display: flex; gap: 8px; }
.row-form { display: flex; gap: 8px; margin-top: 8px; }
.row-form input, .row-form select { margin: 0; }
.btn-sm { padding: 3px 10px; font-size: 12px; border: 1px solid var(--border); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

/* フラッシュ(警告) */
.flash-warning { background: #fdf3e4; color: #9a6700; border: 1px solid #f0dcb8; }

/* タスク詳細 */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 24px; margin-bottom: 12px; }
.detail-label { display: block; color: var(--muted); font-size: 12px; }
.description { white-space: pre-wrap; }
hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* アクティビティ */
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li { padding: 6px 0; border-bottom: 1px solid var(--border); }
.activity-list li:last-child { border-bottom: none; }

@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* プロジェクト内タブ */
.project-nav { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 16px; }
.project-nav a { padding: 8px 16px; color: var(--muted); border-radius: 6px 6px 0 0; margin-bottom: -2px; border-bottom: 2px solid transparent; }
.project-nav a:hover { background: #fff; text-decoration: none; }
.project-nav a.active { color: var(--primary-dark); border-bottom-color: var(--primary); font-weight: bold; background: #fff; }

/* カンバンボード */
.kanban { display: flex; gap: 12px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: #eef1f3; border-radius: 8px; padding: 10px; min-width: 240px; width: 25%; flex-shrink: 0; }
.kanban-col.dropover { outline: 2px dashed var(--primary); outline-offset: -2px; }
.kanban-head { margin: 0 0 10px; font-size: 13px; color: var(--muted); }
.kanban-cards { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.kanban-card { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; cursor: grab; }
.kanban-card.dragging { opacity: .5; }
.kanban-card a { display: block; margin: 2px 0 6px; }
.kanban-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }

/* コメント */
.comment { border-top: 1px solid var(--border); padding: 10px 0; }
.comment:first-of-type { border-top: none; }
.comment-head { display: flex; gap: 8px; align-items: baseline; margin-bottom: 4px; }
.comment-body { white-space: pre-wrap; }

/* ガントチャート */
.gantt-toolbar { display: flex; gap: 8px; align-items: center; padding: 10px 16px; }
.gantt-wrap { padding: 0; overflow: hidden; }
.gantt { display: flex; }
.gantt-names { flex: 0 0 260px; border-right: 1px solid var(--border); }
.gantt-head-cell { height: 48px; display: flex; align-items: flex-end; padding: 4px 10px; color: var(--muted); font-size: 12px; border-bottom: 1px solid var(--border); box-sizing: border-box; }
.gantt-name { height: 34px; line-height: 34px; padding: 0 10px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gantt-name.is-child { padding-left: 26px; }
.gantt-scroll { overflow-x: auto; flex: 1; }
.gantt-months { display: flex; height: 24px; }
.gantt-month { font-size: 12px; color: var(--muted); border-right: 1px solid var(--border); padding: 2px 6px; box-sizing: border-box; white-space: nowrap; overflow: hidden; }
.gantt-days { display: flex; height: 24px; border-bottom: 1px solid var(--border); }
.gantt-day { font-size: 10px; color: var(--muted); text-align: center; line-height: 24px; box-sizing: border-box; border-right: 1px solid #f0f2f4; flex-shrink: 0; }
.gantt-day.weekend { background: #f4f6f8; }
.gantt-day.today { background: #fff3e6; color: #c77700; font-weight: bold; }
.gantt-row { display: flex; position: relative; height: 34px; border-bottom: 1px solid #f0f2f4; }
.gantt-cell { box-sizing: border-box; border-right: 1px solid #f0f2f4; flex-shrink: 0; height: 100%; }
.gantt-cell.weekend { background: #f7f9fa; }
.gantt-cell.today { background: #fff8f0; }
.gantt-bar {
  position: absolute; top: 6px; height: 22px; background: #7fd4b5; border-radius: 4px;
  cursor: grab; overflow: hidden; box-sizing: border-box; touch-action: none; user-select: none;
}
.gantt-bar.closed { background: #c3ccd4; }
.gantt-bar.overdue-bar { background: #f0a0a0; }
.gantt-bar-progress { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(36, 156, 112, .55); pointer-events: none; }
.gantt-bar-label { position: relative; font-size: 11px; color: #1d5c44; padding: 0 6px; line-height: 22px; pointer-events: none; white-space: nowrap; }

/* バーンダウンチャート */
.burndown-scroll { overflow-x: auto; }
.burndown-svg { width: 100%; min-width: 700px; height: auto; }
.bd-grid { stroke: #e8ecef; stroke-width: 1; }
.bd-label { fill: #999; font-size: 11px; }
.bd-label-strong { fill: #1d5c44; font-size: 12px; font-weight: bold; }
.bd-ideal { fill: none; stroke: #b8c2cb; stroke-width: 2; stroke-dasharray: 6 4; }
.bd-actual { fill: none; stroke: #2eb886; stroke-width: 2.5; }
.bd-actual-dot { fill: #2eb886; }
.bd-today { stroke: #f0a840; stroke-width: 1.5; stroke-dasharray: 3 3; }

/* ガントの凡例 */
.gantt-legend { display: inline-flex; align-items: center; gap: 4px; margin-left: auto; }
.gantt-legend .lg { display: inline-block; width: 18px; height: 10px; border-radius: 3px; margin-left: 8px; }
.lg-normal { background: #7fd4b5; }
.lg-progress { background: rgba(36, 156, 112, .75); }
.lg-overdue { background: #f0a0a0; }
.lg-closed { background: #c3ccd4; }

/* 全体ガントのプロジェクト見出し行 */
.gantt-name-project { background: #eef6f2; font-weight: bold; }
.gantt-row-project .gantt-cell { background: #eef6f2; }
.gantt-row-project .gantt-cell.today { background: #f5eee0; }


/* 2FAセットアップキー */
.totp-secret { font-size: 16px; letter-spacing: 1px; background: var(--bg); padding: 10px 14px; border-radius: 6px; border: 1px solid var(--border); word-break: break-all; }

/* ログイン画面 */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; background: var(--bg);
}
.login-box {
  background: #fff; border: 1px solid var(--border); border-radius: 10px;
  padding: 32px; width: 360px;
}
.login-brand { text-align: center; font-size: 18px; margin: 0 0 24px; }
.login-brand span { color: var(--primary); }
