/* やること（リスト・カレンダー・ボード・タイムライン） */

/* ══ やること（タスク管理）══
   一覧は tsk-*、定義モーダルは tskd-*。フォーム部品（セグメント・チップ・スイッチ・
   プレビュー枠）は固定費の fxc-* をそのまま流用しているのでここには無い。 */

.tsk-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-4);
}
.tsk-toolbar-spacer { flex: 1; }
.tsk-tagfilter, .tsk-tagpick {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.tsk-fchip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-family: var(--font);
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.tsk-fchip:hover { border-color: var(--color-primary-border); }
.tsk-fchip.active { box-shadow: var(--shadow-xs); }
.tsk-fchip-n {
  font-size: var(--text-2xs);
  font-weight: var(--fw-bold);
  opacity: 0.75;
}
.tsk-donetoggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
  cursor: pointer;
  white-space: nowrap;
}

/* ── グループ（期限切れ / 今日 / 7日以内 / それ以降 / 完了） ── */
.tsk-group { margin-top: var(--sp-5); }
.tsk-group:first-child { margin-top: var(--sp-3); }
.tsk-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: var(--sp-2);
}
.tsk-group-name {
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--color-text);
}
.tsk-group-count {
  font-size: var(--text-2xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-subtle);
}
.tsk-g--overdue .tsk-group-name { color: var(--color-danger-text); }
.tsk-g--today .tsk-group-name { color: var(--color-warning-text); }
.tsk-g--done .tsk-group-name { color: var(--color-text-subtle); }

.tsk-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tsk-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 16px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.12s;
}
.tsk-row:hover {
  border-color: var(--color-primary-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.tsk-g--overdue .tsk-row { border-color: rgba(239, 68, 68, 0.4); }
.tsk-row--done { opacity: 0.55; }
.tsk-row--done .tsk-row-title { text-decoration: line-through; }
.tsk-check { display: flex; align-items: center; cursor: pointer; }
.tsk-check input { width: 17px; height: 17px; cursor: pointer; accent-color: var(--color-success-text); }
.tsk-row-main { flex: 1; min-width: 0; }
.tsk-row-title {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tsk-row-meta {
  margin-top: 2px;
  font-size: var(--text-2xs);
  color: var(--color-text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tsk-row-meta .fxc-dot { color: var(--color-border); margin: 0 6px; }
.tsk-note { font-style: italic; }
.tsk-moved { color: var(--color-warning-text); }
.tsk-tag {
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-weight: var(--fw-bold);
}
/* 行の先頭に置くタグは幅を揃えた列にする＝項目名の左端が全行で揃う。
   語彙は6つで最長3文字と決まっているので 5.2em で足りる（自分の font-size 基準） */
.tsk-tag--col { min-width: 5.2em; text-align: center; }
.tsk-tag--none { background: transparent; }
.tsk-due {
  flex-shrink: 0;
  min-width: 84px;
  text-align: right;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.tsk-due--over { color: var(--color-danger-text); }
.tsk-due--today { color: var(--color-warning-text); }
.tsk-due--done { color: var(--color-text-subtle); }
/* 遅れ／超過は日付の左の列。空の行でも幅を残す＝バッジの有無で日付が動かない */
.tsk-over {
  flex-shrink: 0;
  min-width: 4.8em;
  text-align: right;
  font-size: var(--text-2xs);
  font-weight: var(--fw-bold);
  color: var(--color-danger-text);
  font-variant-numeric: tabular-nums;
}
/* 完了行の「X日遅れ」は警告ではなく記録＝もう終わっているので赤も太字も引く
   （レイアウトは .tsk-over のまま＝狭い画面の折り返し規則もそのまま効く） */
.tsk-over--late { font-weight: var(--fw-semibold); color: var(--color-text-subtle); }
.tsk-row .mst-edit-icon { opacity: 0; font-size: var(--text-sm); transition: opacity 0.15s; }
.tsk-row:hover .mst-edit-icon { opacity: 1; }

/* ── モーダル ── */
.tsk-duerow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.tsk-fromdef {
  margin: 6px 0 0;
  font-size: var(--text-2xs);
  color: var(--color-text-muted);
}
.tsk-fromdef a { color: var(--color-primary); }
/* 期日の欄の直下に置く「いつ終えたか」。入力欄ではなく事実の1行＝枠線を持たせず、
   済んだことが分かる淡い緑地に置く（編集できる欄と地の色で区別する） */
/* 完了しているものの期日。入力欄の代わりに置く事実の値＝枠も背景も持たせない */
.tsk-duefact {
  margin: 2px 0 0;
  font-size: var(--text-xs);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  font-variant-numeric: tabular-nums;
}
.tsk-donefact {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 0;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  background: var(--color-success-light);
  font-size: var(--text-2xs);
  color: var(--color-text-muted);
}
.tsk-donefact b { font-weight: var(--fw-bold); color: var(--color-text); font-variant-numeric: tabular-nums; }
.tsk-donefact-mark {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 17px;
  border-radius: var(--radius-circle);
  background: var(--color-success);
  color: var(--color-text-on-accent);
  font-size: var(--text-3xs);
  font-weight: var(--fw-bold);
}
.fxc-mchip[disabled] { opacity: 0.35; cursor: not-allowed; }

/* ══ やること: カレンダービュー ══ */
.tsk-monthnav {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: var(--sp-2) 0 var(--sp-4);
  flex-wrap: wrap;
}
.tsk-cal-note { font-size: var(--text-2xs); color: var(--color-text-muted); }
/* セグメントはグリッド幅が中身なりに潰れるので、flex の中では下限を与える */
.tsk-monthnav .fxc-seg { min-width: 260px; }
.tsk-cal-dow { grid-template-columns: repeat(7, 1fr); }
.tsk-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.tsk-cal-cell {
  min-height: 92px;
  padding: 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  overflow: hidden;
}
.tsk-cal-cell--empty { border-color: transparent; background: none; }
.tsk-cal-cell--holiday { background: #fdf3f4; }
.tsk-cal-cell--sat { background: #f3f7fd; }
.tsk-cal-cell--today { border-color: var(--color-primary); box-shadow: 0 0 0 1px var(--color-primary-border); }
.tsk-cal-daynum {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: var(--text-2xs);
  font-weight: var(--fw-bold);
  color: var(--color-text-muted);
  margin-bottom: 4px;
}
.tsk-cal-cell--today .tsk-cal-daynum { color: var(--color-primary); }
.tsk-cal-hname {
  font-size: var(--text-3xs);
  font-weight: var(--fw-medium);
  color: var(--color-danger-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tsk-cal-chips { display: flex; flex-direction: column; gap: 3px; }
.tsk-cal-chip {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 5px;
  border-left: 3px solid var(--color-border);
  border-radius: var(--radius-xs);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: var(--text-2xs);
  line-height: 1.35;
  transition: background 0.12s;
}
.tsk-cal-chip { cursor: grab; }
.tsk-cal-chip:hover { background: var(--color-row-hover); }
.tsk-cal-chip--dragging { opacity: 0.4; }
.tsk-cal-cell--over {
  border-color: var(--color-primary);
  background: var(--color-primary-light);
  box-shadow: inset 0 0 0 1px var(--color-primary-border);
}
.tsk-cal-check {
  width: 12px; height: 12px; flex: none; margin: 0;
  cursor: pointer; accent-color: var(--color-success-text);
}
.tsk-cal-chip-title {
  flex: 1; min-width: 0; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tsk-cal-chip--done .tsk-cal-chip-title { opacity: 0.5; text-decoration: line-through; }

/* ══ やること: 進捗ビュー ══ */
/* 3色（完了/期限切れ/これから）はバーと凡例で共用。率は「期限が来たぶん」だけで出す */
/* 状態の3色。タイムラインの点と凡例で共用する */
.tsk-pbar--done { background: var(--color-success); }
.tsk-pbar--missed { background: var(--color-danger); }
.tsk-pbar--upcoming { background: var(--color-border-strong); }
.tsk-dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: var(--radius-circle);
  margin-right: 5px;
  vertical-align: middle;
}

/* ══ やること: ボードビュー（カンバン風） ══ */
.tsk-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--sp-3);
  align-items: start;
}
.tsk-col {
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  padding: 10px;
  min-height: 120px;
  transition: border-color 0.15s, background 0.15s;
}
.tsk-col--over { border-color: var(--color-primary); background: var(--color-primary-light); }
.tsk-col-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  color: var(--color-text);
}
.tsk-col-count {
  margin-left: auto;
  font-size: var(--text-2xs);
  font-weight: var(--fw-bold);
  color: var(--color-text-subtle);
  font-variant-numeric: tabular-nums;
}
.tsk-col--overdue .tsk-col-head { color: var(--color-danger-text); }
.tsk-col--today .tsk-col-head { color: var(--color-warning-text); }
.tsk-col--done .tsk-col-head { color: var(--color-success-text); }
/* 列ごとに独立してスクロールさせる＝1列だけ長くても板の高さが崩れない */
.tsk-col-body {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 62vh; overflow-y: auto;
}
.tsk-col-empty {
  margin: 0; padding: 8px 0;
  font-size: var(--text-2xs); color: var(--color-text-subtle); text-align: center;
}
.tsk-card {
  padding: 9px 10px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.12s, transform 0.12s;
}
.tsk-card:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.tsk-card--dragging { opacity: 0.4; }
.tsk-card--done { opacity: 0.6; }
.tsk-card--done .tsk-card-title { text-decoration: line-through; }
.tsk-card-head { display: flex; align-items: flex-start; gap: 7px; }
.tsk-card-head .tsk-check input { width: 14px; height: 14px; }
.tsk-card-title {
  flex: 1; min-width: 0;
  font-size: var(--text-xs); font-weight: var(--fw-semibold); color: var(--color-text);
  line-height: 1.4; word-break: break-word;
}
.tsk-card-foot {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; padding-left: 21px;
}
.tsk-card-sub {
  flex: 1; min-width: 0;
  font-size: var(--text-3xs); color: var(--color-text-subtle);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* カードの遅れ／超過。バッジ（日付）の左に置く＝リスト行と同じ並び順にする */
.tsk-card-late {
  flex: none;
  font-size: var(--text-3xs);
  font-weight: var(--fw-bold);
  color: var(--color-text-subtle);
}
.tsk-card-late--over { color: var(--color-danger-text); }
.tsk-card-due {
  flex: none;
  font-size: var(--text-3xs); font-weight: var(--fw-bold); color: var(--color-text-muted);
}
.tsk-card-due--over { color: var(--color-danger-text); }
.tsk-card-due--today { color: var(--color-warning-text); }

@media (max-width: 1100px) {
  .tsk-board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ══ やること: タイムラインビュー ══ */
/* 横軸＝時間の1本の帯（1目盛り＝1日で固定）。1件＝タイトル付きのピルを期日の位置へ置き、
   重なるものは上から順に段を分けて積む（段の割り当ては JS 側）。 */
.tsk-tl {
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  /* 窓に収まるぶんだけ描くのでスクロールは出ない。狭い画面で溢れたときの逃げ道だけ残す */
  overflow-x: auto;
}
.tsk-tl-scale {
  position: relative;
  height: 34px;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}
.tsk-tl-track { position: relative; min-height: 44px; }
/* 帯側の曜日の色。ピルの可読性を落とさないよう目盛りより薄く敷く */
.tsk-tl-band { position: absolute; top: 0; bottom: 0; }
.tsk-tl-band--holiday { background: rgba(239, 68, 68, 0.05); }
.tsk-tl-band--sat { background: rgba(59, 130, 246, 0.05); }
.tsk-tl-gline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--color-border); }
.tsk-tl-gline--month { background: var(--color-text-subtle); opacity: 0.5; }
.tsk-tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--color-primary); opacity: 0.5; }
.tsk-tl-todaykey {
  display: inline-block; width: 2px; height: 11px;
  background: var(--color-primary); margin-right: 5px; vertical-align: middle;
}
/* 日の目盛り（1マス＝1日） */
.tsk-tl-day {
  position: absolute; top: 0; bottom: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 4px;
  background: var(--color-bg);
  border-left: 1px solid rgba(0, 0, 0, 0.04);
  box-sizing: border-box;
}
/* 帯の背景（--color-bg）とほぼ同じ濃さだと見分けられないので、はっきり付ける */
.tsk-tl-day--holiday { background: #fbe9ec; }
.tsk-tl-day--sat { background: #e6eefb; }
.tsk-tl-day--today { background: var(--color-primary-light); }
.tsk-tl-dnum {
  font-size: var(--text-3xs); color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tsk-tl-day--today .tsk-tl-dnum { color: var(--color-primary); font-weight: var(--fw-bold); }
/* 月名は日付マスより上のレイヤー（マスの中に入れると次のマスの背景に隠れる） */
.tsk-tl-mlabel {
  position: absolute; top: 3px;
  font-size: var(--text-3xs); font-weight: var(--fw-bold); color: var(--color-text); white-space: nowrap;
  pointer-events: none;
}
/* 1件＝タイトル付きのピル。左の丸が状態の色 */
.tsk-tl-pill {
  position: absolute;
  display: flex; align-items: center; gap: 5px;
  height: 20px;
  margin-top: 4px;
  padding: 0 7px;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-border);   /* 色は JS がタグから入れる */
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-family: var(--font); font-size: var(--text-2xs); color: var(--color-text);
  box-shadow: var(--shadow-xs);
  transition: box-shadow 0.12s, transform 0.12s;
}
.tsk-tl-pill:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); z-index: 3; }
.tsk-tl-pill span {
  flex: 1; min-width: 0; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* 左の丸＝状態の色。押すと完了/取り消し（カレンダーのチップと同じ操作感） */
.tsk-tl-tick {
  width: 9px; height: 9px; flex: none; padding: 0;
  border: none; border-radius: var(--radius-circle);
  cursor: pointer;
  transition: transform 0.1s;
}
.tsk-tl-tick:hover { transform: scale(1.5); }
.tsk-tl-pill--done .tsk-tl-tick { background: var(--color-success); }
.tsk-tl-pill--missed .tsk-tl-tick { background: var(--color-danger); }
.tsk-tl-pill--upcoming .tsk-tl-tick { background: var(--color-border-strong); }
.tsk-tl-pill span { cursor: pointer; }
.tsk-tl-pill--done { opacity: 0.62; }
.tsk-tl-pill--done span { text-decoration: line-through; }
.tsk-tl-pill--missed { border-color: rgba(239, 68, 68, 0.45); }
.tsk-tl-legend {
  display: flex; gap: var(--sp-4); flex-wrap: wrap;
  margin-top: var(--sp-3);
  font-size: var(--text-2xs); color: var(--color-text-muted);
}

/* カレンダーのチップの丸トグル（素のチェックボックスは12pxまで縮めると潰れる） */
.tsk-tick {
  width: 13px; height: 13px; flex: none; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-circle);
  background: var(--color-surface);
  color: transparent;
  font-size: var(--text-3xs); line-height: 1;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.tsk-tick:hover { border-color: var(--color-success-text); color: var(--color-success-text); }
.tsk-tick--on { background: var(--color-success); border-color: var(--color-success-text); color: var(--color-text-on-accent); }
.tsk-col-to { font-size: var(--text-3xs); font-weight: var(--fw-medium); color: var(--color-text-subtle); }

/* 祝日の上書き（マスタ管理タブ） */
.hol-row { cursor: default; }
.hol-row:hover { transform: none; }
.hol-badge {
  flex: none;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--text-2xs);
  font-weight: var(--fw-bold);
}
.hol-badge--on { background: rgba(239, 68, 68, 0.1); color: var(--color-danger-text); }
.hol-badge--off { background: var(--color-bg); color: var(--color-text-muted); }

/* 祝日: 取り込み済みの年（1年1行にまとめる。全部並べると手入力が埋もれる） */
.hol-years { display: flex; flex-direction: column; gap: 6px; }
.hol-year {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 8px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}
.hol-year-y { font-size: var(--text-xs); font-weight: var(--fw-bold); color: var(--color-text); min-width: 64px; }
.hol-year-n {
  font-size: var(--text-2xs); font-weight: var(--fw-bold); color: var(--color-success-text);
  min-width: 44px;
}
.hol-year-sample {
  flex: 1; min-width: 0;
  font-size: var(--text-2xs); color: var(--color-text-subtle);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.hol-pager {
  display: flex; align-items: center; gap: var(--sp-3);
  margin: 8px 0;
  font-size: var(--text-2xs); color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.hol-pager .fxc-mnav-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.hol-src { flex: none; font-size: var(--text-2xs); color: var(--color-text-subtle); }

.hol-pager {
  display: flex; align-items: center; gap: var(--sp-3);
  margin: 8px 0;
  font-size: var(--text-2xs); color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}
.hol-pager .fxc-mnav-btn[disabled] { opacity: 0.35; cursor: not-allowed; }
.hol-src { flex: none; font-size: var(--text-2xs); color: var(--color-text-subtle); }

.tsk-tlnav { display: inline-flex; align-items: center; gap: 6px; }

/* タイムラインの送り（◀▶）のアニメーション。次＝右から入る、前＝左から入る。
   animating の間だけ横のはみ出しを隠す（入りの位置がスクロール範囲に加わると
   一瞬スクロールバーが出るため）。 */
.tsk-tl--anim { overflow-x: hidden; }
/* 入りは opacity 0 から＝滑り込む側にできる空きを、透明のうちに通り過ぎさせる
   （不透明のまま大きく動かすと、入ってくる端の空白が見えてしまう） */
.tsk-tl--next .tsk-tl-scale, .tsk-tl--next .tsk-tl-track {
  animation: tskTlInNext 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.tsk-tl--prev .tsk-tl-scale, .tsk-tl--prev .tsk-tl-track {
  animation: tskTlInPrev 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes tskTlInNext {
  from { transform: translateX(56px); opacity: 0; }
  40%  { opacity: 1; }
  to   { transform: none; opacity: 1; }
}
@keyframes tskTlInPrev {
  from { transform: translateX(-56px); opacity: 0; }
  40%  { opacity: 1; }
  to   { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .tsk-tl--next .tsk-tl-scale, .tsk-tl--next .tsk-tl-track,
  .tsk-tl--prev .tsk-tl-scale, .tsk-tl--prev .tsk-tl-track { animation: none; }
}
